of macro definitions when passed to CIndex. Add test for code
completion of macros via CIndex.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100431
91177308-0d34-0410-b5e6-
96231b3b80d8
break;
}
break;
-
- case Result::RK_Keyword:
+
case Result::RK_Macro:
+ Kind = CXCursor_MacroDefinition;
+ break;
+
+ case Result::RK_Keyword:
case Result::RK_Pattern:
Kind = CXCursor_NotImplemented;
break;
--- /dev/null
+// Note: the run lines follow their respective tests, since line/column
+// matter in this test.
+
+#define FOO(Arg1,Arg2) foobar
+
+void f() {
+
+}
+
+// RUN: c-index-test -code-completion-at=%s:7:1 %s | FileCheck -check-prefix=CHECK-CC1 %s
+// CHECK-CC1: macro definition:{TypedText FOO}{LeftParen (}{Placeholder Arg1}{Comma , }{Placeholder Arg2}{RightParen )}
RegionOfInterest.setBegin(
cxloc::translateSourceLocation(clang_getTokenLocation(TU, Tokens[0])));
SourceLocation End
- = cxloc::translateSourceLocation(clang_getTokenLocation(TU,
+ = cxloc::translateSourceLocation(clang_getTokenLocation(TU,
Tokens[NumTokens - 1]));
RegionOfInterest.setEnd(CXXUnit->getPreprocessor().getLocForEndOfToken(End));