Skip to content

Commit

Permalink
[clang][bytecode] Fix source range of uncalled base dtor (llvm#111683)
Browse files Browse the repository at this point in the history
Make this emit the same source range as the current interpreter.
  • Loading branch information
tbaederr authored Oct 9, 2024
1 parent 102c384 commit 208584d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
5 changes: 3 additions & 2 deletions clang/lib/AST/ByteCode/EvaluationResult.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,9 @@ static bool CheckFieldsInitialized(InterpState &S, SourceLocation Loc,
const Descriptor *Desc = BasePtr.getDeclDesc();
if (const auto *CD = dyn_cast_if_present<CXXRecordDecl>(R->getDecl())) {
const auto &BS = *std::next(CD->bases_begin(), I);
S.FFDiag(BS.getBaseTypeLoc(), diag::note_constexpr_uninitialized_base)
<< B.Desc->getType() << BS.getSourceRange();
SourceLocation TypeBeginLoc = BS.getBaseTypeLoc();
S.FFDiag(TypeBeginLoc, diag::note_constexpr_uninitialized_base)
<< B.Desc->getType() << SourceRange(TypeBeginLoc, BS.getEndLoc());
} else {
S.FFDiag(Desc->getLocation(), diag::note_constexpr_uninitialized_base)
<< B.Desc->getType();
Expand Down
1 change: 1 addition & 0 deletions clang/test/Misc/constexpr-subobj-init-source-ranges.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// RUN: not %clang_cc1 -fsyntax-only -fdiagnostics-print-source-range-info %s 2>&1 | FileCheck %s --strict-whitespace
// RUN: not %clang_cc1 -fsyntax-only -fdiagnostics-print-source-range-info -fexperimental-new-constant-interpreter %s 2>&1 | FileCheck %s --strict-whitespace

struct DelBase {
constexpr DelBase() = delete;
Expand Down

0 comments on commit 208584d

Please sign in to comment.