[PATCH] D134286: [C2x] implement typeof and typeof_unqual

Matheus Izvekov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 21 06:05:43 PDT 2022


mizvekov added inline comments.


================
Comment at: clang/lib/AST/Type.cpp:3504-3507
+  // We strip all qualifier-like attributes as well.
+  if (const auto *AT = dyn_cast<AttributedType>(Ret.getTypePtr());
+      AT && AT->isQualifier())
+    Ret = AT->getModifiedType();
----------------
I think this block of code is not actually needed.

So the AttributedType node is just sugar right, the address space are real qualifiers applied to the type, just like const and such.

So the `getAtomicUnqualifiedType()` alone should do that, as it uses `getUnqualifiedType()` on the final result.

When unqualifying a type, this will already strip all top level sugar nodes necessary to get rid of the qualifiers.


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

https://reviews.llvm.org/D134286



More information about the cfe-commits mailing list