diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2020-03-10 12:56:17 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-03-10 12:56:17 -0400 |
| commit | 9c4dc7b1bb79b2e1cf5a88d99b9e187640426769 (patch) | |
| tree | 5f964c24ade38e7c16ccef3b655d7919ef609d5e /src/zig_clang.cpp | |
| parent | 3e93dce0a12e8b09f2de30276364d9ee18c6ada0 (diff) | |
| parent | cb4c488cbd1e02b88ca8e7466a0945691f06d4fd (diff) | |
| download | zig-9c4dc7b1bb79b2e1cf5a88d99b9e187640426769.tar.gz zig-9c4dc7b1bb79b2e1cf5a88d99b9e187640426769.zip | |
Merge pull request #4703 from Vexu/translate-c
Translate-c improvements
Diffstat (limited to 'src/zig_clang.cpp')
| -rw-r--r-- | src/zig_clang.cpp | 10 |
1 files changed, 10 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)); |
