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

Chris Lattner sabre at nondot.org
Tue Nov 18 21:34:22 PST 2008


Author: lattner
Date: Tue Nov 18 23:34:22 2008
New Revision: 59590

URL: http://llvm.org/viewvc/llvm-project?rev=59590&view=rev
Log:
Address Sebastian and Doug's objections with taking pointers to temporaries.
Instead of doing that, copy the strings into the diagnostic info.

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=59590&r1=59589&r2=59590&view=diff

==============================================================================
--- cfe/trunk/include/clang/Basic/Diagnostic.h (original)
+++ cfe/trunk/include/clang/Basic/Diagnostic.h Tue Nov 18 23:34:22 2008
@@ -180,7 +180,7 @@
   
   /// 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 @@
   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 @@
     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;
   }
   





More information about the cfe-commits mailing list