[clang] [HLSL] Add ByteAddressBuffer definition to HLSLExternalSemaSource #113477 (PR #116699)
via cfe-commits
cfe-commits at lists.llvm.org
Fri Nov 22 10:35:19 PST 2024
================
@@ -1474,6 +1474,11 @@ DeclContext *DeclContext::getPrimaryContext() {
case Decl::ObjCCategoryImpl:
return this;
+ case Decl::CXXRecord:
+ if (auto *OPD = dyn_cast<CXXRecordDecl>(this))
+ if (auto *Def = OPD->getDefinition())
+ return Def;
+ return this;
default:
----------------
joaosaffran wrote:
The issue I was facing in the default case of `DeclContext::getPrimaryContext` was when calling `Tag->getTypeForDecl()` (line 1491). For `ByteAdrressBuffer` such method was returning `nullptr`.
For example, when calling `getTypeForDecl` for `StructuredBuffer` I get the response below:
```
InjectedClassNameType 0x5555668d3e20 'StructuredBuffer<element_type>' dependent
`-CXXRecord 0x5555668d3a60 'StructuredBuffer'
```
In contrast, if I call the same method for `ByteAddressBuffer` I get:
```
<<<NULL>>>
```
https://github.com/llvm/llvm-project/pull/116699
More information about the cfe-commits
mailing list