diff options
Diffstat (limited to 'clang/include/clang/Sema/Scope.h')
-rw-r--r-- | clang/include/clang/Sema/Scope.h | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/clang/include/clang/Sema/Scope.h b/clang/include/clang/Sema/Scope.h index 7848df8f70d9c..b7260f15fe1b9 100644 --- a/clang/include/clang/Sema/Scope.h +++ b/clang/include/clang/Sema/Scope.h @@ -320,15 +320,28 @@ public: /// isDeclScope - Return true if this is the scope that the specified decl is /// declared in. - bool isDeclScope(Decl *D) { - return DeclsInScope.count(D) != 0; + bool isDeclScope(const Decl *D) const { return DeclsInScope.count(D) != 0; } + + /// Get the entity corresponding to this scope. + DeclContext *getEntity() const { + return isTemplateParamScope() ? nullptr : Entity; } - DeclContext *getEntity() const { return Entity; } - void setEntity(DeclContext *E) { Entity = E; } + /// Get the DeclContext in which to continue unqualified lookup after a + /// lookup in this scope. + DeclContext *getLookupEntity() const { return Entity; } - bool hasErrorOccurred() const { return ErrorTrap.hasErrorOccurred(); } + void setEntity(DeclContext *E) { + assert(!isTemplateParamScope() && + "entity associated with template param scope"); + Entity = E; + } + void setLookupEntity(DeclContext *E) { Entity = E; } + /// Determine whether any unrecoverable errors have occurred within this + /// scope. Note that this may return false even if the scope contains invalid + /// declarations or statements, if the errors for those invalid constructs + /// were suppressed because some prior invalid construct was referenced. bool hasUnrecoverableErrorOccurred() const { return ErrorTrap.hasUnrecoverableErrorOccurred(); } @@ -385,6 +398,12 @@ public: return getFlags() & Scope::FunctionPrototypeScope; } + /// isFunctionDeclarationScope - Return true if this scope is a + /// function prototype scope. + bool isFunctionDeclarationScope() const { + return getFlags() & Scope::FunctionDeclarationScope; + } + /// isAtCatchScope - Return true if this scope is \@catch. bool isAtCatchScope() const { return getFlags() & Scope::AtCatchScope; |