[cfe-commits] r137633 - /cfe/trunk/lib/StaticAnalyzer/Checkers/MacOSKeychainAPIChecker.cpp

Anna Zaks ganna at apple.com
Mon Aug 15 11:42:01 PDT 2011


Author: zaks
Date: Mon Aug 15 13:42:00 2011
New Revision: 137633

URL: http://llvm.org/viewvc/llvm-project?rev=137633&view=rev
Log:
MacOSKeychainAPIChecker: Use llvm::SmallString instead of std::string (as per code review for r137523).

Modified:
    cfe/trunk/lib/StaticAnalyzer/Checkers/MacOSKeychainAPIChecker.cpp

Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/MacOSKeychainAPIChecker.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/MacOSKeychainAPIChecker.cpp?rev=137633&r1=137632&r2=137633&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Checkers/MacOSKeychainAPIChecker.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/MacOSKeychainAPIChecker.cpp Mon Aug 15 13:42:00 2011
@@ -234,8 +234,8 @@
         if (!N)
           return;
         initBugType();
-        std::string sbuf;
-        llvm::raw_string_ostream os(sbuf);
+        llvm::SmallString<128> sbuf;
+        llvm::raw_svector_ostream os(sbuf);
         unsigned int DIdx = FunctionsToTrack[AS->AllocatorIdx].DeallocatorIdx;
         os << "Allocated data should be released before another call to "
            << "the allocator: missing a call to '"
@@ -272,7 +272,7 @@
   if (!ArgSM && !RegionArgIsBad)
     return;
 
-  // If trying to free data which has not been allocated yet, report as bug.
+  // If trying to free data which has not been allocated yet, report as a bug.
   const AllocationState *AS = State->get<AllocatedData>(ArgSM);
   if (!AS || RegionArgIsBad) {
     // It is possible that this is a false positive - the argument might
@@ -299,8 +299,8 @@
       return;
     initBugType();
 
-    std::string sbuf;
-    llvm::raw_string_ostream os(sbuf);
+    llvm::SmallString<80> sbuf;
+    llvm::raw_svector_ostream os(sbuf);
     os << "Allocator doesn't match the deallocator: '"
        << FunctionsToTrack[PDeallocIdx].Name << "' should be used.";
     RangedBugReport *Report = new RangedBugReport(*BT, os.str(), N);
@@ -402,8 +402,8 @@
                                          ExplodedNode *N) const {
   const ADFunctionInfo &FI = FunctionsToTrack[AS.AllocatorIdx];
   initBugType();
-  std::string sbuf;
-  llvm::raw_string_ostream os(sbuf);
+  llvm::SmallString<70> sbuf;
+  llvm::raw_svector_ostream os(sbuf);
   os << "Allocated data is not released: missing a call to '"
       << FunctionsToTrack[FI.DeallocatorIdx].Name << "'.";
   RangedBugReport *Report = new RangedBugReport(*BT, os.str(), N);





More information about the cfe-commits mailing list