diff options
author | Anna Zaks <ganna@apple.com> | 2012-03-16 23:44:28 +0000 |
---|---|---|
committer | Anna Zaks <ganna@apple.com> | 2012-03-16 23:44:28 +0000 |
commit | a7f457a5ea4e07db01ac8c13c003d1cc43a8a9a2 (patch) | |
tree | c2e537c19fcba563618f494d39655f1bc7b7bdd2 /clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp | |
parent | 44ab2103e2138802fa5ddaaaad25cb4cb6a7149e (diff) | |
download | bcm5719-llvm-a7f457a5ea4e07db01ac8c13c003d1cc43a8a9a2.tar.gz bcm5719-llvm-a7f457a5ea4e07db01ac8c13c003d1cc43a8a9a2.zip |
[analyzer] Shorten the stack hint diagnostic.
Do not display the standard "Returning from 'foo'", when a stack hint is
available.
llvm-svn: 152964
Diffstat (limited to 'clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp')
-rw-r--r-- | clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp index 2926fd5c04d..133482fcce6 100644 --- a/clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp @@ -254,7 +254,7 @@ private: SmallString<200> buf; llvm::raw_svector_ostream os(buf); - os << "; reallocation of "; + os << "Reallocation of "; // Printed parameters start at 1, not 0. printOrdinal(++ArgIndex, os); os << " parameter failed"; @@ -263,7 +263,7 @@ private: } virtual std::string getMessageForReturn(const CallExpr *CallExpr) { - return "; reallocation of returned value failed"; + return "Reallocation of returned value failed"; } }; }; @@ -1292,15 +1292,17 @@ MallocChecker::MallocBugVisitor::VisitNode(const ExplodedNode *N, if (Mode == Normal) { if (isAllocated(RS, RSPrev, S)) { Msg = "Memory is allocated"; - StackHint = new StackHintGeneratorForSymbol(Sym, "; allocated memory"); + StackHint = new StackHintGeneratorForSymbol(Sym, + "Returned allocated memory"); } else if (isReleased(RS, RSPrev, S)) { Msg = "Memory is released"; - StackHint = new StackHintGeneratorForSymbol(Sym, "; released memory"); + StackHint = new StackHintGeneratorForSymbol(Sym, + "Returned released memory"); } else if (isReallocFailedCheck(RS, RSPrev, S)) { Mode = ReallocationFailed; Msg = "Reallocation failed"; StackHint = new StackHintGeneratorForReallocationFailed(Sym, - "; reallocation failed"); + "Reallocation failed"); } // We are in a special mode if a reallocation failed later in the path. @@ -1320,7 +1322,8 @@ MallocChecker::MallocBugVisitor::VisitNode(const ExplodedNode *N, if (!(FunName.equals("realloc") || FunName.equals("reallocf"))) return 0; Msg = "Attempt to reallocate memory"; - StackHint = new StackHintGeneratorForSymbol(Sym, "; reallocated memory"); + StackHint = new StackHintGeneratorForSymbol(Sym, + "Returned reallocated memory"); Mode = Normal; } |