This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGe8fb478f2df8: [clang][Interp] Don't call getSource() on
functions without a body (authored by tbaeder).
Changed prior to commit:
https://reviews.llvm.org/D149824?vs=519380&id=519786#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D149824/new/
https://reviews.llvm.org/D149824
Files:
clang/lib/AST/Interp/EvalEmitter.h
clang/lib/AST/Interp/Function.cpp
Index: clang/lib/AST/Interp/Function.cpp
===================================================================
--- clang/lib/AST/Interp/Function.cpp
+++ clang/lib/AST/Interp/Function.cpp
@@ -32,6 +32,7 @@
SourceInfo Function::getSource(CodePtr PC) const {
assert(PC >= getCodeBegin() && "PC does not belong to this function");
assert(PC <= getCodeEnd() && "PC Does not belong to this function");
+ assert(hasBody() && "Function has no body");
unsigned Offset = PC - getCodeBegin();
using Elem = std::pair<unsigned, SourceInfo>;
auto It = llvm::lower_bound(SrcMap, Elem{Offset, {}}, llvm::less_first());
Index: clang/lib/AST/Interp/EvalEmitter.h
===================================================================
--- clang/lib/AST/Interp/EvalEmitter.h
+++ clang/lib/AST/Interp/EvalEmitter.h
@@ -71,7 +71,7 @@
/// Returns the source location of the current opcode.
SourceInfo getSource(const Function *F, CodePtr PC) const override {
- return F ? F->getSource(PC) : CurrentSource;
+ return (F && F->hasBody()) ? F->getSource(PC) : CurrentSource;
}
/// Parameter indices.
Index: clang/lib/AST/Interp/Function.cpp
===================================================================
--- clang/lib/AST/Interp/Function.cpp
+++ clang/lib/AST/Interp/Function.cpp
@@ -32,6 +32,7 @@
SourceInfo Function::getSource(CodePtr PC) const {
assert(PC >= getCodeBegin() && "PC does not belong to this function");
assert(PC <= getCodeEnd() && "PC Does not belong to this function");
+ assert(hasBody() && "Function has no body");
unsigned Offset = PC - getCodeBegin();
using Elem = std::pair<unsigned, SourceInfo>;
auto It = llvm::lower_bound(SrcMap, Elem{Offset, {}}, llvm::less_first());
Index: clang/lib/AST/Interp/EvalEmitter.h
===================================================================
--- clang/lib/AST/Interp/EvalEmitter.h
+++ clang/lib/AST/Interp/EvalEmitter.h
@@ -71,7 +71,7 @@
/// Returns the source location of the current opcode.
SourceInfo getSource(const Function *F, CodePtr PC) const override {
- return F ? F->getSource(PC) : CurrentSource;
+ return (F && F->hasBody()) ? F->getSource(PC) : CurrentSource;
}
/// Parameter indices.
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits