summaryrefslogtreecommitdiffstats
path: root/clang/lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp
diff options
context:
space:
mode:
authorJordy Rose <jediknil@belkadan.com>2011-08-21 05:25:15 +0000
committerJordy Rose <jediknil@belkadan.com>2011-08-21 05:25:15 +0000
commit82c673de33dc40f6cedf616c0cc02623798c6fd0 (patch)
tree37ead238e0653a8b5f165006eb73066196c2b3c8 /clang/lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp
parent3cca223a2af617d1db17f42bf9f536240017408f (diff)
downloadbcm5719-llvm-82c673de33dc40f6cedf616c0cc02623798c6fd0.tar.gz
bcm5719-llvm-82c673de33dc40f6cedf616c0cc02623798c6fd0.zip
[analyzer] Replace calls to getNameAsString() with StringRef equivalents.
llvm-svn: 138215
Diffstat (limited to 'clang/lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp')
-rw-r--r--clang/lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp17
1 files changed, 8 insertions, 9 deletions
diff --git a/clang/lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp
index d3695181486..66787f7a821 100644
--- a/clang/lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp
@@ -103,26 +103,25 @@ public:
if (!reachableCode->isReachable(currentBlock))
return;
- const std::string &name = V->getNameAsString();
-
- const char* BugType = 0;
- std::string msg;
+ llvm::SmallString<64> buf;
+ llvm::raw_svector_ostream os(buf);
+ const char *BugType = 0;
switch (dsk) {
default:
- assert(false && "Impossible dead store type.");
+ llvm_unreachable("Impossible dead store type.");
case DeadInit:
BugType = "Dead initialization";
- msg = "Value stored to '" + name +
- "' during its initialization is never read";
+ os << "Value stored to '" << V
+ << "' during its initialization is never read";
break;
case DeadIncrement:
BugType = "Dead increment";
case Standard:
if (!BugType) BugType = "Dead assignment";
- msg = "Value stored to '" + name + "' is never read";
+ os << "Value stored to '" << V << "' is never read";
break;
case Enclosing:
@@ -132,7 +131,7 @@ public:
return;
}
- BR.EmitBasicReport(BugType, "Dead store", msg, L, R);
+ BR.EmitBasicReport(BugType, "Dead store", os.str(), L, R);
}
void CheckVarDecl(const VarDecl *VD, const Expr *Ex, const Expr *Val,
OpenPOWER on IntegriCloud