summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGClass.cpp
diff options
context:
space:
mode:
authorDavid Majnemer <david.majnemer@gmail.com>2015-02-02 10:22:20 +0000
committerDavid Majnemer <david.majnemer@gmail.com>2015-02-02 10:22:20 +0000
commit129f417efdab746c92598fbf0b32f487db2d2f20 (patch)
tree06da377b4b488a9884fc18eaa5929bc6827ec976 /clang/lib/CodeGen/CGClass.cpp
parent1f83bbb6feebb05f5ca7fb085d80eb5653476636 (diff)
downloadbcm5719-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.cpp8
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 =
OpenPOWER on IntegriCloud