forked from OSchip/llvm-project
BugReport::getEndPath() - Only add a Stmt's range to the constructed PathDiagnosticEventPiece if the BugReport contained no explicit ranges.
llvm-svn: 71516
This commit is contained in:
parent
bd7d11f770
commit
5fb7847fbf
|
|
@ -244,11 +244,12 @@ class PathDiagnosticEventPiece : public PathDiagnosticSpotPiece {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PathDiagnosticEventPiece(const PathDiagnosticLocation &pos,
|
PathDiagnosticEventPiece(const PathDiagnosticLocation &pos,
|
||||||
const std::string& s)
|
const std::string& s, bool addPosRange = true)
|
||||||
: PathDiagnosticSpotPiece(pos, s, Event) {}
|
: PathDiagnosticSpotPiece(pos, s, Event, addPosRange) {}
|
||||||
|
|
||||||
PathDiagnosticEventPiece(const PathDiagnosticLocation &pos, const char* s)
|
PathDiagnosticEventPiece(const PathDiagnosticLocation &pos, const char* s,
|
||||||
: PathDiagnosticSpotPiece(pos, s, Event) {}
|
bool addPosRange = true)
|
||||||
|
: PathDiagnosticSpotPiece(pos, s, Event, addPosRange) {}
|
||||||
|
|
||||||
~PathDiagnosticEventPiece();
|
~PathDiagnosticEventPiece();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1198,13 +1198,16 @@ BugReport::getEndPath(BugReporterContext& BRC,
|
||||||
|
|
||||||
if (!S)
|
if (!S)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
FullSourceLoc L(S->getLocStart(), BRC.getSourceManager());
|
|
||||||
PathDiagnosticPiece* P = new PathDiagnosticEventPiece(L, getDescription());
|
|
||||||
|
|
||||||
const SourceRange *Beg, *End;
|
const SourceRange *Beg, *End;
|
||||||
getRanges(BRC.getBugReporter(), Beg, End);
|
getRanges(BRC.getBugReporter(), Beg, End);
|
||||||
|
PathDiagnosticLocation L(S, BRC.getSourceManager());
|
||||||
|
|
||||||
|
// Only add the statement itself as a range if we didn't specify any
|
||||||
|
// special ranges for this report.
|
||||||
|
PathDiagnosticPiece* P = new PathDiagnosticEventPiece(L, getDescription(),
|
||||||
|
Beg == End);
|
||||||
|
|
||||||
for (; Beg != End; ++Beg)
|
for (; Beg != End; ++Beg)
|
||||||
P->addRange(*Beg);
|
P->addRange(*Beg);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue