================ @@ -738,12 +738,20 @@ void TextDiagnostic::printDiagnosticMessage(raw_ostream &OS, } void TextDiagnostic::emitFilename(StringRef Filename, const SourceManager &SM) { -#ifdef _WIN32 - SmallString<4096> TmpFilename; -#endif - if (DiagOpts.AbsolutePath) { - auto File = SM.getFileManager().getOptionalFileRef(Filename); - if (File) { + auto File = SM.getFileManager().getOptionalFileRef(Filename); + + // Try to simplify paths that contain '..' in any case since paths to + // standard library headers especially tend to get quite long otherwise. + // Only do that for local filesystems though to avoid slowing down + // compilation too much. + auto AlwaysSimplify = [&] { + return File->getName().contains("..") && + llvm::sys::fs::is_local(File->getName()); + }; ---------------- AaronBallman wrote:
Are we sure that `is_local()` isn't going to cause a performance issue by itself? I notice the Windows implementation looks like it could be expensive: https://github.com/llvm/llvm-project/blob/bdcbe67400b8b3d31d89df6c74d06ab80d8c7862/llvm/lib/Support/Windows/Path.inc#L313 https://github.com/llvm/llvm-project/pull/143520 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits