summaryrefslogtreecommitdiffstats
path: root/clang/lib/Lex/PPMacroExpansion.cpp
diff options
context:
space:
mode:
authorKristina Brooks <notstina@gmail.com>2019-05-16 03:30:08 +0000
committerKristina Brooks <notstina@gmail.com>2019-05-16 03:30:08 +0000
commit9d65624bf6577ad597d80cf4dd9d9aa8d65dec61 (patch)
tree848980039ad43f27889814ac3c54ed9ad61dd30f /clang/lib/Lex/PPMacroExpansion.cpp
parent5c073a94f9c25e73d78dbeb8eb7b1b3a60d7dd1f (diff)
downloadbcm5719-llvm-9d65624bf6577ad597d80cf4dd9d9aa8d65dec61.tar.gz
bcm5719-llvm-9d65624bf6577ad597d80cf4dd9d9aa8d65dec61.zip
Revert r360833 until I can work out the issue with Win32 bots
This reverts "r360833: [Clang][PP] Add the __FILE_NAME__ builtin macro." The tests are failing on Windows bots, reverting the patchset until I can work out why. llvm-svn: 360842
Diffstat (limited to 'clang/lib/Lex/PPMacroExpansion.cpp')
-rw-r--r--clang/lib/Lex/PPMacroExpansion.cpp26
1 files changed, 2 insertions, 24 deletions
diff --git a/clang/lib/Lex/PPMacroExpansion.cpp b/clang/lib/Lex/PPMacroExpansion.cpp
index bc25dcd8ead..d698f0e6578 100644
--- a/clang/lib/Lex/PPMacroExpansion.cpp
+++ b/clang/lib/Lex/PPMacroExpansion.cpp
@@ -363,7 +363,6 @@ void Preprocessor::RegisterBuiltinMacros() {
}
// Clang Extensions.
- Ident__FILE_NAME__ = RegisterBuiltinMacro(*this, "__FILE_NAME__");
Ident__has_feature = RegisterBuiltinMacro(*this, "__has_feature");
Ident__has_extension = RegisterBuiltinMacro(*this, "__has_extension");
Ident__has_builtin = RegisterBuiltinMacro(*this, "__has_builtin");
@@ -1475,8 +1474,7 @@ void Preprocessor::ExpandBuiltinMacro(Token &Tok) {
// __LINE__ expands to a simple numeric value.
OS << (PLoc.isValid()? PLoc.getLine() : 1);
Tok.setKind(tok::numeric_constant);
- } else if (II == Ident__FILE__ || II == Ident__BASE_FILE__ ||
- II == Ident__FILE_NAME__) {
+ } else if (II == Ident__FILE__ || II == Ident__BASE_FILE__) {
// C99 6.10.8: "__FILE__: The presumed name of the current source file (a
// character string literal)". This can be affected by #line.
PresumedLoc PLoc = SourceMgr.getPresumedLoc(Tok.getLocation());
@@ -1497,27 +1495,7 @@ void Preprocessor::ExpandBuiltinMacro(Token &Tok) {
// Escape this filename. Turn '\' -> '\\' '"' -> '\"'
SmallString<128> FN;
if (PLoc.isValid()) {
- // __FILE_NAME__ is a Clang-specific extension that expands to the
- // 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('/');
-#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)
- FN += PLFileName.substr(LastSep+1);
- else
- FN += PLFileName;
- } else {
- FN += PLoc.getFilename();
- }
+ FN += PLoc.getFilename();
Lexer::Stringify(FN);
OS << '"' << FN << '"';
}
OpenPOWER on IntegriCloud