зеркало из https://github.com/microsoft/clang.git
Only enable code patterns (e.g., try { statements } catch (...) {
statements }) in the code-completion results if explicitly requested. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104637 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
3458d43b68
Коммит
d8e8a58ee3
|
@ -243,6 +243,8 @@ def no_code_completion_debug_printer : Flag<"-no-code-completion-debug-printer">
|
|||
HelpText<"Don't use the \"debug\" code-completion print">;
|
||||
def code_completion_macros : Flag<"-code-completion-macros">,
|
||||
HelpText<"Include macros in code-completion results">;
|
||||
def code_completion_patterns : Flag<"-code-completion-patterns">,
|
||||
HelpText<"Include code patterns in code-completion results">;
|
||||
def disable_free : Flag<"-disable-free">,
|
||||
HelpText<"Disable freeing of memory on exit">;
|
||||
def help : Flag<"-help">,
|
||||
|
|
|
@ -519,7 +519,7 @@ public:
|
|||
createCodeCompletionConsumer(Preprocessor &PP, const std::string &Filename,
|
||||
unsigned Line, unsigned Column,
|
||||
bool UseDebugPrinter, bool ShowMacros,
|
||||
llvm::raw_ostream &OS);
|
||||
bool ShowCodePatterns, llvm::raw_ostream &OS);
|
||||
|
||||
/// Create the frontend timer and replace any existing one with it.
|
||||
void createFrontendTimer();
|
||||
|
|
|
@ -79,6 +79,8 @@ public:
|
|||
unsigned ShowHelp : 1; ///< Show the -help text.
|
||||
unsigned ShowMacrosInCodeCompletion : 1; ///< Show macros in code completion
|
||||
/// results.
|
||||
unsigned ShowCodePatternsInCodeCompletion : 1; ///< Show code patterns in code
|
||||
/// completion results.
|
||||
unsigned ShowStats : 1; ///< Show frontend performance
|
||||
/// metrics and statistics.
|
||||
unsigned ShowTimers : 1; ///< Show timers for individual
|
||||
|
@ -125,6 +127,7 @@ public:
|
|||
RelocatablePCH = 0;
|
||||
ShowHelp = 0;
|
||||
ShowMacrosInCodeCompletion = 0;
|
||||
ShowCodePatternsInCodeCompletion = 0;
|
||||
ShowStats = 0;
|
||||
ShowTimers = 0;
|
||||
ShowVersion = 0;
|
||||
|
|
|
@ -246,6 +246,10 @@ protected:
|
|||
/// \brief Whether to include macros in the code-completion results.
|
||||
bool IncludeMacros;
|
||||
|
||||
/// \brief Whether to include code patterns (such as for loops) within
|
||||
/// the completion results.
|
||||
bool IncludeCodePatterns;
|
||||
|
||||
/// \brief Whether the output format for the code-completion consumer is
|
||||
/// binary.
|
||||
bool OutputIsBinary;
|
||||
|
@ -420,12 +424,17 @@ public:
|
|||
|
||||
CodeCompleteConsumer() : IncludeMacros(false), OutputIsBinary(false) { }
|
||||
|
||||
CodeCompleteConsumer(bool IncludeMacros, bool OutputIsBinary)
|
||||
: IncludeMacros(IncludeMacros), OutputIsBinary(OutputIsBinary) { }
|
||||
CodeCompleteConsumer(bool IncludeMacros, bool IncludeCodePatterns,
|
||||
bool OutputIsBinary)
|
||||
: IncludeMacros(IncludeMacros), IncludeCodePatterns(IncludeCodePatterns),
|
||||
OutputIsBinary(OutputIsBinary) { }
|
||||
|
||||
/// \brief Whether the code-completion consumer wants to see macros.
|
||||
bool includeMacros() const { return IncludeMacros; }
|
||||
|
||||
/// \brief Whether the code-completion consumer wants to see code patterns.
|
||||
bool includeCodePatterns() const { return IncludeCodePatterns; }
|
||||
|
||||
/// \brief Determine whether the output of this consumer is binary.
|
||||
bool isOutputBinary() const { return OutputIsBinary; }
|
||||
|
||||
|
@ -461,9 +470,9 @@ class PrintingCodeCompleteConsumer : public CodeCompleteConsumer {
|
|||
public:
|
||||
/// \brief Create a new printing code-completion consumer that prints its
|
||||
/// results to the given raw output stream.
|
||||
PrintingCodeCompleteConsumer(bool IncludeMacros,
|
||||
PrintingCodeCompleteConsumer(bool IncludeMacros, bool IncludeCodePatterns,
|
||||
llvm::raw_ostream &OS)
|
||||
: CodeCompleteConsumer(IncludeMacros, false), OS(OS) { }
|
||||
: CodeCompleteConsumer(IncludeMacros, IncludeCodePatterns, false), OS(OS) {}
|
||||
|
||||
/// \brief Prints the finalized code-completion results.
|
||||
virtual void ProcessCodeCompleteResults(Sema &S, Result *Results,
|
||||
|
@ -484,8 +493,9 @@ public:
|
|||
/// \brief Create a new CIndex code-completion consumer that prints its
|
||||
/// results to the given raw output stream in a format readable to the CIndex
|
||||
/// library.
|
||||
CIndexCodeCompleteConsumer(bool IncludeMacros, llvm::raw_ostream &OS)
|
||||
: CodeCompleteConsumer(IncludeMacros, true), OS(OS) { }
|
||||
CIndexCodeCompleteConsumer(bool IncludeMacros, bool IncludeCodePatterns,
|
||||
llvm::raw_ostream &OS)
|
||||
: CodeCompleteConsumer(IncludeMacros, IncludeCodePatterns, true), OS(OS) {}
|
||||
|
||||
/// \brief Prints the finalized code-completion results.
|
||||
virtual void ProcessCodeCompleteResults(Sema &S, Result *Results,
|
||||
|
|
|
@ -295,6 +295,7 @@ void CompilerInstance::createCodeCompletionConsumer() {
|
|||
Loc.FileName, Loc.Line, Loc.Column,
|
||||
getFrontendOpts().DebugCodeCompletionPrinter,
|
||||
getFrontendOpts().ShowMacrosInCodeCompletion,
|
||||
getFrontendOpts().ShowCodePatternsInCodeCompletion,
|
||||
llvm::outs()));
|
||||
if (!CompletionConsumer)
|
||||
return;
|
||||
|
@ -317,6 +318,7 @@ CompilerInstance::createCodeCompletionConsumer(Preprocessor &PP,
|
|||
unsigned Column,
|
||||
bool UseDebugPrinter,
|
||||
bool ShowMacros,
|
||||
bool ShowCodePatterns,
|
||||
llvm::raw_ostream &OS) {
|
||||
// Tell the source manager to chop off the given file at a specific
|
||||
// line and column.
|
||||
|
@ -332,9 +334,9 @@ CompilerInstance::createCodeCompletionConsumer(Preprocessor &PP,
|
|||
|
||||
// Set up the creation routine for code-completion.
|
||||
if (UseDebugPrinter)
|
||||
return new PrintingCodeCompleteConsumer(ShowMacros, OS);
|
||||
return new PrintingCodeCompleteConsumer(ShowMacros, ShowCodePatterns, OS);
|
||||
else
|
||||
return new CIndexCodeCompleteConsumer(ShowMacros, OS);
|
||||
return new CIndexCodeCompleteConsumer(ShowMacros, ShowCodePatterns, OS);
|
||||
}
|
||||
|
||||
// Output Files
|
||||
|
|
|
@ -350,6 +350,8 @@ static void FrontendOptsToArgs(const FrontendOptions &Opts,
|
|||
Res.push_back("-help");
|
||||
if (Opts.ShowMacrosInCodeCompletion)
|
||||
Res.push_back("-code-completion-macros");
|
||||
if (Opts.ShowCodePatternsInCodeCompletion)
|
||||
Res.push_back("-code-completion-patterns");
|
||||
if (Opts.ShowStats)
|
||||
Res.push_back("-print-stats");
|
||||
if (Opts.ShowTimers)
|
||||
|
@ -986,6 +988,8 @@ ParseFrontendArgs(FrontendOptions &Opts, ArgList &Args, Diagnostic &Diags) {
|
|||
Opts.RelocatablePCH = Args.hasArg(OPT_relocatable_pch);
|
||||
Opts.ShowHelp = Args.hasArg(OPT_help);
|
||||
Opts.ShowMacrosInCodeCompletion = Args.hasArg(OPT_code_completion_macros);
|
||||
Opts.ShowCodePatternsInCodeCompletion
|
||||
= Args.hasArg(OPT_code_completion_patterns);
|
||||
Opts.ShowStats = Args.hasArg(OPT_print_stats);
|
||||
Opts.ShowTimers = Args.hasArg(OPT_ftime_report);
|
||||
Opts.ShowVersion = Args.hasArg(OPT_version);
|
||||
|
|
|
@ -127,6 +127,13 @@ namespace {
|
|||
explicit ResultBuilder(Sema &SemaRef, LookupFilter Filter = 0)
|
||||
: SemaRef(SemaRef), Filter(Filter), AllowNestedNameSpecifiers(false) { }
|
||||
|
||||
/// \brief Whether we should include code patterns in the completion
|
||||
/// results.
|
||||
bool includeCodePatterns() const {
|
||||
return SemaRef.CodeCompleter &&
|
||||
SemaRef.CodeCompleter->includeCodePatterns();
|
||||
}
|
||||
|
||||
/// \brief Set the filter used for code-completion results.
|
||||
void setFilter(LookupFilter Filter) {
|
||||
this->Filter = Filter;
|
||||
|
@ -773,13 +780,15 @@ static void AddTypeSpecifierResults(const LangOptions &LangOpts,
|
|||
Results.AddResult(Result("class"));
|
||||
Results.AddResult(Result("wchar_t"));
|
||||
|
||||
// typename qualified-id
|
||||
CodeCompletionString *Pattern = new CodeCompletionString;
|
||||
Pattern->AddTypedTextChunk("typename");
|
||||
Pattern->AddChunk(CodeCompletionString::CK_HorizontalSpace);
|
||||
Pattern->AddPlaceholderChunk("qualified-id");
|
||||
Results.AddResult(Result(Pattern));
|
||||
|
||||
if (Results.includeCodePatterns()) {
|
||||
// typename qualified-id
|
||||
CodeCompletionString *Pattern = new CodeCompletionString;
|
||||
Pattern->AddTypedTextChunk("typename");
|
||||
Pattern->AddChunk(CodeCompletionString::CK_HorizontalSpace);
|
||||
Pattern->AddPlaceholderChunk("qualified-id");
|
||||
Results.AddResult(Result(Pattern));
|
||||
}
|
||||
|
||||
if (LangOpts.CPlusPlus0x) {
|
||||
Results.AddResult(Result("auto"));
|
||||
Results.AddResult(Result("char16_t"));
|
||||
|
@ -795,12 +804,14 @@ static void AddTypeSpecifierResults(const LangOptions &LangOpts,
|
|||
// Results.AddResult(Result("_Decimal64"));
|
||||
// Results.AddResult(Result("_Decimal128"));
|
||||
|
||||
CodeCompletionString *Pattern = new CodeCompletionString;
|
||||
Pattern->AddTypedTextChunk("typeof");
|
||||
Pattern->AddChunk(CodeCompletionString::CK_LeftParen);
|
||||
Pattern->AddPlaceholderChunk("expression-or-type");
|
||||
Pattern->AddChunk(CodeCompletionString::CK_RightParen);
|
||||
Results.AddResult(Result(Pattern));
|
||||
if (Results.includeCodePatterns()) {
|
||||
CodeCompletionString *Pattern = new CodeCompletionString;
|
||||
Pattern->AddTypedTextChunk("typeof");
|
||||
Pattern->AddChunk(CodeCompletionString::CK_LeftParen);
|
||||
Pattern->AddPlaceholderChunk("expression-or-type");
|
||||
Pattern->AddChunk(CodeCompletionString::CK_RightParen);
|
||||
Results.AddResult(Result(Pattern));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -869,7 +880,7 @@ static void AddOrdinaryNameResults(Action::CodeCompletionContext CCC,
|
|||
typedef CodeCompleteConsumer::Result Result;
|
||||
switch (CCC) {
|
||||
case Action::CCC_Namespace:
|
||||
if (SemaRef.getLangOptions().CPlusPlus) {
|
||||
if (SemaRef.getLangOptions().CPlusPlus && Results.includeCodePatterns()) {
|
||||
// namespace <identifier> { }
|
||||
CodeCompletionString *Pattern = new CodeCompletionString;
|
||||
Pattern->AddTypedTextChunk("namespace");
|
||||
|
@ -921,8 +932,10 @@ static void AddOrdinaryNameResults(Action::CodeCompletionContext CCC,
|
|||
// Fall through
|
||||
|
||||
case Action::CCC_Class:
|
||||
Results.AddResult(Result("typedef"));
|
||||
if (SemaRef.getLangOptions().CPlusPlus) {
|
||||
if (Results.includeCodePatterns())
|
||||
Results.AddResult(Result("typedef"));
|
||||
|
||||
if (SemaRef.getLangOptions().CPlusPlus && Results.includeCodePatterns()) {
|
||||
// Using declaration
|
||||
CodeCompletionString *Pattern = new CodeCompletionString;
|
||||
Pattern->AddTypedTextChunk("using");
|
||||
|
@ -965,7 +978,7 @@ static void AddOrdinaryNameResults(Action::CodeCompletionContext CCC,
|
|||
|
||||
case Action::CCC_Template:
|
||||
case Action::CCC_MemberTemplate:
|
||||
if (SemaRef.getLangOptions().CPlusPlus) {
|
||||
if (SemaRef.getLangOptions().CPlusPlus && Results.includeCodePatterns()) {
|
||||
// template < parameters >
|
||||
CodeCompletionString *Pattern = new CodeCompletionString;
|
||||
Pattern->AddTypedTextChunk("template");
|
||||
|
@ -997,10 +1010,11 @@ static void AddOrdinaryNameResults(Action::CodeCompletionContext CCC,
|
|||
|
||||
case Action::CCC_RecoveryInFunction:
|
||||
case Action::CCC_Statement: {
|
||||
Results.AddResult(Result("typedef"));
|
||||
if (Results.includeCodePatterns())
|
||||
Results.AddResult(Result("typedef"));
|
||||
|
||||
CodeCompletionString *Pattern = 0;
|
||||
if (SemaRef.getLangOptions().CPlusPlus) {
|
||||
if (SemaRef.getLangOptions().CPlusPlus && Results.includeCodePatterns()) {
|
||||
Pattern = new CodeCompletionString;
|
||||
Pattern->AddTypedTextChunk("try");
|
||||
Pattern->AddChunk(CodeCompletionString::CK_LeftBrace);
|
||||
|
@ -1020,37 +1034,39 @@ static void AddOrdinaryNameResults(Action::CodeCompletionContext CCC,
|
|||
if (SemaRef.getLangOptions().ObjC1)
|
||||
AddObjCStatementResults(Results, true);
|
||||
|
||||
// if (condition) { statements }
|
||||
Pattern = new CodeCompletionString;
|
||||
Pattern->AddTypedTextChunk("if");
|
||||
Pattern->AddChunk(CodeCompletionString::CK_LeftParen);
|
||||
if (SemaRef.getLangOptions().CPlusPlus)
|
||||
Pattern->AddPlaceholderChunk("condition");
|
||||
else
|
||||
Pattern->AddPlaceholderChunk("expression");
|
||||
Pattern->AddChunk(CodeCompletionString::CK_RightParen);
|
||||
Pattern->AddChunk(CodeCompletionString::CK_LeftBrace);
|
||||
Pattern->AddPlaceholderChunk("statements");
|
||||
Pattern->AddChunk(CodeCompletionString::CK_VerticalSpace);
|
||||
Pattern->AddChunk(CodeCompletionString::CK_RightBrace);
|
||||
Results.AddResult(Result(Pattern));
|
||||
|
||||
// switch (condition) { }
|
||||
Pattern = new CodeCompletionString;
|
||||
Pattern->AddTypedTextChunk("switch");
|
||||
Pattern->AddChunk(CodeCompletionString::CK_LeftParen);
|
||||
if (SemaRef.getLangOptions().CPlusPlus)
|
||||
Pattern->AddPlaceholderChunk("condition");
|
||||
else
|
||||
Pattern->AddPlaceholderChunk("expression");
|
||||
Pattern->AddChunk(CodeCompletionString::CK_RightParen);
|
||||
Pattern->AddChunk(CodeCompletionString::CK_LeftBrace);
|
||||
Pattern->AddChunk(CodeCompletionString::CK_VerticalSpace);
|
||||
Pattern->AddChunk(CodeCompletionString::CK_RightBrace);
|
||||
Results.AddResult(Result(Pattern));
|
||||
if (Results.includeCodePatterns()) {
|
||||
// if (condition) { statements }
|
||||
Pattern = new CodeCompletionString;
|
||||
Pattern->AddTypedTextChunk("if");
|
||||
Pattern->AddChunk(CodeCompletionString::CK_LeftParen);
|
||||
if (SemaRef.getLangOptions().CPlusPlus)
|
||||
Pattern->AddPlaceholderChunk("condition");
|
||||
else
|
||||
Pattern->AddPlaceholderChunk("expression");
|
||||
Pattern->AddChunk(CodeCompletionString::CK_RightParen);
|
||||
Pattern->AddChunk(CodeCompletionString::CK_LeftBrace);
|
||||
Pattern->AddPlaceholderChunk("statements");
|
||||
Pattern->AddChunk(CodeCompletionString::CK_VerticalSpace);
|
||||
Pattern->AddChunk(CodeCompletionString::CK_RightBrace);
|
||||
Results.AddResult(Result(Pattern));
|
||||
|
||||
// switch (condition) { }
|
||||
Pattern = new CodeCompletionString;
|
||||
Pattern->AddTypedTextChunk("switch");
|
||||
Pattern->AddChunk(CodeCompletionString::CK_LeftParen);
|
||||
if (SemaRef.getLangOptions().CPlusPlus)
|
||||
Pattern->AddPlaceholderChunk("condition");
|
||||
else
|
||||
Pattern->AddPlaceholderChunk("expression");
|
||||
Pattern->AddChunk(CodeCompletionString::CK_RightParen);
|
||||
Pattern->AddChunk(CodeCompletionString::CK_LeftBrace);
|
||||
Pattern->AddChunk(CodeCompletionString::CK_VerticalSpace);
|
||||
Pattern->AddChunk(CodeCompletionString::CK_RightBrace);
|
||||
Results.AddResult(Result(Pattern));
|
||||
}
|
||||
|
||||
// Switch-specific statements.
|
||||
if (!SemaRef.getSwitchStack().empty()) {
|
||||
if (!SemaRef.getSwitchStack().empty() && Results.includeCodePatterns()) {
|
||||
// case expression:
|
||||
Pattern = new CodeCompletionString;
|
||||
Pattern->AddTypedTextChunk("case");
|
||||
|
@ -1065,52 +1081,54 @@ static void AddOrdinaryNameResults(Action::CodeCompletionContext CCC,
|
|||
Results.AddResult(Result(Pattern));
|
||||
}
|
||||
|
||||
/// while (condition) { statements }
|
||||
Pattern = new CodeCompletionString;
|
||||
Pattern->AddTypedTextChunk("while");
|
||||
Pattern->AddChunk(CodeCompletionString::CK_LeftParen);
|
||||
if (SemaRef.getLangOptions().CPlusPlus)
|
||||
Pattern->AddPlaceholderChunk("condition");
|
||||
else
|
||||
if (Results.includeCodePatterns()) {
|
||||
/// while (condition) { statements }
|
||||
Pattern = new CodeCompletionString;
|
||||
Pattern->AddTypedTextChunk("while");
|
||||
Pattern->AddChunk(CodeCompletionString::CK_LeftParen);
|
||||
if (SemaRef.getLangOptions().CPlusPlus)
|
||||
Pattern->AddPlaceholderChunk("condition");
|
||||
else
|
||||
Pattern->AddPlaceholderChunk("expression");
|
||||
Pattern->AddChunk(CodeCompletionString::CK_RightParen);
|
||||
Pattern->AddChunk(CodeCompletionString::CK_LeftBrace);
|
||||
Pattern->AddPlaceholderChunk("statements");
|
||||
Pattern->AddChunk(CodeCompletionString::CK_VerticalSpace);
|
||||
Pattern->AddChunk(CodeCompletionString::CK_RightBrace);
|
||||
Results.AddResult(Result(Pattern));
|
||||
|
||||
// do { statements } while ( expression );
|
||||
Pattern = new CodeCompletionString;
|
||||
Pattern->AddTypedTextChunk("do");
|
||||
Pattern->AddChunk(CodeCompletionString::CK_LeftBrace);
|
||||
Pattern->AddPlaceholderChunk("statements");
|
||||
Pattern->AddChunk(CodeCompletionString::CK_VerticalSpace);
|
||||
Pattern->AddChunk(CodeCompletionString::CK_RightBrace);
|
||||
Pattern->AddTextChunk("while");
|
||||
Pattern->AddChunk(CodeCompletionString::CK_LeftParen);
|
||||
Pattern->AddPlaceholderChunk("expression");
|
||||
Pattern->AddChunk(CodeCompletionString::CK_RightParen);
|
||||
Pattern->AddChunk(CodeCompletionString::CK_LeftBrace);
|
||||
Pattern->AddPlaceholderChunk("statements");
|
||||
Pattern->AddChunk(CodeCompletionString::CK_VerticalSpace);
|
||||
Pattern->AddChunk(CodeCompletionString::CK_RightBrace);
|
||||
Results.AddResult(Result(Pattern));
|
||||
Pattern->AddChunk(CodeCompletionString::CK_RightParen);
|
||||
Results.AddResult(Result(Pattern));
|
||||
|
||||
// do { statements } while ( expression );
|
||||
Pattern = new CodeCompletionString;
|
||||
Pattern->AddTypedTextChunk("do");
|
||||
Pattern->AddChunk(CodeCompletionString::CK_LeftBrace);
|
||||
Pattern->AddPlaceholderChunk("statements");
|
||||
Pattern->AddChunk(CodeCompletionString::CK_VerticalSpace);
|
||||
Pattern->AddChunk(CodeCompletionString::CK_RightBrace);
|
||||
Pattern->AddTextChunk("while");
|
||||
Pattern->AddChunk(CodeCompletionString::CK_LeftParen);
|
||||
Pattern->AddPlaceholderChunk("expression");
|
||||
Pattern->AddChunk(CodeCompletionString::CK_RightParen);
|
||||
Results.AddResult(Result(Pattern));
|
||||
|
||||
// for ( for-init-statement ; condition ; expression ) { statements }
|
||||
Pattern = new CodeCompletionString;
|
||||
Pattern->AddTypedTextChunk("for");
|
||||
Pattern->AddChunk(CodeCompletionString::CK_LeftParen);
|
||||
if (SemaRef.getLangOptions().CPlusPlus || SemaRef.getLangOptions().C99)
|
||||
Pattern->AddPlaceholderChunk("init-statement");
|
||||
else
|
||||
Pattern->AddPlaceholderChunk("init-expression");
|
||||
Pattern->AddChunk(CodeCompletionString::CK_SemiColon);
|
||||
Pattern->AddPlaceholderChunk("condition");
|
||||
Pattern->AddChunk(CodeCompletionString::CK_SemiColon);
|
||||
Pattern->AddPlaceholderChunk("inc-expression");
|
||||
Pattern->AddChunk(CodeCompletionString::CK_RightParen);
|
||||
Pattern->AddChunk(CodeCompletionString::CK_LeftBrace);
|
||||
Pattern->AddPlaceholderChunk("statements");
|
||||
Pattern->AddChunk(CodeCompletionString::CK_VerticalSpace);
|
||||
Pattern->AddChunk(CodeCompletionString::CK_RightBrace);
|
||||
Results.AddResult(Result(Pattern));
|
||||
// for ( for-init-statement ; condition ; expression ) { statements }
|
||||
Pattern = new CodeCompletionString;
|
||||
Pattern->AddTypedTextChunk("for");
|
||||
Pattern->AddChunk(CodeCompletionString::CK_LeftParen);
|
||||
if (SemaRef.getLangOptions().CPlusPlus || SemaRef.getLangOptions().C99)
|
||||
Pattern->AddPlaceholderChunk("init-statement");
|
||||
else
|
||||
Pattern->AddPlaceholderChunk("init-expression");
|
||||
Pattern->AddChunk(CodeCompletionString::CK_SemiColon);
|
||||
Pattern->AddPlaceholderChunk("condition");
|
||||
Pattern->AddChunk(CodeCompletionString::CK_SemiColon);
|
||||
Pattern->AddPlaceholderChunk("inc-expression");
|
||||
Pattern->AddChunk(CodeCompletionString::CK_RightParen);
|
||||
Pattern->AddChunk(CodeCompletionString::CK_LeftBrace);
|
||||
Pattern->AddPlaceholderChunk("statements");
|
||||
Pattern->AddChunk(CodeCompletionString::CK_VerticalSpace);
|
||||
Pattern->AddChunk(CodeCompletionString::CK_RightBrace);
|
||||
Results.AddResult(Result(Pattern));
|
||||
}
|
||||
|
||||
if (S->getContinueParent()) {
|
||||
// continue ;
|
||||
|
@ -1145,21 +1163,23 @@ static void AddOrdinaryNameResults(Action::CodeCompletionContext CCC,
|
|||
}
|
||||
Results.AddResult(Result(Pattern));
|
||||
|
||||
// goto identifier ;
|
||||
Pattern = new CodeCompletionString;
|
||||
Pattern->AddTypedTextChunk("goto");
|
||||
Pattern->AddChunk(CodeCompletionString::CK_HorizontalSpace);
|
||||
Pattern->AddPlaceholderChunk("identifier");
|
||||
Results.AddResult(Result(Pattern));
|
||||
if (Results.includeCodePatterns()) {
|
||||
// goto identifier ;
|
||||
Pattern = new CodeCompletionString;
|
||||
Pattern->AddTypedTextChunk("goto");
|
||||
Pattern->AddChunk(CodeCompletionString::CK_HorizontalSpace);
|
||||
Pattern->AddPlaceholderChunk("identifier");
|
||||
Results.AddResult(Result(Pattern));
|
||||
|
||||
// Using directives
|
||||
Pattern = new CodeCompletionString;
|
||||
Pattern->AddTypedTextChunk("using");
|
||||
Pattern->AddChunk(CodeCompletionString::CK_HorizontalSpace);
|
||||
Pattern->AddTextChunk("namespace");
|
||||
Pattern->AddChunk(CodeCompletionString::CK_HorizontalSpace);
|
||||
Pattern->AddPlaceholderChunk("identifier");
|
||||
Results.AddResult(Result(Pattern));
|
||||
// Using directives
|
||||
Pattern = new CodeCompletionString;
|
||||
Pattern->AddTypedTextChunk("using");
|
||||
Pattern->AddChunk(CodeCompletionString::CK_HorizontalSpace);
|
||||
Pattern->AddTextChunk("namespace");
|
||||
Pattern->AddChunk(CodeCompletionString::CK_HorizontalSpace);
|
||||
Pattern->AddPlaceholderChunk("identifier");
|
||||
Results.AddResult(Result(Pattern));
|
||||
}
|
||||
}
|
||||
|
||||
// Fall through (for statement expressions).
|
||||
|
@ -1180,103 +1200,105 @@ static void AddOrdinaryNameResults(Action::CodeCompletionContext CCC,
|
|||
Results.AddResult(Result("true"));
|
||||
Results.AddResult(Result("false"));
|
||||
|
||||
// dynamic_cast < type-id > ( expression )
|
||||
Pattern = new CodeCompletionString;
|
||||
Pattern->AddTypedTextChunk("dynamic_cast");
|
||||
Pattern->AddChunk(CodeCompletionString::CK_LeftAngle);
|
||||
Pattern->AddPlaceholderChunk("type-id");
|
||||
Pattern->AddChunk(CodeCompletionString::CK_RightAngle);
|
||||
Pattern->AddChunk(CodeCompletionString::CK_LeftParen);
|
||||
Pattern->AddPlaceholderChunk("expression");
|
||||
Pattern->AddChunk(CodeCompletionString::CK_RightParen);
|
||||
Results.AddResult(Result(Pattern));
|
||||
|
||||
// static_cast < type-id > ( expression )
|
||||
Pattern = new CodeCompletionString;
|
||||
Pattern->AddTypedTextChunk("static_cast");
|
||||
Pattern->AddChunk(CodeCompletionString::CK_LeftAngle);
|
||||
Pattern->AddPlaceholderChunk("type-id");
|
||||
Pattern->AddChunk(CodeCompletionString::CK_RightAngle);
|
||||
Pattern->AddChunk(CodeCompletionString::CK_LeftParen);
|
||||
Pattern->AddPlaceholderChunk("expression");
|
||||
Pattern->AddChunk(CodeCompletionString::CK_RightParen);
|
||||
Results.AddResult(Result(Pattern));
|
||||
if (Results.includeCodePatterns()) {
|
||||
// dynamic_cast < type-id > ( expression )
|
||||
Pattern = new CodeCompletionString;
|
||||
Pattern->AddTypedTextChunk("dynamic_cast");
|
||||
Pattern->AddChunk(CodeCompletionString::CK_LeftAngle);
|
||||
Pattern->AddPlaceholderChunk("type-id");
|
||||
Pattern->AddChunk(CodeCompletionString::CK_RightAngle);
|
||||
Pattern->AddChunk(CodeCompletionString::CK_LeftParen);
|
||||
Pattern->AddPlaceholderChunk("expression");
|
||||
Pattern->AddChunk(CodeCompletionString::CK_RightParen);
|
||||
Results.AddResult(Result(Pattern));
|
||||
|
||||
// static_cast < type-id > ( expression )
|
||||
Pattern = new CodeCompletionString;
|
||||
Pattern->AddTypedTextChunk("static_cast");
|
||||
Pattern->AddChunk(CodeCompletionString::CK_LeftAngle);
|
||||
Pattern->AddPlaceholderChunk("type-id");
|
||||
Pattern->AddChunk(CodeCompletionString::CK_RightAngle);
|
||||
Pattern->AddChunk(CodeCompletionString::CK_LeftParen);
|
||||
Pattern->AddPlaceholderChunk("expression");
|
||||
Pattern->AddChunk(CodeCompletionString::CK_RightParen);
|
||||
Results.AddResult(Result(Pattern));
|
||||
|
||||
// reinterpret_cast < type-id > ( expression )
|
||||
Pattern = new CodeCompletionString;
|
||||
Pattern->AddTypedTextChunk("reinterpret_cast");
|
||||
Pattern->AddChunk(CodeCompletionString::CK_LeftAngle);
|
||||
Pattern->AddPlaceholderChunk("type-id");
|
||||
Pattern->AddChunk(CodeCompletionString::CK_RightAngle);
|
||||
Pattern->AddChunk(CodeCompletionString::CK_LeftParen);
|
||||
Pattern->AddPlaceholderChunk("expression");
|
||||
Pattern->AddChunk(CodeCompletionString::CK_RightParen);
|
||||
Results.AddResult(Result(Pattern));
|
||||
// reinterpret_cast < type-id > ( expression )
|
||||
Pattern = new CodeCompletionString;
|
||||
Pattern->AddTypedTextChunk("reinterpret_cast");
|
||||
Pattern->AddChunk(CodeCompletionString::CK_LeftAngle);
|
||||
Pattern->AddPlaceholderChunk("type-id");
|
||||
Pattern->AddChunk(CodeCompletionString::CK_RightAngle);
|
||||
Pattern->AddChunk(CodeCompletionString::CK_LeftParen);
|
||||
Pattern->AddPlaceholderChunk("expression");
|
||||
Pattern->AddChunk(CodeCompletionString::CK_RightParen);
|
||||
Results.AddResult(Result(Pattern));
|
||||
|
||||
// const_cast < type-id > ( expression )
|
||||
Pattern = new CodeCompletionString;
|
||||
Pattern->AddTypedTextChunk("const_cast");
|
||||
Pattern->AddChunk(CodeCompletionString::CK_LeftAngle);
|
||||
Pattern->AddPlaceholderChunk("type-id");
|
||||
Pattern->AddChunk(CodeCompletionString::CK_RightAngle);
|
||||
Pattern->AddChunk(CodeCompletionString::CK_LeftParen);
|
||||
Pattern->AddPlaceholderChunk("expression");
|
||||
Pattern->AddChunk(CodeCompletionString::CK_RightParen);
|
||||
Results.AddResult(Result(Pattern));
|
||||
// const_cast < type-id > ( expression )
|
||||
Pattern = new CodeCompletionString;
|
||||
Pattern->AddTypedTextChunk("const_cast");
|
||||
Pattern->AddChunk(CodeCompletionString::CK_LeftAngle);
|
||||
Pattern->AddPlaceholderChunk("type-id");
|
||||
Pattern->AddChunk(CodeCompletionString::CK_RightAngle);
|
||||
Pattern->AddChunk(CodeCompletionString::CK_LeftParen);
|
||||
Pattern->AddPlaceholderChunk("expression");
|
||||
Pattern->AddChunk(CodeCompletionString::CK_RightParen);
|
||||
Results.AddResult(Result(Pattern));
|
||||
|
||||
// typeid ( expression-or-type )
|
||||
Pattern = new CodeCompletionString;
|
||||
Pattern->AddTypedTextChunk("typeid");
|
||||
Pattern->AddChunk(CodeCompletionString::CK_LeftParen);
|
||||
Pattern->AddPlaceholderChunk("expression-or-type");
|
||||
Pattern->AddChunk(CodeCompletionString::CK_RightParen);
|
||||
Results.AddResult(Result(Pattern));
|
||||
// typeid ( expression-or-type )
|
||||
Pattern = new CodeCompletionString;
|
||||
Pattern->AddTypedTextChunk("typeid");
|
||||
Pattern->AddChunk(CodeCompletionString::CK_LeftParen);
|
||||
Pattern->AddPlaceholderChunk("expression-or-type");
|
||||
Pattern->AddChunk(CodeCompletionString::CK_RightParen);
|
||||
Results.AddResult(Result(Pattern));
|
||||
|
||||
// new T ( ... )
|
||||
Pattern = new CodeCompletionString;
|
||||
Pattern->AddTypedTextChunk("new");
|
||||
Pattern->AddChunk(CodeCompletionString::CK_HorizontalSpace);
|
||||
Pattern->AddPlaceholderChunk("type-id");
|
||||
Pattern->AddChunk(CodeCompletionString::CK_LeftParen);
|
||||
Pattern->AddPlaceholderChunk("expressions");
|
||||
Pattern->AddChunk(CodeCompletionString::CK_RightParen);
|
||||
Results.AddResult(Result(Pattern));
|
||||
// new T ( ... )
|
||||
Pattern = new CodeCompletionString;
|
||||
Pattern->AddTypedTextChunk("new");
|
||||
Pattern->AddChunk(CodeCompletionString::CK_HorizontalSpace);
|
||||
Pattern->AddPlaceholderChunk("type-id");
|
||||
Pattern->AddChunk(CodeCompletionString::CK_LeftParen);
|
||||
Pattern->AddPlaceholderChunk("expressions");
|
||||
Pattern->AddChunk(CodeCompletionString::CK_RightParen);
|
||||
Results.AddResult(Result(Pattern));
|
||||
|
||||
// new T [ ] ( ... )
|
||||
Pattern = new CodeCompletionString;
|
||||
Pattern->AddTypedTextChunk("new");
|
||||
Pattern->AddChunk(CodeCompletionString::CK_HorizontalSpace);
|
||||
Pattern->AddPlaceholderChunk("type-id");
|
||||
Pattern->AddChunk(CodeCompletionString::CK_LeftBracket);
|
||||
Pattern->AddPlaceholderChunk("size");
|
||||
Pattern->AddChunk(CodeCompletionString::CK_RightBracket);
|
||||
Pattern->AddChunk(CodeCompletionString::CK_LeftParen);
|
||||
Pattern->AddPlaceholderChunk("expressions");
|
||||
Pattern->AddChunk(CodeCompletionString::CK_RightParen);
|
||||
Results.AddResult(Result(Pattern));
|
||||
// new T [ ] ( ... )
|
||||
Pattern = new CodeCompletionString;
|
||||
Pattern->AddTypedTextChunk("new");
|
||||
Pattern->AddChunk(CodeCompletionString::CK_HorizontalSpace);
|
||||
Pattern->AddPlaceholderChunk("type-id");
|
||||
Pattern->AddChunk(CodeCompletionString::CK_LeftBracket);
|
||||
Pattern->AddPlaceholderChunk("size");
|
||||
Pattern->AddChunk(CodeCompletionString::CK_RightBracket);
|
||||
Pattern->AddChunk(CodeCompletionString::CK_LeftParen);
|
||||
Pattern->AddPlaceholderChunk("expressions");
|
||||
Pattern->AddChunk(CodeCompletionString::CK_RightParen);
|
||||
Results.AddResult(Result(Pattern));
|
||||
|
||||
// delete expression
|
||||
Pattern = new CodeCompletionString;
|
||||
Pattern->AddTypedTextChunk("delete");
|
||||
Pattern->AddChunk(CodeCompletionString::CK_HorizontalSpace);
|
||||
Pattern->AddPlaceholderChunk("expression");
|
||||
Results.AddResult(Result(Pattern));
|
||||
// delete expression
|
||||
Pattern = new CodeCompletionString;
|
||||
Pattern->AddTypedTextChunk("delete");
|
||||
Pattern->AddChunk(CodeCompletionString::CK_HorizontalSpace);
|
||||
Pattern->AddPlaceholderChunk("expression");
|
||||
Results.AddResult(Result(Pattern));
|
||||
|
||||
// delete [] expression
|
||||
Pattern = new CodeCompletionString;
|
||||
Pattern->AddTypedTextChunk("delete");
|
||||
Pattern->AddChunk(CodeCompletionString::CK_LeftBracket);
|
||||
Pattern->AddChunk(CodeCompletionString::CK_RightBracket);
|
||||
Pattern->AddChunk(CodeCompletionString::CK_HorizontalSpace);
|
||||
Pattern->AddPlaceholderChunk("expression");
|
||||
Results.AddResult(Result(Pattern));
|
||||
// delete [] expression
|
||||
Pattern = new CodeCompletionString;
|
||||
Pattern->AddTypedTextChunk("delete");
|
||||
Pattern->AddChunk(CodeCompletionString::CK_LeftBracket);
|
||||
Pattern->AddChunk(CodeCompletionString::CK_RightBracket);
|
||||
Pattern->AddChunk(CodeCompletionString::CK_HorizontalSpace);
|
||||
Pattern->AddPlaceholderChunk("expression");
|
||||
Results.AddResult(Result(Pattern));
|
||||
|
||||
// throw expression
|
||||
Pattern = new CodeCompletionString;
|
||||
Pattern->AddTypedTextChunk("throw");
|
||||
Pattern->AddChunk(CodeCompletionString::CK_HorizontalSpace);
|
||||
Pattern->AddPlaceholderChunk("expression");
|
||||
Results.AddResult(Result(Pattern));
|
||||
// throw expression
|
||||
Pattern = new CodeCompletionString;
|
||||
Pattern->AddTypedTextChunk("throw");
|
||||
Pattern->AddChunk(CodeCompletionString::CK_HorizontalSpace);
|
||||
Pattern->AddPlaceholderChunk("expression");
|
||||
Results.AddResult(Result(Pattern));
|
||||
}
|
||||
}
|
||||
|
||||
if (SemaRef.getLangOptions().ObjC1) {
|
||||
|
@ -1288,13 +1310,15 @@ static void AddOrdinaryNameResults(Action::CodeCompletionContext CCC,
|
|||
AddObjCExpressionResults(Results, true);
|
||||
}
|
||||
|
||||
// sizeof expression
|
||||
Pattern = new CodeCompletionString;
|
||||
Pattern->AddTypedTextChunk("sizeof");
|
||||
Pattern->AddChunk(CodeCompletionString::CK_LeftParen);
|
||||
Pattern->AddPlaceholderChunk("expression-or-type");
|
||||
Pattern->AddChunk(CodeCompletionString::CK_RightParen);
|
||||
Results.AddResult(Result(Pattern));
|
||||
if (Results.includeCodePatterns()) {
|
||||
// sizeof expression
|
||||
Pattern = new CodeCompletionString;
|
||||
Pattern->AddTypedTextChunk("sizeof");
|
||||
Pattern->AddChunk(CodeCompletionString::CK_LeftParen);
|
||||
Pattern->AddPlaceholderChunk("expression-or-type");
|
||||
Pattern->AddChunk(CodeCompletionString::CK_RightParen);
|
||||
Results.AddResult(Result(Pattern));
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1545,7 +1569,7 @@ CodeCompleteConsumer::Result::CreateCodeCompletionString(Sema &S) {
|
|||
return Result;
|
||||
}
|
||||
|
||||
assert(Kind == RK_Declaration && "Missed a macro kind?");
|
||||
assert(Kind == RK_Declaration && "Missed a result kind?");
|
||||
NamedDecl *ND = Declaration;
|
||||
|
||||
if (StartsNestedNameSpecifier) {
|
||||
|
@ -2419,6 +2443,9 @@ void Sema::CodeCompleteOperatorName(Scope *S) {
|
|||
static void AddObjCImplementationResults(const LangOptions &LangOpts,
|
||||
ResultBuilder &Results,
|
||||
bool NeedAt) {
|
||||
if (!Results.includeCodePatterns())
|
||||
return;
|
||||
|
||||
typedef CodeCompleteConsumer::Result Result;
|
||||
// Since we have an implementation, we can end it.
|
||||
Results.AddResult(Result(OBJC_AT_KEYWORD_NAME(NeedAt,end)));
|
||||
|
@ -2444,6 +2471,9 @@ static void AddObjCImplementationResults(const LangOptions &LangOpts,
|
|||
static void AddObjCInterfaceResults(const LangOptions &LangOpts,
|
||||
ResultBuilder &Results,
|
||||
bool NeedAt) {
|
||||
if (!Results.includeCodePatterns())
|
||||
return;
|
||||
|
||||
typedef CodeCompleteConsumer::Result Result;
|
||||
|
||||
// Since we have an interface or protocol, we can end it.
|
||||
|
@ -2462,6 +2492,9 @@ static void AddObjCInterfaceResults(const LangOptions &LangOpts,
|
|||
}
|
||||
|
||||
static void AddObjCTopLevelResults(ResultBuilder &Results, bool NeedAt) {
|
||||
if (!Results.includeCodePatterns())
|
||||
return;
|
||||
|
||||
typedef CodeCompleteConsumer::Result Result;
|
||||
CodeCompletionString *Pattern = 0;
|
||||
|
||||
|
@ -2521,6 +2554,9 @@ void Sema::CodeCompleteObjCAtDirective(Scope *S, DeclPtrTy ObjCImpDecl,
|
|||
}
|
||||
|
||||
static void AddObjCExpressionResults(ResultBuilder &Results, bool NeedAt) {
|
||||
if (!Results.includeCodePatterns())
|
||||
return;
|
||||
|
||||
typedef CodeCompleteConsumer::Result Result;
|
||||
CodeCompletionString *Pattern = 0;
|
||||
|
||||
|
@ -2550,6 +2586,9 @@ static void AddObjCExpressionResults(ResultBuilder &Results, bool NeedAt) {
|
|||
}
|
||||
|
||||
static void AddObjCStatementResults(ResultBuilder &Results, bool NeedAt) {
|
||||
if (!Results.includeCodePatterns())
|
||||
return;
|
||||
|
||||
typedef CodeCompleteConsumer::Result Result;
|
||||
CodeCompletionString *Pattern = 0;
|
||||
|
||||
|
@ -2596,6 +2635,9 @@ static void AddObjCStatementResults(ResultBuilder &Results, bool NeedAt) {
|
|||
static void AddObjCVisibilityResults(const LangOptions &LangOpts,
|
||||
ResultBuilder &Results,
|
||||
bool NeedAt) {
|
||||
if (!Results.includeCodePatterns())
|
||||
return;
|
||||
|
||||
typedef CodeCompleteConsumer::Result Result;
|
||||
Results.AddResult(Result(OBJC_AT_KEYWORD_NAME(NeedAt,private)));
|
||||
Results.AddResult(Result(OBJC_AT_KEYWORD_NAME(NeedAt,protected)));
|
||||
|
|
|
@ -6,7 +6,7 @@ void test() {
|
|||
f0(0, 0);
|
||||
g0(0, 0);
|
||||
f1(0, 0);
|
||||
// RUN: %clang_cc1 -std=c89 -fsyntax-only -code-completion-at=%s:6:6 %s -o - | FileCheck -check-prefix=CC1 %s
|
||||
// RUN: %clang_cc1 -std=c89 -fsyntax-only -code-completion-at=%s:6:6 %s -o - | FileCheck -check-prefix=CC1 %s
|
||||
// CHECK-CC1: f0(<#float x#>, float y)
|
||||
// RUN: %clang_cc1 -std=c89 -fsyntax-only -code-completion-at=%s:6:9 %s -o - | FileCheck -check-prefix=CC2 %s
|
||||
// CHECK-CC2: f0(float x, <#float y#>)
|
||||
|
|
|
@ -17,7 +17,7 @@ void f();
|
|||
|
||||
void test() {
|
||||
f(Y(), 0, 0);
|
||||
// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:19:9 %s -o - | FileCheck -check-prefix=CC1 %s
|
||||
// RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:19:9 %s -o - | FileCheck -check-prefix=CC1 %s
|
||||
// CHECK-CC1: COMPLETION: Pattern : dynamic_cast<<#type-id#>>(<#expression#>)
|
||||
// CHECK-CC1: f(N::Y y, <#int ZZ#>)
|
||||
// CHECK-CC1-NEXT: f(int i, <#int j#>, int k)
|
||||
|
|
|
@ -4,7 +4,7 @@ typedef struct t TYPEDEF;
|
|||
|
||||
void foo() {
|
||||
int y = 17;
|
||||
// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:6:14 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s
|
||||
// RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:6:14 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s
|
||||
// CHECK-CC1: COMPLETION: bool
|
||||
// CHECK-CC1-NEXT: COMPLETION: char
|
||||
// CHECK-CC1-NEXT: COMPLETION: class
|
||||
|
@ -57,7 +57,7 @@ void foo() {
|
|||
// CHECK-CC1-NEXT: COMPLETION: y : [#int#]y
|
||||
// CHECK-CC1-NEXT: COMPLETION: z : [#void#]z(<#int#>)
|
||||
|
||||
// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:4:1 %s -o - | FileCheck -check-prefix=CHECK-CC2 %s
|
||||
// RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:4:1 %s -o - | FileCheck -check-prefix=CHECK-CC2 %s
|
||||
// CHECK-CC2: COMPLETION: Pattern : asm(<#string-literal#>)
|
||||
// CHECK-CC2-NEXT: COMPLETION: bool
|
||||
// CHECK-CC2-NEXT: COMPLETION: char
|
||||
|
@ -93,7 +93,7 @@ void foo() {
|
|||
// CHECK-CC2-NEXT: COMPLETION: wchar_t
|
||||
// CHECK-CC2-NEXT: COMPLETION: X : X
|
||||
|
||||
// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:1:19 %s -o - | FileCheck -check-prefix=CHECK-CC3 %s
|
||||
// RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:1:19 %s -o - | FileCheck -check-prefix=CHECK-CC3 %s
|
||||
// CHECK-CC3: COMPLETION: bool
|
||||
// CHECK-CC3-NEXT: COMPLETION: char
|
||||
// CHECK-CC3-NEXT: COMPLETION: class
|
||||
|
@ -129,7 +129,7 @@ void foo() {
|
|||
// CHECK-CC3-NEXT: COMPLETION: wchar_t
|
||||
// CHECK-CC3-NEXT: COMPLETION: X : X
|
||||
|
||||
// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:6:11 %s -o - | FileCheck -check-prefix=CHECK-CC4 %s
|
||||
// RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:6:11 %s -o - | FileCheck -check-prefix=CHECK-CC4 %s
|
||||
// CHECK-CC4: COMPLETION: bool
|
||||
// CHECK-CC4-NEXT: COMPLETION: char
|
||||
// CHECK-CC4-NEXT: COMPLETION: class
|
||||
|
|
|
@ -5,25 +5,25 @@
|
|||
@implementation MyClass
|
||||
@end
|
||||
|
||||
// RUN: c-index-test -code-completion-at=%s:2:2 %s | FileCheck -check-prefix=CHECK-CC1 %s
|
||||
// RUN: c-index-test -code-completion-at=%s:2:2 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC1 %s
|
||||
// CHECK-CC1: {TypedText class}{HorizontalSpace }{Placeholder identifier}
|
||||
// CHECK-CC1: {TypedText compatibility_alias}{HorizontalSpace }{Placeholder alias}{HorizontalSpace }{Placeholder class}
|
||||
// CHECK-CC1: {TypedText implementation}{HorizontalSpace }{Placeholder class}
|
||||
// CHECK-CC1: {TypedText interface}{HorizontalSpace }{Placeholder class}
|
||||
// CHECK-CC1: {TypedText protocol}{HorizontalSpace }{Placeholder protocol}
|
||||
|
||||
// RUN: c-index-test -code-completion-at=%s:3:2 %s | FileCheck -check-prefix=CHECK-CC2 %s
|
||||
// RUN: c-index-test -code-completion-at=%s:3:2 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC2 %s
|
||||
// CHECK-CC2: {TypedText end}
|
||||
// CHECK-CC2: {TypedText optional}
|
||||
// CHECK-CC2: {TypedText property}
|
||||
// CHECK-CC2: {TypedText required}
|
||||
|
||||
// RUN: c-index-test -code-completion-at=%s:6:2 %s | FileCheck -check-prefix=CHECK-CC3 %s
|
||||
// RUN: c-index-test -code-completion-at=%s:6:2 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC3 %s
|
||||
// CHECK-CC3: {TypedText dynamic}{HorizontalSpace }{Placeholder property}
|
||||
// CHECK-CC3: {TypedText end}
|
||||
// CHECK-CC3: {TypedText synthesize}{HorizontalSpace }{Placeholder property}
|
||||
|
||||
// RUN: c-index-test -code-completion-at=%s:2:1 %s | FileCheck -check-prefix=CHECK-CC4 %s
|
||||
// RUN: c-index-test -code-completion-at=%s:2:1 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC4 %s
|
||||
// CHECK-CC4: NotImplemented:{TypedText @class}{HorizontalSpace }{Placeholder identifier}
|
||||
// CHECK-CC4: NotImplemented:{TypedText @compatibility_alias}{HorizontalSpace }{Placeholder alias}{HorizontalSpace }{Placeholder class}
|
||||
// CHECK-CC4: NotImplemented:{TypedText @implementation}{HorizontalSpace }{Placeholder class}
|
||||
|
@ -34,7 +34,7 @@
|
|||
// CHECK-CC4: TypedefDecl:{TypedText id}
|
||||
// CHECK-CC4: TypedefDecl:{TypedText SEL}
|
||||
|
||||
// RUN: c-index-test -code-completion-at=%s:3:1 %s | FileCheck -check-prefix=CHECK-CC5 %s
|
||||
// RUN: c-index-test -code-completion-at=%s:3:1 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC5 %s
|
||||
// CHECK-CC5: {TypedText @end}
|
||||
// CHECK-CC5: {TypedText @optional}
|
||||
// CHECK-CC5: {TypedText @property}
|
||||
|
@ -45,13 +45,13 @@
|
|||
// CHECK-CC5: ObjCInterfaceDecl:{TypedText MyClass}
|
||||
// CHECK-CC5: TypedefDecl:{TypedText SEL}
|
||||
|
||||
// RUN: c-index-test -code-completion-at=%s:2:23 %s | FileCheck -check-prefix=CHECK-CC6 %s
|
||||
// RUN: c-index-test -code-completion-at=%s:2:23 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC6 %s
|
||||
// CHECK-CC6: NotImplemented:{TypedText package}
|
||||
// CHECK-CC6: NotImplemented:{TypedText private}
|
||||
// CHECK-CC6: NotImplemented:{TypedText protected}
|
||||
// CHECK-CC6: NotImplemented:{TypedText public}
|
||||
|
||||
// RUN: c-index-test -code-completion-at=%s:2:22 %s | FileCheck -check-prefix=CHECK-CC7 %s
|
||||
// RUN: c-index-test -code-completion-at=%s:2:22 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC7 %s
|
||||
// CHECK-CC7: NotImplemented:{TypedText @package}
|
||||
// CHECK-CC7: NotImplemented:{TypedText @private}
|
||||
// CHECK-CC7: NotImplemented:{TypedText @protected}
|
||||
|
|
|
@ -9,18 +9,18 @@
|
|||
@synchronized (@encode(MyClass)) { }
|
||||
}
|
||||
@end
|
||||
// RUN: c-index-test -code-completion-at=%s:9:4 %s | FileCheck -check-prefix=CHECK-CC1 %s
|
||||
// RUN: c-index-test -code-completion-at=%s:9:4 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC1 %s
|
||||
// CHECK-CC1: {TypedText encode}{LeftParen (}{Placeholder type-name}{RightParen )}
|
||||
// CHECK-CC1: {TypedText protocol}{LeftParen (}{Placeholder protocol-name}{RightParen )}
|
||||
// CHECK-CC1: {TypedText selector}{LeftParen (}{Placeholder selector}{RightParen )}
|
||||
// CHECK-CC1: {TypedText synchronized}{HorizontalSpace }{LeftParen (}{Placeholder expression}{RightParen )}{LeftBrace {}{Placeholder statements}{RightBrace }}
|
||||
// CHECK-CC1: {TypedText throw}{HorizontalSpace }{Placeholder expression}
|
||||
// CHECK-CC1: {TypedText try}{LeftBrace {}{Placeholder statements}{RightBrace }}{Text @catch}{LeftParen (}{Placeholder parameter}{RightParen )}{LeftBrace {}{Placeholder statements}{RightBrace }}{Text @finally}{LeftBrace {}{Placeholder statements}{RightBrace }}
|
||||
// RUN: c-index-test -code-completion-at=%s:9:19 %s | FileCheck -check-prefix=CHECK-CC2 %s
|
||||
// RUN: c-index-test -code-completion-at=%s:9:19 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC2 %s
|
||||
// CHECK-CC2: {TypedText encode}{LeftParen (}{Placeholder type-name}{RightParen )}
|
||||
// CHECK-CC2: {TypedText protocol}{LeftParen (}{Placeholder protocol-name}{RightParen )}
|
||||
// CHECK-CC2: {TypedText selector}{LeftParen (}{Placeholder selector}{RightParen )}
|
||||
// RUN: c-index-test -code-completion-at=%s:9:3 %s | FileCheck -check-prefix=CHECK-CC3 %s
|
||||
// RUN: c-index-test -code-completion-at=%s:9:3 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC3 %s
|
||||
// CHECK-CC3: NotImplemented:{TypedText @encode}{LeftParen (}{Placeholder type-name}{RightParen )}
|
||||
// CHECK-CC3: NotImplemented:{TypedText @protocol}{LeftParen (}{Placeholder protocol-name}{RightParen )}
|
||||
// CHECK-CC3: NotImplemented:{TypedText @selector}{LeftParen (}{Placeholder selector}{RightParen )}
|
||||
|
|
|
@ -7,9 +7,9 @@ int test(int i, int j, int k, int l) {
|
|||
return i | j | k & l;
|
||||
}
|
||||
|
||||
// RUN: c-index-test -code-completion-at=%s:7:9 %s | FileCheck -check-prefix=CHECK-CC1 %s
|
||||
// RUN: c-index-test -code-completion-at=%s:7:9 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC1 %s
|
||||
// CHECK-CC1: FunctionDecl:{ResultType int}{TypedText f}{LeftParen (}{Placeholder int}{RightParen )}
|
||||
// CHECK-CC1: NotImplemented:{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )}
|
||||
// RUN: c-index-test -code-completion-at=%s:7:14 %s | FileCheck -check-prefix=CHECK-CC1 %s
|
||||
// RUN: c-index-test -code-completion-at=%s:7:18 %s | FileCheck -check-prefix=CHECK-CC1 %s
|
||||
// RUN: c-index-test -code-completion-at=%s:7:22 %s | FileCheck -check-prefix=CHECK-CC1 %s
|
||||
// RUN: c-index-test -code-completion-at=%s:7:14 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC1 %s
|
||||
// RUN: c-index-test -code-completion-at=%s:7:18 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC1 %s
|
||||
// RUN: c-index-test -code-completion-at=%s:7:22 -Xclang -code-completion-patterns %s | FileCheck -check-prefix=CHECK-CC1 %s
|
||||
|
|
|
@ -11,11 +11,11 @@
|
|||
}
|
||||
@end
|
||||
|
||||
// RUN: c-index-test -code-completion-at=%s:9:20 %s 2>%t | FileCheck -check-prefix=CHECK-CC1 %s
|
||||
// RUN: c-index-test -code-completion-at=%s:9:20 -Xclang -code-completion-patterns %s 2>%t | FileCheck -check-prefix=CHECK-CC1 %s
|
||||
// RUN: not grep error %t
|
||||
// CHECK-CC1: NotImplemented:{TypedText @encode}{LeftParen (}{Placeholder type-name}{RightParen )}
|
||||
// CHECK-CC1: NotImplemented:{TypedText _Bool}
|
||||
// CHECK-CC1: VarDecl:{ResultType A *}{TypedText a}
|
||||
// CHECK-CC1: NotImplemented:{TypedText sizeof}{LeftParen (}{Placeholder expression-or-type}{RightParen )}
|
||||
|
||||
// RUN: c-index-test -code-completion-at=%s:10:24 %s 2>%t | FileCheck -check-prefix=CHECK-CC1 %s
|
||||
// RUN: c-index-test -code-completion-at=%s:10:24 -Xclang -code-completion-patterns %s 2>%t | FileCheck -check-prefix=CHECK-CC1 %s
|
||||
|
|
Загрузка…
Ссылка в новой задаче