diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2010-04-19 00:44:22 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2010-04-19 00:44:22 +0000 |
commit | b8cab18e8562994b87f8d7c06f8c122beb712677 (patch) | |
tree | 7b44393cd19437a44d1fdba36fcdd640eafb6ad8 /lib/CodeGen/CGVTables.h | |
parent | 65ad5a42cca954e070428dcc499b62393aa7a6d3 (diff) |
If a method is virtual and the class key function is in another file, emit the method as available_externally.
Fixes PR6747
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101757 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGVTables.h')
-rw-r--r-- | lib/CodeGen/CGVTables.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/CodeGen/CGVTables.h b/lib/CodeGen/CGVTables.h index b4262fe224..bc113ec42f 100644 --- a/lib/CodeGen/CGVTables.h +++ b/lib/CodeGen/CGVTables.h @@ -295,6 +295,15 @@ public: CodeGenVTables(CodeGenModule &CGM) : CGM(CGM) { } + // isKeyFunctionInAnotherTU - True if this record has a key function and it is + // in another translation unit. + static bool isKeyFunctionInAnotherTU(ASTContext &Context, + const CXXRecordDecl *RD) { + assert (RD->isDynamicClass() && "Non dynamic classes have no key."); + const CXXMethodDecl *KeyFunction = Context.getKeyFunction(RD); + return KeyFunction && !KeyFunction->getBody(); + } + /// needsVTTParameter - Return whether the given global decl needs a VTT /// parameter, which it does if it's a base constructor or destructor with /// virtual bases. |