Fix diagnostic pragmas.
commitd8342f70424e70ae663789185bceb90e5612d82f
authorArgiris Kirtzidis <akyrtzi@gmail.com>
Wed, 15 Dec 2010 18:44:22 +0000 (15 18:44 +0000)
committerArgiris Kirtzidis <akyrtzi@gmail.com>
Wed, 15 Dec 2010 18:44:22 +0000 (15 18:44 +0000)
treed8c9122a107aab93c08b01adb6df4f9c954c3705
parent3fd91d00a58819acef368f56b49452b31ab6d7a6
Fix diagnostic pragmas.

Diagnostic pragmas are broken because we don't keep track of the diagnostic state changes and we only check the current/latest state.
Problems manifest if a diagnostic is emitted for a source line that has different diagnostic state than the current state; this can affect
a lot of places, like C++ inline methods, template instantiations, the lexer, etc.

Fix the issue by having the Diagnostic object keep track of the source location of the pragmas so that it is able to know what is the diagnostic state at any given source location.

Fixes rdar://8365684.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121873 91177308-0d34-0410-b5e6-96231b3b80d8
23 files changed:
include/clang/Basic/Diagnostic.h
include/clang/Basic/DiagnosticIDs.h
include/clang/Basic/SourceLocation.h
include/clang/Lex/MacroInfo.h
include/clang/Lex/Preprocessor.h
lib/Basic/Diagnostic.cpp
lib/Basic/DiagnosticIDs.cpp
lib/Basic/SourceLocation.cpp
lib/Lex/MacroInfo.cpp
lib/Lex/PPDirectives.cpp
lib/Lex/PPExpressions.cpp
lib/Lex/PPLexerChange.cpp
lib/Lex/PPMacroExpansion.cpp
lib/Lex/Pragma.cpp
lib/Sema/AnalysisBasedWarnings.cpp
lib/Sema/SemaChecking.cpp
lib/Sema/SemaDecl.cpp
lib/Sema/SemaDeclCXX.cpp
lib/Sema/SemaDeclObjC.cpp
lib/Sema/SemaExpr.cpp
lib/Serialization/ASTReader.cpp
lib/Serialization/ASTWriter.cpp
test/Preprocessor/pragma_diagnostic_sections.cpp [new file with mode: 0644]