r200193 - Roll back the use of ConstStringRef for now

Alp Toker alp at nuanti.com
Sun Jan 26 21:21:24 PST 2014


Author: alp
Date: Sun Jan 26 23:21:24 2014
New Revision: 200193

URL: http://llvm.org/viewvc/llvm-project?rev=200193&view=rev
Log:
Roll back the use of ConstStringRef for now

We might want try a different strategy so hold back on this for the moment, but
fix the off-by-one error in the original function template.

This reverts commit r200190.

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

Modified: cfe/trunk/include/clang/Basic/Diagnostic.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Diagnostic.h?rev=200193&r1=200192&r2=200193&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/Diagnostic.h (original)
+++ cfe/trunk/include/clang/Basic/Diagnostic.h Sun Jan 26 23:21:24 2014
@@ -595,8 +595,10 @@ public:
   ///
   /// \param FormatString A fixed diagnostic format string that will be hashed
   /// and mapped to a unique DiagID.
-  unsigned getCustomDiagID(Level L, ConstStringRef FormatString) {
-    return Diags->getCustomDiagID((DiagnosticIDs::Level)L, FormatString);
+  template <unsigned N>
+  unsigned getCustomDiagID(Level L, const char (&FormatString)[N]) {
+    return Diags->getCustomDiagID((DiagnosticIDs::Level)L,
+                                  StringRef(FormatString, N - 1));
   }
 
   /// \brief Converts a diagnostic argument (as an intptr_t) into the string

Modified: cfe/trunk/include/clang/Basic/LLVM.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/LLVM.h?rev=200193&r1=200192&r2=200193&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/LLVM.h (original)
+++ cfe/trunk/include/clang/Basic/LLVM.h Sun Jan 26 23:21:24 2014
@@ -27,7 +27,6 @@
 namespace llvm {
   // ADT's.
   class StringRef;
-  class ConstStringRef;
   class Twine;
   template<typename T> class ArrayRef;
   template<typename T> class OwningPtr;
@@ -62,7 +61,6 @@ namespace clang {
   using llvm::None;
   using llvm::Optional;
   using llvm::StringRef;
-  using llvm::ConstStringRef;
   using llvm::Twine;
   using llvm::ArrayRef;
   using llvm::OwningPtr;





More information about the cfe-commits mailing list