================
@@ -47,36 +48,54 @@ class Block final {
static constexpr uint8_t WeakFlag = 1 << 2;
public:
- static constexpr uint8_t InlineDescMD = sizeof(InlineDescriptor);
- static constexpr uint8_t GlobalMD = sizeof(GlobalInlineDescriptor);
+ enum BlockKind : uint8_t { None, Local, Global };
/// Creates a new block.
Block(unsigned EvalID, UnsignedOrNone DeclID, const Descriptor *Desc,
- unsigned MDSize = 0, bool IsStatic = false, bool IsExtern = false,
- bool IsWeak = false)
- : Desc(Desc), DeclID(DeclID), EvalID(EvalID), MDSize(MDSize),
- IsStatic(IsStatic) {
+ BlockKind K, bool IsExtern, bool IsWeak)
+
+ : Desc(Desc), DescSize(Desc->getAllocSize()), DeclID(DeclID),
+ EvalID(EvalID), Kind(K), MDSize(getMetadataSize(K)) {
assert(Desc);
AccessFlags |= (ExternFlag * IsExtern);
AccessFlags |= (WeakFlag * IsWeak);
}
- Block(unsigned EvalID, const Descriptor *Desc, unsigned MDSize = 0,
- bool IsStatic = false, bool IsExtern = false, bool IsWeak = false)
- : Desc(Desc), EvalID(EvalID), MDSize(MDSize), IsStatic(IsStatic) {
+ Block(unsigned EvalID, const Descriptor *Desc, BlockKind K,
+ bool IsExtern = false, bool IsWeak = false)
+ : Desc(Desc), DescSize(Desc->getAllocSize()), EvalID(EvalID), Kind(K),
+ MDSize(getMetadataSize(K)) {
assert(Desc);
AccessFlags |= (ExternFlag * IsExtern);
AccessFlags |= (WeakFlag * IsWeak);
}
+ /// Number of bytes needed to allocate the block.
+ static constexpr unsigned allocSize(const Descriptor *D, BlockKind K) {
+ return sizeof(Block) + getMetadataSize(K) + D->getAllocSize();
----------------
Meinersbur wrote:
Fails when compiled with msvc:
```
FAILED: [code=2]
tools/clang/lib/AST/CMakeFiles/obj.clangAST.dir/ASTContext.cpp.obj
ccache
C:\PROGRA~1\MICROS~2\18\COMMUN~1\VC\Tools\MSVC\1451~1.362\bin\Hostx64\x64\cl.exe
/nologo /TP -DCLANG_BUILD_STATIC -DUNICODE -D_CRT_NONSTDC_NO_DEPRECATE
-D_CRT_NONSTDC_NO_WARNINGS -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS
-D_GLIBCXX_ASSERTIONS -D_HAS_EXCEPTIONS=0
-D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_EXTENSIVE
-D_SCL_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS -D_UNICODE
-D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
-IC:\buildbot\flang-x86_64-windows\build\tools\clang\lib\AST
-IC:\buildbot\flang-x86_64-windows\llvm-project\clang\lib\AST
-IC:\buildbot\flang-x86_64-windows\llvm-project\clang\include
-IC:\buildbot\flang-x86_64-windows\build\tools\clang\include
-IC:\buildbot\flang-x86_64-windows\build\include
-IC:\buildbot\flang-x86_64-windows\llvm-project\llvm\include -I"C:\Program
Files\Microsoft Visual Studio\18\Community\DIA SDK\include" /DWIN32 /D_WINDOWS
/Zc:inline /Zc:preprocessor /Zc:__cplusplus /Oi /bigobj /permissive- /W4
-wd4146 -wd4244 -wd4267 -wd4456 -wd4457 -wd4458 -wd4459 -wd4624 -wd4100 -wd4127
-wd4505 -wd4702 -wd4245 -wd4310 -wd4701 -wd4703 -wd4389 -wd4805 -wd4577 -wd4319
-wd4324 -wd4251 -wd4275 -w14062 -we4238 /Gw /O2 /Ob2 -std:c++17 -MD -UNDEBUG
/EHs-c- /GR- /showIncludes
/Fotools\clang\lib\AST\CMakeFiles\obj.clangAST.dir\ASTContext.cpp.obj
/Fdtools\clang\lib\AST\CMakeFiles\obj.clangAST.dir\ /FS -c
C:\buildbot\flang-x86_64-windows\llvm-project\clang\lib\AST\ASTContext.cpp
..\llvm-project\clang\lib\AST\ByteCode\Block.h(74): error C3615: constexpr
function 'clang::interp::Block::allocSize' cannot result in a constant
expression
..\llvm-project\clang\lib\AST\ByteCode\Block.h(75): note: failure was caused by
call of undefined function or one not declared 'constexpr'
..\llvm-project\clang\lib\AST\ByteCode\Block.h(75): note: see usage of
'clang::interp::Descriptor::getAllocSize'
```
https://lab.llvm.org/buildbot/#/builders/166/builds/11531
https://github.com/llvm/llvm-project/pull/234203
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits