Skip to content

Commit

Permalink
Merge pull request #75 from usethesource/issue-69
Browse files Browse the repository at this point in the history
issue 69
  • Loading branch information
jurgenvinju authored Dec 22, 2023
2 parents e340f48 + dd08118 commit 5636cde
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/lang/cpp/internal/TypeResolver.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import org.eclipse.cdt.core.dom.ast.IASTExpression.ValueCategory;
import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IASTSimpleDeclaration;
import org.eclipse.cdt.core.dom.ast.IASTStandardFunctionDeclarator;
import org.eclipse.cdt.core.dom.ast.IArrayType;
import org.eclipse.cdt.core.dom.ast.IBasicType;
import org.eclipse.cdt.core.dom.ast.IBinding;
Expand All @@ -42,6 +43,7 @@
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTDeclarator;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTElaboratedTypeSpecifier;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDeclarator;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDefinition;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTNamedTypeSpecifier;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTParameterDeclaration;
Expand Down Expand Up @@ -69,6 +71,7 @@
import org.eclipse.cdt.core.dom.ast.cpp.ICPPUnaryTypeTransformation;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTNaryTypeIdExpression.Operator;
import org.eclipse.cdt.internal.core.dom.parser.ITypeContainer;
import org.eclipse.cdt.internal.core.dom.parser.c.CASTFunctionDeclarator;
import org.eclipse.cdt.internal.core.dom.parser.c.CStructure;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPImplicitTemplateTypeParameter;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPTemplateNonTypeArgument;
Expand Down Expand Up @@ -156,6 +159,21 @@ public IConstructor resolveType(IASTNode node) {
return resolveICPPASTTemplateId((ICPPASTTemplateId) node);
if (node instanceof ICPPASTDeclarator)
return resolveICPPASTDeclarator((ICPPASTDeclarator) node);
if (node instanceof IASTStandardFunctionDeclarator) {
return resolveIASTStandardFunctionDeclarator((IASTStandardFunctionDeclarator) node);
}

return builder.TypeSymbol_any();
}

private IConstructor resolveIASTStandardFunctionDeclarator(IASTStandardFunctionDeclarator node) {
IBinding binding = node.getName().resolveBinding();
ISourceLocation origin = locs.forNode(node.getName());

if (binding instanceof IFunction) {
return resolveType(((IFunction) binding).getType(), origin);
}

return builder.TypeSymbol_any();
}

Expand Down

0 comments on commit 5636cde

Please sign in to comment.