[cfe-commits] r112057 - in /cfe/trunk: include/clang/Sema/CodeCompleteConsumer.h lib/Sema/SemaCodeComplete.cpp

Douglas Gregor dgregor at apple.com
Wed Aug 25 10:10:00 PDT 2010


Author: dgregor
Date: Wed Aug 25 12:10:00 2010
New Revision: 112057

URL: http://llvm.org/viewvc/llvm-project?rev=112057&view=rev
Log:
Add a code-completion context for "natural language" completions, so
that ASTUnit knows not to try to provide completions there.

Modified:
    cfe/trunk/include/clang/Sema/CodeCompleteConsumer.h
    cfe/trunk/lib/Sema/SemaCodeComplete.cpp

Modified: cfe/trunk/include/clang/Sema/CodeCompleteConsumer.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/CodeCompleteConsumer.h?rev=112057&r1=112056&r2=112057&view=diff
==============================================================================
--- cfe/trunk/include/clang/Sema/CodeCompleteConsumer.h (original)
+++ cfe/trunk/include/clang/Sema/CodeCompleteConsumer.h Wed Aug 25 12:10:00 2010
@@ -181,7 +181,13 @@
     /// (without any arguments, in the case of a function-like macro).
     CCC_MacroNameUse,
     /// \brief Code completion occurred within a preprocessor expression.
-    CCC_PreprocessorExpression
+    CCC_PreprocessorExpression,
+    /// \brief Code completion occurred in a context where natural language is
+    /// expected, e.g., a comment or string literal.
+    ///
+    /// This context usually implies that no completions should be added,
+    /// unless they come from an appropriate natural-language dictionary.
+    CCC_NaturalLanguage
   };
 
 private:

Modified: cfe/trunk/lib/Sema/SemaCodeComplete.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaCodeComplete.cpp?rev=112057&r1=112056&r2=112057&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaCodeComplete.cpp (original)
+++ cfe/trunk/lib/Sema/SemaCodeComplete.cpp Wed Aug 25 12:10:00 2010
@@ -4874,9 +4874,8 @@
 }
 
 void Sema::CodeCompleteNaturalLanguage() {
-  // FIXME: Use a dedicated completion context for this!
   HandleCodeCompleteResults(this, CodeCompleter,
-                            CodeCompletionContext::CCC_Other,
+                            CodeCompletionContext::CCC_NaturalLanguage,
                             0, 0);
 }
 





More information about the cfe-commits mailing list