[llvm] [DirectX] Error handling improve in root signature metadata Parser (PR #149232)
Chris B via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 25 10:29:45 PDT 2025
================
@@ -22,42 +21,34 @@ namespace llvm {
namespace hlsl {
namespace rootsig {
-static std::optional<uint32_t> extractMdIntValue(MDNode *Node,
+char GenericRSMetadataError::ID;
+char InvalidRSMetadataFormat::ID;
+char InvalidRSMetadataValue::ID;
+template <typename T> char RootSignatureValidationError<T>::ID;
+
+inline std::optional<uint32_t> extractMdIntValue(MDNode *Node,
unsigned int OpId) {
if (auto *CI =
mdconst::dyn_extract<ConstantInt>(Node->getOperand(OpId).get()))
return CI->getZExtValue();
return std::nullopt;
}
-static std::optional<float> extractMdFloatValue(MDNode *Node,
+inline std::optional<float> extractMdFloatValue(MDNode *Node,
----------------
llvm-beanz wrote:
`static` and `inline` aren't strictly equivalent. The `inline` keyword doesn't impact symbol visibility, so this function is still exported and externally visible. It becomes an ODR so if there are multiple definitions they must all be identical, but that's not the behavior we want.
See the relevant coding standard: https://llvm.org/docs/CodingStandards.html#restrict-visibility
https://github.com/llvm/llvm-project/pull/149232
More information about the llvm-commits
mailing list