[clang] d472c55 - [clang][Interp] Fix double-printing InterpFrame::describe()

Timm Bäder via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 31 06:26:03 PDT 2023


Author: Timm Bäder
Date: 2023-03-31T15:25:30+02:00
New Revision: d472c55fa28a249e1845908b47a1be6f2e05a1cd

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

LOG: [clang][Interp] Fix double-printing InterpFrame::describe()

Differential Revision: https://reviews.llvm.org/D141831

Added: 
    

Modified: 
    clang/lib/AST/Interp/InterpFrame.cpp
    clang/test/AST/Interp/constexpr-nqueens.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/AST/Interp/InterpFrame.cpp b/clang/lib/AST/Interp/InterpFrame.cpp
index 584cf1a9a69e6..897d420e91a3a 100644
--- a/clang/lib/AST/Interp/InterpFrame.cpp
+++ b/clang/lib/AST/Interp/InterpFrame.cpp
@@ -126,6 +126,9 @@ void print(llvm::raw_ostream &OS, const Pointer &P, ASTContext &Ctx,
     F = F.isArrayElement() ? F.getArray().expand() : F.getBase();
   }
 
+  // Drop the first pointer since we print it unconditionally anyway.
+  Levels.erase(Levels.begin());
+
   printDesc(P.getDeclDesc());
   for (const auto &It : Levels) {
     if (It.inArray()) {

diff  --git a/clang/test/AST/Interp/constexpr-nqueens.cpp b/clang/test/AST/Interp/constexpr-nqueens.cpp
index ffe8553a944b0..5aeb7afcd79ce 100644
--- a/clang/test/AST/Interp/constexpr-nqueens.cpp
+++ b/clang/test/AST/Interp/constexpr-nqueens.cpp
@@ -6,9 +6,6 @@
 /// Board constructors.
 /// This tests that InterpFrame::describe().
 
-// FIXME: With the new interpreter, most of the described frames are
-//  currently broken in one way or another.
-
 typedef unsigned long uint64_t;
 
 struct Board {


        


More information about the cfe-commits mailing list