[cfe-commits] r171502 - /cfe/trunk/lib/StaticAnalyzer/Checkers/NSErrorChecker.cpp
Ted Kremenek
kremenek at apple.com
Fri Jan 4 11:04:41 PST 2013
Author: kremenek
Date: Fri Jan 4 13:04:40 2013
New Revision: 171502
URL: http://llvm.org/viewvc/llvm-project?rev=171502&view=rev
Log:
NSErrorChecker: remove quoting the parameter name in the diagnostic until we actually include it's name.
This is a possible regression of moving to using ImplicitNullDerefEvent.
Fixing this for real (including the parameter name) requires more
plumbing in ImplicitNullDerefEvent. This is just a stop gap fix.
Modified:
cfe/trunk/lib/StaticAnalyzer/Checkers/NSErrorChecker.cpp
Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/NSErrorChecker.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/NSErrorChecker.cpp?rev=171502&r1=171501&r2=171502&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Checkers/NSErrorChecker.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/NSErrorChecker.cpp Fri Jan 4 13:04:40 2013
@@ -23,7 +23,7 @@
#include "clang/StaticAnalyzer/Core/CheckerManager.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/ProgramStateTrait.h"
-#include "llvm/ADT/SmallVector.h"
+#include "llvm/ADT/SmallString.h"
#include "llvm/Support/raw_ostream.h"
using namespace clang;
@@ -252,18 +252,15 @@
return;
// Storing to possible null NSError/CFErrorRef out parameter.
+ llvm::SmallString<128> Buf;
+ llvm::raw_svector_ostream os(Buf);
- // Emit an error.
- std::string err;
- llvm::raw_string_ostream os(err);
- os << "Potential null dereference. According to coding standards ";
+ os << "Potential null dereference. According to coding standards ";
+ os << (isNSError
+ ? "in 'Creating and Returning NSError Objects' the parameter"
+ : "documented in CoreFoundation/CFError.h the parameter");
- if (isNSError)
- os << "in 'Creating and Returning NSError Objects' the parameter '";
- else
- os << "documented in CoreFoundation/CFError.h the parameter '";
-
- os << "' may be null.";
+ os << " may be null";
BugType *bug = 0;
if (isNSError)
More information about the cfe-commits
mailing list