-
Notifications
You must be signed in to change notification settings - Fork 13.5k
[clang] Migration to PointerIntPair
#69835
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@llvm/issue-subscribers-clang-static-analyzer Author: Vlad Serebrennikov (Endilll)
Here is an incomplete list of ad-hoc tagged pointers that should be refactored to use `llvm::PointerIntPair`:
- [ ] clang::ActionResult::Value
- [ ] clang::ASTWriter::DeclOrType::Stored
- [ ] clang::CGBlockInfo::Capture::Data
- [ ] clang::DeclAccessPair::Ptr
- [ ] clang::DeclarationName::Ptr
- [ ] clang::DesignatedInitExpr::Designator::NameOrField
- [ ] clang::IdentifierResolver::Iterator::Ptr
- [ ] clang::LazyOffsetPtr::Ptr
- [ ] clang::NodeGroup::P
- [ ] clang::ObjCMessageExpr::SelectorOrMethod
- [ ] clang::OffsetOfNode::Data
- [ ] clang::Selector::InfoPtr
- [ ] clang::StmtIteratorBase::RawVAPtr
- [ ] clang::Token::PtrData
- [ ] clang::VTableComponent::Value
- [ ] clang::api_notes::FunctionInfo::NullabilityPayload
- [ ] clang::ento::SVal::Data
Apart from inconsistency with newer code that uses |
PointerIntPair
@llvm/issue-subscribers-clang-codegen Author: Vlad Serebrennikov (Endilll)
Here is an incomplete list of ad-hoc tagged pointers that should be refactored to use `llvm::PointerIntPair`:
- [ ] `clang::ActionResult::Value`
- [ ] `clang::ASTWriter::DeclOrType::Stored`
- [ ] `clang::CGBlockInfo::Capture::Data`
- [ ] `clang::DeclAccessPair::Ptr`
- [ ] `clang::DeclarationName::Ptr`
- [ ] `clang::DesignatedInitExpr::Designator::NameOrField`
- [ ] `clang::IdentifierResolver::Iterator::Ptr`
- [ ] `clang::LazyOffsetPtr::Ptr`
- [ ] `clang::NodeGroup::P`
- [ ] `clang::ObjCMessageExpr::SelectorOrMethod`
- [ ] `clang::OffsetOfNode::Data`
- [ ] `clang::Selector::InfoPtr`
- [ ] `clang::StmtIteratorBase::RawVAPtr`
- [ ] `clang::Token::PtrData`
- [ ] `clang::VTableComponent::Value`
- [ ] `clang::api_notes::FunctionInfo::NullabilityPayload`
- [ ] `clang::ento::SVal::Data`
Apart from inconsistency with newer code that uses |
@llvm/issue-subscribers-clang-frontend Author: Vlad Serebrennikov (Endilll)
Here is an incomplete list of ad-hoc tagged pointers that should be refactored to use `llvm::PointerIntPair`:
- [ ] `clang::ActionResult::Value`
- [ ] `clang::ASTWriter::DeclOrType::Stored`
- [ ] `clang::CGBlockInfo::Capture::Data`
- [ ] `clang::DeclAccessPair::Ptr`
- [ ] `clang::DeclarationName::Ptr`
- [ ] `clang::DesignatedInitExpr::Designator::NameOrField`
- [ ] `clang::IdentifierResolver::Iterator::Ptr`
- [ ] `clang::LazyOffsetPtr::Ptr`
- [ ] `clang::NodeGroup::P`
- [ ] `clang::ObjCMessageExpr::SelectorOrMethod`
- [ ] `clang::OffsetOfNode::Data`
- [ ] `clang::Selector::InfoPtr`
- [ ] `clang::StmtIteratorBase::RawVAPtr`
- [ ] `clang::Token::PtrData`
- [ ] `clang::VTableComponent::Value`
- [ ] `clang::api_notes::FunctionInfo::NullabilityPayload`
- [ ] `clang::ento::SVal::Data`
Apart from inconsistency with newer code that uses |
AFAIK |
Upon closer inspection, I agree with you. I saw
Look at the following bit of implementation, it appears that you can break it down into two bit-fields: 2 bits and 30 bits (or less): llvm-project/clang/include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h Lines 109 to 110 in 9022f40
Even if you need to combine them into single number for whatever reason, it should be trivial. But every time we do ad-hoc bit-packing without a type information attached that tells how to unpack it, debugging experience suffers. #69104 should help with bit-field cases where it's impossible to let compiler know the type, because of Microsoft ABI implications. |
There are not-so-good solutions like refactoring |
Refactor `uintptr_t` inside of `clang::Selector` that holds a pointer to `IdentifierInfo` or `MultiKeywordSelector` and `IdentifierInfoFlag` enum into `PointerIntPair`. This is a part of `PointerIntPair` migration outlined in #69835. Unlike `uintpt_t`, `PointerIntPair` required pointee types to be complete, so I had to shuffle definitions of `MultiKeywordSelector` and `detail::DeclarationNameExtra` around to make them complete at `Selector`. Also, there were outdated specializations of `PointerLikeTypeTraits` for `IdentifierInfo *`, which are no longer needed, because `alignof` that primary template use works just fine. Not just that, but they declared that `IdentifierInfo *` has only 1 spare lower bit, but today they are 8-byte aligned.
Here is an incomplete list of ad-hoc tagged pointers that should be refactored to use
llvm::PointerIntPair
:clang::ActionResult::Value
clang::ASTWriter::DeclOrType::Stored
clang::CGBlockInfo::Capture::Data
clang::DeclAccessPair::Ptr
clang::DeclarationName::Ptr
clang::DesignatedInitExpr::Designator::NameOrField
clang::IdentifierResolver::Iterator::Ptr
clang::LazyOffsetPtr::Ptr
clang::NodeGroup::P
clang::ObjCMessageExpr::SelectorOrMethod
clang::OffsetOfNode::Data
clang::Selector::InfoPtr
clang::StmtIteratorBase::RawVAPtr
clang::Token::PtrData
clang::VTableComponent::Value
clang::api_notes::FunctionInfo::NullabilityPayload
Apart from inconsistency with newer code that uses
PointerIntPair
, ad-hoc tagged pointers require boilerplate on the side of debug formatters.The text was updated successfully, but these errors were encountered: