make sure to not warn about unused macros from -D
authorLuboš Luňák <l.lunak@centrum.cz>
Sun, 2 Feb 2020 11:15:40 +0000 (12:15 +0100)
committerLuboš Luňák <l.lunak@centrum.cz>
Mon, 27 Apr 2020 19:26:13 +0000 (21:26 +0200)
commit5c8c9905c2496a38a17f1b2a180601e790e45db9
tree8151da0d22ee2f3813538f6f01f0abe5697c68d1
parentc695ea2afa144a0235edb7a7f56684bbc93bb389
make sure to not warn about unused macros from -D

If a PCH is used for compilation, SourceManager::isInMainFile()
returns true even for the "<built-in>" predefines area. Using -D
only for the TU compilation may trigger -Wunused-macros for it.
It is admitedly a bit fishy to set a macro only for a TU and not
for the PCH, but this works fine if the PCH does not use the macro
(I couldn't find a statement on this for Clang, but GCC explicitly
allows this in the docs).

Differential Revision: https://reviews.llvm.org/D73846
clang/lib/Lex/PPDirectives.cpp
clang/test/PCH/cli-macro.c [new file with mode: 0644]