summaryrefslogtreecommitdiffstats
path: root/clang/lib/Lex/Pragma.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-02-15 20:52:18 +0000
committerChris Lattner <sabre@nondot.org>2009-02-15 20:52:18 +0000
commit9dc9c206d3a2b2a35e5a9dfd407c1741bcee9ecf (patch)
tree9a5ffe0af544a4d1975e85a8fd2b3d9e447be977 /clang/lib/Lex/Pragma.cpp
parent7f543ba9fa1dc3dde925ea32d77a64c2bff84115 (diff)
downloadbcm5719-llvm-9dc9c206d3a2b2a35e5a9dfd407c1741bcee9ecf.tar.gz
bcm5719-llvm-9dc9c206d3a2b2a35e5a9dfd407c1741bcee9ecf.zip
track "just a little more" location information for macro instantiations.
Now instead of just tracking the expansion history, also track the full range of the macro that got replaced. For object-like macros, this doesn't change anything. For _Pragma and function-like macros, this means we track the locations of the ')'. This is required for PR3579 because apparently GCC uses the line of the ')' of a function-like macro as the location to expand __LINE__ to. llvm-svn: 64601
Diffstat (limited to 'clang/lib/Lex/Pragma.cpp')
-rw-r--r--clang/lib/Lex/Pragma.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/clang/lib/Lex/Pragma.cpp b/clang/lib/Lex/Pragma.cpp
index 87410f9ff4a..73d36414ba9 100644
--- a/clang/lib/Lex/Pragma.cpp
+++ b/clang/lib/Lex/Pragma.cpp
@@ -117,7 +117,6 @@ void Preprocessor::Handle_Pragma(Token &Tok) {
// Remember the string.
std::string StrVal = getSpelling(Tok);
- SourceLocation StrLoc = Tok.getLocation();
// Read the ')'.
Lex(Tok);
@@ -126,6 +125,8 @@ void Preprocessor::Handle_Pragma(Token &Tok) {
return;
}
+ SourceLocation RParenLoc = Tok.getLocation();
+
// The _Pragma is lexically sound. Destringize according to C99 6.10.9.1:
// "The string literal is destringized by deleting the L prefix, if present,
// deleting the leading and trailing double-quotes, replacing each escape
@@ -163,7 +164,7 @@ void Preprocessor::Handle_Pragma(Token &Tok) {
// Make and enter a lexer object so that we lex and expand the tokens just
// like any others.
- Lexer *TL = Lexer::Create_PragmaLexer(TokLoc, StrLoc,
+ Lexer *TL = Lexer::Create_PragmaLexer(TokLoc, PragmaLoc, RParenLoc,
// do not include the null in the count.
StrVal.size()-1, *this);
OpenPOWER on IntegriCloud