r336584 - [Index] Ignore noop #undef's when handling macro occurrences.

Eric Liu via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 9 12:02:41 PDT 2018


Author: ioeric
Date: Mon Jul  9 12:02:41 2018
New Revision: 336584

URL: http://llvm.org/viewvc/llvm-project?rev=336584&view=rev
Log:
[Index] Ignore noop #undef's when handling macro occurrences.

Modified:
    cfe/trunk/lib/Index/IndexingAction.cpp

Modified: cfe/trunk/lib/Index/IndexingAction.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Index/IndexingAction.cpp?rev=336584&r1=336583&r2=336584&view=diff
==============================================================================
--- cfe/trunk/lib/Index/IndexingAction.cpp (original)
+++ cfe/trunk/lib/Index/IndexingAction.cpp Mon Jul  9 12:02:41 2018
@@ -98,6 +98,8 @@ public:
 
   void MacroUndefined(const Token &MacroNameTok, const MacroDefinition &MD,
                       const MacroDirective *Undef) override {
+    if (!MD.getMacroInfo())  // Ignore noop #undef.
+      return;
     IndexCtx->handleMacroUndefined(*MacroNameTok.getIdentifierInfo(),
                                    MacroNameTok.getLocation(),
                                    *MD.getMacroInfo());




More information about the cfe-commits mailing list