diff options
Diffstat (limited to 'clang/lib/AST/Interp/Source.cpp')
| -rw-r--r-- | clang/lib/AST/Interp/Source.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/clang/lib/AST/Interp/Source.cpp b/clang/lib/AST/Interp/Source.cpp index 467cde116843..4e032c92d26d 100644 --- a/clang/lib/AST/Interp/Source.cpp +++ b/clang/lib/AST/Interp/Source.cpp @@ -22,6 +22,16 @@ SourceLocation SourceInfo::getLoc() const { return SourceLocation(); } +SourceRange SourceInfo::getRange() const { + if (const Expr *E = asExpr()) + return E->getSourceRange(); + if (const Stmt *S = asStmt()) + return S->getSourceRange(); + if (const Decl *D = asDecl()) + return D->getSourceRange(); + return SourceRange(); +} + const Expr *SourceInfo::asExpr() const { if (auto *S = Source.dyn_cast<const Stmt *>()) return dyn_cast<Expr>(S); @@ -37,3 +47,7 @@ const Expr *SourceMapper::getExpr(const Function *F, CodePtr PC) const { SourceLocation SourceMapper::getLocation(const Function *F, CodePtr PC) const { return getSource(F, PC).getLoc(); } + +SourceRange SourceMapper::getRange(const Function *F, CodePtr PC) const { + return getSource(F, PC).getRange(); +} |
