[PATCH] D72998: [IR] Attribute/AttrBuilder: use Value::MaximumAlignment magic constant
Guillaume Chatelet via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Jan 24 07:44:45 PST 2020
gchatelet added a comment.
Actually there's an issue with the code. It doesn't compile in shared_library mode.
ld.lld: error: undefined symbol: clang::Sema::MaximumAlignment
>>> referenced by SemaChecking.cpp:5397 (/redacted/llvm-project/clang/lib/Sema/SemaChecking.cpp:5397)
>>> tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaChecking.cpp.o:(clang::Sema::SemaBuiltinAssumeAligned(clang::CallExpr*))
>>> referenced by SemaChecking.cpp:3670 (/redacted/llvm-project/clang/lib/Sema/SemaChecking.cpp:3670)
>>> tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaChecking.cpp.o:(clang::Sema::checkCall(clang::NamedDecl*, clang::FunctionProtoType const*, clang::Expr const*, llvm::ArrayRef<clang::Expr const*>, bool, clang::SourceLocation, clang::SourceRange, clang::Sema::VariadicCallType))
>>> referenced by SemaDeclAttr.cpp:1631 (/redacted/llvm-project/clang/lib/Sema/SemaDeclAttr.cpp:1631)
>>> tools/clang/lib/Sema/CMakeFiles/obj.clangSema.dir/SemaDeclAttr.cpp.o:(clang::Sema::AddAssumeAlignedAttr(clang::Decl*, clang::AttributeCommonInfo const&, clang::Expr*, clang::Expr*))
It comes from the fact that `Diag::operator<<` takes arguments by `const&`.
You'd need to anchor the value in `Sema.cpp` but then the compiler doesn't see the value anymore, another option would be to use inlined variables <https://en.cppreference.com/w/cpp/language/inline> (but this is C++17) or use an anonymous enum value.
enum {
MaxAlignmentExponent = 29;
MaximumAlignment = 1u << MaxAlignmentExponent;
};
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D72998/new/
https://reviews.llvm.org/D72998
More information about the cfe-commits
mailing list