зеркало из https://github.com/microsoft/clang-1.git
Code completion results that refer to macros now get the cursor kind
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
This commit is contained in:
Родитель
7b73b92870
Коммит
09d9fa1933
|
@ -582,9 +582,12 @@ CIndexCodeCompleteConsumer::ProcessCodeCompleteResults(Sema &SemaRef,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Result::RK_Keyword:
|
|
||||||
case Result::RK_Macro:
|
case Result::RK_Macro:
|
||||||
|
Kind = CXCursor_MacroDefinition;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Result::RK_Keyword:
|
||||||
case Result::RK_Pattern:
|
case Result::RK_Pattern:
|
||||||
Kind = CXCursor_NotImplemented;
|
Kind = CXCursor_NotImplemented;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
// 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 )}
|
|
@ -2333,7 +2333,7 @@ void clang_annotateTokens(CXTranslationUnit TU,
|
||||||
RegionOfInterest.setBegin(
|
RegionOfInterest.setBegin(
|
||||||
cxloc::translateSourceLocation(clang_getTokenLocation(TU, Tokens[0])));
|
cxloc::translateSourceLocation(clang_getTokenLocation(TU, Tokens[0])));
|
||||||
SourceLocation End
|
SourceLocation End
|
||||||
= cxloc::translateSourceLocation(clang_getTokenLocation(TU,
|
= cxloc::translateSourceLocation(clang_getTokenLocation(TU,
|
||||||
Tokens[NumTokens - 1]));
|
Tokens[NumTokens - 1]));
|
||||||
RegionOfInterest.setEnd(CXXUnit->getPreprocessor().getLocForEndOfToken(End));
|
RegionOfInterest.setEnd(CXXUnit->getPreprocessor().getLocForEndOfToken(End));
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче