diff options
author | George Karpenkov <ekarpenkov@apple.com> | 2019-01-10 18:15:57 +0000 |
---|---|---|
committer | George Karpenkov <ekarpenkov@apple.com> | 2019-01-10 18:15:57 +0000 |
commit | 4f64b38f561a7dfab1cbb7514f1bfdacbc7e8bad (patch) | |
tree | de116851b2390a305de3b5e927bf56345561ce90 /clang/lib | |
parent | 363dd8e4b86cab350999afbbaf23c5f8fa472b47 (diff) | |
download | bcm5719-llvm-4f64b38f561a7dfab1cbb7514f1bfdacbc7e8bad.tar.gz bcm5719-llvm-4f64b38f561a7dfab1cbb7514f1bfdacbc7e8bad.zip |
[analyzer] Quote the type of the leaked/problematic object in diagnostics for readability
Differential Revision: https://reviews.llvm.org/D56344
llvm-svn: 350867
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountDiagnostics.cpp | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/clang/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountDiagnostics.cpp b/clang/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountDiagnostics.cpp index 0f01d9a9954..1f370fc301b 100644 --- a/clang/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountDiagnostics.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountDiagnostics.cpp @@ -157,14 +157,14 @@ static void generateDiagnosticsForCallLike(ProgramStateRef CurrSt, } if (CurrV.getObjKind() == ObjKind::CF) { - os << " returns a Core Foundation object of type " - << Sym->getType().getAsString() << " with a "; + os << " a Core Foundation object of type '" + << Sym->getType().getAsString() << "' with a "; } else if (CurrV.getObjKind() == ObjKind::OS) { - os << " returns an OSObject of type " << getPrettyTypeName(Sym->getType()) - << " with a "; + os << " an OSObject of type '" << getPrettyTypeName(Sym->getType()) + << "' with a "; } else if (CurrV.getObjKind() == ObjKind::Generalized) { - os << " returns an object of type " << Sym->getType().getAsString() - << " with a "; + os << " an object of type '" << Sym->getType().getAsString() + << "' with a "; } else { assert(CurrV.getObjKind() == ObjKind::ObjC); QualType T = Sym->getType(); @@ -587,7 +587,8 @@ CFRefLeakReportVisitor::getEndPath(BugReporterContext &BRC, if (RegionDescription) { os << "object allocated and stored into '" << *RegionDescription << '\''; } else { - os << "allocated object of type " << getPrettyTypeName(Sym->getType()); + os << "allocated object of type '" << getPrettyTypeName(Sym->getType()) + << "'"; } // Get the retain count. @@ -724,7 +725,7 @@ void CFRefLeakReport::createDescription(CheckerContext &Ctx) { } else { // If we can't figure out the name, just supply the type information. - os << " of type " << getPrettyTypeName(Sym->getType()); + os << " of type '" << getPrettyTypeName(Sym->getType()) << "'"; } } |