Reapply "[clang][Interp][NFC] Save source location of evaluating expression"
This reverts commit ebcb04ae8825b15fd6aa249a8da0617b877b4705.
This commit is contained in:
parent
ce7700e29d
commit
155dcce401
@ -34,6 +34,7 @@ EvalEmitter::~EvalEmitter() {
|
||||
|
||||
EvaluationResult EvalEmitter::interpretExpr(const Expr *E,
|
||||
bool ConvertResultToRValue) {
|
||||
S.setEvalLocation(E->getExprLoc());
|
||||
this->ConvertResultToRValue = ConvertResultToRValue;
|
||||
EvalResult.setSource(E);
|
||||
|
||||
|
||||
@ -191,8 +191,11 @@ Frame *InterpFrame::getCaller() const {
|
||||
}
|
||||
|
||||
SourceRange InterpFrame::getCallRange() const {
|
||||
if (!Caller->Func)
|
||||
return S.getRange(nullptr, {});
|
||||
if (!Caller->Func) {
|
||||
if (SourceRange NullRange = S.getRange(nullptr, {}); NullRange.isValid())
|
||||
return NullRange;
|
||||
return S.EvalLocation;
|
||||
}
|
||||
return S.getRange(Caller->Func, RetPC - sizeof(uintptr_t));
|
||||
}
|
||||
|
||||
|
||||
@ -98,6 +98,8 @@ public:
|
||||
|
||||
Context &getContext() const { return Ctx; }
|
||||
|
||||
void setEvalLocation(SourceLocation SL) { this->EvalLocation = SL; }
|
||||
|
||||
private:
|
||||
/// AST Walker state.
|
||||
State &Parent;
|
||||
@ -115,6 +117,8 @@ public:
|
||||
Context &Ctx;
|
||||
/// The current frame.
|
||||
InterpFrame *Current = nullptr;
|
||||
/// Source location of the evaluating expression
|
||||
SourceLocation EvalLocation;
|
||||
};
|
||||
|
||||
} // namespace interp
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user