diff options
author | Markus Schorn | 2006-10-13 08:46:20 +0000 |
---|---|---|
committer | Markus Schorn | 2006-10-13 08:46:20 +0000 |
commit | 4c2b2120e49bda069e08a1cb69fb67723aedcb28 (patch) | |
tree | 6bc565bf196ed0fac2fb28ca4cdf286ed7c6e404 /core/org.eclipse.cdt.core.tests/resources | |
parent | 08a632ecc7549c64e3761af7700ce4bf69a85862 (diff) | |
download | org.eclipse.cdt-4c2b2120e49bda069e08a1cb69fb67723aedcb28.tar.gz org.eclipse.cdt-4c2b2120e49bda069e08a1cb69fb67723aedcb28.tar.xz org.eclipse.cdt-4c2b2120e49bda069e08a1cb69fb67723aedcb28.zip |
Variable and function annotations in PDOM, by Jason Montojo, bug 159595.
Diffstat (limited to 'core/org.eclipse.cdt.core.tests/resources')
9 files changed, 359 insertions, 0 deletions
diff --git a/core/org.eclipse.cdt.core.tests/resources/pdomtests/compositeTypeTests/compositeType.cpp b/core/org.eclipse.cdt.core.tests/resources/pdomtests/compositeTypeTests/compositeType.cpp new file mode 100644 index 00000000000..ce2a71c4b4d --- /dev/null +++ b/core/org.eclipse.cdt.core.tests/resources/pdomtests/compositeTypeTests/compositeType.cpp @@ -0,0 +1,120 @@ +struct SimpleStructure { + char ssa; +}; + +struct Structure1 { + int s1a; + double s1b; + struct Structure2 { + float s2a; + struct Structure3 { + char s3a; + } s2b; + } s1c; +}; + +union Union1 { + int u1a; + double u1b; + char u1c; + union Union2 { + int u2a; + } u1d; +}; + +struct MixedS1 { + union MixedU1 { + struct MixedS2 { + double ms2a; + } mu1a; + union MixedU2 { + int mu2a; + } mu1b; + float mu1c; + } ms1a; + struct MixedS3 { + char ms3a; + } ms1b; +} + +int main() { + struct SimpleStructure ss; + struct SimpleStructure *pss; + + ss.ssa = 0; + pss->ssa = 1; + + struct Structure1 s1; + struct Structure1 *ps1 = &s1; + + s1.s1a = 0; + ps1->s1a = 1; + + s1.s1b = 2; + s1.s1b = 3; + ps1->s1b = 4; + + struct Structure1::Structure2 s2; + struct Structure1::Structure2 *ps2 = &s2; + + s1.s1c = s2; + s1.s1c = s2; + s1.s1c = s2; + ps1->s1c = s2; + + struct Structure1::Structure2::Structure3 s3; + struct Structure1::Structure2::Structure3 *ps3 = &s3; + + s1.s1c.s2b = 9; + s1.s1c.s2b = 10; + s1.s1c.s2b = 11; + ps1->s1c.s2b = 12; + ps2->s2b = 13; + + s1.s1c.s2b.s3a = 13; + s1.s1c.s2b.s3a = 14; + s1.s1c.s2b.s3a = 15; + s1.s1c.s2b.s3a = 16; + s1.s1c.s2b.s3a = 17; + ps1->s1c.s2b.s3a = 18; + ps2->s2b.s3a = 19; + ps3->s3a = 19; + + Union1 u1; + Union1 *pu1 = &u1; + + u1.u1a = 0; + pu1->u1a = 1; + + Union1::Union2 u2; + Union1::Union2 *pu2 = &u1.u1d; + + u2.u2a = 2; + pu2->u2a = 3; + + MixedS1::MixedU1 mu1; + MixedS1::MixedU1 *pmu1 = &mu1; + + mu1.mu1a; + pmu1->mu1a; + + MixedS1::MixedU1::MixedU2 mu2; + MixedS1::MixedU1::MixedU2 *pmu2 = &mu2; + + mu2.mu2a; + pmu2->mu2a; + + MixedS1::MixedU1::MixedS2 ms2; + MixedS1::MixedU1::MixedS2 *pms2 = &ms2; + + ms2.ms2a; + pms2->ms2a; + + MixedS1::MixedS3 ms3; + MixedS1::MixedS3 *pms3 = &ms3; + + ms3.ms3a; + pms3->ms3a; + + return 0; +} diff --git a/core/org.eclipse.cdt.core.tests/resources/pdomtests/fieldTests/fields.cpp b/core/org.eclipse.cdt.core.tests/resources/pdomtests/fieldTests/fields.cpp new file mode 100644 index 00000000000..e54fccffac3 --- /dev/null +++ b/core/org.eclipse.cdt.core.tests/resources/pdomtests/fieldTests/fields.cpp @@ -0,0 +1,60 @@ +class Class1 { + int defaultField = 0; + + mutable int mutableField; + static int staticField; + +private: + double privateField = 4.5; +protected: + char protectedField = 'A'; +public: + long publicField = 20; + + int c1a; + double c1b; + + Class1(); + ~Class1(); +}; + +class Class2 : public Class1 { +public: + char c2a; + float c2b; + + Class2(); + ~Class2(); +}; + +Class1::Class1() { +} + +Class1::~Class1() { +} + +Class2::Class2() { +} + +Class2::~Class2() { +} + +int main() { + Class1 c1; + Class1 *pc1 = &c1; + + Class2 c2; + Class2 *pc2 = &c2; + + c1.c1a = 0; + pc1->c1a = 1; + + c2.c1a = 2; + pc2->c1a = 3; + + c2.c2a = 4; + c2.c2a = 5; + pc2->c2a = 6; + + return 0; +} diff --git a/core/org.eclipse.cdt.core.tests/resources/pdomtests/functionTests/declarations.cpp b/core/org.eclipse.cdt.core.tests/resources/pdomtests/functionTests/declarations.cpp new file mode 100644 index 00000000000..79fb12bc8aa --- /dev/null +++ b/core/org.eclipse.cdt.core.tests/resources/pdomtests/functionTests/declarations.cpp @@ -0,0 +1,21 @@ +void forwardDeclaration(); + +void normalDeclaration1() { + forwardDeclaration(); +} + +void normalDeclaration2() { + normalDeclaration1(); +} + +void forwardDeclaration() { + normalDeclaration2(); +} + +void spin() { + normalDeclaration1(); + normalDeclaration2(); + normalDeclaration2(); + forwardDeclaration(); +} + diff --git a/core/org.eclipse.cdt.core.tests/resources/pdomtests/functionTests/modifiers.c b/core/org.eclipse.cdt.core.tests/resources/pdomtests/functionTests/modifiers.c new file mode 100644 index 00000000000..da086afa48c --- /dev/null +++ b/core/org.eclipse.cdt.core.tests/resources/pdomtests/functionTests/modifiers.c @@ -0,0 +1,13 @@ +double normalCFunction(int p1, char p2, float p3); +static int staticCFunction(double p1); +extern float externCFunction(int p1); +inline void inlineCFunction(long p1); +void varArgsCFunction(int p1, ...); +const void constCFunction(); +volatile void volatileCFunction(); + +void voidCFunction(); +int intCFunction(); +double doubleCFunction(); +char charCFunction(); +float floatCFunction(); diff --git a/core/org.eclipse.cdt.core.tests/resources/pdomtests/functionTests/modifiers.cpp b/core/org.eclipse.cdt.core.tests/resources/pdomtests/functionTests/modifiers.cpp new file mode 100644 index 00000000000..41edbcd4e75 --- /dev/null +++ b/core/org.eclipse.cdt.core.tests/resources/pdomtests/functionTests/modifiers.cpp @@ -0,0 +1,11 @@ +double normalCPPFunction(int p1, char p2, float p3); +static int staticCPPFunction(double p1); +extern float externCPPFunction(int p1); +inline void inlineCPPFunction(long p1); +void varArgsCPPFunction(int p1, ...); + +void voidCPPFunction(); +int intCPPFunction(); +double doubleCPPFunction(); +char charCPPFunction(); +float floatCPPFunction(); diff --git a/core/org.eclipse.cdt.core.tests/resources/pdomtests/functionTests/overloaded.cpp b/core/org.eclipse.cdt.core.tests/resources/pdomtests/functionTests/overloaded.cpp new file mode 100644 index 00000000000..2968b2f42b7 --- /dev/null +++ b/core/org.eclipse.cdt.core.tests/resources/pdomtests/functionTests/overloaded.cpp @@ -0,0 +1,13 @@ +void overloadedFunction() { +} + +void overloadedFunction(int p1) { +} + +int main() { + overloadedFunction(); + overloadedFunction(1); + overloadedFunction(1); + + return 0; +} diff --git a/core/org.eclipse.cdt.core.tests/resources/pdomtests/methodTests/inheritance.cpp b/core/org.eclipse.cdt.core.tests/resources/pdomtests/methodTests/inheritance.cpp new file mode 100644 index 00000000000..782139217c3 --- /dev/null +++ b/core/org.eclipse.cdt.core.tests/resources/pdomtests/methodTests/inheritance.cpp @@ -0,0 +1,113 @@ +class Class1 { +public: + double normalMethod(int p1, char p2, float p3); + virtual void inheritedMethod(); + virtual void pureVirtualMethod() = 0; + virtual void overriddenMethod(); + + inline int inlineMethod(); + static int staticMethod(); + int varArgsMethod(...); + int constMethod() const; + int volatileMethod() volatile; + int constVolatileMethod() const volatile; + + // Here, const/volatile applies to the return value, not the method + const int *notConstMethod(); + volatile int *notVolatileMethod(); + const volatile int *notConstVolatileMethod(); + + Class1(); + virtual ~Class1() = 0; +}; + +class Class2 : public Class1 { +public: + void pureVirtualMethod(); + void overriddenMethod(); + void overloadedMethod(); + void overloadedMethod(int p1); + + Class2(); + ~Class2(); +}; + +double Class1::normalMethod(int p1, char p2, float p3) { +} + +void Class1::inheritedMethod() { +} + +void Class1::overriddenMethod() { +} + +void Class2::pureVirtualMethod() { +} + +void Class2::overriddenMethod() { +} + +void Class2::overloadedMethod() { +} + +void Class2::overloadedMethod(int p1) { +} + +Class1::Class1() { +} + +Class1::~Class1() { +} + +Class2::Class2() { +} + +Class2::~Class2() { +} + +class Class3 { + int defaultMethod(); +private: + void privateMethod(); +protected: + char protectedMethod(); +public: + double publicMethod(); +}; + +int main() { + Class2 c2; + + Class1 *pc1 = &c2; + Class2 *pc2 = &c2; + + pc1->inheritedMethod(); + + pc1->pureVirtualMethod(); + pc1->pureVirtualMethod(); + + pc1->overriddenMethod(); + pc1->overriddenMethod(); + pc1->overriddenMethod(); + + c2.inheritedMethod(); + pc2->inheritedMethod(); + + c2.pureVirtualMethod(); + c2.pureVirtualMethod(); + pc2->pureVirtualMethod(); + + c2.overriddenMethod(); + c2.overriddenMethod(); + c2.overriddenMethod(); + pc2->overriddenMethod(); + + c2.overloadedMethod(); + pc2->overloadedMethod(); + + c2.overloadedMethod(1); + c2.overloadedMethod(1); + pc2->overloadedMethod(1); + + return 0; +} diff --git a/core/org.eclipse.cdt.core.tests/resources/pdomtests/variableTests/variables.c b/core/org.eclipse.cdt.core.tests/resources/pdomtests/variableTests/variables.c new file mode 100644 index 00000000000..2b1e886d41a --- /dev/null +++ b/core/org.eclipse.cdt.core.tests/resources/pdomtests/variableTests/variables.c @@ -0,0 +1,4 @@ +auto int autoCVariable; +extern int externCVariable; +register int registerCVariable; +static int staticCVariable; diff --git a/core/org.eclipse.cdt.core.tests/resources/pdomtests/variableTests/variables.cpp b/core/org.eclipse.cdt.core.tests/resources/pdomtests/variableTests/variables.cpp new file mode 100644 index 00000000000..0611def6d44 --- /dev/null +++ b/core/org.eclipse.cdt.core.tests/resources/pdomtests/variableTests/variables.cpp @@ -0,0 +1,4 @@ +auto int autoCPPVariable; +extern int externCPPVariable; +register int registerCPPVariable; +static int staticCPPVariable; |