aboutsummaryrefslogtreecommitdiff
path: root/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
commit7df1234c2e62b2a23dc4417e527f941c20ebe858 (patch)
tree2ffee97d95dc60b592e0a6a47ab29330a956f8d1 /lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp
parentd9f5a709ddbffe35dcc419c9c3fa6a852e833f7a (diff)
[analyzer] Replace calls to getNameAsString() with StringRef equivalents.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138215 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp')
-rw-r--r--lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp17
1 files changed, 8 insertions, 9 deletions
diff --git a/lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp b/lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp
index d369518148..66787f7a82 100644
--- a/lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp
+++ b/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,