Skip to content

Revert "Revert "[clang][Interp] Improve "in call to" call argument printing"" #102786

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 13, 2024

Conversation

vitalybuka
Copy link
Collaborator

Reverts #102785

@vitalybuka vitalybuka requested a review from yronglin August 11, 2024 03:40
@llvmbot llvmbot added clang Clang issues not falling into any other category clang:frontend Language frontend issues, e.g. anything involving "Sema" labels Aug 11, 2024
@llvmbot
Copy link
Member

llvmbot commented Aug 11, 2024

@llvm/pr-subscribers-clang

Author: Vitaly Buka (vitalybuka)

Changes

Reverts llvm/llvm-project#102785


Full diff: https://github.com/llvm/llvm-project/pull/102786.diff

2 Files Affected:

  • (modified) clang/lib/AST/Interp/InterpFrame.cpp (+3-2)
  • (modified) clang/test/AST/Interp/constexpr-frame-describe.cpp (+15)
diff --git a/clang/lib/AST/Interp/InterpFrame.cpp b/clang/lib/AST/Interp/InterpFrame.cpp
index 27108f957305f..4530f28d694e8 100644
--- a/clang/lib/AST/Interp/InterpFrame.cpp
+++ b/clang/lib/AST/Interp/InterpFrame.cpp
@@ -102,8 +102,9 @@ void InterpFrame::popArgs() {
 }
 
 template <typename T>
-static void print(llvm::raw_ostream &OS, const T &V, ASTContext &, QualType) {
-  OS << V;
+static void print(llvm::raw_ostream &OS, const T &V, ASTContext &ASTCtx,
+                  QualType Ty) {
+  V.toAPValue(ASTCtx).printPretty(OS, ASTCtx, Ty);
 }
 
 template <>
diff --git a/clang/test/AST/Interp/constexpr-frame-describe.cpp b/clang/test/AST/Interp/constexpr-frame-describe.cpp
index e039fd61ae981..a0ae046fc0178 100644
--- a/clang/test/AST/Interp/constexpr-frame-describe.cpp
+++ b/clang/test/AST/Interp/constexpr-frame-describe.cpp
@@ -81,3 +81,18 @@ static_assert(bar.fail2<int*, 42>()); // both-error {{constant expression}} \
 static_assert(bar.fail3(3, 4UL, bar, &bar)); // both-error {{constant expression}} \
                                              // expected-note {{in call to 'bar.fail3<int, unsigned long, Bar<int>, const Bar<int> *>(3, 4, &bar, &bar)'}} \
                                              // ref-note {{in call to 'bar.fail3<int, unsigned long, Bar<int>, const Bar<int> *>(3, 4, {}, &bar)'}}
+
+
+
+/// FIXME: Bound member pointer printing doesn't work right, see the last parameter to MemPtr().
+struct MemPtrTest {
+  int n;
+  void f();
+};
+MemPtrTest mpt; // both-note {{here}}
+constexpr int MemPtr(int (MemPtrTest::*a), void (MemPtrTest::*b)(), int &c) {
+  return c; // both-note {{read of non-constexpr variable 'mpt'}}
+}
+static_assert(MemPtr(&MemPtrTest::n, &MemPtrTest::f, mpt.*&MemPtrTest::n), ""); // both-error {{constant expression}} \
+                                                                                // expected-note {{in call to 'MemPtr(&MemPtrTest::n, &MemPtrTest::f, mpt)'}} \
+                                                                                // ref-note {{in call to 'MemPtr(&MemPtrTest::n, &MemPtrTest::f, mpt.n)'}}

@vitalybuka
Copy link
Collaborator Author

I am not sure what is going on there, maybe it needs // UNSUPPORTED: asan

I am not going to reland, it's just a notice, to make sure you noticed the revert.

@vitalybuka
Copy link
Collaborator Author

vitalybuka commented Aug 12, 2024

I am not sure what is going on there, maybe it needs // UNSUPPORTED: asan

I am not going to reland, it's just a notice, to make sure you noticed the revert.

Looks like it some kind of flakiness in the test #102859. It returned https://lab.llvm.org/buildbot/#/builders/52/builds/1526/steps/10/logs/stdio without [Interp] patches.
Please reland this patch at your convenience. Feel free to merge this PR if you like.
Sorry for inconvenience.

Copy link
Contributor

@yronglin yronglin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@tbaederr tbaederr merged commit 367e99e into main Aug 13, 2024
11 checks passed
@tbaederr tbaederr deleted the revert-102785-revert-102735-printing1 branch August 13, 2024 04:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:frontend Language frontend issues, e.g. anything involving "Sema" clang Clang issues not falling into any other category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants