| author | |
| committer | |
| log | 3aa43dc31c468b2f80bf065f850618a981c5fca2 |
| tree | 45a5dcb06e6a45d1aef73e7487c46e6e68c9bf9a |
| parent | 787fd0f1bea262d134f06e5913554b8ca086655f |
| signature | Commit is signed but in an unrecognized format. |
2 files changed, 36 insertions(+), 0 deletions(-)
src/zig_clang.cpp+23| ... | @@ -1255,6 +1255,22 @@ static_assert((clang::StorageClass)ZigClangStorageClass_PrivateExtern == clang:: | ... | @@ -1255,6 +1255,22 @@ static_assert((clang::StorageClass)ZigClangStorageClass_PrivateExtern == clang:: |
| 1255 | static_assert((clang::StorageClass)ZigClangStorageClass_Auto == clang::SC_Auto, ""); | 1255 | static_assert((clang::StorageClass)ZigClangStorageClass_Auto == clang::SC_Auto, ""); |
| 1256 | static_assert((clang::StorageClass)ZigClangStorageClass_Register == clang::SC_Register, ""); | 1256 | static_assert((clang::StorageClass)ZigClangStorageClass_Register == clang::SC_Register, ""); |
| 1257 | 1257 | ||
| 1258 | void ZigClang_detect_enum_RoundingMode(llvm::APFloat::roundingMode x) { | ||
| 1259 | switch (x) { | ||
| 1260 | case llvm::APFloat::rmNearestTiesToEven: | ||
| 1261 | case llvm::APFloat::rmTowardPositive: | ||
| 1262 | case llvm::APFloat::rmTowardNegative: | ||
| 1263 | case llvm::APFloat::rmTowardZero: | ||
| 1264 | case llvm::APFloat::rmNearestTiesToAway: | ||
| 1265 | break; | ||
| 1266 | } | ||
| 1267 | } | ||
| 1268 | static_assert((llvm::APFloat::roundingMode)ZigClangAPFloat_roundingMode_NearestTiesToEven == llvm::APFloat::rmNearestTiesToEven, ""); | ||
| 1269 | static_assert((llvm::APFloat::roundingMode)ZigClangAPFloat_roundingMode_TowardPositive == llvm::APFloat::rmTowardPositive, ""); | ||
| 1270 | static_assert((llvm::APFloat::roundingMode)ZigClangAPFloat_roundingMode_TowardNegative == llvm::APFloat::rmTowardNegative, ""); | ||
| 1271 | static_assert((llvm::APFloat::roundingMode)ZigClangAPFloat_roundingMode_TowardZero == llvm::APFloat::rmTowardZero, ""); | ||
| 1272 | static_assert((llvm::APFloat::roundingMode)ZigClangAPFloat_roundingMode_NearestTiesToAway == llvm::APFloat::rmNearestTiesToAway, ""); | ||
| 1273 | |||
| 1258 | 1274 | ||
| 1259 | static_assert(sizeof(ZigClangSourceLocation) == sizeof(clang::SourceLocation), ""); | 1275 | static_assert(sizeof(ZigClangSourceLocation) == sizeof(clang::SourceLocation), ""); |
| 1260 | static ZigClangSourceLocation bitcast(clang::SourceLocation src) { | 1276 | static ZigClangSourceLocation bitcast(clang::SourceLocation src) { |
| ... | @@ -1829,3 +1845,10 @@ ZigClangCompoundStmt_const_body_iterator ZigClangCompoundStmt_body_end(const str | ... | @@ -1829,3 +1845,10 @@ ZigClangCompoundStmt_const_body_iterator ZigClangCompoundStmt_body_end(const str |
| 1829 | auto casted = reinterpret_cast<const clang::CompoundStmt *>(self); | 1845 | auto casted = reinterpret_cast<const clang::CompoundStmt *>(self); |
| 1830 | return bitcast(casted->body_end()); | 1846 | return bitcast(casted->body_end()); |
| 1831 | } | 1847 | } |
| 1848 | |||
| 1849 | unsigned ZigClangAPFloat_convertToHexString(const ZigClangAPFloat *self, char *DST, | ||
| 1850 | unsigned HexDigits, bool UpperCase, enum ZigClangAPFloat_roundingMode RM) | ||
| 1851 | { | ||
| 1852 | auto casted = reinterpret_cast<const llvm::APFloat *>(self); | ||
| 1853 | return casted->convertToHexString(DST, HexDigits, UpperCase, (llvm::APFloat::roundingMode)RM); | ||
| 1854 | } |
src/zig_clang.h+13| ... | @@ -32,6 +32,7 @@ struct ZigClangAPValueLValueBase { | ... | @@ -32,6 +32,7 @@ struct ZigClangAPValueLValueBase { |
| 32 | 32 | ||
| 33 | struct ZigClangAPValue; | 33 | struct ZigClangAPValue; |
| 34 | struct ZigClangAPSInt; | 34 | struct ZigClangAPSInt; |
| 35 | struct ZigClangAPFloat; | ||
| 35 | struct ZigClangASTContext; | 36 | struct ZigClangASTContext; |
| 36 | struct ZigClangASTUnit; | 37 | struct ZigClangASTUnit; |
| 37 | struct ZigClangArraySubscriptExpr; | 38 | struct ZigClangArraySubscriptExpr; |
| ... | @@ -713,6 +714,15 @@ enum ZigClangStorageClass { | ... | @@ -713,6 +714,15 @@ enum ZigClangStorageClass { |
| 713 | ZigClangStorageClass_Register, | 714 | ZigClangStorageClass_Register, |
| 714 | }; | 715 | }; |
| 715 | 716 | ||
| 717 | /// IEEE-754R 4.3: Rounding-direction attributes. | ||
| 718 | enum ZigClangAPFloat_roundingMode { | ||
| 719 | ZigClangAPFloat_roundingMode_NearestTiesToEven, | ||
| 720 | ZigClangAPFloat_roundingMode_TowardPositive, | ||
| 721 | ZigClangAPFloat_roundingMode_TowardNegative, | ||
| 722 | ZigClangAPFloat_roundingMode_TowardZero, | ||
| 723 | ZigClangAPFloat_roundingMode_NearestTiesToAway, | ||
| 724 | }; | ||
| 725 | |||
| 716 | ZIG_EXTERN_C struct ZigClangSourceLocation ZigClangSourceManager_getSpellingLoc(const struct ZigClangSourceManager *, | 726 | ZIG_EXTERN_C struct ZigClangSourceLocation ZigClangSourceManager_getSpellingLoc(const struct ZigClangSourceManager *, |
| 717 | struct ZigClangSourceLocation Loc); | 727 | struct ZigClangSourceLocation Loc); |
| 718 | ZIG_EXTERN_C const char *ZigClangSourceManager_getFilename(const struct ZigClangSourceManager *, | 728 | ZIG_EXTERN_C const char *ZigClangSourceManager_getFilename(const struct ZigClangSourceManager *, |
| ... | @@ -827,4 +837,7 @@ ZIG_EXTERN_C struct ZigClangQualType ZigClangFunctionProtoType_getParamType(cons | ... | @@ -827,4 +837,7 @@ ZIG_EXTERN_C struct ZigClangQualType ZigClangFunctionProtoType_getParamType(cons |
| 827 | ZIG_EXTERN_C ZigClangCompoundStmt_const_body_iterator ZigClangCompoundStmt_body_begin(const struct ZigClangCompoundStmt *self); | 837 | ZIG_EXTERN_C ZigClangCompoundStmt_const_body_iterator ZigClangCompoundStmt_body_begin(const struct ZigClangCompoundStmt *self); |
| 828 | ZIG_EXTERN_C ZigClangCompoundStmt_const_body_iterator ZigClangCompoundStmt_body_end(const struct ZigClangCompoundStmt *self); | 838 | ZIG_EXTERN_C ZigClangCompoundStmt_const_body_iterator ZigClangCompoundStmt_body_end(const struct ZigClangCompoundStmt *self); |
| 829 | 839 | ||
| 840 | ZIG_EXTERN_C unsigned ZigClangAPFloat_convertToHexString(const struct ZigClangAPFloat *self, char *DST, | ||
| 841 | unsigned HexDigits, bool UpperCase, enum ZigClangAPFloat_roundingMode RM); | ||
| 842 | |||
| 830 | #endif | 843 | #endif |