Skip to content

Commit 208584d

Browse files
authoredOct 9, 2024
[clang][bytecode] Fix source range of uncalled base dtor (#111683)
Make this emit the same source range as the current interpreter.
1 parent 102c384 commit 208584d

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed
 

‎clang/lib/AST/ByteCode/EvaluationResult.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,9 @@ static bool CheckFieldsInitialized(InterpState &S, SourceLocation Loc,
130130
const Descriptor *Desc = BasePtr.getDeclDesc();
131131
if (const auto *CD = dyn_cast_if_present<CXXRecordDecl>(R->getDecl())) {
132132
const auto &BS = *std::next(CD->bases_begin(), I);
133-
S.FFDiag(BS.getBaseTypeLoc(), diag::note_constexpr_uninitialized_base)
134-
<< B.Desc->getType() << BS.getSourceRange();
133+
SourceLocation TypeBeginLoc = BS.getBaseTypeLoc();
134+
S.FFDiag(TypeBeginLoc, diag::note_constexpr_uninitialized_base)
135+
<< B.Desc->getType() << SourceRange(TypeBeginLoc, BS.getEndLoc());
135136
} else {
136137
S.FFDiag(Desc->getLocation(), diag::note_constexpr_uninitialized_base)
137138
<< B.Desc->getType();

‎clang/test/Misc/constexpr-subobj-init-source-ranges.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// RUN: not %clang_cc1 -fsyntax-only -fdiagnostics-print-source-range-info %s 2>&1 | FileCheck %s --strict-whitespace
2+
// RUN: not %clang_cc1 -fsyntax-only -fdiagnostics-print-source-range-info -fexperimental-new-constant-interpreter %s 2>&1 | FileCheck %s --strict-whitespace
23

34
struct DelBase {
45
constexpr DelBase() = delete;

0 commit comments

Comments
 (0)
Please sign in to comment.