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

Douglas Gregor dgregor at apple.com
Tue Nov 17 08:43:06 PST 2009


Author: dgregor
Date: Tue Nov 17 10:43:05 2009
New Revision: 89102

URL: http://llvm.org/viewvc/llvm-project?rev=89102&view=rev
Log:
StringRef'ify CodeCompletionString

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

Modified: cfe/trunk/include/clang/Sema/CodeCompleteConsumer.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/CodeCompleteConsumer.h?rev=89102&r1=89101&r2=89102&view=diff

==============================================================================
--- cfe/trunk/include/clang/Sema/CodeCompleteConsumer.h (original)
+++ cfe/trunk/include/clang/Sema/CodeCompleteConsumer.h Tue Nov 17 10:43:05 2009
@@ -109,19 +109,19 @@
     Chunk(ChunkKind Kind, llvm::StringRef Text = "");
     
     /// \brief Create a new text chunk.
-    static Chunk CreateText(const char *Text);
+    static Chunk CreateText(llvm::StringRef Text);
 
     /// \brief Create a new optional chunk.
     static Chunk CreateOptional(std::auto_ptr<CodeCompletionString> Optional);
 
     /// \brief Create a new placeholder chunk.
-    static Chunk CreatePlaceholder(const char *Placeholder);
+    static Chunk CreatePlaceholder(llvm::StringRef Placeholder);
 
     /// \brief Create a new informative chunk.
-    static Chunk CreateInformative(const char *Informative);
+    static Chunk CreateInformative(llvm::StringRef Informative);
 
     /// \brief Create a new current-parameter chunk.
-    static Chunk CreateCurrentParameter(const char *CurrentParameter);
+    static Chunk CreateCurrentParameter(llvm::StringRef CurrentParameter);
 
     /// \brief Destroy this chunk, deallocating any memory it owns.
     void Destroy();
@@ -156,13 +156,13 @@
   
   /// \brief Add a new typed-text chunk.
   /// The text string will be copied.
-  void AddTypedTextChunk(const char *Text) { 
+  void AddTypedTextChunk(llvm::StringRef Text) { 
     Chunks.push_back(Chunk(CK_TypedText, Text));
   }
   
   /// \brief Add a new text chunk.
   /// The text string will be copied.
-  void AddTextChunk(const char *Text) { 
+  void AddTextChunk(llvm::StringRef Text) { 
     Chunks.push_back(Chunk::CreateText(Text)); 
   }
   
@@ -173,19 +173,19 @@
   
   /// \brief Add a new placeholder chunk.
   /// The placeholder text will be copied.
-  void AddPlaceholderChunk(const char *Placeholder) {
+  void AddPlaceholderChunk(llvm::StringRef Placeholder) {
     Chunks.push_back(Chunk::CreatePlaceholder(Placeholder));
   }
 
   /// \brief Add a new informative chunk.
   /// The text will be copied.
-  void AddInformativeChunk(const char *Text) {
+  void AddInformativeChunk(llvm::StringRef Text) {
     Chunks.push_back(Chunk::CreateInformative(Text));
   }
 
   /// \brief Add a new current-parameter chunk.
   /// The text will be copied.
-  void AddCurrentParameterChunk(const char *CurrentParameter) {
+  void AddCurrentParameterChunk(llvm::StringRef CurrentParameter) {
     Chunks.push_back(Chunk::CreateCurrentParameter(CurrentParameter));
   }
   

Modified: cfe/trunk/lib/Sema/CodeCompleteConsumer.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/CodeCompleteConsumer.cpp?rev=89102&r1=89101&r2=89102&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/CodeCompleteConsumer.cpp (original)
+++ cfe/trunk/lib/Sema/CodeCompleteConsumer.cpp Tue Nov 17 10:43:05 2009
@@ -22,7 +22,9 @@
 #include <algorithm>
 #include <cstring>
 #include <functional>
+
 using namespace clang;
+using llvm::StringRef;
 
 //===----------------------------------------------------------------------===//
 // Code completion string implementation
@@ -86,7 +88,7 @@
 }
 
 CodeCompletionString::Chunk
-CodeCompletionString::Chunk::CreateText(const char *Text) {
+CodeCompletionString::Chunk::CreateText(StringRef Text) {
   return Chunk(CK_Text, Text);
 }
 
@@ -100,18 +102,18 @@
 }
 
 CodeCompletionString::Chunk 
-CodeCompletionString::Chunk::CreatePlaceholder(const char *Placeholder) {
+CodeCompletionString::Chunk::CreatePlaceholder(StringRef Placeholder) {
   return Chunk(CK_Placeholder, Placeholder);
 }
 
 CodeCompletionString::Chunk 
-CodeCompletionString::Chunk::CreateInformative(const char *Informative) {
+CodeCompletionString::Chunk::CreateInformative(StringRef Informative) {
   return Chunk(CK_Informative, Informative);
 }
 
 CodeCompletionString::Chunk 
 CodeCompletionString::Chunk::CreateCurrentParameter(
-                                                const char *CurrentParameter) {
+                                                StringRef CurrentParameter) {
   return Chunk(CK_CurrentParameter, CurrentParameter);
 }
 





More information about the cfe-commits mailing list