[clang] ebcb04a - Revert "[clang][Interp][NFC] Save source location of evaluating expression"

Timm Bäder via cfe-commits cfe-commits at lists.llvm.org
Thu May 2 05:04:06 PDT 2024


Author: Timm Bäder
Date: 2024-05-02T14:01:09+02:00
New Revision: ebcb04ae8825b15fd6aa249a8da0617b877b4705

URL: https://github.com/llvm/llvm-project/commit/ebcb04ae8825b15fd6aa249a8da0617b877b4705
DIFF: https://github.com/llvm/llvm-project/commit/ebcb04ae8825b15fd6aa249a8da0617b877b4705.diff

LOG: Revert "[clang][Interp][NFC] Save source location of evaluating expression"

This reverts commit de04e6cd90b891215f1dfc83ec886d037a7c2ed0.

This breaks the Misc/constexpr-source-ranges test:
https://lab.llvm.org/buildbot/#/builders/139/builds/64685

Added: 
    

Modified: 
    clang/lib/AST/Interp/EvalEmitter.cpp
    clang/lib/AST/Interp/InterpFrame.cpp
    clang/lib/AST/Interp/InterpState.h

Removed: 
    


################################################################################
diff  --git a/clang/lib/AST/Interp/EvalEmitter.cpp b/clang/lib/AST/Interp/EvalEmitter.cpp
index 388c3612f292b0..d764b4b6f6d17b 100644
--- a/clang/lib/AST/Interp/EvalEmitter.cpp
+++ b/clang/lib/AST/Interp/EvalEmitter.cpp
@@ -34,7 +34,6 @@ EvalEmitter::~EvalEmitter() {
 
 EvaluationResult EvalEmitter::interpretExpr(const Expr *E,
                                             bool ConvertResultToRValue) {
-  S.setEvalLocation(E->getExprLoc());
   this->ConvertResultToRValue = ConvertResultToRValue;
   EvalResult.setSource(E);
 

diff  --git a/clang/lib/AST/Interp/InterpFrame.cpp b/clang/lib/AST/Interp/InterpFrame.cpp
index cf296b4e64f928..515b1f5fde1aa7 100644
--- a/clang/lib/AST/Interp/InterpFrame.cpp
+++ b/clang/lib/AST/Interp/InterpFrame.cpp
@@ -191,11 +191,8 @@ Frame *InterpFrame::getCaller() const {
 }
 
 SourceRange InterpFrame::getCallRange() const {
-  if (!Caller->Func) {
-    if (S.EvalLocation.isValid())
-      return S.EvalLocation;
+  if (!Caller->Func)
     return S.getRange(nullptr, {});
-  }
   return S.getRange(Caller->Func, RetPC - sizeof(uintptr_t));
 }
 

diff  --git a/clang/lib/AST/Interp/InterpState.h b/clang/lib/AST/Interp/InterpState.h
index d483c60c58e248..c17cfad11b1e2b 100644
--- a/clang/lib/AST/Interp/InterpState.h
+++ b/clang/lib/AST/Interp/InterpState.h
@@ -98,8 +98,6 @@ class InterpState final : public State, public SourceMapper {
 
   Context &getContext() const { return Ctx; }
 
-  void setEvalLocation(SourceLocation SL) { this->EvalLocation = SL; }
-
 private:
   /// AST Walker state.
   State &Parent;
@@ -117,8 +115,6 @@ class InterpState final : public State, public SourceMapper {
   Context &Ctx;
   /// The current frame.
   InterpFrame *Current = nullptr;
-  /// Source location of the evaluating expression
-  SourceLocation EvalLocation;
 };
 
 } // namespace interp


        


More information about the cfe-commits mailing list