forked from OSchip/llvm-project
Implement PathDiagnosticLocation::asRange() and PathDiagnosticLocation::asStmt().
llvm-svn: 67777
This commit is contained in:
parent
c25116576f
commit
96110d5920
|
@ -67,7 +67,7 @@ public:
|
|||
|
||||
FullSourceLoc asLocation() const;
|
||||
SourceRange asRange() const;
|
||||
const Stmt *asStmt() const;
|
||||
const Stmt *asStmt() const { return S ? S : 0; }
|
||||
};
|
||||
|
||||
class PathDiagnostic {
|
||||
|
|
|
@ -152,3 +152,18 @@ FullSourceLoc PathDiagnosticLocation::asLocation() const {
|
|||
|
||||
return FullSourceLoc(R.getBegin(), const_cast<SourceManager&>(SM));
|
||||
}
|
||||
|
||||
SourceRange PathDiagnosticLocation::asRange() const {
|
||||
// Note that we want a 'switch' here so that the compiler can warn us in
|
||||
// case we add more cases.
|
||||
switch (K) {
|
||||
case SingleLoc:
|
||||
case Range:
|
||||
break;
|
||||
case Statement:
|
||||
return S->getSourceRange();
|
||||
}
|
||||
|
||||
return R;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue