summaryrefslogtreecommitdiffstats
path: root/clang/lib/Lex/PPMacroExpansion.cpp
diff options
context:
space:
mode:
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