summaryrefslogtreecommitdiffstats
path: root/clang/lib/StaticAnalyzer/Checkers/CStringChecker.cpp
diff options
context:
space:
mode:
authorArtem Dergachev <artem.dergachev@gmail.com>2018-07-30 23:44:37 +0000
committerArtem Dergachev <artem.dergachev@gmail.com>2018-07-30 23:44:37 +0000
commit67fdf81f0c98d7389057a6030124b59f95280125 (patch)
treec610635e45dc9ed52e2abdd8ae6492f28417017c /clang/lib/StaticAnalyzer/Checkers/CStringChecker.cpp
parent934864bfa79f23b2a230f0847b0649899aa82d2a (diff)
downloadbcm5719-llvm-67fdf81f0c98d7389057a6030124b59f95280125.tar.gz
bcm5719-llvm-67fdf81f0c98d7389057a6030124b59f95280125.zip
[analyzer] CStringChecker: Remember to highlight the argument expression range.
When emitting a bug report, it is important to highlight which argument of the call-expression is causing the problem. Before: warning: Null pointer argument in call to string comparison function   strcmp(a, b);   ^~~~~~~~~~~~ After: warning: Null pointer argument in call to string comparison function   strcmp(a, b);   ^      ~ Affects other output modes as well, not just text. Differential Revision: https://reviews.llvm.org/D50028 llvm-svn: 338333
Diffstat (limited to 'clang/lib/StaticAnalyzer/Checkers/CStringChecker.cpp')
-rw-r--r--clang/lib/StaticAnalyzer/Checkers/CStringChecker.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/clang/lib/StaticAnalyzer/Checkers/CStringChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/CStringChecker.cpp
index 278452ec994..12a576e5d80 100644
--- a/clang/lib/StaticAnalyzer/Checkers/CStringChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/CStringChecker.cpp
@@ -552,6 +552,7 @@ void CStringChecker::emitNullArgBug(CheckerContext &C, ProgramStateRef State,
BuiltinBug *BT = static_cast<BuiltinBug *>(BT_Null.get());
auto Report = llvm::make_unique<BugReport>(*BT, WarningMsg, N);
+ Report->addRange(S->getSourceRange());
bugreporter::trackNullOrUndefValue(N, S, *Report);
C.emitReport(std::move(Report));
}
OpenPOWER on IntegriCloud