[PATCH] D37954: Try to shorten system header paths when using -MD depfiles

James Y Knight via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Oct 21 18:48:15 PDT 2017


jyknight added a comment.

I think the diagnosis on the original issue was incorrect.

It seems to me that it was caused by the prefix being set as "/bin" instead of "/usr/bin", because clang _doesn't_ actually canonicalize its prefix, even when -no-canonical-prefixes isn't specified! All it does, now, is to make the prefix absolute -- without fully canonicalizing. I think that's simply a bug.

If the prefix had been, properly, /usr/bin, then the include path would've been:

  /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/7.2.0/../../../../include/c++/7.2.0/iostream

And in that case, it would've worked properly with ninja, without adding the feature in this patch.

Reference clang/tools/driver/driver.cpp:297:

  // FIXME: We don't actually canonicalize this, we just make it absolute.
  if (CanonicalPrefixes)
    llvm::sys::fs::make_absolute(InstalledPath);


Repository:
  rL LLVM

https://reviews.llvm.org/D37954





More information about the cfe-commits mailing list