< prev index next >

src/jdk.jextract/share/classes/com/sun/tools/jextract/HeaderFile.java

Print this page

        

*** 21,34 **** --- 21,37 ---- * questions. */ package com.sun.tools.jextract; import java.nio.file.Path; + import java.util.ArrayList; import java.util.Collections; import java.util.List; + import java.util.Objects; import java.util.concurrent.atomic.AtomicInteger; import java.util.logging.Logger; + import java.util.stream.Stream; import jdk.internal.clang.Cursor; import jdk.internal.clang.CursorKind; import jdk.internal.clang.Type; import jdk.internal.clang.TypeKind;
*** 41,50 **** --- 44,55 ---- final String pkgName; final String clsName; private final TypeDictionary dict; // The top header file cause this file to be parsed private HeaderFile main; + // files included that are from the same directory + private final List<HeaderFile> includedFiles; private AsmCodeFactory cf; List<String> libraries; // immutable List<String> libraryPaths; // immutable private final AtomicInteger serialNo;
*** 54,66 **** HeaderFile(Context ctx, Path path, String pkgName, String clsName, HeaderFile main) { this.ctx = ctx; this.path = path; this.pkgName = pkgName; this.clsName = clsName; ! dict = ctx.typeDictionaryFor(pkgName); ! serialNo = new AtomicInteger(); this.main = main == null ? this : main; } void useLibraries(List<String> libraries, List<String> libraryPaths) { this.libraries = Collections.unmodifiableList(libraries); this.libraryPaths = Collections.unmodifiableList(libraryPaths); --- 59,76 ---- HeaderFile(Context ctx, Path path, String pkgName, String clsName, HeaderFile main) { this.ctx = ctx; this.path = path; this.pkgName = pkgName; this.clsName = clsName; ! this.dict = ctx.typeDictionaryFor(pkgName); ! this.serialNo = new AtomicInteger(); this.main = main == null ? this : main; + this.includedFiles = new ArrayList<>(); + } + + Stream<HeaderFile> getIncludedFiles() { + return includedFiles.stream(); } void useLibraries(List<String> libraries, List<String> libraryPaths) { this.libraries = Collections.unmodifiableList(libraries); this.libraryPaths = Collections.unmodifiableList(libraryPaths);
*** 82,91 **** --- 92,108 ---- if (Main.DEBUG) { new Throwable().printStackTrace(ctx.err); } } else { this.cf = cf; + // The 'main' header interface inherits from included header interfaces + // only if the included file is assigned to the same package and is from + // the same directory. + if (this != main && Objects.equals(pkgName, main.pkgName) && + Objects.equals(path.getParent(), main.path.getParent())) { + main.includedFiles.add(this); + } } } @Override public String toString() {
*** 226,237 **** case Unexposed: case Elaborated: jt = define(t.canonicalType()); break; case ConstantArray: - jt = JType.ofArray(globalLookup(t.getElementType())); - break; case IncompleteArray: jt = JType.ofArray(globalLookup(t.getElementType())); break; case FunctionProto: case FunctionNoProto: --- 243,252 ----
< prev index next >