< prev index next >
src/jdk.internal.clang/share/classes/jdk/internal/clang/Cursor.java
Print this page
*** 57,87 ****
public native boolean isDeclaration();
public native boolean isPreprocessing();
public native boolean isInvalid();
public native boolean isDefinition();
public native boolean isAnonymousStruct();
public native boolean isMacroFunctionLike();
- public boolean isAnonymousEnum() {
- // libclang::clang_Cursor_isAnonymous only applies to struct, not enum
- return (type().kind() == TypeKind.Enum && spelling().isEmpty());
- }
-
- public boolean isAnonymous() {
- return isAnonymousStruct() || isAnonymousEnum();
- }
-
public native String spelling();
public native String USR();
public native int kind1();
public native int visitChildren(Visitor visitor, Object data);
- public native boolean equalCursor(Cursor other);
-
public native Type type();
public native Type getEnumDeclIntegerType();
public native Cursor getDefinition();
--- 57,80 ----
public native boolean isDeclaration();
public native boolean isPreprocessing();
public native boolean isInvalid();
public native boolean isDefinition();
+
+ // Determine whether the given cursor represents an anonymous record declaration.
+ // "Anonymous" here is not just about name (spelling) being empty. This is an
+ // anonymous struct or union embedded in another struct or union.
public native boolean isAnonymousStruct();
public native boolean isMacroFunctionLike();
public native String spelling();
public native String USR();
public native int kind1();
public native int visitChildren(Visitor visitor, Object data);
public native Type type();
public native Type getEnumDeclIntegerType();
public native Cursor getDefinition();
*** 110,123 ****
int v = kind1();
// FIXME: assert(v == getData().getInt(0));
return CursorKind.valueOf(v);
}
- public boolean equals(Cursor other) {
- return getData().equals(other.getData());
- }
-
public Stream<Cursor> children() {
ArrayList<Cursor> ar = new ArrayList<>();
visitChildren((c, p, d) -> {
@SuppressWarnings("unchecked")
List<Cursor> a = (List<Cursor>) d;
--- 103,112 ----
*** 125,133 ****
return VisitResult.Continue;
}, ar);
return ar.stream();
}
! public Stream<Cursor> stream() {
return children().flatMap(c -> Stream.concat(Stream.of(c), c.children()));
}
}
--- 114,140 ----
return VisitResult.Continue;
}, ar);
return ar.stream();
}
! public Stream<Cursor> allChildren() {
return children().flatMap(c -> Stream.concat(Stream.of(c), c.children()));
}
+
+ public native boolean equalCursor(Cursor other);
+
+ @Override
+ public boolean equals(Object other) {
+ if (this == other) {
+ return true;
+ }
+ if (!(other instanceof Cursor)) {
+ return false;
+ }
+ return equalCursor((Cursor)other);
+ }
+
+ @Override
+ public int hashCode() {
+ return spelling().hashCode();
+ }
}
< prev index next >