Bläddra i källkod

Fix assert in DeduceTemplateArgumentsForHLSL for extension method support

Tex Riddell 6 år sedan
förälder
incheckning
47b75271d5
1 ändrade filer med 5 tillägg och 4 borttagningar
  1. 5 4
      tools/clang/lib/Sema/SemaHLSL.cpp

+ 5 - 4
tools/clang/lib/Sema/SemaHLSL.cpp

@@ -8983,11 +8983,12 @@ Sema::TemplateDeductionResult HLSLExternalSource::DeduceTemplateArgumentsForHLSL
   }
   }
 
 
   // Find the table of intrinsics based on the object type.
   // Find the table of intrinsics based on the object type.
-  const HLSL_INTRINSIC* intrinsics;
-  size_t intrinsicCount;
-  const char* objectName;
+  const HLSL_INTRINSIC* intrinsics = nullptr;
+  size_t intrinsicCount = 0;
+  const char* objectName = nullptr;
   FindIntrinsicTable(FunctionTemplate->getDeclContext(), &objectName, &intrinsics, &intrinsicCount);
   FindIntrinsicTable(FunctionTemplate->getDeclContext(), &objectName, &intrinsics, &intrinsicCount);
-  DXASSERT(intrinsics != nullptr,
+  DXASSERT(objectName != nullptr &&
+    (intrinsics != nullptr || m_intrinsicTables.size() > 0),
     "otherwise FindIntrinsicTable failed to lookup a valid object, "
     "otherwise FindIntrinsicTable failed to lookup a valid object, "
     "or the parser let a user-defined template object through");
     "or the parser let a user-defined template object through");