[Index] Ignore noop #undef's when handling macro occurrences.
authorEric Liu <ioeric@google.com>
Mon, 9 Jul 2018 19:02:41 +0000 (19:02 +0000)
committerEric Liu <ioeric@google.com>
Mon, 9 Jul 2018 19:02:41 +0000 (19:02 +0000)
llvm-svn: 336584

clang/lib/Index/IndexingAction.cpp

index b8faf70..16f6c21 100644 (file)
@@ -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());