[clang] 3aae4ca - [clang][Interp] Improve InterpFrame::describe()
Timm Bäder via cfe-commits
cfe-commits at lists.llvm.org
Sun Jul 14 09:21:11 PDT 2024
Author: Timm Bäder
Date: 2024-07-14T18:20:51+02:00
New Revision: 3aae4caffa3134d4edd1811fd2c35cbc95eb7441
URL: https://github.com/llvm/llvm-project/commit/3aae4caffa3134d4edd1811fd2c35cbc95eb7441
DIFF: https://github.com/llvm/llvm-project/commit/3aae4caffa3134d4edd1811fd2c35cbc95eb7441.diff
LOG: [clang][Interp] Improve InterpFrame::describe()
Use getNameForDiagnostic(), like the CallStackFrame of the current
interpreter.
Added:
Modified:
clang/lib/AST/Interp/InterpFrame.cpp
clang/test/AST/Interp/literals.cpp
Removed:
################################################################################
diff --git a/clang/lib/AST/Interp/InterpFrame.cpp b/clang/lib/AST/Interp/InterpFrame.cpp
index b33f74dfe99f..383380f485e0 100644
--- a/clang/lib/AST/Interp/InterpFrame.cpp
+++ b/clang/lib/AST/Interp/InterpFrame.cpp
@@ -167,7 +167,10 @@ void InterpFrame::describe(llvm::raw_ostream &OS) const {
print(OS, This, S.getCtx(), S.getCtx().getRecordType(M->getParent()));
OS << "->";
}
- OS << *F << "(";
+
+ F->getNameForDiagnostic(OS, S.getCtx().getPrintingPolicy(),
+ /*Qualified=*/false);
+ OS << '(';
unsigned Off = 0;
Off += Func->hasRVO() ? primSize(PT_Ptr) : 0;
diff --git a/clang/test/AST/Interp/literals.cpp b/clang/test/AST/Interp/literals.cpp
index 93e7e8b52a45..af5bcb6d48ae 100644
--- a/clang/test/AST/Interp/literals.cpp
+++ b/clang/test/AST/Interp/literals.cpp
@@ -568,37 +568,27 @@ namespace IncDec {
return 1;
}
static_assert(uninit<int, true, true>(), ""); // both-error {{not an integral constant expression}} \
- // ref-note {{in call to 'uninit<int, true, true>()'}} \
- // expected-note {{in call to 'uninit()'}}
+ // both-note {{in call to 'uninit<int, true, true>()'}}
static_assert(uninit<int, false, true>(), ""); // both-error {{not an integral constant expression}} \
- // ref-note {{in call to 'uninit<int, false, true>()'}} \
- // expected-note {{in call to 'uninit()'}}
+ // both-note {{in call to 'uninit<int, false, true>()'}}
static_assert(uninit<float, true, true>(), ""); // both-error {{not an integral constant expression}} \
- // ref-note {{in call to 'uninit<float, true, true>()'}} \
- // expected-note {{in call to 'uninit()'}}
+ // both-note {{in call to 'uninit<float, true, true>()'}}
static_assert(uninit<float, false, true>(), ""); // both-error {{not an integral constant expression}} \
- // ref-note {{in call to 'uninit<float, false, true>()'}} \
- // expected-note {{in call to 'uninit()'}}
+ // both-note {{in call to 'uninit<float, false, true>()'}}
static_assert(uninit<float, true, false>(), ""); // both-error {{not an integral constant expression}} \
- // ref-note {{in call to 'uninit<float, true, false>()'}} \
- // expected-note {{in call to 'uninit()'}}
+ // both-note {{in call to 'uninit<float, true, false>()'}}
static_assert(uninit<float, false, false>(), ""); // both-error {{not an integral constant expression}} \
- // ref-note {{in call to 'uninit<float, false, false>()'}} \
- // expected-note {{in call to 'uninit()'}}
+ // both-note {{in call to 'uninit<float, false, false>()'}}
static_assert(uninit<int*, true, true>(), ""); // both-error {{not an integral constant expression}} \
- // ref-note {{in call to 'uninit<int *, true, true>()'}} \
- // expected-note {{in call to 'uninit()'}}
+ // both-note {{in call to 'uninit<int *, true, true>()'}}
static_assert(uninit<int*, false, true>(), ""); // both-error {{not an integral constant expression}} \
- // ref-note {{in call to 'uninit<int *, false, true>()'}} \
- // expected-note {{in call to 'uninit()'}}
+ // both-note {{in call to 'uninit<int *, false, true>()'}}
static_assert(uninit<int*, true, false>(), ""); // both-error {{not an integral constant expression}} \
- // ref-note {{in call to 'uninit<int *, true, false>()'}} \
- // expected-note {{in call to 'uninit()'}}
+ // both-note {{in call to 'uninit<int *, true, false>()'}}
static_assert(uninit<int*, false, false>(), ""); // both-error {{not an integral constant expression}} \
- // ref-note {{in call to 'uninit<int *, false, false>()'}} \
- // expected-note {{in call to 'uninit()'}}
+ // both-note {{in call to 'uninit<int *, false, false>()'}}
constexpr int OverFlow() { // both-error {{never produces a constant expression}}
int a = INT_MAX;
More information about the cfe-commits
mailing list