From 4bb6ac2bb626003b62c71c044df8959ddf158435 Mon Sep 17 00:00:00 2001 From: Ted Kremenek Date: Thu, 10 Apr 2008 16:12:38 +0000 Subject: [PATCH] When not emitting path diagnostics in BugReporter::EmitWarning(), use the BugReport-specific SourceRanges (when available). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49486 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Analysis/BugReporter.cpp | 16 +++++++++++++--- utils/ccc-analyzer | 2 +- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/lib/Analysis/BugReporter.cpp b/lib/Analysis/BugReporter.cpp index c851696a30..0f7b235944 100644 --- a/lib/Analysis/BugReporter.cpp +++ b/lib/Analysis/BugReporter.cpp @@ -358,8 +358,18 @@ void BugReporter::EmitWarning(BugReport& R, ExplodedNode* N) { if (!S) return; - SourceRange Range = S->getSourceRange(); + const SourceRange *Beg, *End; + R.getRanges(Beg, End); + + if (Beg == End) { + SourceRange Range = S->getSourceRange(); + + Diag.Report(FullSourceLoc(S->getLocStart(), Ctx.getSourceManager()), + ErrorDiag, NULL, 0, &Range, 1); + + } + else + Diag.Report(FullSourceLoc(S->getLocStart(), Ctx.getSourceManager()), + ErrorDiag, NULL, 0, Beg, End - Beg); - Diag.Report(FullSourceLoc(S->getLocStart(), Ctx.getSourceManager()), - ErrorDiag, NULL, 0, &Range, 1); } diff --git a/utils/ccc-analyzer b/utils/ccc-analyzer index 038032f2dc..23a6d6a857 100755 --- a/utils/ccc-analyzer +++ b/utils/ccc-analyzer @@ -74,7 +74,7 @@ def analyze(args,language,output,files,verbose,htmldir): command = 'cp'.split() args = command + files + target.split() else: - command = 'clang --grsimple'.split() + command = 'clang -check-cfref'.split() args = command + args; if htmldir is not None: -- 2.50.1