[cfe-commits] r140053 - in /cfe/trunk: lib/Basic/SourceManager.cpp test/Index/annotate-tokens-pp.c

Argyrios Kyrtzidis akyrtzi at gmail.com
Mon Sep 19 13:39:58 PDT 2011


Author: akirtzidis
Date: Mon Sep 19 15:39:57 2011
New Revision: 140053

URL: http://llvm.org/viewvc/llvm-project?rev=140053&view=rev
Log:
For SourceManager::isBeforeInTranslationUnit, a location pointing
inside a macro argument should be regarded as coming before
the location of the expanded tokens.

Modified:
    cfe/trunk/lib/Basic/SourceManager.cpp
    cfe/trunk/test/Index/annotate-tokens-pp.c

Modified: cfe/trunk/lib/Basic/SourceManager.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/SourceManager.cpp?rev=140053&r1=140052&r2=140053&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/SourceManager.cpp (original)
+++ cfe/trunk/lib/Basic/SourceManager.cpp Mon Sep 19 15:39:57 2011
@@ -1598,7 +1598,7 @@
   SourceLocation UpperLoc;
   const SrcMgr::SLocEntry &Entry = SM.getSLocEntry(Loc.first);
   if (Entry.isExpansion())
-    UpperLoc = Entry.getExpansion().getExpansionLocStart();
+    UpperLoc = Entry.getExpansion().getExpansionLocEnd();
   else
     UpperLoc = Entry.getFile().getIncludeLoc();
   

Modified: cfe/trunk/test/Index/annotate-tokens-pp.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/annotate-tokens-pp.c?rev=140053&r1=140052&r2=140053&view=diff
==============================================================================
--- cfe/trunk/test/Index/annotate-tokens-pp.c (original)
+++ cfe/trunk/test/Index/annotate-tokens-pp.c Mon Sep 19 15:39:57 2011
@@ -122,7 +122,8 @@
 // CHECK: Identifier: "t" [16:25 - 16:26] DeclRefExpr=t:15:7
 // CHECK: Punctuation: "," [16:26 - 16:27]
 // CHECK: Identifier: "z" [16:27 - 16:28] DeclRefExpr=z:14:7
-// CHECK: Punctuation: ")" [16:28 - 16:29] UnexposedStmt=
+// FIXME: The token below should really be annotated as "macro expansion=REVERSE_MACRO:10:9"
+// CHECK: Punctuation: ")" [16:28 - 16:29] VarDecl=k:16:7 (Definition)
 // CHECK: Punctuation: ";" [16:29 - 16:30] UnexposedStmt=
 // CHECK: Keyword: "int" [17:3 - 17:6] VarDecl=j:17:7 (Definition)
 // CHECK: Identifier: "j" [17:7 - 17:8] VarDecl=j:17:7 (Definition)
@@ -132,7 +133,8 @@
 // CHECK: Identifier: "k" [17:23 - 17:24] DeclRefExpr=k:16:7
 // CHECK: Punctuation: "+" [17:25 - 17:26] UnexposedExpr=
 // CHECK: Identifier: "k" [17:27 - 17:28] DeclRefExpr=k:16:7
-// CHECK: Punctuation: ")" [17:28 - 17:29] UnexposedStmt=
+// FIXME: The token below should really be annotated as "macro expansion=TWICE_MACRO:11:9"
+// CHECK: Punctuation: ")" [17:28 - 17:29] VarDecl=j:17:7 (Definition)
 // CHECK: Punctuation: ";" [17:29 - 17:30] UnexposedStmt=
 // CHECK: Keyword: "int" [18:3 - 18:6] VarDecl=w:18:7 (Definition)
 // CHECK: Identifier: "w" [18:7 - 18:8] VarDecl=w:18:7 (Definition)





More information about the cfe-commits mailing list