================ @@ -2438,6 +2438,22 @@ bool Type::isIncompleteType(NamedDecl **Def) const { } } +bool Type::isIncompletableIncompleteType() const { + if (!isIncompleteType()) + return false; + + // Forward declarations of structs, classes, enums, and unions could be later + // completed in a compilation unit by providing a type definition. + if (isStructureOrClassType() || isEnumeralType() || isUnionType()) + return false; + + // Other types are incompletable. + // + // E.g. `char[]` and `void`. The type is incomplete and no future + // type declarations can make the type complete. + return true; +} + ---------------- delcypher wrote:
This implementation is more concise (and is probably slightly faster) but it is much less readable. I could potentially fix that by using the conditions if your patch but not writing them like this. ``` if (!isCompleteType()) return false; // Forward declarations of structs, classes, enums, and unions could be later // completed in a compilation unit by providing a type definition. TagDecl *TD = getAsTagDecl(); if (TD) return false; // Other types are incompletable. // // E.g. `char[]` and `void`. The type is incomplete and no future // type declarations can make the type complete. return true; ``` Why is the `!TD->isCompleteDefinition()` necessary? If `isIncompleteType()` returned true then that would imply that `!TD->isCompleteDefinition()` is true, right? Or am I missing something? https://github.com/llvm/llvm-project/pull/106321 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits