aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/Parse/Parser.cpp3
-rw-r--r--lib/Sema/SemaDecl.cpp2
-rw-r--r--lib/Sema/SemaDeclCXX.cpp8
3 files changed, 6 insertions, 7 deletions
diff --git a/lib/Parse/Parser.cpp b/lib/Parse/Parser.cpp
index 918c6718fc..fefe7871df 100644
--- a/lib/Parse/Parser.cpp
+++ b/lib/Parse/Parser.cpp
@@ -305,9 +305,8 @@ void Parser::EnterScope(unsigned ScopeFlags) {
N->Init(getCurScope(), ScopeFlags);
Actions.CurScope = N;
} else {
- Actions.CurScope = new Scope(getCurScope(), ScopeFlags);
+ Actions.CurScope = new Scope(getCurScope(), ScopeFlags, Diags);
}
- getCurScope()->setNumErrorsAtStart(Diags.getNumErrors());
}
/// ExitScope - Pop a scope off the scope stack.
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp
index ceec0016e9..7c2a8fb105 100644
--- a/lib/Sema/SemaDecl.cpp
+++ b/lib/Sema/SemaDecl.cpp
@@ -696,7 +696,7 @@ void Sema::ActOnPopScope(SourceLocation Loc, Scope *S) {
if (!D->getDeclName()) continue;
// Diagnose unused variables in this scope.
- if (S->getNumErrorsAtStart() == getDiagnostics().getNumErrors())
+ if (!S->hasErrorOccurred())
DiagnoseUnusedDecl(D);
// Remove this name from our lexical scope.
diff --git a/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp
index 7217b25652..38c1c3928d 100644
--- a/lib/Sema/SemaDeclCXX.cpp
+++ b/lib/Sema/SemaDeclCXX.cpp
@@ -4365,7 +4365,7 @@ void Sema::DefineImplicitDefaultConstructor(SourceLocation CurrentLocation,
assert(ClassDecl && "DefineImplicitDefaultConstructor - invalid constructor");
ImplicitlyDefinedFunctionScope Scope(*this, Constructor);
- ErrorTrap Trap(*this);
+ DiagnosticErrorTrap Trap(Diags);
if (SetBaseOrMemberInitializers(Constructor, 0, 0, /*AnyErrors=*/false) ||
Trap.hasErrorOccurred()) {
Diag(CurrentLocation, diag::note_member_synthesized_at)
@@ -4473,7 +4473,7 @@ void Sema::DefineImplicitDestructor(SourceLocation CurrentLocation,
ImplicitlyDefinedFunctionScope Scope(*this, Destructor);
- ErrorTrap Trap(*this);
+ DiagnosticErrorTrap Trap(Diags);
MarkBaseAndMemberDestructorsReferenced(Destructor->getLocation(),
Destructor->getParent());
@@ -4878,7 +4878,7 @@ void Sema::DefineImplicitCopyAssignment(SourceLocation CurrentLocation,
CopyAssignOperator->setUsed();
ImplicitlyDefinedFunctionScope Scope(*this, CopyAssignOperator);
- ErrorTrap Trap(*this);
+ DiagnosticErrorTrap Trap(Diags);
// C++0x [class.copy]p30:
// The implicitly-defined or explicitly-defaulted copy assignment operator
@@ -5340,7 +5340,7 @@ void Sema::DefineImplicitCopyConstructor(SourceLocation CurrentLocation,
assert(ClassDecl && "DefineImplicitCopyConstructor - invalid constructor");
ImplicitlyDefinedFunctionScope Scope(*this, CopyConstructor);
- ErrorTrap Trap(*this);
+ DiagnosticErrorTrap Trap(Diags);
if (SetBaseOrMemberInitializers(CopyConstructor, 0, 0, /*AnyErrors=*/false) ||
Trap.hasErrorOccurred()) {