]> granicus.if.org Git - clang/commitdiff
Address Sebastian and Doug's objections with taking pointers to temporaries.
authorChris Lattner <sabre@nondot.org>
Wed, 19 Nov 2008 05:34:22 +0000 (05:34 +0000)
committerChris Lattner <sabre@nondot.org>
Wed, 19 Nov 2008 05:34:22 +0000 (05:34 +0000)
Instead of doing that, copy the strings into the diagnostic info.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59590 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Basic/Diagnostic.h

index 3edf990d24e1eacc2068049e6fb5b21bbc0d496a..ca7c100ee921c7989dbe66c563c6867e5cc5670b 100644 (file)
@@ -180,7 +180,7 @@ private:
   
   /// DiagArguments - The values for the various substitution positions.  It
   /// currently only support 10 arguments (%0-%9).
-  const std::string *DiagArguments[10];
+  std::string DiagArguments[10];
   /// DiagRanges - The list of ranges added to this diagnostic.  It currently
   /// only support 10 ranges, could easily be extended if needed.
   const SourceRange *DiagRanges[10];
@@ -255,7 +255,7 @@ public:
   const std::string &getArgStr(unsigned Idx) const {
     assert((signed char)Idx < DiagObj->NumDiagArgs &&
            "Argument out of range!");
-    return *DiagObj->DiagArguments[Idx];
+    return DiagObj->DiagArguments[Idx];
   }
   
   /// getNumRanges - Return the number of source ranges associated with this
@@ -273,7 +273,7 @@ public:
     assert((unsigned)DiagObj->NumDiagArgs < 
            sizeof(DiagObj->DiagArguments)/sizeof(DiagObj->DiagArguments[0]) &&
            "Too many arguments to diagnostic!");
-    DiagObj->DiagArguments[DiagObj->NumDiagArgs++] = &S;
+    DiagObj->DiagArguments[DiagObj->NumDiagArgs++] = S;
     return *this;
   }