summaryrefslogtreecommitdiffstats
path: root/clang/lib/StaticAnalyzer/Checkers/NSErrorChecker.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2013-01-04 19:04:40 +0000
committerTed Kremenek <kremenek@apple.com>2013-01-04 19:04:40 +0000
commit9deaef7f44115c9defa2af3d91bd589e172074e7 (patch)
treefbd8ace0ff27f23103dc20fc0fe3cf666f9b5273 /clang/lib/StaticAnalyzer/Checkers/NSErrorChecker.cpp
parent7505b5a64cd1de60d5b9bb9361c53c7eb7ff489e (diff)
downloadbcm5719-llvm-9deaef7f44115c9defa2af3d91bd589e172074e7.tar.gz
bcm5719-llvm-9deaef7f44115c9defa2af3d91bd589e172074e7.zip
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. llvm-svn: 171502
Diffstat (limited to 'clang/lib/StaticAnalyzer/Checkers/NSErrorChecker.cpp')
-rw-r--r--clang/lib/StaticAnalyzer/Checkers/NSErrorChecker.cpp19
1 files changed, 8 insertions, 11 deletions
diff --git a/clang/lib/StaticAnalyzer/Checkers/NSErrorChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/NSErrorChecker.cpp
index 8b5e4b6bc4b..d7c8023c571 100644
--- a/clang/lib/StaticAnalyzer/Checkers/NSErrorChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/NSErrorChecker.cpp
@@ -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 @@ void NSOrCFErrorDerefChecker::checkEvent(ImplicitNullDerefEvent event) const {
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)
OpenPOWER on IntegriCloud