================
@@ -1382,6 +1382,15 @@ bool SemaHLSL::handleResourceTypeAttr(QualType T, const 
ParsedAttr &AL) {
     return false;
 
   Attr *A = nullptr;
+
+  AttributeCommonInfo ACI(
----------------
a-tarasyuk wrote:

I'll double-check to be sure, but my understanding is that 
`AttributeCommonInfo` is copied during attribute creation. Since the attribute 
itself is allocated via the `ASTContext` allocator, I assumed this temporary 
`ACI` would be safe to use here.

```cpp
HLSLResourceClassAttr *HLSLResourceClassAttr::Create(ASTContext &Ctx, 
llvm::hlsl::ResourceClass ResourceClass, const AttributeCommonInfo &CommonInfo) 
{
  auto *A = new (Ctx) HLSLResourceClassAttr(Ctx, CommonInfo, ResourceClass);
  if (!A->isAttributeSpellingListCalculated() && !A->getAttrName())
    A->setAttributeSpellingListIndex(0);
  return A;
}
```


https://github.com/llvm/llvm-project/pull/144619
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to