diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2011-01-14 20:54:07 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2011-01-14 20:54:07 +0000 |
commit | 3efd52cf8f4e57c5571bd8cc3168264c3bc46a1e (patch) | |
tree | e01032cae49e0af5c073d902fc347cddfef7c904 /lib/Basic/Diagnostic.cpp | |
parent | db0594bfc013131f88429add4eb653c285fa94fb (diff) |
Properly propagate #pragma diagnostic mappings from PCH but not command-line warning flags.
Addresses rdar://8435969&8852495
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123462 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Basic/Diagnostic.cpp')
-rw-r--r-- | lib/Basic/Diagnostic.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/Basic/Diagnostic.cpp b/lib/Basic/Diagnostic.cpp index 919ba8187e..9a263c1d0b 100644 --- a/lib/Basic/Diagnostic.cpp +++ b/lib/Basic/Diagnostic.cpp @@ -147,12 +147,13 @@ void Diagnostic::setDiagnosticMapping(diag::kind Diag, diag::Mapping Map, "Cannot map errors into warnings!"); assert(!DiagStatePoints.empty()); + bool isPragma = L.isValid(); FullSourceLoc Loc(L, *SourceMgr); FullSourceLoc LastStateChangePos = DiagStatePoints.back().Loc; // Common case; setting all the diagnostics of a group in one place. if (Loc.isInvalid() || Loc == LastStateChangePos) { - setDiagnosticMappingInternal(Diag, Map, GetCurDiagState(), true); + setDiagnosticMappingInternal(Diag, Map, GetCurDiagState(), true, isPragma); return; } @@ -165,7 +166,7 @@ void Diagnostic::setDiagnosticMapping(diag::kind Diag, diag::Mapping Map, // the new state became active. DiagStates.push_back(*GetCurDiagState()); PushDiagStatePoint(&DiagStates.back(), Loc); - setDiagnosticMappingInternal(Diag, Map, GetCurDiagState(), true); + setDiagnosticMappingInternal(Diag, Map, GetCurDiagState(), true, isPragma); return; } @@ -178,12 +179,12 @@ void Diagnostic::setDiagnosticMapping(diag::kind Diag, diag::Mapping Map, // Update all diagnostic states that are active after the given location. for (DiagStatePointsTy::iterator I = Pos+1, E = DiagStatePoints.end(); I != E; ++I) { - setDiagnosticMappingInternal(Diag, Map, I->State, true); + setDiagnosticMappingInternal(Diag, Map, I->State, true, isPragma); } // If the location corresponds to an existing point, just update its state. if (Pos->Loc == Loc) { - setDiagnosticMappingInternal(Diag, Map, Pos->State, true); + setDiagnosticMappingInternal(Diag, Map, Pos->State, true, isPragma); return; } @@ -192,7 +193,7 @@ void Diagnostic::setDiagnosticMapping(diag::kind Diag, diag::Mapping Map, Pos->Loc.isBeforeInTranslationUnitThan(Loc); DiagStates.push_back(*Pos->State); DiagState *NewState = &DiagStates.back(); - setDiagnosticMappingInternal(Diag, Map, NewState, true); + setDiagnosticMappingInternal(Diag, Map, NewState, true, isPragma); DiagStatePoints.insert(Pos+1, DiagStatePoint(NewState, FullSourceLoc(Loc, *SourceMgr))); } |