[cfe-commits] r51395 - in /cfe/trunk: include/clang/Basic/DiagnosticKinds.def lib/Analysis/DeadStores.cpp test/Analysis/dead-stores.c

Chris Lattner clattner at apple.com
Wed May 21 17:38:16 PDT 2008


On May 21, 2008, at 3:59 PM, Ted Kremenek wrote:

> Author: kremenek
> Date: Wed May 21 17:59:16 2008
> New Revision: 51395
>
> URL: http://llvm.org/viewvc/llvm-project?rev=51395&view=rev
> Log:
> Improve dead stores diagnostics to include the variable name.

Hey Ted,

> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
> --- cfe/trunk/lib/Analysis/DeadStores.cpp (original)
> +++ cfe/trunk/lib/Analysis/DeadStores.cpp Wed May 21 17:59:16 2008
> @@ -20,6 +20,7 @@
> #include "clang/Basic/Diagnostic.h"
> #include "clang/AST/ASTContext.h"
> #include "llvm/Support/Compiler.h"
> +#include <sstream>
>
> using namespace clang;
>
> @@ -35,16 +36,22 @@
>
>   virtual ~DeadStoreObs() {}
>
> +  unsigned GetDiag(VarDecl* VD) {
> +    std::ostringstream os;
> +    os << "value stored to '" << VD->getName() << "' is never used";

Why not just:

   std::string S = "value stored to '" + std::string(VD->getName()) +  
"' is never used";

Which avoids sstream?

-Chris



More information about the cfe-commits mailing list