diff options
author | David Majnemer <david.majnemer@gmail.com> | 2015-02-02 10:22:20 +0000 |
---|---|---|
committer | David Majnemer <david.majnemer@gmail.com> | 2015-02-02 10:22:20 +0000 |
commit | 129f417efdab746c92598fbf0b32f487db2d2f20 (patch) | |
tree | 06da377b4b488a9884fc18eaa5929bc6827ec976 /clang/lib/CodeGen/CGClass.cpp | |
parent | 1f83bbb6feebb05f5ca7fb085d80eb5653476636 (diff) | |
download | bcm5719-llvm-129f417efdab746c92598fbf0b32f487db2d2f20.tar.gz bcm5719-llvm-129f417efdab746c92598fbf0b32f487db2d2f20.zip |
MS ABI: Implement support for 'novtable'
It is common for COM interface classes to be marked as 'novtable' to
tell the compiler that constructors and destructors should not reference
virtual function tables.
This commit implements this feature in clang.
llvm-svn: 227796
Diffstat (limited to 'clang/lib/CodeGen/CGClass.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGClass.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CGClass.cpp b/clang/lib/CodeGen/CGClass.cpp index d72eda95d7c..459b7742a26 100644 --- a/clang/lib/CodeGen/CGClass.cpp +++ b/clang/lib/CodeGen/CGClass.cpp @@ -1949,6 +1949,14 @@ CodeGenFunction::InitializeVTablePointer(BaseSubobject Base, const CXXRecordDecl *NearestVBase, CharUnits OffsetFromNearestVBase, const CXXRecordDecl *VTableClass) { + const CXXRecordDecl *RD = Base.getBase(); + + // Don't initialize the vtable pointer if the class is marked with the + // 'novtable' attribute. + if ((RD == VTableClass || RD == NearestVBase) && + VTableClass->hasAttr<MsNoVTableAttr>()) + return; + // Compute the address point. bool NeedsVirtualOffset; llvm::Value *VTableAddressPoint = |