Author: kristina Date: Wed May 15 19:46:12 2019 New Revision: 360839 URL: http://llvm.org/viewvc/llvm-project?rev=360839&view=rev Log: Fix assumption about Win32 paths in r360833
Attempt to fix Windows buildbots due to differences in path handling (caused by r360833). Modified: cfe/trunk/lib/Lex/PPMacroExpansion.cpp Modified: cfe/trunk/lib/Lex/PPMacroExpansion.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/PPMacroExpansion.cpp?rev=360839&r1=360838&r2=360839&view=diff ============================================================================== --- cfe/trunk/lib/Lex/PPMacroExpansion.cpp (original) +++ cfe/trunk/lib/Lex/PPMacroExpansion.cpp Wed May 15 19:46:12 2019 @@ -1501,8 +1501,14 @@ void Preprocessor::ExpandBuiltinMacro(To // the last part of __FILE__. if (II == Ident__FILE_NAME__) { // Try to get the last path component. - StringRef PLFileName = PLoc.getFilename(); - size_t LastSep = PLFileName.find_last_of('/'); + StringRef PLFileName = PLoc.getFilename(); + size_t LastSep = PLFileName.find_last_of('/'); +#ifdef _WIN32 + // On Windows targets, absolute paths can be normalized to use + // backslashes instead - handle this potential case here. + if (LastSep == StringRef::npos) + LastSep = PLFileName.find_last_of('\\'); +#endif // Skip the separator and get the last part, otherwise fall back on // returning the original full filename. if (LastSep != StringRef::npos) _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits