at the start of a macro instantiation.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133801
91177308-0d34-0410-b5e6-
96231b3b80d8
// suggest inserting the colon in between them, otherwise insert ": ".
SourceLocation FILoc = Tok.getLocation();
const char *FIText = ": ";
- if (FILoc.isFileID()) {
- const SourceManager &SM = PP.getSourceManager();
+ const SourceManager &SM = PP.getSourceManager();
+ if (FILoc.isFileID() || SM.isAtStartOfMacroInstantiation(FILoc)) {
+ FILoc = SM.getInstantiationLoc(FILoc);
bool IsInvalid = false;
const char *SourcePtr =
SM.getCharacterData(FILoc.getFileLocWithOffset(-1), &IsInvalid);
int i0 = { 17 };
+#define ONE 1
+#define TWO 2
+
int test_cond(int y, int fooBar) {
// CHECK: int x = y ? 1 : 4+fooBar;
int x = y ? 1 4+foobar;
+// CHECK: x = y ? ONE : TWO;
+ x = y ? ONE TWO;
return x;
}