• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
2 // -*- Mode: C++ -*-
3 //
4 // Copyright (C) 2013-2020 Red Hat, Inc.
5 
6 /// @file
7 
8 #include "abg-internal.h"
9 // <headers defining libabigail's API go under here>
10 ABG_BEGIN_EXPORT_DECLARATIONS
11 
12 #include "abg-traverse.h"
13 
14 ABG_END_EXPORT_DECLARATIONS
15 // </headers defining libabigail's API>
16 
17 namespace abigail
18 {
19 
20 namespace ir
21 {
22 
23 /// Private data type of the @ref traversable_base type.
24 struct traversable_base::priv
25 {
26   bool visiting_;
27 
privabigail::ir::traversable_base::priv28   priv(bool visiting = false)
29     : visiting_(visiting)
30   {}
31 }; // end struct traversable_base::priv
32 
33 /// Default constructor of the @ref traversable_base type.
traversable_base()34 traversable_base::traversable_base()
35   :priv_(new priv)
36 {}
37 
38 /// Destructor of the @ref traversable_base type.
~traversable_base()39 traversable_base::~traversable_base()
40 {}
41 
42 /// This should returns false before and after the node has been
43 /// visiting.  During the visiting of the node (and of its children)
44 /// this should return true.
45 ///
46 /// @return true if the current node is being visited.
47 bool
visiting() const48 traversable_base::visiting() const
49 {return priv_->visiting_;}
50 
51 /// The traversing code should be responsible of calling this, not
52 /// the user code.
53 ///
54 /// This is the setter of the "visiting" flag of the node being
55 /// visited.  If set to yes, it means the node is being visited.
56 /// False means either the node has not yet been visited, or it
57 /// has already been visited.
58 ///
59 /// @param f the new value of the "visiting" flag.
60 void
visiting(bool f)61 traversable_base::visiting(bool f)
62 {priv_->visiting_ = f;}
63 
64 }// end namaspace ir
65 }// end namespace abigail
66