diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2010-11-19 00:19:15 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2010-11-19 00:19:15 +0000 |
commit | f51ec1d12ba3a9b5f36d65e32a6ec22b2a051016 (patch) | |
tree | 0b219803e8163d8718f7e7ef9b8946f5d473108d /clang/lib | |
parent | 186534244257d989383051f5b1a7d89d3bc146c8 (diff) | |
download | bcm5719-llvm-f51ec1d12ba3a9b5f36d65e32a6ec22b2a051016.tar.gz bcm5719-llvm-f51ec1d12ba3a9b5f36d65e32a6ec22b2a051016.zip |
Refactoring. Get FunctionScopeInfo to use DiagnosticErrorTrap.
llvm-svn: 119764
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/Sema/Sema.cpp | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/clang/lib/Sema/Sema.cpp b/clang/lib/Sema/Sema.cpp index 8c1d5f449c6..ec7b61d32a3 100644 --- a/clang/lib/Sema/Sema.cpp +++ b/clang/lib/Sema/Sema.cpp @@ -39,7 +39,7 @@ using namespace sema; FunctionScopeInfo::~FunctionScopeInfo() { } -void FunctionScopeInfo::Clear(unsigned NumErrors) { +void FunctionScopeInfo::Clear() { HasBranchProtectedScope = false; HasBranchIntoScope = false; HasIndirectGoto = false; @@ -47,7 +47,7 @@ void FunctionScopeInfo::Clear(unsigned NumErrors) { LabelMap.clear(); SwitchStack.clear(); Returns.clear(); - NumErrorsAtStartOfFunction = NumErrors; + ErrorTrap.reset(); } BlockScopeInfo::~BlockScopeInfo() { } @@ -154,7 +154,7 @@ Sema::Sema(Preprocessor &pp, ASTContext &ctxt, ASTConsumer &consumer, ExprEvalContexts.push_back( ExpressionEvaluationContextRecord(PotentiallyEvaluated, 0)); - FunctionScopes.push_back(new FunctionScopeInfo(Diags.getNumErrors())); + FunctionScopes.push_back(new FunctionScopeInfo(Diags)); } void Sema::Initialize() { @@ -535,17 +535,16 @@ void Sema::PushFunctionScope() { if (FunctionScopes.size() == 1) { // Use the "top" function scope rather than having to allocate // memory for a new scope. - FunctionScopes.back()->Clear(getDiagnostics().getNumErrors()); + FunctionScopes.back()->Clear(); FunctionScopes.push_back(FunctionScopes.back()); return; } - FunctionScopes.push_back( - new FunctionScopeInfo(getDiagnostics().getNumErrors())); + FunctionScopes.push_back(new FunctionScopeInfo(getDiagnostics())); } void Sema::PushBlockScope(Scope *BlockScope, BlockDecl *Block) { - FunctionScopes.push_back(new BlockScopeInfo(getDiagnostics().getNumErrors(), + FunctionScopes.push_back(new BlockScopeInfo(getDiagnostics(), BlockScope, Block)); } @@ -559,8 +558,7 @@ void Sema::PopFunctionOrBlockScope() { /// \brief Determine whether any errors occurred within this function/method/ /// block. bool Sema::hasAnyErrorsInThisFunction() const { - return getCurFunction()->NumErrorsAtStartOfFunction - != getDiagnostics().getNumErrors(); + return getCurFunction()->ErrorTrap.hasErrorOccurred(); } BlockScopeInfo *Sema::getCurBlock() { |