[Serialization] Place command line defines in the correct file
authorJohn Brawn <john.brawn@arm.com>
Tue, 21 Feb 2023 11:09:26 +0000 (11:09 +0000)
committerJohn Brawn <john.brawn@arm.com>
Mon, 20 Mar 2023 17:36:01 +0000 (17:36 +0000)
commit72073fc95cd4793a853925ddc8cc3fb2118808a5
tree40bae3267ad7f57f9d9003f0220a80a719d810df
parentcd11f55a0c6d8524f9ac494d26514d4d72d83435
[Serialization] Place command line defines in the correct file

Fix several problems related to serialization causing command line
defines to be reported as being built-in defines:
 * When serializing the <built-in> and <command line> files don't
   convert them into absolute paths.
 * When deserializing SM_SLOC_BUFFER_ENTRY we need to call
   setHasLineDirectives in the same way as we do for
   SM_SLOC_FILE_ENTRY.
 * When created suggested predefines based on the current command line
   options we need to add line markers in the same way that
   InitializePreprocessor does.
 * Adjust a place in clangd where it was implicitly relying on command
   line defines being treated as builtin.

Differential Revision: https://reviews.llvm.org/D144651
clang-tools-extra/clangd/index/SymbolCollector.cpp
clang/docs/ReleaseNotes.rst
clang/lib/Serialization/ASTReader.cpp
clang/lib/Serialization/ASTWriter.cpp
clang/test/PCH/macro-cmdline.c [new file with mode: 0644]
clang/test/PCH/ms-pch-macro.c