================
@@ -1370,19 +1370,47 @@ ToolChain::CXXStdlibType 
ToolChain::GetCXXStdlibType(const ArgList &Args) const{
   return *cxxStdlibType;
 }
 
+static void ResolveAndAddSystemIncludePath(const ArgList &DriverArgs,
+                                           ArgStringList &CC1Args,
+                                           const Twine &Path) {
+  bool Canonicalize =
+      DriverArgs.hasFlag(options::OPT_canonical_prefixes,
+                         options::OPT_no_canonical_prefixes, true);
+
+  if (!Canonicalize) {
+    CC1Args.push_back(DriverArgs.MakeArgString(Path));
+    return;
+  }
+
+  // We canonicalise system include paths that were added automatically if
+  // that yields a shorter path since those can end up quite long otherwise.
+  //
+  // While we would ideally prefer to use FileManager for this, there doesn't
----------------
jyknight wrote:

I think we do NOT prefer that -- at least not for this function in isolation. 
All of the rest of the code in this file is working with llvm::sys::fs 
functions directly, to find search paths on the filesystem. 

So, concretely here, I'd actually recommend not using 
`vfs::getRealFileSystem()`, and instead call `llvm::sys::fs::real_path` 
directly.

https://github.com/llvm/llvm-project/pull/148745
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to