[clang] [clang] Add clang::preferred_type attribute for bitfields (PR #69104)
Vlad Serebrennikov via cfe-commits
cfe-commits at lists.llvm.org
Fri Oct 20 09:09:41 PDT 2023
================
@@ -5910,6 +5910,51 @@ static void handleBuiltinAliasAttr(Sema &S, Decl *D,
D->addAttr(::new (S.Context) BuiltinAliasAttr(S.Context, AL, Ident));
}
+static void handlePreferredTypeAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
+ if (!AL.hasParsedType()) {
+ S.Diag(AL.getLoc(), diag::err_attribute_wrong_number_arguments) << AL << 1;
+ return;
+ }
+
+ TypeSourceInfo *ParmTSI = nullptr;
+ QualType QT = S.GetTypeFromParser(AL.getTypeArg(), &ParmTSI);
+ QT->getAsTagDecl()->setCompleteDefinitionRequired();
----------------
Endilll wrote:
@dwblaikie Would it be fine to do this? The intention here is that we parse type argument of the attribute, and then use it in `CGDebugInfo.h` (you might be interested in changes there as well), bypassing Sema.
https://github.com/llvm/llvm-project/pull/69104
More information about the cfe-commits
mailing list