aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/zig_clang.cpp10
-rw-r--r--src/zig_clang.h1
2 files changed, 11 insertions, 0 deletions
diff --git a/src/zig_clang.cpp b/src/zig_clang.cpp
index c5ea182e87..ca93634aab 100644
--- a/src/zig_clang.cpp
+++ b/src/zig_clang.cpp
@@ -1615,6 +1615,16 @@ unsigned ZigClangVarDecl_getAlignedAttribute(const struct ZigClangVarDecl *self,
return 0;
}
+unsigned ZigClangFieldDecl_getAlignedAttribute(const struct ZigClangFieldDecl *self, const ZigClangASTContext* ctx) {
+ auto casted_self = reinterpret_cast<const clang::FieldDecl *>(self);
+ auto casted_ctx = const_cast<clang::ASTContext *>(reinterpret_cast<const clang::ASTContext *>(ctx));
+ if (const clang::AlignedAttr *AA = casted_self->getAttr<clang::AlignedAttr>()) {
+ return AA->getAlignment(*casted_ctx);
+ }
+ // Zero means no explicit alignment factor was specified
+ return 0;
+}
+
unsigned ZigClangFunctionDecl_getAlignedAttribute(const struct ZigClangFunctionDecl *self, const ZigClangASTContext* ctx) {
auto casted_self = reinterpret_cast<const clang::FunctionDecl *>(self);
auto casted_ctx = const_cast<clang::ASTContext *>(reinterpret_cast<const clang::ASTContext *>(ctx));
diff --git a/src/zig_clang.h b/src/zig_clang.h
index 579812a84a..af4b04c776 100644
--- a/src/zig_clang.h
+++ b/src/zig_clang.h
@@ -865,6 +865,7 @@ ZIG_EXTERN_C const struct ZigClangVarDecl *ZigClangVarDecl_getCanonicalDecl(cons
ZIG_EXTERN_C const char* ZigClangVarDecl_getSectionAttribute(const struct ZigClangVarDecl *self, size_t *len);
ZIG_EXTERN_C unsigned ZigClangVarDecl_getAlignedAttribute(const struct ZigClangVarDecl *self, const ZigClangASTContext* ctx);
ZIG_EXTERN_C unsigned ZigClangFunctionDecl_getAlignedAttribute(const struct ZigClangFunctionDecl *self, const ZigClangASTContext* ctx);
+ZIG_EXTERN_C unsigned ZigClangFieldDecl_getAlignedAttribute(const struct ZigClangFieldDecl *self, const ZigClangASTContext* ctx);
ZIG_EXTERN_C struct ZigClangQualType ZigClangParmVarDecl_getOriginalType(const struct ZigClangParmVarDecl *self);