authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-05-15 11:57:30-04:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-05-15 11:57:55-04:00
log3aa43dc31c468b2f80bf065f850618a981c5fca2
tree45a5dcb06e6a45d1aef73e7487c46e6e68c9bf9a
parent787fd0f1bea262d134f06e5913554b8ca086655f
signaturelock-open Commit is signed but in an unrecognized format.

update libclang C API wrapper


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::
1255static_assert((clang::StorageClass)ZigClangStorageClass_Auto == clang::SC_Auto, "");1255static_assert((clang::StorageClass)ZigClangStorageClass_Auto == clang::SC_Auto, "");
1256static_assert((clang::StorageClass)ZigClangStorageClass_Register == clang::SC_Register, "");1256static_assert((clang::StorageClass)ZigClangStorageClass_Register == clang::SC_Register, "");
12571257
1258void 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}
1268static_assert((llvm::APFloat::roundingMode)ZigClangAPFloat_roundingMode_NearestTiesToEven == llvm::APFloat::rmNearestTiesToEven, "");
1269static_assert((llvm::APFloat::roundingMode)ZigClangAPFloat_roundingMode_TowardPositive == llvm::APFloat::rmTowardPositive, "");
1270static_assert((llvm::APFloat::roundingMode)ZigClangAPFloat_roundingMode_TowardNegative == llvm::APFloat::rmTowardNegative, "");
1271static_assert((llvm::APFloat::roundingMode)ZigClangAPFloat_roundingMode_TowardZero == llvm::APFloat::rmTowardZero, "");
1272static_assert((llvm::APFloat::roundingMode)ZigClangAPFloat_roundingMode_NearestTiesToAway == llvm::APFloat::rmNearestTiesToAway, "");
1273
12581274
1259static_assert(sizeof(ZigClangSourceLocation) == sizeof(clang::SourceLocation), "");1275static_assert(sizeof(ZigClangSourceLocation) == sizeof(clang::SourceLocation), "");
1260static ZigClangSourceLocation bitcast(clang::SourceLocation src) {1276static 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
1849unsigned 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 {
3232
33struct ZigClangAPValue;33struct ZigClangAPValue;
34struct ZigClangAPSInt;34struct ZigClangAPSInt;
35struct ZigClangAPFloat;
35struct ZigClangASTContext;36struct ZigClangASTContext;
36struct ZigClangASTUnit;37struct ZigClangASTUnit;
37struct ZigClangArraySubscriptExpr;38struct ZigClangArraySubscriptExpr;
...@@ -713,6 +714,15 @@ enum ZigClangStorageClass {...@@ -713,6 +714,15 @@ enum ZigClangStorageClass {
713 ZigClangStorageClass_Register,714 ZigClangStorageClass_Register,
714};715};
715716
717/// IEEE-754R 4.3: Rounding-direction attributes.
718enum ZigClangAPFloat_roundingMode {
719 ZigClangAPFloat_roundingMode_NearestTiesToEven,
720 ZigClangAPFloat_roundingMode_TowardPositive,
721 ZigClangAPFloat_roundingMode_TowardNegative,
722 ZigClangAPFloat_roundingMode_TowardZero,
723 ZigClangAPFloat_roundingMode_NearestTiesToAway,
724};
725
716ZIG_EXTERN_C struct ZigClangSourceLocation ZigClangSourceManager_getSpellingLoc(const struct ZigClangSourceManager *,726ZIG_EXTERN_C struct ZigClangSourceLocation ZigClangSourceManager_getSpellingLoc(const struct ZigClangSourceManager *,
717 struct ZigClangSourceLocation Loc);727 struct ZigClangSourceLocation Loc);
718ZIG_EXTERN_C const char *ZigClangSourceManager_getFilename(const struct ZigClangSourceManager *,728ZIG_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
827ZIG_EXTERN_C ZigClangCompoundStmt_const_body_iterator ZigClangCompoundStmt_body_begin(const struct ZigClangCompoundStmt *self);837ZIG_EXTERN_C ZigClangCompoundStmt_const_body_iterator ZigClangCompoundStmt_body_begin(const struct ZigClangCompoundStmt *self);
828ZIG_EXTERN_C ZigClangCompoundStmt_const_body_iterator ZigClangCompoundStmt_body_end(const struct ZigClangCompoundStmt *self);838ZIG_EXTERN_C ZigClangCompoundStmt_const_body_iterator ZigClangCompoundStmt_body_end(const struct ZigClangCompoundStmt *self);
829839
840ZIG_EXTERN_C unsigned ZigClangAPFloat_convertToHexString(const struct ZigClangAPFloat *self, char *DST,
841 unsigned HexDigits, bool UpperCase, enum ZigClangAPFloat_roundingMode RM);
842
830#endif843#endif