diff options
author | Erik Pilkington <erik.pilkington@gmail.com> | 2019-07-02 18:28:13 +0000 |
---|---|---|
committer | Erik Pilkington <erik.pilkington@gmail.com> | 2019-07-02 18:28:13 +0000 |
commit | eee944e7f9e60df44714eb547d0b876ee5dc7290 (patch) | |
tree | bfbb77d0b88de0f45c22ce3747d8d214d0f5a0d7 /clang/tools | |
parent | 5613874947462fd4ceb4f66926c879269609463f (diff) | |
download | bcm5719-llvm-eee944e7f9e60df44714eb547d0b876ee5dc7290.tar.gz bcm5719-llvm-eee944e7f9e60df44714eb547d0b876ee5dc7290.zip |
[C++2a] Add __builtin_bit_cast, used to implement std::bit_cast
This commit adds a new builtin, __builtin_bit_cast(T, v), which performs a
bit_cast from a value v to a type T. This expression can be evaluated at
compile time under specific circumstances.
The compile time evaluation currently doesn't support bit-fields, but I'm
planning on fixing this in a follow up (some of the logic for figuring this out
is in CodeGen). I'm also planning follow-ups for supporting some more esoteric
types that the constexpr evaluator supports, as well as extending
__builtin_memcpy constexpr evaluation to use the same infrastructure.
rdar://44987528
Differential revision: https://reviews.llvm.org/D62825
llvm-svn: 364954
Diffstat (limited to 'clang/tools')
-rw-r--r-- | clang/tools/libclang/CIndex.cpp | 2 | ||||
-rw-r--r-- | clang/tools/libclang/CXCursor.cpp | 2 |
2 files changed, 4 insertions, 0 deletions
diff --git a/clang/tools/libclang/CIndex.cpp b/clang/tools/libclang/CIndex.cpp index c9d4c6f0a48..b3d2974b43b 100644 --- a/clang/tools/libclang/CIndex.cpp +++ b/clang/tools/libclang/CIndex.cpp @@ -5194,6 +5194,8 @@ CXString clang_getCursorKindSpelling(enum CXCursorKind Kind) { return cxstring::createRef("CallExpr"); case CXCursor_ObjCMessageExpr: return cxstring::createRef("ObjCMessageExpr"); + case CXCursor_BuiltinBitCastExpr: + return cxstring::createRef("BuiltinBitCastExpr"); case CXCursor_UnexposedStmt: return cxstring::createRef("UnexposedStmt"); case CXCursor_DeclStmt: diff --git a/clang/tools/libclang/CXCursor.cpp b/clang/tools/libclang/CXCursor.cpp index 0d80cdb9af1..422c2dacf75 100644 --- a/clang/tools/libclang/CXCursor.cpp +++ b/clang/tools/libclang/CXCursor.cpp @@ -716,6 +716,8 @@ CXCursor cxcursor::MakeCXCursor(const Stmt *S, const Decl *Parent, case Stmt::OMPTargetTeamsDistributeSimdDirectiveClass: K = CXCursor_OMPTargetTeamsDistributeSimdDirective; break; + case Stmt::BuiltinBitCastExprClass: + K = CXCursor_BuiltinBitCastExpr; } CXCursor C = { K, 0, { Parent, S, TU } }; |