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
e19a8cf4bc
commit
3a3a353075
3 changed files with 98 additions and 108 deletions
|
@ -39,8 +39,10 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVisitor;
|
|||
/**
|
||||
* @author aniefer
|
||||
*/
|
||||
public class CPPFunctionTemplate extends CPPTemplateDefinition implements ICPPFunctionTemplate, ICPPFunction, ICPPInternalFunction {
|
||||
public static final class CPPFunctionTemplateProblem extends ProblemBinding implements ICPPFunctionTemplate, ICPPFunction {
|
||||
public class CPPFunctionTemplate extends CPPTemplateDefinition
|
||||
implements ICPPFunctionTemplate, ICPPFunction, ICPPInternalFunction {
|
||||
public static final class CPPFunctionTemplateProblem extends ProblemBinding
|
||||
implements ICPPFunctionTemplate, ICPPFunction {
|
||||
public CPPFunctionTemplateProblem(IASTNode node, int id, char[] arg) {
|
||||
super(node, id, arg);
|
||||
}
|
||||
|
@ -108,7 +110,6 @@ public class CPPFunctionTemplate extends CPPTemplateDefinition implements ICPPFu
|
|||
super.addDefinition(node);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void addDeclaration(IASTNode node) {
|
||||
if (!(node instanceof IASTName))
|
||||
|
@ -116,6 +117,7 @@ public class CPPFunctionTemplate extends CPPTemplateDefinition implements ICPPFu
|
|||
updateFunctionParameterBindings((IASTName) node);
|
||||
super.addDeclaration(node);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param name
|
||||
*/
|
||||
|
@ -135,7 +137,6 @@ public class CPPFunctionTemplate extends CPPTemplateDefinition implements ICPPFu
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
public IParameter[] getParameters() {
|
||||
IASTName name = getTemplateName();
|
||||
ICPPASTFunctionDeclarator fdecl= getDeclaratorByName(name);
|
||||
|
@ -150,9 +151,9 @@ public class CPPFunctionTemplate extends CPPTemplateDefinition implements ICPPFu
|
|||
final IBinding binding= pname.resolveBinding();
|
||||
if (binding instanceof IParameter) {
|
||||
result[i]= (IParameter) binding;
|
||||
}
|
||||
else {
|
||||
result[i] = new CPPParameter.CPPParameterProblem(p, IProblemBinding.SEMANTIC_INVALID_TYPE, pname.toCharArray());
|
||||
} else {
|
||||
result[i] = new CPPParameter.CPPParameterProblem(p,
|
||||
IProblemBinding.SEMANTIC_INVALID_TYPE, pname.toCharArray());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -161,12 +162,10 @@ public class CPPFunctionTemplate extends CPPTemplateDefinition implements ICPPFu
|
|||
return null;
|
||||
}
|
||||
|
||||
|
||||
public IScope getFunctionScope() {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public IFunctionType getType() {
|
||||
if (type == null) {
|
||||
IASTName name = getTemplateName();
|
||||
|
@ -192,10 +191,11 @@ public class CPPFunctionTemplate extends CPPTemplateDefinition implements ICPPFu
|
|||
parent = parent.getParent();
|
||||
|
||||
IASTDeclSpecifier declSpec = null;
|
||||
if( parent instanceof IASTSimpleDeclaration )
|
||||
if (parent instanceof IASTSimpleDeclaration) {
|
||||
declSpec = ((IASTSimpleDeclaration)parent).getDeclSpecifier();
|
||||
else if( parent instanceof IASTFunctionDefinition )
|
||||
} else if (parent instanceof IASTFunctionDefinition) {
|
||||
declSpec = ((IASTFunctionDefinition)parent).getDeclSpecifier();
|
||||
}
|
||||
if (declSpec != null && declSpec.getStorageClass() == storage) {
|
||||
return true;
|
||||
}
|
||||
|
@ -208,7 +208,6 @@ public class CPPFunctionTemplate extends CPPTemplateDefinition implements ICPPFu
|
|||
return false;
|
||||
}
|
||||
|
||||
|
||||
public IBinding resolveParameter(IASTParameterDeclaration param) {
|
||||
IASTName name = CPPVisitor.findInnermostDeclarator(param.getDeclarator()).getName();
|
||||
IBinding binding = name.getBinding();
|
||||
|
@ -261,7 +260,6 @@ public class CPPFunctionTemplate extends CPPTemplateDefinition implements ICPPFu
|
|||
return hasStorageClass(ICPPASTDeclSpecifier.sc_mutable);
|
||||
}
|
||||
|
||||
|
||||
public boolean isInline() throws DOMException {
|
||||
IASTName name = (IASTName) getDefinition();
|
||||
IASTNode[] ns = getDeclarations();
|
||||
|
@ -273,10 +271,11 @@ public class CPPFunctionTemplate extends CPPTemplateDefinition implements ICPPFu
|
|||
parent = parent.getParent();
|
||||
|
||||
IASTDeclSpecifier declSpec = null;
|
||||
if( parent instanceof IASTSimpleDeclaration )
|
||||
if (parent instanceof IASTSimpleDeclaration) {
|
||||
declSpec = ((IASTSimpleDeclaration)parent).getDeclSpecifier();
|
||||
else if( parent instanceof IASTFunctionDefinition )
|
||||
} else if (parent instanceof IASTFunctionDefinition) {
|
||||
declSpec = ((IASTFunctionDefinition)parent).getDeclSpecifier();
|
||||
}
|
||||
|
||||
if (declSpec != null && declSpec.isInline())
|
||||
return true;
|
||||
|
@ -304,7 +303,6 @@ public class CPPFunctionTemplate extends CPPTemplateDefinition implements ICPPFu
|
|||
return false;
|
||||
}
|
||||
|
||||
|
||||
public boolean isExtern() {
|
||||
return hasStorageClass(IASTDeclSpecifier.sc_extern);
|
||||
}
|
||||
|
|
|
@ -243,8 +243,7 @@ public class PDOMFile implements IIndexFragmentFile {
|
|||
IASTPreprocessorMacroDefinition macro= (IASTPreprocessorMacroDefinition) stmt;
|
||||
PDOMMacroContainer container= linkage.getMacroContainer(macro.getName().toCharArray());
|
||||
pdomMacro = new PDOMMacro(pdom, container, macro, this);
|
||||
}
|
||||
else if (stmt instanceof IASTPreprocessorUndefStatement) {
|
||||
} else if (stmt instanceof IASTPreprocessorUndefStatement) {
|
||||
IASTPreprocessorUndefStatement undef= (IASTPreprocessorUndefStatement) stmt;
|
||||
PDOMMacroContainer container= linkage.getMacroContainer(undef.getMacroName().toCharArray());
|
||||
pdomMacro = new PDOMMacro(pdom, container, undef, this);
|
||||
|
@ -287,13 +286,11 @@ public class PDOMFile implements IIndexFragmentFile {
|
|||
nameCache.put(name[0], pdomName);
|
||||
if (lastName == null) {
|
||||
setFirstName(pdomName);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
lastName.setNextInFile(pdomName);
|
||||
}
|
||||
lastName= pdomName;
|
||||
}
|
||||
else if (fname instanceof PDOMMacroReferenceName) {
|
||||
} else if (fname instanceof PDOMMacroReferenceName) {
|
||||
PDOMMacroReferenceName macroName = (PDOMMacroReferenceName) fname;
|
||||
if (lastMacroName == null) {
|
||||
setFirstMacroReference(macroName);
|
||||
|
@ -430,8 +427,7 @@ public class PDOMFile implements IIndexFragmentFile {
|
|||
include.setPrevInIncludedBy(firstIncludedBy);
|
||||
firstIncludedBy.setNextInIncludedBy(include);
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
setFirstIncludedBy(include);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -94,7 +94,6 @@ import org.eclipse.core.runtime.CoreException;
|
|||
* Container for c++-entities.
|
||||
*/
|
||||
class PDOMCPPLinkage extends PDOMLinkage implements IIndexCPPBindingConstants {
|
||||
|
||||
public final static int CACHE_MEMBERS= 0;
|
||||
public final static int CACHE_BASES= 1;
|
||||
public final static int CACHE_INSTANCES= 2;
|
||||
|
@ -256,8 +255,7 @@ class PDOMCPPLinkage extends PDOMLinkage implements IIndexCPPBindingConstants {
|
|||
pdomBinding = adaptBinding(parent, binding);
|
||||
if (pdomBinding != null) {
|
||||
pdom.putCachedResult(inputBinding, pdomBinding);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
try {
|
||||
pdomBinding = createBinding(parent, binding);
|
||||
if (pdomBinding != null) {
|
||||
|
@ -646,7 +644,7 @@ class PDOMCPPLinkage extends PDOMLinkage implements IIndexCPPBindingConstants {
|
|||
private final PDOMNode adaptOrAddParent(boolean add, IBinding binding) throws CoreException {
|
||||
try {
|
||||
IBinding owner= binding.getOwner();
|
||||
if (owner instanceof IFunction && binding instanceof ICPPTemplateParameter == false) {
|
||||
if (owner instanceof IFunction && !(binding instanceof ICPPTemplateParameter)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -716,12 +714,10 @@ class PDOMCPPLinkage extends PDOMLinkage implements IIndexCPPBindingConstants {
|
|||
return addBinding((ITypedef) type, null);
|
||||
}
|
||||
if (type instanceof ICPPReferenceType) {
|
||||
return new PDOMCPPReferenceType(pdom, parent,
|
||||
(ICPPReferenceType) type);
|
||||
return new PDOMCPPReferenceType(pdom, parent, (ICPPReferenceType) type);
|
||||
}
|
||||
if (type instanceof ICPPPointerToMemberType) {
|
||||
return new PDOMCPPPointerToMemberType(pdom, parent,
|
||||
(ICPPPointerToMemberType) type);
|
||||
return new PDOMCPPPointerToMemberType(pdom, parent, (ICPPPointerToMemberType) type);
|
||||
}
|
||||
if (type instanceof ICPPTemplateTypeParameter) {
|
||||
return addBinding((ICPPTemplateTypeParameter) type, null);
|
||||
|
|
Loading…
Add table
Reference in a new issue