[clang] [HLSL] Add ByteAddressBuffer definition to HLSLExternalSemaSource #113477 (PR #116699)

Helena Kotas via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 21 16:23:04 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:
----------------
hekota wrote:

Ok, that explains why the *pch* tests are now failing - they include the new buffer types.

I believe the default case in `DeclContext::getPrimaryContext` should be covering the CXXRecordDecl case as well. Since it hits the assert, my guess is that the CXXRecordDecl is probably not set up as expected. Maybe the definition is not complete? What is the difference between the records that use `addSimpleTemplateParams` and this one that does not when executing `DeclContext::getPrimaryContext`?

https://github.com/llvm/llvm-project/pull/116699


More information about the cfe-commits mailing list