Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorNathan Ridge2018-01-10 22:35:32 +0000
committerNathan Ridge2018-01-17 18:21:19 +0000
commit88da6c08bb8b06f2df3bc7c83a7f6c7f229782d0 (patch)
tree0a0904ff1e291f253990dc93d14d70cc940a8927 /core
parentd822d7ce162297d3d4bf480ba11ce835529c1eae (diff)
downloadorg.eclipse.cdt-88da6c08bb8b06f2df3bc7c83a7f6c7f229782d0.tar.gz
org.eclipse.cdt-88da6c08bb8b06f2df3bc7c83a7f6c7f229782d0.tar.xz
org.eclipse.cdt-88da6c08bb8b06f2df3bc7c83a7f6c7f229782d0.zip
Bug 529646 - Avoid computing the value of static fields for every object of a class type
Diffstat (limited to 'core')
-rw-r--r--core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexCPPBindingResolutionTest.java66
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalConstructor.java3
2 files changed, 69 insertions, 0 deletions
diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexCPPBindingResolutionTest.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexCPPBindingResolutionTest.java
index c83115f0738..d759bb382e6 100644
--- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexCPPBindingResolutionTest.java
+++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexCPPBindingResolutionTest.java
@@ -2495,4 +2495,70 @@ public class IndexCPPBindingResolutionTest extends IndexBindingResolutionTestBas
public void testNestedClassDefinedOutOfLine_502999() throws Exception {
checkBindings();
}
+
+ // class MyClass
+ // {
+ // public:
+ // MyClass( int i )
+ // {
+ // }
+ // static const MyClass CONSTANT_NAME1;
+ // static const MyClass CONSTANT_NAME2;
+ // static const MyClass CONSTANT_NAME3;
+ // static const MyClass CONSTANT_NAME4;
+ // static const MyClass CONSTANT_NAME5;
+ // static const MyClass CONSTANT_NAME6;
+ // static const MyClass CONSTANT_NAME7;
+ // static const MyClass CONSTANT_NAME8;
+ // static const MyClass CONSTANT_NAME9;
+ // static const MyClass CONSTANT_NAME10;
+ // static const MyClass CONSTANT_NAME11;
+ // static const MyClass CONSTANT_NAME12;
+ // static const MyClass CONSTANT_NAME13;
+ // static const MyClass CONSTANT_NAME14;
+ // static const MyClass CONSTANT_NAME15;
+ // static const MyClass CONSTANT_NAME16;
+ // static const MyClass CONSTANT_NAME17;
+ // static const MyClass CONSTANT_NAME18;
+ // static const MyClass CONSTANT_NAME19;
+ // static const MyClass CONSTANT_NAME20;
+ // static const MyClass CONSTANT_NAME21;
+ // static const MyClass CONSTANT_NAME22;
+ // static const MyClass CONSTANT_NAME23;
+ // static const MyClass CONSTANT_NAME24;
+ // static const MyClass CONSTANT_NAME25;
+ // static const MyClass CONSTANT_NAME26;
+ // };
+ //
+ // const MyClass MyClass::CONSTANT_NAME1( 1 );
+ // const MyClass MyClass::CONSTANT_NAME2( 2 );
+ // const MyClass MyClass::CONSTANT_NAME3( 3 );
+ // const MyClass MyClass::CONSTANT_NAME4( 4 );
+ // const MyClass MyClass::CONSTANT_NAME5( 5 );
+ // const MyClass MyClass::CONSTANT_NAME6( 6 );
+ // const MyClass MyClass::CONSTANT_NAME7( 7 );
+ // const MyClass MyClass::CONSTANT_NAME8( 8 );
+ // const MyClass MyClass::CONSTANT_NAME9( 9 );
+ // const MyClass MyClass::CONSTANT_NAME10( 10 );
+ // const MyClass MyClass::CONSTANT_NAME11( 11 );
+ // const MyClass MyClass::CONSTANT_NAME12( 12 );
+ // const MyClass MyClass::CONSTANT_NAME13( 13 );
+ // const MyClass MyClass::CONSTANT_NAME14( 14 );
+ // const MyClass MyClass::CONSTANT_NAME15( 15 );
+ // const MyClass MyClass::CONSTANT_NAME16( 16 );
+ // const MyClass MyClass::CONSTANT_NAME17( 17 );
+ // const MyClass MyClass::CONSTANT_NAME18( 18 );
+ // const MyClass MyClass::CONSTANT_NAME19( 19 );
+ // const MyClass MyClass::CONSTANT_NAME20( 20 );
+ // const MyClass MyClass::CONSTANT_NAME21( 21 );
+ // const MyClass MyClass::CONSTANT_NAME22( 22 );
+ // const MyClass MyClass::CONSTANT_NAME23( 23 );
+ // const MyClass MyClass::CONSTANT_NAME24( 24 );
+ // const MyClass MyClass::CONSTANT_NAME25( 25 );
+ // const MyClass MyClass::CONSTANT_NAME26( 26 );
+
+ // // empty file
+ public void testOOM_529646() throws Exception {
+ checkBindings();
+ }
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalConstructor.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalConstructor.java
index 1f3b058d748..5dbf28390fa 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalConstructor.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalConstructor.java
@@ -176,6 +176,9 @@ public final class EvalConstructor extends CPPDependentEvaluation {
ICPPField[] fields = classType.getDeclaredFields();
for (ICPPField field : fields) {
+ if (field.isStatic()) {
+ continue;
+ }
final Map.Entry<IBinding, ICPPEvaluation> initializer =
getInitializerFromMemberInitializerList(field, exec);

Back to the top