================ @@ -10,20 +10,20 @@ bool clang::CIRGen::isEmptyRecordForLayout(const ASTContext &context, if (!rt) return false; - const RecordDecl *rd = rt->getDecl(); + const RecordDecl *rd = rt->getOriginalDecl(); ---------------- mizvekov wrote:
FYI the reason this was renamed is because this changed meaning. getDecl before this change would search for a definition and return that if it existed. getOriginalDecl doesn't, it always returns the decl found when building the type. To strictly keep the previous behavior, you would have to use getDefinitionOrSelf() on what getOriginalDecl returns. Note this situation is a mess and is transitory, we plan to rectify this in the future, including providing inline helpers so you can getDefinitionOrSelf directly on the type, and rename getOriginalDecl back to getDecl once the dust settles. For example on this usage, the 'bases' method automatically seeks out the definition, so that's fine, but 'fields' doesn't, and this will return an empty range on a forward declaration. The same applies to many other methods. For example 'canPassInRegister' will always be true on a forward declaration. I suspect since we are dealing with codegen here, you will mostly want the definition anyway. Except when using the decl as a key, using the canonical decl will be a bit cheaper. Maybe in some novel debug info stuff you will really want the original decl anyways. This comment applies to other usages in this PR as well. https://github.com/llvm/llvm-project/pull/152846 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits