diff options
| author | Roman Divacky <rdivacky@FreeBSD.org> | 2010-01-01 10:34:51 +0000 |
|---|---|---|
| committer | Roman Divacky <rdivacky@FreeBSD.org> | 2010-01-01 10:34:51 +0000 |
| commit | abe15e553e58165e7692c0d0842865c488ed7b45 (patch) | |
| tree | 1e68501209c9133fbda8d45171e59f8d6f12dd55 /test/CodeGenCXX/predefined-expr.cpp | |
| parent | 34d02d0b37f16015f317a935c48ce8b7b64ae77b (diff) | |
Notes
Diffstat (limited to 'test/CodeGenCXX/predefined-expr.cpp')
| -rw-r--r-- | test/CodeGenCXX/predefined-expr.cpp | 143 |
1 files changed, 133 insertions, 10 deletions
diff --git a/test/CodeGenCXX/predefined-expr.cpp b/test/CodeGenCXX/predefined-expr.cpp index 45b4e9f5402f..f5e5ca95282d 100644 --- a/test/CodeGenCXX/predefined-expr.cpp +++ b/test/CodeGenCXX/predefined-expr.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc %s -emit-llvm -o - | FileCheck %s +// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s // CHECK: private constant [15 x i8] c"externFunction\00" // CHECK: private constant [26 x i8] c"void NS::externFunction()\00" @@ -11,6 +11,15 @@ // CHECK: private constant [45 x i8] c"void NS::Base::functionTemplate1(NS::Base *)\00" // CHECK: private constant [38 x i8] c"void NS::Base::functionTemplate1(int)\00" +// CHECK: private constant [23 x i8] c"anonymousUnionFunction\00" +// CHECK: private constant [83 x i8] c"void NS::ContainerForAnonymousRecords::<anonymous union>::anonymousUnionFunction()\00" + +// CHECK: private constant [24 x i8] c"anonymousStructFunction\00" +// CHECK: private constant [85 x i8] c"void NS::ContainerForAnonymousRecords::<anonymous struct>::anonymousStructFunction()\00" + +// CHECK: private constant [23 x i8] c"anonymousClassFunction\00" +// CHECK: private constant [83 x i8] c"void NS::ContainerForAnonymousRecords::<anonymous class>::anonymousClassFunction()\00" + // CHECK: private constant [12 x i8] c"~Destructor\00" // CHECK: private constant [30 x i8] c"NS::Destructor::~Destructor()\00" @@ -22,6 +31,15 @@ // CHECK: private constant [16 x i8] c"virtualFunction\00" // CHECK: private constant [44 x i8] c"virtual void NS::Derived::virtualFunction()\00" +// CHECK: private constant [22 x i8] c"constVolatileFunction\00" +// CHECK: private constant [54 x i8] c"void NS::Base::constVolatileFunction() const volatile\00" + +// CHECK: private constant [17 x i8] c"volatileFunction\00" +// CHECK: private constant [43 x i8] c"void NS::Base::volatileFunction() volatile\00" + +// CHECK: private constant [14 x i8] c"constFunction\00" +// CHECK: private constant [37 x i8] c"void NS::Base::constFunction() const\00" + // CHECK: private constant [26 x i8] c"functionReturingTemplate2\00" // CHECK: private constant [64 x i8] c"ClassTemplate<NS::Base *> NS::Base::functionReturingTemplate2()\00" @@ -48,11 +66,42 @@ // CHECK: private constant [15 x i8] c"inlineFunction\00" // CHECK: private constant [32 x i8] c"void NS::Base::inlineFunction()\00" -// CHECK: private constant [11 x i8] c"staticFunc\00" -// CHECK: private constant [28 x i8] c"void NS::Base::staticFunc()\00" +// CHECK: private constant [15 x i8] c"staticFunction\00" +// CHECK: private constant [39 x i8] c"static void NS::Base::staticFunction()\00" + +// CHECK: private constant [26 x i8] c"topLevelNamespaceFunction\00" +// CHECK: private constant [59 x i8] c"void ClassInTopLevelNamespace::topLevelNamespaceFunction()\00" + +// CHECK: private constant [27 x i8] c"anonymousNamespaceFunction\00" +// CHECK: private constant [84 x i8] c"void <anonymous namespace>::ClassInAnonymousNamespace::anonymousNamespaceFunction()\00" + +// CHECK: private constant [19 x i8] c"localClassFunction\00" +// CHECK: private constant [59 x i8] c"void NS::localClass(int)::LocalClass::localClassFunction()\00" int printf(const char * _Format, ...); +class ClassInTopLevelNamespace { +public: + void topLevelNamespaceFunction() { + printf("__func__ %s\n", __func__); + printf("__FUNCTION__ %s\n", __FUNCTION__); + printf("__PRETTY_FUNCTION__ %s\n\n", __PRETTY_FUNCTION__); + } +}; + +namespace { + + class ClassInAnonymousNamespace { + public: + void anonymousNamespaceFunction() { + printf("__func__ %s\n", __func__); + printf("__FUNCTION__ %s\n", __FUNCTION__); + printf("__PRETTY_FUNCTION__ %s\n\n", __PRETTY_FUNCTION__); + } + }; + +} // end anonymous namespace + namespace NS { template<typename T> @@ -67,7 +116,7 @@ public: class Base { public: - static void staticFunc() { + static void staticFunction() { printf("__func__ %s\n", __func__); printf("__FUNCTION__ %s\n", __FUNCTION__); printf("__PRETTY_FUNCTION__ %s\n\n", __PRETTY_FUNCTION__); @@ -136,6 +185,24 @@ public: printf("__FUNCTION__ %s\n", __FUNCTION__); printf("__PRETTY_FUNCTION__ %s\n\n", __PRETTY_FUNCTION__); } + + void constFunction() const { + printf("__func__ %s\n", __func__); + printf("__FUNCTION__ %s\n", __FUNCTION__); + printf("__PRETTY_FUNCTION__ %s\n\n", __PRETTY_FUNCTION__); + } + + void volatileFunction() volatile { + printf("__func__ %s\n", __func__); + printf("__FUNCTION__ %s\n", __FUNCTION__); + printf("__PRETTY_FUNCTION__ %s\n\n", __PRETTY_FUNCTION__); + } + + void constVolatileFunction() const volatile { + printf("__func__ %s\n", __func__); + printf("__FUNCTION__ %s\n", __FUNCTION__); + printf("__PRETTY_FUNCTION__ %s\n\n", __PRETTY_FUNCTION__); + } }; class Derived : public Base { @@ -167,7 +234,6 @@ public: printf("__FUNCTION__ %s\n", __FUNCTION__); printf("__PRETTY_FUNCTION__ %s\n\n", __PRETTY_FUNCTION__); } - }; class Destructor { @@ -179,17 +245,64 @@ public: } }; +class ContainerForAnonymousRecords { +public: + class { + public: + void anonymousClassFunction() { + printf("__func__ %s\n", __func__); + printf("__FUNCTION__ %s\n", __FUNCTION__); + printf("__PRETTY_FUNCTION__ %s\n\n", __PRETTY_FUNCTION__); + } + } anonymousClass; + + struct { + void anonymousStructFunction() { + printf("__func__ %s\n", __func__); + printf("__FUNCTION__ %s\n", __FUNCTION__); + printf("__PRETTY_FUNCTION__ %s\n\n", __PRETTY_FUNCTION__); + } + } anonymousStruct; + + union { + void anonymousUnionFunction() { + printf("__func__ %s\n", __func__); + printf("__FUNCTION__ %s\n", __FUNCTION__); + printf("__PRETTY_FUNCTION__ %s\n\n", __PRETTY_FUNCTION__); + } + } anonymousUnion; +}; + +void localClass(int) { + class LocalClass { + public: + void localClassFunction() { + printf("__func__ %s\n", __func__); + printf("__FUNCTION__ %s\n", __FUNCTION__); + printf("__PRETTY_FUNCTION__ %s\n\n", __PRETTY_FUNCTION__); + } + }; + LocalClass lc; + lc.localClassFunction(); +} + extern void externFunction() { printf("__func__ %s\n", __func__); printf("__FUNCTION__ %s\n", __FUNCTION__); printf("__PRETTY_FUNCTION__ %s\n\n", __PRETTY_FUNCTION__); } -} +} // end NS namespace int main() { - NS::Base::staticFunc(); + ClassInAnonymousNamespace anonymousNamespace; + anonymousNamespace.anonymousNamespaceFunction(); + + ClassInTopLevelNamespace topLevelNamespace; + topLevelNamespace.topLevelNamespaceFunction(); + NS::Base::staticFunction(); + NS::Base b; b.inlineFunction(); b.virtualFunction(); @@ -203,7 +316,10 @@ int main() { b.functionReturingTemplate2(); b.functionTemplate1<int>(0); b.functionTemplate1<NS::Base *>(0); - + b.constFunction(); + b.volatileFunction(); + b.constVolatileFunction(); + NS::Derived d; d.virtualFunction(); @@ -219,8 +335,15 @@ int main() { { NS::Destructor destructor; } - + + NS::ContainerForAnonymousRecords anonymous; + anonymous.anonymousClass.anonymousClassFunction(); + anonymous.anonymousStruct.anonymousStructFunction(); + anonymous.anonymousUnion.anonymousUnionFunction(); + + NS::localClass(0); + NS::externFunction(); - + return 0; } |
