[PATCH] Support Sourcery CodeBench MIPS toolchain

Simon Atanasyan simon at atanasyan.com
Fri Apr 19 14:04:41 PDT 2013

Comment at: lib/Driver/ToolChains.cpp:2379
@@ +2378,3 @@
+  if (GCCInstallation.isValid() && isMipsArch(getTriple().getArch())) {
+    Twine MipsInc = GCCInstallation.getInstallPath() + "/include";
+    if (llvm::sys::fs::exists(MipsInc))
Rafael Ávila de Espíndola wrote:
> It is dangerous to use Twine like this. I think this case is safe, but a change to, for example, compute a string in getInstallPath instead of just returning a StringRef to a member would break this.
> Can you add a trivial addExternCSystemIncludeIfExits with a Twine argument to avoid this? Or maybe addExternCSystemInclude itself could check if thee directory exit?
I prefer to make addExternCSystemIncludeIfExits(). It's a good idea to move path existence checking to the addExternCSystemInclude(). But I think this change should be made by a separate commit.


More information about the cfe-commits mailing list