Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: f9b12306882e2e6950b1dbe0736e41a54713306b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/*************************************************************************
 * Copyright (c) 2005, 2012 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *     Markus Schorn (Wind River Systems)
 *******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp;

import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructor;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPConstructorSpecialization;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunctionType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameterMap;
import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPTemplates;

/**
 * Specialization of a constructor for a class-template or class-template specialization.
 */
public class CPPConstructorSpecialization extends CPPMethodSpecialization 
		implements ICPPConstructorSpecialization {

	public CPPConstructorSpecialization(ICPPConstructor orig, ICPPClassType owner,
			ICPPTemplateParameterMap argMap, ICPPFunctionType type, IType[] exceptionSpecs) {
		super(orig, owner, argMap, type, exceptionSpecs);
	}
	static <T extends ICPPConstructorSpecialization & ICPPInternalBinding> ICPPExecution 
			getConstructorChainExecution(T functionSpec) {
		if (!functionSpec.isConstexpr()) {
			return null;
		}

		IASTNode def = functionSpec.getDefinition();
		if (def != null) {
			return CPPConstructor.computeConstructorChainExecution(def);
		}
		return CPPTemplates.instantiateConstructorChain(functionSpec);
	}

	@Override
	public ICPPExecution getConstructorChainExecution() {
		return getConstructorChainExecution(this);
	}
	
	@Override
	public ICPPExecution getConstructorChainExecution(IASTNode point) {
		return getConstructorChainExecution();
	}
}

Back to the top