parent
8f5753ba9f
commit
dff201540f
File diff suppressed because it is too large
Load Diff
|
@ -212,3 +212,48 @@ bool ZigClangASTUnit_visitLocalTopLevelDecls(ZigClangASTUnit *self, void *contex
|
|||
return reinterpret_cast<clang::ASTUnit *>(self)->visitLocalTopLevelDecls(context,
|
||||
reinterpret_cast<bool (*)(void *, const clang::Decl *)>(Fn));
|
||||
}
|
||||
|
||||
const ZigClangRecordDecl *ZigClangRecordType_getDecl(const ZigClangRecordType *record_ty) {
|
||||
const clang::RecordDecl *record_decl = reinterpret_cast<const clang::RecordType *>(record_ty)->getDecl();
|
||||
return reinterpret_cast<const ZigClangRecordDecl *>(record_decl);
|
||||
}
|
||||
|
||||
const ZigClangTagDecl *ZigClangRecordDecl_getCanonicalDecl(const ZigClangRecordDecl *record_decl) {
|
||||
const clang::TagDecl *tag_decl = reinterpret_cast<const clang::RecordDecl*>(record_decl)->getCanonicalDecl();
|
||||
return reinterpret_cast<const ZigClangTagDecl *>(tag_decl);
|
||||
}
|
||||
|
||||
const ZigClangRecordDecl *ZigClangRecordDecl_getDefinition(const ZigClangRecordDecl *zig_record_decl) {
|
||||
const clang::RecordDecl *record_decl = reinterpret_cast<const clang::RecordDecl *>(zig_record_decl);
|
||||
const clang::RecordDecl *definition = record_decl->getDefinition();
|
||||
return reinterpret_cast<const ZigClangRecordDecl *>(definition);
|
||||
}
|
||||
|
||||
bool ZigClangRecordDecl_isUnion(const ZigClangRecordDecl *record_decl) {
|
||||
return reinterpret_cast<const clang::RecordDecl*>(record_decl)->isUnion();
|
||||
}
|
||||
|
||||
bool ZigClangRecordDecl_isStruct(const ZigClangRecordDecl *record_decl) {
|
||||
return reinterpret_cast<const clang::RecordDecl*>(record_decl)->isStruct();
|
||||
}
|
||||
|
||||
bool ZigClangRecordDecl_isAnonymousStructOrUnion(const ZigClangRecordDecl *record_decl) {
|
||||
return reinterpret_cast<const clang::RecordDecl*>(record_decl)->isAnonymousStructOrUnion();
|
||||
}
|
||||
|
||||
const char *ZigClangDecl_getName_bytes_begin(const ZigClangDecl *zig_decl) {
|
||||
const clang::Decl *decl = reinterpret_cast<const clang::Decl *>(zig_decl);
|
||||
const clang::NamedDecl *named_decl = static_cast<const clang::NamedDecl *>(decl);
|
||||
return (const char *)named_decl->getName().bytes_begin();
|
||||
}
|
||||
|
||||
ZigClangSourceLocation ZigClangRecordDecl_getLocation(const ZigClangRecordDecl *zig_record_decl) {
|
||||
const clang::RecordDecl *record_decl = reinterpret_cast<const clang::RecordDecl *>(zig_record_decl);
|
||||
return bitcast(record_decl->getLocation());
|
||||
}
|
||||
|
||||
bool ZigClangSourceLocation_eq(ZigClangSourceLocation zig_a, ZigClangSourceLocation zig_b) {
|
||||
clang::SourceLocation a = bitcast(zig_a);
|
||||
clang::SourceLocation b = bitcast(zig_b);
|
||||
return a == b;
|
||||
}
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
|
||||
// ATTENTION: If you modify this file, be sure to update the corresponding
|
||||
// extern function declarations in the self-hosted compiler.
|
||||
// Note: not yet, we don't have the corresponding clang.zig yet.
|
||||
|
||||
struct ZigClangSourceLocation {
|
||||
unsigned ID;
|
||||
|
@ -86,6 +87,7 @@ struct ZigClangStorageClass;
|
|||
struct ZigClangStringLiteral;
|
||||
struct ZigClangStringRef;
|
||||
struct ZigClangSwitchStmt;
|
||||
struct ZigClangTagDecl;
|
||||
struct ZigClangType;
|
||||
struct ZigClangTypedefNameDecl;
|
||||
struct ZigClangTypedefType;
|
||||
|
@ -256,4 +258,17 @@ ZIG_EXTERN_C ZigClangASTContext *ZigClangASTUnit_getASTContext(ZigClangASTUnit *
|
|||
ZIG_EXTERN_C ZigClangSourceManager *ZigClangASTUnit_getSourceManager(ZigClangASTUnit *);
|
||||
ZIG_EXTERN_C bool ZigClangASTUnit_visitLocalTopLevelDecls(ZigClangASTUnit *, void *context,
|
||||
bool (*Fn)(void *context, const ZigClangDecl *decl));
|
||||
|
||||
ZIG_EXTERN_C const ZigClangRecordDecl *ZigClangRecordType_getDecl(const ZigClangRecordType *record_ty);
|
||||
|
||||
ZIG_EXTERN_C const ZigClangTagDecl *ZigClangRecordDecl_getCanonicalDecl(const ZigClangRecordDecl *record_decl);
|
||||
ZIG_EXTERN_C bool ZigClangRecordDecl_isUnion(const ZigClangRecordDecl *record_decl);
|
||||
ZIG_EXTERN_C bool ZigClangRecordDecl_isStruct(const ZigClangRecordDecl *record_decl);
|
||||
ZIG_EXTERN_C bool ZigClangRecordDecl_isAnonymousStructOrUnion(const ZigClangRecordDecl *record_decl);
|
||||
ZIG_EXTERN_C const ZigClangRecordDecl *ZigClangRecordDecl_getDefinition(const ZigClangRecordDecl *);
|
||||
ZIG_EXTERN_C ZigClangSourceLocation ZigClangRecordDecl_getLocation(const ZigClangRecordDecl *);
|
||||
|
||||
ZIG_EXTERN_C const char *ZigClangDecl_getName_bytes_begin(const ZigClangDecl *decl);
|
||||
|
||||
ZIG_EXTERN_C bool ZigClangSourceLocation_eq(ZigClangSourceLocation a, ZigClangSourceLocation b);
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue
Block a user