Propagate the ASTContext to various AST traversal and lookup functions.
No functionality change (really).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68726 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/include/clang/AST/DeclBase.h b/include/clang/AST/DeclBase.h
index 4675136..3244c63 100644
--- a/include/clang/AST/DeclBase.h
+++ b/include/clang/AST/DeclBase.h
@@ -1,4 +1,4 @@
-//===-- DeclBase.h - Base Classes for representing declarations *- C++ -*-===//
+//===-- DeclBase.h - Base Classes for representing declarations -*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -178,10 +178,6 @@
virtual ~Decl();
- /// setDeclContext - Set both the semantic and lexical DeclContext
- /// to DC.
- void setDeclContext(DeclContext *DC);
-
public:
SourceLocation getLocation() const { return Loc; }
void setLocation(SourceLocation L) { Loc = L; }
@@ -229,7 +225,7 @@
/// setInvalidDecl - Indicates the Decl had a semantic error. This
/// allows for graceful error recovery.
- void setInvalidDecl() { InvalidDecl = 1; }
+ void setInvalidDecl(bool Invalid = true) { InvalidDecl = Invalid; }
bool isInvalidDecl() const { return (bool) InvalidDecl; }
/// isImplicit - Indicates whether the declaration was implicitly
@@ -266,6 +262,10 @@
return const_cast<Decl*>(this)->getLexicalDeclContext();
}
+ /// setDeclContext - Set both the semantic and lexical DeclContext
+ /// to DC.
+ void setDeclContext(DeclContext *DC);
+
void setLexicalDeclContext(DeclContext *DC);
// isDefinedOutsideFunctionOrMethod - This predicate returns true if this
@@ -535,8 +535,8 @@
/// decls_begin/decls_end - Iterate over the declarations stored in
/// this context.
- decl_iterator decls_begin() const { return decl_iterator(FirstDecl); }
- decl_iterator decls_end() const { return decl_iterator(); }
+ decl_iterator decls_begin(ASTContext &Context) const;
+ decl_iterator decls_end(ASTContext &Context) const;
/// specific_decl_iterator - Iterates over a subrange of
/// declarations stored in a DeclContext, providing only those that
@@ -692,7 +692,7 @@
///
/// If D is also a NamedDecl, it will be made visible within its
/// semantic context via makeDeclVisibleInContext.
- void addDecl(Decl *D);
+ void addDecl(ASTContext &Context, Decl *D);
/// lookup_iterator - An iterator that provides access to the results
/// of looking up a name within this context.
@@ -711,8 +711,8 @@
/// the declarations with this name, with object, function, member,
/// and enumerator names preceding any tag name. Note that this
/// routine will not look into parent contexts.
- lookup_result lookup(DeclarationName Name);
- lookup_const_result lookup(DeclarationName Name) const;
+ lookup_result lookup(ASTContext &Context, DeclarationName Name);
+ lookup_const_result lookup(ASTContext &Context, DeclarationName Name) const;
/// @brief Makes a declaration visible within this context.
///
@@ -728,7 +728,7 @@
/// visible from this context, as determined by
/// NamedDecl::declarationReplaces, the previous declaration will be
/// replaced with D.
- void makeDeclVisibleInContext(NamedDecl *D);
+ void makeDeclVisibleInContext(ASTContext &Context, NamedDecl *D);
/// udir_iterator - Iterates through the using-directives stored
/// within this context.
@@ -736,14 +736,14 @@
typedef std::pair<udir_iterator, udir_iterator> udir_iterator_range;
- udir_iterator_range getUsingDirectives() const;
+ udir_iterator_range getUsingDirectives(ASTContext &Context) const;
- udir_iterator using_directives_begin() const {
- return getUsingDirectives().first;
+ udir_iterator using_directives_begin(ASTContext &Context) const {
+ return getUsingDirectives(Context).first;
}
- udir_iterator using_directives_end() const {
- return getUsingDirectives().second;
+ udir_iterator using_directives_end(ASTContext &Context) const {
+ return getUsingDirectives(Context).second;
}
// Low-level accessors
@@ -758,8 +758,8 @@
#include "clang/AST/DeclNodes.def"
private:
- void buildLookup(DeclContext *DCtx);
- void makeDeclVisibleInContextImpl(NamedDecl *D);
+ void buildLookup(ASTContext &Context, DeclContext *DCtx);
+ void makeDeclVisibleInContextImpl(ASTContext &Context, NamedDecl *D);
void EmitOutRec(llvm::Serializer& S) const;
void ReadOutRec(llvm::Deserializer& D, ASTContext& C);