[cfe-commits] r100555 - in /cfe/trunk: lib/Sema/SemaCodeComplete.cpp test/CodeCompletion/macros.c

Douglas Gregor dgregor at apple.com
Tue Apr 6 13:02:15 PDT 2010


Author: dgregor
Date: Tue Apr  6 15:02:15 2010
New Revision: 100555

URL: http://llvm.org/viewvc/llvm-project?rev=100555&view=rev
Log:
Only prove macros as code-completion results when we're in a case
statement or for ordinary names. This means that we won't show macros
when completing, e.g., member expressions such as "p->".


Modified:
    cfe/trunk/lib/Sema/SemaCodeComplete.cpp
    cfe/trunk/test/CodeCompletion/macros.c

Modified: cfe/trunk/lib/Sema/SemaCodeComplete.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaCodeComplete.cpp?rev=100555&r1=100554&r2=100555&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaCodeComplete.cpp (original)
+++ cfe/trunk/lib/Sema/SemaCodeComplete.cpp Tue Apr  6 15:02:15 2010
@@ -2077,10 +2077,6 @@
   
   Results.ExitScope();
 
-  // Add macros
-  if (CodeCompleter->includeMacros())
-    AddMacroResults(PP, Results);
-
   // Hand off the results found for code completion.
   HandleCodeCompleteResults(this, CodeCompleter, Results.data(),Results.size());
 }
@@ -2115,8 +2111,6 @@
   CodeCompletionDeclConsumer Consumer(Results, CurContext);
   LookupVisibleDecls(S, LookupTagName, Consumer);
   
-  if (CodeCompleter->includeMacros())
-    AddMacroResults(PP, Results);
   HandleCodeCompleteResults(this, CodeCompleter, Results.data(),Results.size());
 }
 
@@ -2194,7 +2188,7 @@
                       CurContext, 0, false);
   }
   Results.ExitScope();
-  
+
   if (CodeCompleter->includeMacros())
     AddMacroResults(PP, Results);
   HandleCodeCompleteResults(this, CodeCompleter, Results.data(),Results.size());
@@ -2309,8 +2303,6 @@
   if (!Results.empty() && NNS->isDependent())
     Results.AddResult("template");
   
-  if (CodeCompleter->includeMacros())
-    AddMacroResults(PP, Results);
   HandleCodeCompleteResults(this, CodeCompleter, Results.data(),Results.size());
 }
 
@@ -2331,8 +2323,6 @@
   LookupVisibleDecls(S, LookupOrdinaryName, Consumer);
   Results.ExitScope();
   
-  if (CodeCompleter->includeMacros())
-    AddMacroResults(PP, Results);
   HandleCodeCompleteResults(this, CodeCompleter, Results.data(),Results.size());
 }
 
@@ -2347,8 +2337,6 @@
   CodeCompletionDeclConsumer Consumer(Results, CurContext);
   LookupVisibleDecls(S, LookupOrdinaryName, Consumer);
   Results.ExitScope();
-  if (CodeCompleter->includeMacros())
-    AddMacroResults(PP, Results);
   HandleCodeCompleteResults(this, CodeCompleter, Results.data(),Results.size());
 }
 
@@ -2383,8 +2371,6 @@
     Results.ExitScope();
   }
   
-  if (CodeCompleter->includeMacros())
-    AddMacroResults(PP, Results);
   HandleCodeCompleteResults(this, CodeCompleter, Results.data(),Results.size());
 }
 
@@ -2396,8 +2382,6 @@
   ResultBuilder Results(*this, &ResultBuilder::IsNamespaceOrAlias);
   CodeCompletionDeclConsumer Consumer(Results, CurContext);
   LookupVisibleDecls(S, LookupOrdinaryName, Consumer);
-  if (CodeCompleter->includeMacros())
-    AddMacroResults(PP, Results);
   HandleCodeCompleteResults(this, CodeCompleter, Results.data(),Results.size());
 }
 
@@ -2424,8 +2408,6 @@
   AddTypeSpecifierResults(getLangOptions(), Results);
   Results.ExitScope();
   
-  if (CodeCompleter->includeMacros())
-    AddMacroResults(PP, Results);
   HandleCodeCompleteResults(this, CodeCompleter, Results.data(),Results.size());
 }
 

Modified: cfe/trunk/test/CodeCompletion/macros.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeCompletion/macros.c?rev=100555&r1=100554&r2=100555&view=diff
==============================================================================
--- cfe/trunk/test/CodeCompletion/macros.c (original)
+++ cfe/trunk/test/CodeCompletion/macros.c Tue Apr  6 15:02:15 2010
@@ -19,11 +19,7 @@
   // RUN: %clang_cc1 -include-pch %t -fsyntax-only -code-completion-macros -code-completion-at=%s:12:14 %s -o - | FileCheck -check-prefix=CC1 %s
   // RUN: %clang_cc1 -include-pch %t -fsyntax-only -code-completion-macros -code-completion-at=%s:14:9 %s -o - | FileCheck -check-prefix=CC2 %s
 
-  // CC1: BAR(<#X#>, <#Y#>)
   // CC1: color
-  // CC1: FOO
-  // CC1: IDENTITY(<#X#>)
-  // CC1: WIBBLE
   // CC1: x
   // CC1: y
   // CC1: z





More information about the cfe-commits mailing list