mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Code formatting.
This commit is contained in:
parent
31f3a10fe2
commit
1fd562b49a
1 changed files with 513 additions and 507 deletions
|
@ -246,12 +246,12 @@ public class CPPTemplates {
|
|||
decl = decl.getParent();
|
||||
|
||||
if (decl instanceof ICPPASTExplicitTemplateInstantiation &&
|
||||
parent instanceof ICPPASTElaboratedTypeSpecifier && segment != 0 )
|
||||
{
|
||||
parent instanceof ICPPASTElaboratedTypeSpecifier && segment != 0) {
|
||||
return createClassExplicitInstantiation((ICPPASTElaboratedTypeSpecifier) parent);
|
||||
} else if( ( (parent instanceof ICPPASTElaboratedTypeSpecifier && decl instanceof ICPPASTTemplateDeclaration) ||
|
||||
parent instanceof ICPPASTCompositeTypeSpecifier )
|
||||
&& segment != 0 ){
|
||||
} else if (((parent instanceof ICPPASTElaboratedTypeSpecifier &&
|
||||
decl instanceof ICPPASTTemplateDeclaration) ||
|
||||
parent instanceof ICPPASTCompositeTypeSpecifier) &&
|
||||
segment != 0) {
|
||||
return createClassSpecialization((ICPPASTDeclSpecifier) parent);
|
||||
} else if (parent instanceof ICPPASTFunctionDeclarator && segment != 0) {
|
||||
return createFunctionSpecialization(id);
|
||||
|
@ -262,8 +262,7 @@ public class CPPTemplates {
|
|||
if (parent instanceof ICPPASTNamedTypeSpecifier ||
|
||||
parent instanceof ICPPASTElaboratedTypeSpecifier ||
|
||||
parent instanceof ICPPASTBaseSpecifier ||
|
||||
segment == 0 )
|
||||
{
|
||||
segment == 0) {
|
||||
//class template
|
||||
IASTName templateName = id.getTemplateName();
|
||||
template = templateName.resolveBinding();
|
||||
|
@ -487,8 +486,9 @@ public class CPPTemplates {
|
|||
continue;
|
||||
} else if (o instanceof IBinding) {
|
||||
temp = (IBinding) o;
|
||||
} else
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (temp instanceof ICPPTemplateInstance)
|
||||
temp = ((ICPPTemplateInstance)temp).getTemplateDefinition();
|
||||
|
@ -541,13 +541,14 @@ public class CPPTemplates {
|
|||
ICPPTemplateParameter param = params[j];
|
||||
if (j < numArgs) {
|
||||
arg = templateArguments[j];
|
||||
} else
|
||||
} else {
|
||||
arg = null;
|
||||
}
|
||||
if (map.containsKey(param)) {
|
||||
IType t = (IType) map.get(param);
|
||||
if( arg == null )
|
||||
if (arg == null) {
|
||||
arg = t;
|
||||
else if( !t.isSameType( arg ) ){
|
||||
} else if (!t.isSameType(arg)) {
|
||||
continue outer;
|
||||
}
|
||||
} else if (arg == null || !matchTemplateParameterAndArgument(param, arg, map)) {
|
||||
|
@ -823,14 +824,16 @@ public class CPPTemplates {
|
|||
IASTDeclaration currDecl = decl;
|
||||
for (int j = 0; j < ns.length; j++) {
|
||||
if (ns[j] instanceof ICPPASTTemplateId || j + 1 == ns.length) {
|
||||
if( currDecl == templateDecl )
|
||||
if (currDecl == templateDecl) {
|
||||
return ns[j];
|
||||
if( currDecl instanceof ICPPASTTemplateDeclaration )
|
||||
}
|
||||
if (currDecl instanceof ICPPASTTemplateDeclaration) {
|
||||
currDecl = ((ICPPASTTemplateDeclaration)currDecl).getDeclaration();
|
||||
else
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return name;
|
||||
}
|
||||
|
@ -1024,12 +1027,12 @@ public class CPPTemplates {
|
|||
IType arg = (i < numTemplateArgs) ? CPPVisitor.createType(templateArguments[i]) : null;
|
||||
IType mapped = (IType) map.get(templateParams[i]);
|
||||
|
||||
if( arg != null && mapped != null )
|
||||
if (arg != null && mapped != null) {
|
||||
if (arg.isSameType(mapped))
|
||||
instanceArgs = (IType[]) ArrayUtil.append(IType.class, instanceArgs, arg);
|
||||
else
|
||||
continue outer;
|
||||
else if( arg == null && mapped == null ) {
|
||||
} else if (arg == null && mapped == null) {
|
||||
IType def = null;
|
||||
try {
|
||||
if (templateParams[i] instanceof ICPPTemplateTypeParameter) {
|
||||
|
@ -1051,11 +1054,13 @@ public class CPPTemplates {
|
|||
}
|
||||
}
|
||||
instanceArgs = (IType[]) ArrayUtil.append(IType.class, instanceArgs, def);
|
||||
} else
|
||||
} else {
|
||||
continue outer;
|
||||
} else
|
||||
}
|
||||
} else {
|
||||
instanceArgs = (IType[]) ArrayUtil.append(IType.class, instanceArgs, (arg != null) ? arg : mapped);
|
||||
}
|
||||
}
|
||||
instanceArgs = (IType[]) ArrayUtil.trim(IType.class, instanceArgs);
|
||||
ICPPSpecialization temp = (ICPPSpecialization) ((ICPPInternalTemplateInstantiator)template).instantiate(instanceArgs);
|
||||
if (temp != null)
|
||||
|
@ -1267,11 +1272,11 @@ public class CPPTemplates {
|
|||
* @param template
|
||||
* @return
|
||||
* -for each type template parameter, synthesize a unique type and substitute that for each
|
||||
* occurence of that parameter in the function parameter list
|
||||
* occurrence of that parameter in the function parameter list
|
||||
* -for each non-type template parameter, synthesize a unique value of the appropriate type and
|
||||
* susbstitute that for each occurence of that parameter in the function parameter list
|
||||
* substitute that for each occurrence of that parameter in the function parameter list
|
||||
* for each template template parameter, synthesize a unique class template and substitute that
|
||||
* for each occurence of that parameter in the function parameter list
|
||||
* for each occurrence of that parameter in the function parameter list
|
||||
* @throws DOMException
|
||||
*/
|
||||
|
||||
|
@ -1474,6 +1479,7 @@ public class CPPTemplates {
|
|||
//TODO
|
||||
return true;
|
||||
}
|
||||
|
||||
static protected boolean matchTemplateParameterAndArgument(ICPPTemplateParameter param, IType argument, ObjectMap map) {
|
||||
if (!isValidArgument(param, argument)) {
|
||||
return false;
|
||||
|
@ -1619,7 +1625,7 @@ public class CPPTemplates {
|
|||
arg = (IType) map.get(defaultType);
|
||||
}
|
||||
} else if (defaultType instanceof ICPPInternalDeferredClassInstance) {
|
||||
// Default template parameter may be depend on a previously defined
|
||||
// A default template parameter may be depend on a previously defined
|
||||
// parameter: template<typename T1, typename T2 = A<T1> > class B {};
|
||||
arg = ((ICPPInternalDeferredClassInstance) defaultType).instantiate(map);
|
||||
} else {
|
||||
|
@ -1665,8 +1671,8 @@ public class CPPTemplates {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns an array of specialised bases. The bases will be specialised versions of
|
||||
* the template instances associated specialised bindings bases.
|
||||
* Returns an array of specialized bases. The bases will be specialized versions of
|
||||
* the template instances associated specialized bindings bases.
|
||||
* binding.
|
||||
* @param classInstance
|
||||
* @return
|
||||
|
|
Loading…
Add table
Reference in a new issue