[cfe-commits] r104637 - in /cfe/trunk: include/clang/Driver/CC1Options.td include/clang/Frontend/CompilerInstance.h include/clang/Frontend/FrontendOptions.h include/clang/Sema/CodeCompleteConsumer.h lib/Frontend/CompilerInstance.cpp lib/Frontend/CompilerInvocation.cpp lib/Sema/SemaCodeComplete.cpp test/CodeCompletion/call.c test/CodeCompletion/call.cpp test/CodeCompletion/ordinary-name.cpp test/Index/complete-at-directives.m test/Index/complete-at-exprstmt.m test/Index/complete-exprs.c test/Index/complete-recovery.m

Douglas Gregor dgregor at apple.com
Tue May 25 14:41:55 PDT 2010


Author: dgregor
Date: Tue May 25 16:41:55 2010
New Revision: 104637

URL: http://llvm.org/viewvc/llvm-project?rev=104637&view=rev
Log:
Only enable code patterns (e.g., try { statements } catch (...) {
statements }) in the code-completion results if explicitly requested.

Modified:
    cfe/trunk/include/clang/Driver/CC1Options.td
    cfe/trunk/include/clang/Frontend/CompilerInstance.h
    cfe/trunk/include/clang/Frontend/FrontendOptions.h
    cfe/trunk/include/clang/Sema/CodeCompleteConsumer.h
    cfe/trunk/lib/Frontend/CompilerInstance.cpp
    cfe/trunk/lib/Frontend/CompilerInvocation.cpp
    cfe/trunk/lib/Sema/SemaCodeComplete.cpp
    cfe/trunk/test/CodeCompletion/call.c
    cfe/trunk/test/CodeCompletion/call.cpp
    cfe/trunk/test/CodeCompletion/ordinary-name.cpp
    cfe/trunk/test/Index/complete-at-directives.m
    cfe/trunk/test/Index/complete-at-exprstmt.m
    cfe/trunk/test/Index/complete-exprs.c
    cfe/trunk/test/Index/complete-recovery.m

Modified: cfe/trunk/include/clang/Driver/CC1Options.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/CC1Options.td?rev=104637&r1=104636&r2=104637&view=diff
==============================================================================
--- cfe/trunk/include/clang/Driver/CC1Options.td (original)
+++ cfe/trunk/include/clang/Driver/CC1Options.td Tue May 25 16:41:55 2010
@@ -243,6 +243,8 @@
   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">,

Modified: cfe/trunk/include/clang/Frontend/CompilerInstance.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/CompilerInstance.h?rev=104637&r1=104636&r2=104637&view=diff
==============================================================================
--- cfe/trunk/include/clang/Frontend/CompilerInstance.h (original)
+++ cfe/trunk/include/clang/Frontend/CompilerInstance.h Tue May 25 16:41:55 2010
@@ -519,7 +519,7 @@
   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();

Modified: cfe/trunk/include/clang/Frontend/FrontendOptions.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/FrontendOptions.h?rev=104637&r1=104636&r2=104637&view=diff
==============================================================================
--- cfe/trunk/include/clang/Frontend/FrontendOptions.h (original)
+++ cfe/trunk/include/clang/Frontend/FrontendOptions.h Tue May 25 16:41:55 2010
@@ -79,6 +79,8 @@
   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 @@
     RelocatablePCH = 0;
     ShowHelp = 0;
     ShowMacrosInCodeCompletion = 0;
+    ShowCodePatternsInCodeCompletion = 0;
     ShowStats = 0;
     ShowTimers = 0;
     ShowVersion = 0;

Modified: cfe/trunk/include/clang/Sema/CodeCompleteConsumer.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/CodeCompleteConsumer.h?rev=104637&r1=104636&r2=104637&view=diff
==============================================================================
--- cfe/trunk/include/clang/Sema/CodeCompleteConsumer.h (original)
+++ cfe/trunk/include/clang/Sema/CodeCompleteConsumer.h Tue May 25 16:41:55 2010
@@ -246,6 +246,10 @@
   /// \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 @@
   
   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 @@
 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 @@
   /// \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, 

Modified: cfe/trunk/lib/Frontend/CompilerInstance.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInstance.cpp?rev=104637&r1=104636&r2=104637&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/CompilerInstance.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInstance.cpp Tue May 25 16:41:55 2010
@@ -295,6 +295,7 @@
                                  Loc.FileName, Loc.Line, Loc.Column,
                                  getFrontendOpts().DebugCodeCompletionPrinter,
                                  getFrontendOpts().ShowMacrosInCodeCompletion,
+                             getFrontendOpts().ShowCodePatternsInCodeCompletion,
                                  llvm::outs()));
   if (!CompletionConsumer)
     return;
