When not emitting path diagnostics in BugReporter::EmitWarning(), use the

BugReport-specific SourceRanges (when available).

llvm-svn: 49486
This commit is contained in:
Ted Kremenek 2008-04-10 16:12:38 +00:00
parent 83744ddbd9
commit 42d9db75f0
2 changed files with 14 additions and 4 deletions

View File

@ -358,8 +358,18 @@ void BugReporter::EmitWarning(BugReport& R, ExplodedNode<ValueState>* 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);
}

View File

@ -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: