Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8267504: jextract should report unsupported language and exit rather than generating partial nonworking code #539

Closed
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view

Large diffs are not rendered by default.

@@ -19,6 +19,26 @@
--include-typedef CXTranslationUnit # header: /Users/sundarajanathijegannathan/bin/llvm10/include/clang-c/Index.h
--include-typedef CXType # header: /Users/sundarajanathijegannathan/bin/llvm10/include/clang-c/Index.h
--include-struct CXUnsavedFile # header: /Users/sundarajanathijegannathan/bin/llvm10/include/clang-c/Index.h
--include-macro CXCallingConv_AAPCS # header: /Users/sundarajanathijegannathan/bin/llvm10/include/clang-c/Index.h
--include-macro CXCallingConv_AAPCS_VFP # header: /Users/sundarajanathijegannathan/bin/llvm10/include/clang-c/Index.h
--include-macro CXCallingConv_AArch64VectorCall # header: /Users/sundarajanathijegannathan/bin/llvm10/include/clang-c/Index.h
--include-macro CXCallingConv_C # header: /Users/sundarajanathijegannathan/bin/llvm10/include/clang-c/Index.h
--include-macro CXCallingConv_Default # header: /Users/sundarajanathijegannathan/bin/llvm10/include/clang-c/Index.h
--include-macro CXCallingConv_IntelOclBicc # header: /Users/sundarajanathijegannathan/bin/llvm10/include/clang-c/Index.h
--include-macro CXCallingConv_Invalid # header: /Users/sundarajanathijegannathan/bin/llvm10/include/clang-c/Index.h
--include-macro CXCallingConv_PreserveAll # header: /Users/sundarajanathijegannathan/bin/llvm10/include/clang-c/Index.h
--include-macro CXCallingConv_PreserveMost # header: /Users/sundarajanathijegannathan/bin/llvm10/include/clang-c/Index.h
--include-macro CXCallingConv_Swift # header: /Users/sundarajanathijegannathan/bin/llvm10/include/clang-c/Index.h
--include-macro CXCallingConv_Unexposed # header: /Users/sundarajanathijegannathan/bin/llvm10/include/clang-c/Index.h
--include-macro CXCallingConv_Win64 # header: /Users/sundarajanathijegannathan/bin/llvm10/include/clang-c/Index.h
--include-macro CXCallingConv_X86FastCall # header: /Users/sundarajanathijegannathan/bin/llvm10/include/clang-c/Index.h
--include-macro CXCallingConv_X86Pascal # header: /Users/sundarajanathijegannathan/bin/llvm10/include/clang-c/Index.h
--include-macro CXCallingConv_X86RegCall # header: /Users/sundarajanathijegannathan/bin/llvm10/include/clang-c/Index.h
--include-macro CXCallingConv_X86StdCall # header: /Users/sundarajanathijegannathan/bin/llvm10/include/clang-c/Index.h
--include-macro CXCallingConv_X86ThisCall # header: /Users/sundarajanathijegannathan/bin/llvm10/include/clang-c/Index.h
--include-macro CXCallingConv_X86VectorCall # header: /Users/sundarajanathijegannathan/bin/llvm10/include/clang-c/Index.h
--include-macro CXCallingConv_X86_64SysV # header: /Users/sundarajanathijegannathan/bin/llvm10/include/clang-c/Index.h
--include-macro CXCallingConv_X86_64Win64 # header: /Users/sundarajanathijegannathan/bin/llvm10/include/clang-c/Index.h
--include-macro CXChildVisit_Break # header: /Users/sundarajanathijegannathan/bin/llvm10/include/clang-c/Index.h
--include-macro CXChildVisit_Continue # header: /Users/sundarajanathijegannathan/bin/llvm10/include/clang-c/Index.h
--include-macro CXChildVisit_Recurse # header: /Users/sundarajanathijegannathan/bin/llvm10/include/clang-c/Index.h
@@ -302,6 +322,10 @@
--include-macro CXDiagnostic_Ignored # header: /Users/sundarajanathijegannathan/bin/llvm10/include/clang-c/Index.h
--include-macro CXDiagnostic_Note # header: /Users/sundarajanathijegannathan/bin/llvm10/include/clang-c/Index.h
--include-macro CXDiagnostic_Warning # header: /Users/sundarajanathijegannathan/bin/llvm10/include/clang-c/Index.h
--include-macro CXLanguage_C # header: /Users/sundarajanathijegannathan/bin/llvm10/include/clang-c/Index.h
--include-macro CXLanguage_CPlusPlus # header: /Users/sundarajanathijegannathan/bin/llvm10/include/clang-c/Index.h
--include-macro CXLanguage_Invalid # header: /Users/sundarajanathijegannathan/bin/llvm10/include/clang-c/Index.h
--include-macro CXLanguage_ObjC # header: /Users/sundarajanathijegannathan/bin/llvm10/include/clang-c/Index.h
--include-macro CXPrintingPolicy_Alignof # header: /Users/sundarajanathijegannathan/bin/llvm10/include/clang-c/Index.h
--include-macro CXPrintingPolicy_AnonymousTagLocations # header: /Users/sundarajanathijegannathan/bin/llvm10/include/clang-c/Index.h
--include-macro CXPrintingPolicy_Bool # header: /Users/sundarajanathijegannathan/bin/llvm10/include/clang-c/Index.h
@@ -537,6 +561,7 @@
--include-function clang_getCursorExtent # header: /Users/sundarajanathijegannathan/bin/llvm10/include/clang-c/Index.h
--include-function clang_getCursorKind # header: /Users/sundarajanathijegannathan/bin/llvm10/include/clang-c/Index.h
--include-function clang_getCursorKindSpelling # header: /Users/sundarajanathijegannathan/bin/llvm10/include/clang-c/Index.h
--include-function clang_getCursorLanguage # header: /Users/sundarajanathijegannathan/bin/llvm10/include/clang-c/Index.h
--include-function clang_getCursorLocation # header: /Users/sundarajanathijegannathan/bin/llvm10/include/clang-c/Index.h
--include-function clang_getCursorPrettyPrinted # header: /Users/sundarajanathijegannathan/bin/llvm10/include/clang-c/Index.h
--include-function clang_getCursorPrintingPolicy # header: /Users/sundarajanathijegannathan/bin/llvm10/include/clang-c/Index.h
@@ -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;
}