aboutsummaryrefslogtreecommitdiff
path: root/include/clang/Sema/Scope.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/clang/Sema/Scope.h')
-rw-r--r--include/clang/Sema/Scope.h23
1 files changed, 9 insertions, 14 deletions
diff --git a/include/clang/Sema/Scope.h b/include/clang/Sema/Scope.h
index 4229c6c62748..d7fda35cdb87 100644
--- a/include/clang/Sema/Scope.h
+++ b/include/clang/Sema/Scope.h
@@ -14,6 +14,7 @@
#ifndef LLVM_CLANG_SEMA_SCOPE_H
#define LLVM_CLANG_SEMA_SCOPE_H
+#include "clang/Basic/Diagnostic.h"
#include "llvm/ADT/SmallPtrSet.h"
namespace clang {
@@ -52,7 +53,7 @@ public:
/// ClassScope - The scope of a struct/union/class definition.
ClassScope = 0x20,
- /// BlockScope - This is a scope that corresponds to a block object.
+ /// BlockScope - This is a scope that corresponds to a block/closure object.
/// Blocks serve as top-level scopes for some objects like labels, they
/// also prevent things like break and continue. BlockScopes always have
/// the FnScope, BreakScope, ContinueScope, and DeclScope flags set as well.
@@ -131,11 +132,12 @@ private:
typedef llvm::SmallVector<UsingDirectiveDecl *, 2> UsingDirectivesTy;
UsingDirectivesTy UsingDirectives;
- /// \brief The number of errors at the start of the given scope.
- unsigned NumErrorsAtStart;
+ /// \brief Used to determine if errors occurred in this scope.
+ DiagnosticErrorTrap ErrorTrap;
public:
- Scope(Scope *Parent, unsigned ScopeFlags) {
+ Scope(Scope *Parent, unsigned ScopeFlags, Diagnostic &Diag)
+ : ErrorTrap(Diag) {
Init(Parent, ScopeFlags);
}
@@ -144,8 +146,7 @@ public:
unsigned getFlags() const { return Flags; }
void setFlags(unsigned F) { Flags = F; }
- /// isBlockScope - Return true if this scope does not correspond to a
- /// closure.
+ /// isBlockScope - Return true if this scope correspond to a closure.
bool isBlockScope() const { return Flags & BlockScope; }
/// getParent - Return the scope that this is nested in.
@@ -214,13 +215,7 @@ public:
void* getEntity() const { return Entity; }
void setEntity(void *E) { Entity = E; }
- /// \brief Retrieve the number of errors that had been emitted when we
- /// entered this scope.
- unsigned getNumErrorsAtStart() const { return NumErrorsAtStart; }
-
- void setNumErrorsAtStart(unsigned NumErrors) {
- NumErrorsAtStart = NumErrors;
- }
+ bool hasErrorOccurred() const { return ErrorTrap.hasErrorOccurred(); }
/// isClassScope - Return true if this scope is a class/struct/union scope.
bool isClassScope() const {
@@ -318,7 +313,7 @@ public:
DeclsInScope.clear();
UsingDirectives.clear();
Entity = 0;
- NumErrorsAtStart = 0;
+ ErrorTrap.reset();
}
};