Skip to content

Commit 3aae4ca

Browse files
committed
[clang][Interp] Improve InterpFrame::describe()
Use getNameForDiagnostic(), like the CallStackFrame of the current interpreter.
1 parent 61a4e1e commit 3aae4ca

File tree

2 files changed

+14
-21
lines changed

2 files changed

+14
-21
lines changed

clang/lib/AST/Interp/InterpFrame.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,10 @@ void InterpFrame::describe(llvm::raw_ostream &OS) const {
167167
print(OS, This, S.getCtx(), S.getCtx().getRecordType(M->getParent()));
168168
OS << "->";
169169
}
170-
OS << *F << "(";
170+
171+
F->getNameForDiagnostic(OS, S.getCtx().getPrintingPolicy(),
172+
/*Qualified=*/false);
173+
OS << '(';
171174
unsigned Off = 0;
172175

173176
Off += Func->hasRVO() ? primSize(PT_Ptr) : 0;

clang/test/AST/Interp/literals.cpp

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -568,37 +568,27 @@ namespace IncDec {
568568
return 1;
569569
}
570570
static_assert(uninit<int, true, true>(), ""); // both-error {{not an integral constant expression}} \
571-
// ref-note {{in call to 'uninit<int, true, true>()'}} \
572-
// expected-note {{in call to 'uninit()'}}
571+
// both-note {{in call to 'uninit<int, true, true>()'}}
573572
static_assert(uninit<int, false, true>(), ""); // both-error {{not an integral constant expression}} \
574-
// ref-note {{in call to 'uninit<int, false, true>()'}} \
575-
// expected-note {{in call to 'uninit()'}}
573+
// both-note {{in call to 'uninit<int, false, true>()'}}
576574

577575
static_assert(uninit<float, true, true>(), ""); // both-error {{not an integral constant expression}} \
578-
// ref-note {{in call to 'uninit<float, true, true>()'}} \
579-
// expected-note {{in call to 'uninit()'}}
576+
// both-note {{in call to 'uninit<float, true, true>()'}}
580577
static_assert(uninit<float, false, true>(), ""); // both-error {{not an integral constant expression}} \
581-
// ref-note {{in call to 'uninit<float, false, true>()'}} \
582-
// expected-note {{in call to 'uninit()'}}
578+
// both-note {{in call to 'uninit<float, false, true>()'}}
583579
static_assert(uninit<float, true, false>(), ""); // both-error {{not an integral constant expression}} \
584-
// ref-note {{in call to 'uninit<float, true, false>()'}} \
585-
// expected-note {{in call to 'uninit()'}}
580+
// both-note {{in call to 'uninit<float, true, false>()'}}
586581
static_assert(uninit<float, false, false>(), ""); // both-error {{not an integral constant expression}} \
587-
// ref-note {{in call to 'uninit<float, false, false>()'}} \
588-
// expected-note {{in call to 'uninit()'}}
582+
// both-note {{in call to 'uninit<float, false, false>()'}}
589583

590584
static_assert(uninit<int*, true, true>(), ""); // both-error {{not an integral constant expression}} \
591-
// ref-note {{in call to 'uninit<int *, true, true>()'}} \
592-
// expected-note {{in call to 'uninit()'}}
585+
// both-note {{in call to 'uninit<int *, true, true>()'}}
593586
static_assert(uninit<int*, false, true>(), ""); // both-error {{not an integral constant expression}} \
594-
// ref-note {{in call to 'uninit<int *, false, true>()'}} \
595-
// expected-note {{in call to 'uninit()'}}
587+
// both-note {{in call to 'uninit<int *, false, true>()'}}
596588
static_assert(uninit<int*, true, false>(), ""); // both-error {{not an integral constant expression}} \
597-
// ref-note {{in call to 'uninit<int *, true, false>()'}} \
598-
// expected-note {{in call to 'uninit()'}}
589+
// both-note {{in call to 'uninit<int *, true, false>()'}}
599590
static_assert(uninit<int*, false, false>(), ""); // both-error {{not an integral constant expression}} \
600-
// ref-note {{in call to 'uninit<int *, false, false>()'}} \
601-
// expected-note {{in call to 'uninit()'}}
591+
// both-note {{in call to 'uninit<int *, false, false>()'}}
602592

603593
constexpr int OverFlow() { // both-error {{never produces a constant expression}}
604594
int a = INT_MAX;

0 commit comments

Comments
 (0)