Skip to content
Permalink
Browse files
8267504: jextract should report unsupported language and exit rather …
…than generating partial nonworking code

Reviewed-by: mcimadamore
  • Loading branch information
sundararajana committed May 21, 2021
1 parent 601ce85 commit 12615a616a1d1190fca524e65de5c1dff81eb8f1
Showing with 2,727 additions and 1,331 deletions.
  1. +1,556 −0 src/jdk.incubator.jextract/share/classes/clang.full.symbols
  2. +619 −594 src/jdk.incubator.jextract/share/classes/clang.symbols
  3. +1 −44 src/jdk.incubator.jextract/share/classes/{jdk/internal/clang/RefQualifierKind.java → cp_header.txt}
  4. +8 −0 src/jdk.incubator.jextract/share/classes/extract.sh
  5. +15 −14 src/jdk.incubator.jextract/share/classes/jdk/internal/clang/CallingConvention.java
  6. +4 −0 src/jdk.incubator.jextract/share/classes/jdk/internal/clang/Cursor.java
  7. +44 −239 src/jdk.incubator.jextract/share/classes/jdk/internal/clang/CursorKind.java
  8. +26 −29 ....incubator.jextract/share/classes/jdk/internal/clang/{AccessSpecifier.java → CursorLanguage.java}
  9. +5 −5 src/jdk.incubator.jextract/share/classes/jdk/internal/clang/Diagnostic.java
  10. +1 −5 src/jdk.incubator.jextract/share/classes/jdk/internal/clang/ErrorCode.java
  11. +28 −27 src/jdk.incubator.jextract/share/classes/jdk/internal/clang/PrintingPolicyProperty.java
  12. +1 −4 src/jdk.incubator.jextract/share/classes/jdk/internal/clang/SaveError.java
  13. +0 −75 src/jdk.incubator.jextract/share/classes/jdk/internal/clang/TemplateArgumentKind.java
  14. +118 −117 src/jdk.incubator.jextract/share/classes/jdk/internal/clang/TypeKind.java
  15. +2 −2 src/jdk.incubator.jextract/share/classes/jdk/internal/clang/libclang/CXCursorVisitor.java
  16. +105 −22 src/jdk.incubator.jextract/share/classes/jdk/internal/clang/libclang/Index_h.java
  17. +16 −17 src/jdk.incubator.jextract/share/classes/jdk/internal/clang/libclang/constants$10.java
  18. +17 −12 src/jdk.incubator.jextract/share/classes/jdk/internal/clang/libclang/constants$11.java
  19. +12 −13 src/jdk.incubator.jextract/share/classes/jdk/internal/clang/libclang/constants$12.java
  20. +0 −10 src/jdk.incubator.jextract/share/classes/jdk/internal/clang/libclang/constants$13.java
  21. +10 −16 src/jdk.incubator.jextract/share/classes/jdk/internal/clang/libclang/constants$14.java
  22. +16 −16 src/jdk.incubator.jextract/share/classes/jdk/internal/clang/libclang/constants$15.java
  23. +16 −8 src/jdk.incubator.jextract/share/classes/jdk/internal/clang/libclang/constants$16.java
  24. +8 −8 src/jdk.incubator.jextract/share/classes/jdk/internal/clang/libclang/constants$17.java
  25. +8 −0 src/jdk.incubator.jextract/share/classes/jdk/internal/clang/libclang/constants$18.java
  26. +5 −5 src/jdk.incubator.jextract/share/classes/jdk/internal/clang/libclang/constants$6.java
  27. +12 −16 src/jdk.incubator.jextract/share/classes/jdk/internal/clang/libclang/constants$7.java
  28. +16 −17 src/jdk.incubator.jextract/share/classes/jdk/internal/clang/libclang/constants$8.java
  29. +17 −16 src/jdk.incubator.jextract/share/classes/jdk/internal/clang/libclang/constants$9.java
  30. +5 −0 src/jdk.incubator.jextract/share/classes/jdk/internal/jextract/impl/TreeMaker.java
  31. +9 −0 test/jdk/tools/jextract/JextractToolProviderTest.java
  32. +27 −0 test/jdk/tools/jextract/unsupported_lang.h

Large diffs are not rendered by default.

Large diffs are not rendered by default.

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -21,47 +21,4 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/

package jdk.internal.clang;

import java.util.HashMap;
import java.util.Map;
import java.util.NoSuchElementException;

public enum RefQualifierKind {
/** No ref-qualifier was provided. */
CXRefQualifier_None(0),
/** An lvalue ref-qualifier was provided (\c &). */
CXRefQualifier_LValue(1),
/** An rvalue ref-qualifier was provided (\c &&). */
CXRefQualifier_RValue(2);

private final int value;

RefQualifierKind(int value) {
this.value = value;
}

public int value() {
return value;
}

private final static Map<Integer, RefQualifierKind> lookup;

static {
lookup = new HashMap<>();
for (RefQualifierKind e: RefQualifierKind.values()) {
lookup.put(e.value(), e);
}
}

public final static RefQualifierKind valueOf(int value) {
RefQualifierKind x = lookup.get(value);
if (null == x) {
throw new NoSuchElementException("Invalid RefQualifierKind kind value: " + value);
}
return x;
}
}
@@ -1,6 +1,14 @@
#!/bin/bash

jextract --source -t jdk.internal.clang.libclang -lclang \
-I /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/ \
-I ${LIBCLANG_HOME}/include/ \
-I ${LIBCLANG_HOME}/include/clang-c \
@clang.symbols \
${LIBCLANG_HOME}/include/clang-c/Index.h


for x in jdk/internal/clang/libclang/*.java; do
head -$COPYRIGHTLEN $x | diff cp_header.txt - || ( ( cat cp_header.txt; echo; cat $x) > /tmp/file;
mv /tmp/file $x )
done
@@ -28,23 +28,24 @@
import java.util.HashMap;
import java.util.Map;
import java.util.NoSuchElementException;
import static jdk.internal.clang.libclang.Index_h.*;

public enum CallingConvention {

Default(0),
C(1),
X86StdCall(2),
X86FastCall(3),
X86ThisCall(4),
X86Pascal(5),
AAPCS(6),
AAPCS_VFP(7),
PnaclCall(8),
IntelOclBicc(9),
X86_64Win64(10),
X86_64SysV(11),
Invalid(100),
Unexposed(200);
Default(CXCallingConv_Default()),
C(CXCallingConv_C()),
X86StdCall(CXCallingConv_X86StdCall()),
X86FastCall(CXCallingConv_X86FastCall()),
X86ThisCall(CXCallingConv_X86ThisCall()),
X86Pascal(CXCallingConv_X86Pascal()),
AAPCS(CXCallingConv_AAPCS()),
AAPCS_VFP(CXCallingConv_AAPCS_VFP()),
PnaclCall(CXCallingConv_X86RegCall()),
IntelOclBicc(CXCallingConv_IntelOclBicc()),
X86_64Win64(CXCallingConv_X86_64Win64()),
X86_64SysV(CXCallingConv_X86_64SysV()),
Invalid(CXCallingConv_Invalid()),
Unexposed(CXCallingConv_Unexposed());

private final int value;

@@ -169,6 +169,10 @@ public CursorKind kind() {
return CursorKind.valueOf(kind);
}

public CursorLanguage language() {
return CursorLanguage.valueOf(Index_h.clang_getCursorLanguage(cursor));
}

public int kind0() {
return kind;
}

0 comments on commit 12615a6

Please sign in to comment.