[PATCH] D24933: Enable configuration files in clang

Serge Pavlov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 6 07:37:21 PST 2017


sepavloff marked 2 inline comments as done.
sepavloff added inline comments.


================
Comment at: lib/Driver/ToolChain.cpp:183
   std::string Target;
-  if (llvm::TargetRegistry::lookupTarget(Prefix, IgnoredError)) {
+  if (!VerifyTarget || llvm::TargetRegistry::lookupTarget(Prefix, IgnoredError))
     Target = Prefix;
----------------
hfinkel wrote:
> I don't think that we can do it this way; it is a behavior change (we now might try to set the target to some string which did not validate as a known target, whereas we did not previously).
> 
> How about you always return the prefix, but also return a boolean indicating whether or not the prefix is a valid target? Then, after processing the config file, you can clear out the string if it was not a valid target.
Changed implementation of this function. Indeed using explicit flag looks more clear than conditional setting target name.


================
Comment at: tools/driver/driver.cpp:363
+                                       TargetAndMode.first + ".cfg");
+    TargetAndMode.first.clear();
+  }
----------------
hfinkel wrote:
> I don't think that you can clear the string here. We might need it later to call insertTargetAndModeArgs.
With new implementation of `ToolChain::getTargetAndModeFromProgramName` it is not needed anymore.


https://reviews.llvm.org/D24933





More information about the cfe-commits mailing list