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

Add a libclang-style C API and improve type safety #304

Closed
wants to merge 23 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
869 changes: 869 additions & 0 deletions include/clang-c/CXCppInterOp.h

Large diffs are not rendered by default.

12 changes: 7 additions & 5 deletions include/clang/Interpreter/CppInterOp.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ namespace Cpp {
class JitCall {
public:
friend CPPINTEROP_API JitCall MakeFunctionCallable(TCppConstFunction_t);
friend JitCall MakeFunctionCallableImpl(TInterp_t I,
TCppConstFunction_t func);
enum Kind : char {
kUnknown = 0,
kGenericCall,
Expand Down Expand Up @@ -262,16 +264,16 @@ namespace Cpp {

/// This is similar to GetName() function, but besides
/// the name, it also gets the template arguments.
CPPINTEROP_API std::string GetCompleteName(TCppType_t klass);
CPPINTEROP_API std::string GetCompleteName(TCppScope_t klass);

/// Gets the "qualified" name (including the namespace) of any
/// named decl (a class, namespace, variable, or a function).
CPPINTEROP_API std::string GetQualifiedName(TCppType_t klass);
CPPINTEROP_API std::string GetQualifiedName(TCppScope_t klass);

/// This is similar to GetQualifiedName() function, but besides
/// the "qualified" name (including the namespace), it also
/// gets the template arguments.
CPPINTEROP_API std::string GetQualifiedCompleteName(TCppType_t klass);
CPPINTEROP_API std::string GetQualifiedCompleteName(TCppScope_t klass);

/// Gets the list of namespaces utilized in the supplied scope.
CPPINTEROP_API std::vector<TCppScope_t> GetUsingNamespaces(TCppScope_t scope);
Expand Down Expand Up @@ -307,13 +309,13 @@ namespace Cpp {

/// Gets the number of Base Classes for the Derived Class that
/// is passed as a parameter.
CPPINTEROP_API TCppIndex_t GetNumBases(TCppType_t klass);
CPPINTEROP_API TCppIndex_t GetNumBases(TCppScope_t klass);

/// Gets a specific Base Class using its index. Typically GetNumBases()
/// is used to get the number of Base Classes, and then that number
/// can be used to iterate through the index value to get each specific
/// base class.
CPPINTEROP_API TCppScope_t GetBaseClass(TCppType_t klass, TCppIndex_t ibase);
CPPINTEROP_API TCppScope_t GetBaseClass(TCppScope_t klass, TCppIndex_t ibase);

/// Checks if the supplied Derived Class is a sub-class of the
/// provided Base Class.
Expand Down
1 change: 1 addition & 0 deletions lib/Interpreter/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ endif(LLVM_LINK_LLVM_DYLIB)
add_llvm_library(clangCppInterOp
DISABLE_LLVM_LINK_LLVM_DYLIB
CppInterOp.cpp
CXCppInterOp.cpp
${DLM}
LINK_LIBS
${link_libs}
Expand Down
Loading
Loading