diff options
author | Lubos Lunak <l.lunak@centrum.cz> | 2019-09-16 19:18:37 +0000 |
---|---|---|
committer | Lubos Lunak <l.lunak@centrum.cz> | 2019-09-16 19:18:37 +0000 |
commit | cb90360eef8944a00785e38181d58274de8b974f (patch) | |
tree | 0382b2b7eaaa7b89d907ea240ce926e6e4bac632 /lib | |
parent | 4c6a6cd76e75370db0f3f20014eb70d49c525715 (diff) | |
download | clang-cb90360eef8944a00785e38181d58274de8b974f.tar.gz |
do not emit -Wunused-macros warnings in -frewrite-includes mode (PR15614)
-frewrite-includes calls PP.SetMacroExpansionOnlyInDirectives() to avoid
macro expansions that are useless in that mode, but this can lead
to -Wunused-macros false positives. As -frewrite-includes does not emit
normal warnings, block -Wunused-macros too.
Differential Revision: https://reviews.llvm.org/D65371
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@372026 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Lex/PPDirectives.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/Lex/PPDirectives.cpp b/lib/Lex/PPDirectives.cpp index c4f660f88c..fe57f37f09 100644 --- a/lib/Lex/PPDirectives.cpp +++ b/lib/Lex/PPDirectives.cpp @@ -2782,7 +2782,8 @@ void Preprocessor::HandleDefineDirective( // If we need warning for not using the macro, add its location in the // warn-because-unused-macro set. If it gets used it will be removed from set. if (getSourceManager().isInMainFile(MI->getDefinitionLoc()) && - !Diags->isIgnored(diag::pp_macro_not_used, MI->getDefinitionLoc())) { + !Diags->isIgnored(diag::pp_macro_not_used, MI->getDefinitionLoc()) && + !MacroExpansionInDirectivesOverride) { MI->setIsWarnIfUnused(true); WarnUnusedMacroLocs.insert(MI->getDefinitionLoc()); } |