summaryrefslogtreecommitdiffstats
path: root/clang/lib/Lex/PPMacroExpansion.cpp
diff options
context:
space:
mode:
authorKristina Brooks <notstina@gmail.com>2019-05-16 02:46:12 +0000
committerKristina Brooks <notstina@gmail.com>2019-05-16 02:46:12 +0000
commit69e927662dc959ad4fd057619f6511bb65537213 (patch)
treeaf7d8b922b16ce66a45d64b38a0c70e1b9a55c38 /clang/lib/Lex/PPMacroExpansion.cpp
parent7d4761928e7895650b5f57a30a1be250de4082df (diff)
downloadbcm5719-llvm-69e927662dc959ad4fd057619f6511bb65537213.tar.gz
bcm5719-llvm-69e927662dc959ad4fd057619f6511bb65537213.zip
Fix assumption about Win32 paths in r360833
Attempt to fix Windows buildbots due to differences in path handling (caused by r360833). llvm-svn: 360839
Diffstat (limited to 'clang/lib/Lex/PPMacroExpansion.cpp')
-rw-r--r--clang/lib/Lex/PPMacroExpansion.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/clang/lib/Lex/PPMacroExpansion.cpp b/clang/lib/Lex/PPMacroExpansion.cpp
index 148fc67c431..bc25dcd8ead 100644
--- a/clang/lib/Lex/PPMacroExpansion.cpp
+++ b/clang/lib/Lex/PPMacroExpansion.cpp
@@ -1501,8 +1501,14 @@ void Preprocessor::ExpandBuiltinMacro(Token &Tok) {
// 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)
OpenPOWER on IntegriCloud