[modules] Fix incorrect diagnostic mapping computation when a module changes
authorRichard Smith <richard-llvm@metafoo.co.uk>
Fri, 9 Feb 2018 01:15:13 +0000 (01:15 +0000)
committerRichard Smith <richard-llvm@metafoo.co.uk>
Fri, 9 Feb 2018 01:15:13 +0000 (01:15 +0000)
commit6c2b5a8ff0b4ea3a9c5dcaf1ffe80c949845f500
tree3ab04e25945e45757936e507b7dbf8cf1fdedb91
parentfb7b14f70d33225a8299db98bff6e99d79f13ae7
[modules] Fix incorrect diagnostic mapping computation when a module changes
diagnostic settings using _Pragma within a macro.

The AST writer had previously been assuming that all diagnostic state
transitions would occur within a FileID corresponding to a file. When a
diagnostic state change occured within a macro, it was unable to form a
location for that state change and would instead corrupt the diagnostic state
of the "root" node (and thus that of the main compilation).

Also introduce a "#pragma clang __debug diag_mapping" debugging utility
that I added to track this issue down.

llvm-svn: 324695
clang/include/clang/Basic/Diagnostic.h
clang/include/clang/Basic/SourceManager.h
clang/lib/Basic/Diagnostic.cpp
clang/lib/Lex/Pragma.cpp
clang/lib/Serialization/ASTReader.cpp
clang/lib/Serialization/ASTWriter.cpp
clang/test/Modules/Inputs/diag_flags.h
clang/test/Modules/diag-flags.cpp