summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDeclCXX.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/Sema/SemaDeclCXX.cpp')
-rw-r--r--clang/lib/Sema/SemaDeclCXX.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp
index 2df172e76e7..1e96bf525ae 100644
--- a/clang/lib/Sema/SemaDeclCXX.cpp
+++ b/clang/lib/Sema/SemaDeclCXX.cpp
@@ -5090,8 +5090,12 @@ void Sema::MaybeMarkVirtualImplicitMembersReferenced(SourceLocation Loc,
return;
CXXRecordDecl *RD = MD->getParent();
- const ASTRecordLayout &Layout = Context.getASTRecordLayout(RD);
- const CXXMethodDecl *KeyFunction = Layout.getKeyFunction();
+
+ // Ignore classes without a vtable.
+ if (!RD->isDynamicClass())
+ return;
+
+ const CXXMethodDecl *KeyFunction = Context.getKeyFunction(RD);
if (!KeyFunction) {
// This record does not have a key function, so we assume that the vtable
OpenPOWER on IntegriCloud