[PATCH] D133586: [clang] initialize type qualifiers for FunctionNoProtoType

Richard Trieu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 22 21:18:57 PDT 2022


rtrieu added inline comments.


================
Comment at: clang/include/clang/AST/Type.h:3947
+                     Info) {
+    FunctionTypeBits.FastTypeQuals = 0;
+  }
----------------
rmaz wrote:
> aaron.ballman wrote:
> > It seems a bit odd to me that we only want to initialize one member of the bits and none of the rest.
> The reason I only set the `FastTypeQuals` is because the rest of the `FunctionTypeBits` are not accessed in the base class or this class, except for `ExtInfo` which is initialized in the base class.
This feels error-prone since any new classes derived from `FunctionType` will need to also have this.

I think the safer change is to modify `FunctionType::getFastTypeQuals()`.  If `this` is a `FunctionProtoType`, use `FastTypeQuals` to create a `Qualifiers`.  If it is not, return a default created `Qualifiers`.  This way, we won't need to increase the access to data members.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D133586/new/

https://reviews.llvm.org/D133586



More information about the cfe-commits mailing list