================
@@ -433,6 +433,22 @@ QualType Descriptor::getDataType(const ASTContext &Ctx) 
const {
   return getType();
 }
 
+QualType Descriptor::getDataElemType() const {
+  if (const auto *E = asExpr()) {
----------------
keinflue wrote:

I could factor out the conditions for the `new`/`allocate` expressions into 
another function which would then return the element type before it is 
(possibly) turned into an array type. But that function then also needs to 
return whether or not the special handling applies (rather than the default 
path `return getType();`), e.g. by returning an empty `QualType`, maybe?

Alternatively I could add a parameter `bool ElemTypeOnly` to switch between the 
two variants in a single function. That would look cleaner in the 
implementation, but has the usual problems of a `bool` parameter affecting the 
semantics of a function.

Any opinions on these approaches?

https://github.com/llvm/llvm-project/pull/174132
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to