~ubuntu-branches/debian/sid/eclipse-cdt/sid

« back to all changes in this revision

Viewing changes to core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/composite/cpp/CompositeCPPClassSpecialization.java

  • Committer: Package Import Robot
  • Author(s): Jakub Adam
  • Date: 2013-10-03 20:30:16 UTC
  • mfrom: (1.1.11)
  • Revision ID: package-import@ubuntu.com-20131003203016-d4ug6l0xgosasumq
Tags: 8.2.1-1
* New upstream release.
* Updated autotools documentation sources.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*******************************************************************************
2
 
 * Copyright (c) 2007, 2012 Symbian Software Systems and others.
 
2
 * Copyright (c) 2007, 2013 Symbian Software Systems and others.
3
3
 * All rights reserved. This program and the accompanying materials
4
4
 * are made available under the terms of the Eclipse Public License v1.0
5
5
 * which accompanies this distribution, and is available at
42
42
 
43
43
public class CompositeCPPClassSpecialization extends CompositeCPPClassType implements ICPPClassSpecialization {
44
44
        private ObjectMap specializationMap;
45
 
        private final ThreadLocal<Set<IBinding>> fInProgress= new ThreadLocal<Set<IBinding>>();
 
45
        private final ThreadLocal<Set<IBinding>> fInProgress= new ThreadLocal<Set<IBinding>>() {
 
46
                @Override
 
47
                protected Set<IBinding> initialValue() {
 
48
                        return new HashSet<IBinding>();
 
49
                }
 
50
        };
46
51
 
47
52
        public CompositeCPPClassSpecialization(ICompositesFactory cf, ICPPClassType rbinding) {
48
53
                super(cf, rbinding);
103
108
                                specializationMap= (ObjectMap) frag.putCachedResult(key, newMap, false);
104
109
                        }
105
110
                }
106
 
                Set<IBinding> set;
107
111
                synchronized (specializationMap) {
108
112
                        IBinding result= (IBinding) specializationMap.get(original);
109
113
                        if (result != null) 
110
114
                                return result;
111
 
                        set= fInProgress.get();
112
 
                        if (set == null) {
113
 
                                set= new HashSet<IBinding>();
114
 
                                fInProgress.set(set);
115
 
                        } 
116
 
                        if (!set.add(original)) 
117
 
                                return RecursionResolvingBinding.createFor(original, point);
118
 
                }
119
 
                IBinding newSpec= CPPTemplates.createSpecialization(this, original, point);
120
 
                set.remove(original);
 
115
                }
 
116
 
 
117
                IBinding newSpec;
 
118
                Set<IBinding> recursionProtectionSet= fInProgress.get();
 
119
                if (!recursionProtectionSet.add(original))
 
120
                        return RecursionResolvingBinding.createFor(original, point);
 
121
 
 
122
                try {
 
123
                        newSpec= CPPTemplates.createSpecialization(this, original, point);
 
124
                } finally {
 
125
                        recursionProtectionSet.remove(original);
 
126
                }
121
127
 
122
128
                synchronized (specializationMap) {
123
129
                        IBinding oldSpec= (IBinding) specializationMap.put(original, newSpec);