Skip to content

Commit

Permalink
Revert "For #64088: mark vtable as used if we might emit a reference …
Browse files Browse the repository at this point in the history
…to it."

This reverts commit b6847ed.
  • Loading branch information
steelannelida committed Jul 28, 2023
1 parent 7010a4f commit 3b34d69
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 17 deletions.
8 changes: 0 additions & 8 deletions clang/lib/Sema/SemaCast.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -935,14 +935,6 @@ void CastOperation::CheckDynamicCast() {
<< isClangCL;
}

// For a dynamic_cast to a final type, IR generation might emit a reference
// to the vtable.
if (DestRecord) {
auto *DestDecl = DestRecord->getAsCXXRecordDecl();
if (DestDecl->isEffectivelyFinal())
Self.MarkVTableUsed(OpRange.getBegin(), DestDecl);
}

// Done. Everything else is run-time checks.
Kind = CK_Dynamic;
}
Expand Down
9 changes: 0 additions & 9 deletions clang/test/CodeGenCXX/dynamic-cast-exact.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,3 @@ H *exact_multi(A *a) {
// CHECK: phi ptr [ %[[RESULT]], %[[LABEL_NOTNULL]] ], [ null, %[[LABEL_FAILED]] ]
return dynamic_cast<H*>(a);
}

namespace GH64088 {
// Ensure we mark the B vtable as used here, because we're going to emit a
// reference to it.
// CHECK: define {{.*}} @_ZN7GH640881BD0
struct A { virtual ~A(); };
struct B final : A { virtual ~B() = default; };
B *cast(A *p) { return dynamic_cast<B*>(p); }
}

4 comments on commit 3b34d69

@tbaederr
Copy link
Contributor

Choose a reason for hiding this comment

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

You should mention why you reverted a commit.

@BertalanD
Copy link
Member

@BertalanD BertalanD commented on 3b34d69 Jul 29, 2023

Choose a reason for hiding this comment

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

I second @tbaederr. Please explain it and file an issue if appropriate! This revert regresses the build of SerenityOS.

@nico
Copy link
Contributor

@nico nico commented on 3b34d69 Aug 8, 2023

Choose a reason for hiding this comment

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

(There's some follow-up at https://reviews.llvm.org/rG3b34d69ac7a643742364be3591b324ddd14ef9aa#1234621 . I think at least at the moment, comments on commits are more common over on phab than on github.)

@nico
Copy link
Contributor

@nico nico commented on 3b34d69 Aug 8, 2023

Choose a reason for hiding this comment

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

(Also some follow-up at #64088)

Please sign in to comment.