Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: e851cdc10bc88e9366c1fcfcd50225f984d90204 (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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
/*******************************************************************************
 * Copyright (c) 2010 Google, Inc 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:
 * 	   Sergey Prigogin (Google) - initial API and implementation
 *******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp.semantics;

import org.eclipse.cdt.core.dom.ILinkage;
import org.eclipse.cdt.core.dom.ast.DOMException;
import org.eclipse.cdt.core.dom.ast.IBasicType.Kind;
import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.IScope;
import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunctionTemplate;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunctionType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPParameter;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameter;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateTypeParameter;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPASTName;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPBasicType;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPFunctionType;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPTemplateTypeParameter;
import org.eclipse.core.runtime.CoreException;

/**
 * This class represents a template function used for deducing 'auto' types (C++0x: 7.1.6.4).
 */
class AutoTypeResolver implements ICPPFunctionTemplate {
	// Template parameter of the function. This parameter is used in place of 'auto' keyword.
	public static final ICPPTemplateTypeParameter AUTO_TYPE =
			new CPPTemplateTypeParameter(new CPPASTName(), false);
	private static final ICPPTemplateTypeParameter[] TEMPLATE_PARAMETERS =
			new ICPPTemplateTypeParameter[] { AUTO_TYPE };
	private static final String UNEXPECTED_CALL = "Unexpected call"; //$NON-NLS-1$
	private final CPPFunctionType functionType;

	public AutoTypeResolver(IType paramType) {
		functionType = new CPPFunctionType(new CPPBasicType(Kind.eVoid, 0), new IType[] { paramType });
	}
	
	public ICPPTemplateParameter[] getTemplateParameters() {
		return TEMPLATE_PARAMETERS;
	}
	
	public ICPPFunctionType getType() {
		return functionType;
	}

	public boolean isMutable() {
		return false;
	}

	public boolean isInline() {
		return false;
	}

	public boolean isExternC() {
		return false;
	}

	public boolean isDeleted() {
		return false;
	}

	public IType[] getExceptionSpecification() {
		return null;
	}

	public ICPPParameter[] getParameters() {
		throw new UnsupportedOperationException(UNEXPECTED_CALL);
	}

	public int getRequiredArgumentCount() {
		return 1;
	}

	public boolean hasParameterPack() {
		return false;
	}

	public IScope getFunctionScope() {
		throw new UnsupportedOperationException(UNEXPECTED_CALL);
	}

	public boolean isStatic() {
		return false;
	}

	public boolean isExtern() {
		return false;
	}

	public boolean isAuto() {
		return false;
	}

	public boolean isRegister() {
		return false;
	}

	public boolean takesVarArgs() {
		return false;
	}

	public String getName() {
		throw new UnsupportedOperationException(UNEXPECTED_CALL);
	}

	public char[] getNameCharArray() {
		throw new UnsupportedOperationException(UNEXPECTED_CALL);
	}

	public ILinkage getLinkage() throws CoreException {
		throw new UnsupportedOperationException(UNEXPECTED_CALL);
	}

	public IBinding getOwner() {
		throw new UnsupportedOperationException(UNEXPECTED_CALL);
	}

	public IScope getScope() throws DOMException {
		throw new UnsupportedOperationException(UNEXPECTED_CALL);
	}

	@SuppressWarnings("rawtypes")
	public Object getAdapter(Class adapter) {
		throw new UnsupportedOperationException(UNEXPECTED_CALL);
	}

	public String[] getQualifiedName() throws DOMException {
		throw new UnsupportedOperationException(UNEXPECTED_CALL);
	}

	public char[][] getQualifiedNameCharArray() throws DOMException {
		throw new UnsupportedOperationException(UNEXPECTED_CALL);
	}

	public boolean isGloballyQualified() throws DOMException {
		throw new UnsupportedOperationException(UNEXPECTED_CALL);
	}
}

Back to the top