@@ -317,6 +318,7 @@
                                                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 @@
 
   // 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

Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=104637&r1=104636&r2=104637&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Tue May 25 16:41:55 2010
@@ -350,6 +350,8 @@
     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 @@
   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);

Modified: cfe/trunk/lib/Sema/SemaCodeComplete.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaCodeComplete.cpp?rev=104637&r1=104636&r2=104637&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaCodeComplete.cpp (original)
+++ cfe/trunk/lib/Sema/SemaCodeComplete.cpp Tue May 25 16:41:55 2010
@@ -127,6 +127,13 @@
     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 @@
     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 @@
     //    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 @@
   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 @@
     // 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 @@
 
   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 @@
       
   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 @@
     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 @@
       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
-      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));
+    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);
-    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 @@
     }
     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 @@
       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 @@
       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 @@
     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 @@
 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 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 AddObjCTopLevelResults(ResultBuilder &Results, bool NeedAt) {
+  if (!Results.includeCodePatterns())
+    return;
+  
   typedef CodeCompleteConsumer::Result Result;
   CodeCompletionString *Pattern = 0;
   
@@ -2521,6 +2554,9 @@
 }
 
 static void AddObjCExpressionResults(ResultBuilder &Results, bool NeedAt) {
+  if (!Results.includeCodePatterns())
+    return;
+  
   typedef CodeCompleteConsumer::Result Result;
   CodeCompletionString *Pattern = 0;
 
@@ -2550,6 +2586,9 @@
 }
 
 static void AddObjCStatementResults(ResultBuilder &Results, bool NeedAt) {
+  if (!Results.includeCodePatterns())
+    return;
+  
   typedef CodeCompleteConsumer::Result Result;
   CodeCompletionString *Pattern = 0;
   
@@ -2596,6 +2635,9 @@
 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)));

Modified: cfe/trunk/test/CodeCompletion/call.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeCompletion/call.c?rev=104637&r1=104636&r2=104637&view=diff
==============================================================================
--- cfe/trunk/test/CodeCompletion/call.c (original)
+++ cfe/trunk/test/CodeCompletion/call.c Tue May 25 16:41:55 2010
@@ -6,7 +6,7 @@
   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#>)

Modified: cfe/trunk/test/CodeCompletion/call.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeCompletion/call.cpp?rev=104637&r1=104636&r2=104637&view=diff
==============================================================================
--- cfe/trunk/test/CodeCompletion/call.cpp (original)
+++ cfe/trunk/test/CodeCompletion/call.cpp Tue May 25 16:41:55 2010
@@ -17,7 +17,7 @@
 
 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)

Modified: cfe/trunk/test/CodeCompletion/ordinary-name.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeCompletion/ordinary-name.cpp?rev=104637&r1=104636&r2=104637&view=diff
==============================================================================
--- cfe/trunk/test/CodeCompletion/ordinary-name.cpp (original)
+++ cfe/trunk/test/CodeCompletion/ordinary-name.cpp Tue May 25 16:41:55 2010
@@ -4,7 +4,7 @@
 
 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 @@
   // 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 @@
   // 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 @@
   // 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

Modified: cfe/trunk/test/Index/complete-at-directives.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/complete-at-directives.m?rev=104637&r1=104636&r2=104637&view=diff
==============================================================================
--- cfe/trunk/test/Index/complete-at-directives.m (original)
+++ cfe/trunk/test/Index/complete-at-directives.m Tue May 25 16:41:55 2010
@@ -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}

Modified: cfe/trunk/test/Index/complete-at-exprstmt.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/complete-at-exprstmt.m?rev=104637&r1=104636&r2=104637&view=diff
==============================================================================
--- cfe/trunk/test/Index/complete-at-exprstmt.m (original)
+++ cfe/trunk/test/Index/complete-at-exprstmt.m Tue May 25 16:41:55 2010
@@ -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 )}

Modified: cfe/trunk/test/Index/complete-exprs.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/complete-exprs.c?rev=104637&r1=104636&r2=104637&view=diff
==============================================================================
--- cfe/trunk/test/Index/complete-exprs.c (original)
+++ cfe/trunk/test/Index/complete-exprs.c Tue May 25 16:41:55 2010
@@ -7,9 +7,9 @@
   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

Modified: cfe/trunk/test/Index/complete-recovery.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/complete-recovery.m?rev=104637&r1=104636&r2=104637&view=diff
==============================================================================
--- cfe/trunk/test/Index/complete-recovery.m (original)
+++ cfe/trunk/test/Index/complete-recovery.m Tue May 25 16:41:55 2010
@@ -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





More information about the cfe-commits mailing list