[PATCH] D65371: do not emit -Wunused-macros warnings in -frewrite-includes mode (PR15614)

Luboš Luňák via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Jul 27 12:44:11 PDT 2019


llunak created this revision.
llunak added a reviewer: rsmith.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

This is an updated patch from https://bugs.llvm.org/show_bug.cgi?id=15614. See there for testcase etc.


Repository:
  rC Clang

https://reviews.llvm.org/D65371

Files:
  clang/lib/Lex/PPDirectives.cpp


Index: clang/lib/Lex/PPDirectives.cpp
===================================================================
--- clang/lib/Lex/PPDirectives.cpp
+++ clang/lib/Lex/PPDirectives.cpp
@@ -2723,7 +2723,8 @@
   // 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());
   }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D65371.212067.patch
Type: text/x-patch
Size: 716 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190727/e3b60129/attachment.bin>


More information about the cfe-commits mailing list