[cfe-commits] r84377 - /cfe/trunk/include/clang/Basic/Diagnostic.h

Daniel Dunbar daniel at zuster.org
Sat Oct 17 16:52:43 PDT 2009


Author: ddunbar
Date: Sat Oct 17 18:52:43 2009
New Revision: 84377

URL: http://llvm.org/viewvc/llvm-project?rev=84377&view=rev
Log:
StringRefize some parts of Diagnostic API.

Modified:
    cfe/trunk/include/clang/Basic/Diagnostic.h

Modified: cfe/trunk/include/clang/Basic/Diagnostic.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Diagnostic.h?rev=84377&r1=84376&r2=84377&view=diff

==============================================================================
--- cfe/trunk/include/clang/Basic/Diagnostic.h (original)
+++ cfe/trunk/include/clang/Basic/Diagnostic.h Sat Oct 17 18:52:43 2009
@@ -15,6 +15,7 @@
 #define LLVM_CLANG_DIAGNOSTIC_H
 
 #include "clang/Basic/SourceLocation.h"
+#include "llvm/ADT/StringRef.h"
 #include "llvm/Support/type_traits.h"
 #include <string>
 #include <vector>
@@ -107,7 +108,7 @@
   /// \brief Create a code modification hint that inserts the given
   /// code string at a specific location.
   static CodeModificationHint CreateInsertion(SourceLocation InsertionLoc,
-                                              const std::string &Code) {
+                                              llvm::StringRef Code) {
     CodeModificationHint Hint;
     Hint.InsertionLoc = InsertionLoc;
     Hint.CodeToInsert = Code;
@@ -125,7 +126,7 @@
   /// \brief Create a code modification hint that replaces the given
   /// source range with the given code string.
   static CodeModificationHint CreateReplacement(SourceRange RemoveRange,
-                                                const std::string &Code) {
+                                                llvm::StringRef Code) {
     CodeModificationHint Hint;
     Hint.RemoveRange = RemoveRange;
     Hint.InsertionLoc = RemoveRange.getBegin();
@@ -546,7 +547,7 @@
   /// return Diag(...);
   operator bool() const { return true; }
 
-  void AddString(const std::string &S) const {
+  void AddString(llvm::StringRef S) const {
     assert(NumArgs < Diagnostic::MaxArguments &&
            "Too many arguments to diagnostic!");
     if (DiagObj) {
@@ -581,7 +582,7 @@
 };
 
 inline const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB,
-                                           const std::string &S) {
+                                           llvm::StringRef S) {
   DB.AddString(S);
   return DB;
 }





More information about the cfe-commits mailing list