protected void visitStoredDeclarations(StoredDeclarations d) { visitDeclaration(d); visit(d.getDeclarators()); }
List<String> getNames(Declaration d) { if (d instanceof StoredDeclarations) { List<String> ret = new ArrayList<String>(); for (Declarator declarator : ((StoredDeclarations) d).getDeclarators()) { ret.add(declarator.resolveName()); } return ret; } else if (d instanceof TaggedTypeRefDeclaration) { TaggedTypeRef tr = ((TaggedTypeRefDeclaration) d).getTaggedTypeRef(); Identifier id = tr.getTag(); if (id instanceof SimpleIdentifier) { return Collections.singletonList(((SimpleIdentifier) id).getName()); } } return Collections.EMPTY_LIST; }
List<String> getNames(Declaration d) { if (d instanceof StoredDeclarations) { List<String> ret = new ArrayList<String>(); for (Declarator declarator : ((StoredDeclarations) d).getDeclarators()) { ret.add(declarator.resolveName()); } return ret; } else if (d instanceof TaggedTypeRefDeclaration) { TaggedTypeRef tr = ((TaggedTypeRefDeclaration) d).getTaggedTypeRef(); Identifier id = tr.getTag(); if (id instanceof SimpleIdentifier) { return Collections.singletonList(((SimpleIdentifier) id).getName()); } } return Collections.EMPTY_LIST; }
protected void valueTypeAndStorageSuffix(StoredDeclarations e) { if (e.getValueType() instanceof FunctionSignature) { FunctionSignature sig = (FunctionSignature) e.getValueType(); if (sig.getFunction() != null) { Identifier name = sig.getFunction().getName(); if (name != null && e.declarators.size() == 1) { String stoName = e.declarators.get(0).resolveName(); if (name.equals(stoName) || stoName == null) { append(sig); return; } } } } append(e.getValueType()).space(!e.getDeclarators().isEmpty()).implode(e.getDeclarators(), ", "); }
for (Declarator st : sd.getDeclarators()) { if (st instanceof DirectDeclarator) { DirectDeclarator decl = (DirectDeclarator) st;
for (Declarator st : sd.getDeclarators()) { if (st instanceof DirectDeclarator) { DirectDeclarator decl = (DirectDeclarator) st;
@Override protected void visitStoredDeclarations(StoredDeclarations d) { super.visitStoredDeclarations(d); if (d.getDeclarators().size() == 1) { Declarator declarator = d.getDeclarators().get(0); if (declarator instanceof FunctionDeclarator) { FunctionDeclarator fd = (FunctionDeclarator) declarator; Function f = new Function(Function.Type.CFunction, null, d.getValueType(), fd.getArgs()); f.addModifiers(fd.getTarget().getModifiers()); FunctionSignature fs = new FunctionSignature(f); d.setValueType(fs); Declarator target = fd.getTarget(); Declarator newTarget = target == null ? new DirectDeclarator(fd.resolveName(), fd.getDefaultValue()) : target.clone(); d.setDeclarators(Arrays.asList(newTarget)); d.accept(this); } } }
@Override protected void visitStoredDeclarations(StoredDeclarations d) { super.visitStoredDeclarations(d); if (d.getDeclarators().size() == 1) { Declarator declarator = d.getDeclarators().get(0); if (declarator instanceof FunctionDeclarator) { FunctionDeclarator fd = (FunctionDeclarator) declarator; Function f = new Function(Function.Type.CFunction, null, d.getValueType(), fd.getArgs()); f.addModifiers(fd.getTarget().getModifiers()); FunctionSignature fs = new FunctionSignature(f); d.setValueType(fs); Declarator target = fd.getTarget(); Declarator newTarget = target == null ? new DirectDeclarator(fd.resolveName(), fd.getDefaultValue()) : target.clone(); d.setDeclarators(Arrays.asList(newTarget)); d.accept(this); } } }
StoredDeclarations d = as(parent, StoredDeclarations.class); if (d != null && d.getDeclarators().isEmpty()) { if (d instanceof VariablesDeclaration) { VariablesDeclaration pvd = (VariablesDeclaration) d;
StoredDeclarations d = as(parent, StoredDeclarations.class); if (d != null && d.getDeclarators().isEmpty()) { if (d instanceof VariablesDeclaration) { VariablesDeclaration pvd = (VariablesDeclaration) d;