def MsNoVTable : InheritableAttr {
let Spellings = [Declspec<"novtable">];
let Subjects = SubjectList<[CXXRecord]>;
- let Documentation = [Undocumented];
+ let Documentation = [MsNoVTableDocs];
}
def MsProperty : IgnoredAttr {
}];
}
+def MsNoVTableDocs : Documentation {
+ let Category = DocCatType;
+ let Content = [{
+This attribute can be added to a class declaration or definition to signal to
+the compiler that constructors and destructors will not reference the virtual
+function table.
+ }];
+}
+
def OptnoneDocs : Documentation {
let Category = DocCatFunction;
let Content = [{
--- /dev/null
+// RUN: %clang_cc1 -triple i386-pc-win32 %s -emit-llvm -fms-extensions -fms-compatibility -fno-rtti -o - | FileCheck %s
+
+// CHECK-NOT: @"\01??_7C@@6B@"
+
+// CHECK-DAG: @"\01??_7A2@@6B@"
+
+// CHECK-DAG: @"\01??_7B2@@6B@"
+
+// CHECK-NOT: @"\01??_7B1@@6B@"
+
+// CHECK-NOT: @"\01??_7A1@@6B@"
+
+struct __declspec(novtable) A1 {
+ virtual void a();
+} a1;
+struct A2 {
+ virtual void a();
+};
+struct __declspec(novtable) B1 : virtual A1 {} b1;
+struct B2 : virtual A1 {} b2;
+struct __declspec(novtable) C : virtual A2 {} c;
--- /dev/null
+// RUN: %clang_cc1 %s -fsyntax-only -verify -fms-extensions -Wno-microsoft -std=c++11
+
+struct __declspec(novtable) S {};
+enum __declspec(novtable) E {}; // expected-warning{{'novtable' attribute only applies to classes}}
+int __declspec(novtable) I; // expected-warning{{'novtable' attribute only applies to classes}}
+typedef struct T __declspec(novtable) U; // expected-warning{{'novtable' attribute only applies to classes}}