95
96 private int serialNo() {
97 return serialNo.incrementAndGet();
98 }
99
100 void processCursor(Cursor c, HeaderFile main, boolean isBuiltIn) {
101 if (c.isDeclaration()) {
102 Type t = c.type();
103 if (t.kind() == TypeKind.FunctionProto ||
104 t.kind() == TypeKind.FunctionNoProto) {
105 String name = c.spelling();
106
107 if (ctx.isSymbolExcluded(name)) {
108 return;
109 }
110
111 if (!ctx.isSymbolFound(name)) {
112 ctx.err.println(Main.format("warn.symbol.not.found", name));
113 }
114 }
115 JType jt = dict.computeIfAbsent(t, type -> {
116 logger.fine(() -> "PH: Compute type for " + type.spelling());
117 return define(type);
118 });
119 assert (jt instanceof JType2);
120 // Only main file can define interface
121 if (cf != null && this.main == main) {
122 cf.addType(jt, c);
123 }
124 } else if (c.isPreprocessing()) {
125 if (cf != null && c.kind() == CursorKind.MacroDefinition && !isBuiltIn && this.main == main) {
126 cf.addMacro(c);
127 }
128 }
129 }
130
131 JType globalLookup(Type type) {
132 JType jt;
133 try {
134 jt = dict.lookup(type);
135 if (null == jt) {
136 jt = dict.computeIfAbsent(type, this::define);
137 }
138 } catch (TypeDictionary.NotDeclaredException ex) {
139 // The type has no declaration, consider it local defined
|
95
96 private int serialNo() {
97 return serialNo.incrementAndGet();
98 }
99
100 void processCursor(Cursor c, HeaderFile main, boolean isBuiltIn) {
101 if (c.isDeclaration()) {
102 Type t = c.type();
103 if (t.kind() == TypeKind.FunctionProto ||
104 t.kind() == TypeKind.FunctionNoProto) {
105 String name = c.spelling();
106
107 if (ctx.isSymbolExcluded(name)) {
108 return;
109 }
110
111 if (!ctx.isSymbolFound(name)) {
112 ctx.err.println(Main.format("warn.symbol.not.found", name));
113 }
114 }
115
116 JType jt = dict.computeIfAbsent(t, type -> {
117 logger.fine(() -> "PH: Compute type for " + type.spelling());
118 return define(type);
119 });
120 assert (jt instanceof JType2);
121
122 if (t.kind() == TypeKind.Typedef) {
123 // Enum is already an TypeAlias for int with proper name
124 // In case of typedef has a different name with enum, do we care?
125 // Typedef is a type annotation, has no real use case
126 if (t.canonicalType().kind() == TypeKind.Enum) {
127 logger.finest("Skip enum typedef for " + t.spelling());
128 return;
129 }
130 }
131
132 // Only main file can define interface
133 if (cf != null && this.main == main) {
134 cf.addType(jt, c);
135 }
136 } else if (c.isPreprocessing()) {
137 if (cf != null && c.kind() == CursorKind.MacroDefinition && !isBuiltIn && this.main == main) {
138 cf.addMacro(c);
139 }
140 }
141 }
142
143 JType globalLookup(Type type) {
144 JType jt;
145 try {
146 jt = dict.lookup(type);
147 if (null == jt) {
148 jt = dict.computeIfAbsent(type, this::define);
149 }
150 } catch (TypeDictionary.NotDeclaredException ex) {
151 // The type has no declaration, consider it local defined
|