Be a little more permissive with -fmodules-ignore-macro= by removing everything after the second '=' if it is there.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174567 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Frontend/CompilerInstance.cpp b/lib/Frontend/CompilerInstance.cpp
index 356bf31..0c5a1fa 100644
--- a/lib/Frontend/CompilerInstance.cpp
+++ b/lib/Frontend/CompilerInstance.cpp
@@ -754,13 +754,8 @@
       : HSOpts(HSOpts) { }
 
     bool operator()(const std::pair<std::string, bool> &def) const {
-      // Dig out the macro name.
-      StringRef MacroName = def.first;
-      StringRef::size_type EqPos = MacroName.find('=');
-      if (EqPos != StringRef::npos)
-        MacroName = MacroName.substr(0, EqPos);
-
-      return HSOpts.ModulesIgnoreMacros.count(MacroName) > 0;
+      StringRef MacroDef = def.first;
+      return HSOpts.ModulesIgnoreMacros.count(MacroDef.split('=').first) > 0;
     }
   };
 }
diff --git a/lib/Frontend/CompilerInvocation.cpp b/lib/Frontend/CompilerInvocation.cpp
index 34496ed..0e313a9 100644
--- a/lib/Frontend/CompilerInvocation.cpp
+++ b/lib/Frontend/CompilerInvocation.cpp
@@ -816,8 +816,8 @@
 
   for (arg_iterator it = Args.filtered_begin(OPT_fmodules_ignore_macro),
        ie = Args.filtered_end(); it != ie; ++it) {
-    const Arg *A = *it;
-    Opts.ModulesIgnoreMacros.insert(A->getValue());
+    StringRef MacroDef = (*it)->getValue();
+    Opts.ModulesIgnoreMacros.insert(MacroDef.split('=').first);
   }
 
   // Add -I..., -F..., and -index-header-map options in order.
@@ -1617,14 +1617,9 @@
     // If we're supposed to ignore this macro for the purposes of modules,
     // don't put it into the hash.
     if (!hsOpts.ModulesIgnoreMacros.empty()) {
-      // Dig out the macro name.
-      StringRef MacroName = I->first;
-      StringRef::size_type EqPos = MacroName.find('=');
-      if (EqPos != StringRef::npos)
-        MacroName = MacroName.substr(0, EqPos);
-
       // Check whether we're ignoring this macro.
-      if (hsOpts.ModulesIgnoreMacros.count(MacroName))
+      StringRef MacroDef = I->first;
+      if (hsOpts.ModulesIgnoreMacros.count(MacroDef.split('=').first))
         continue;
     }