[all-commits] [llvm/llvm-project] 5c8c99: make sure to not warn about unused macros from -D

Luboš Luňák via All-commits all-commits at lists.llvm.org
Mon Apr 27 12:30:25 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 5c8c9905c2496a38a17f1b2a180601e790e45db9
      https://github.com/llvm/llvm-project/commit/5c8c9905c2496a38a17f1b2a180601e790e45db9
  Author: Luboš Luňák <l.lunak at centrum.cz>
  Date:   2020-04-27 (Mon, 27 Apr 2020)

  Changed paths:
    M clang/lib/Lex/PPDirectives.cpp
    A clang/test/PCH/cli-macro.c

  Log Message:
  -----------
  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




More information about the All-commits mailing list