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 2 commits
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.

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;
}