================
@@ -699,19 +736,20 @@ static bool verifyBorderColor(uint32_t BorderColor) {
 static bool verifyLOD(float LOD) { return !std::isnan(LOD); }
 
 static bool validate(LLVMContext *Ctx, const mcdxbc::RootSignatureDesc &RSD) {
-
+  bool HasError = false;
   if (!verifyVersion(RSD.Version)) {
-    return reportValueError(Ctx, "Version", RSD.Version);
+    HasError = reportValueError(Ctx, "Version", RSD.Version) || HasError;
----------------
llvm-beanz wrote:

This pattern seems really awkward because the report functions always return 
`true`. That means that the `||` is always unnecessary, but also the assignment 
itself isn't really as clear to understand as it could be.

You could instead write this code as something like:

```
if (!verifyVersion(RSD.Version)) {
  reportValueError(...);
  HasError = true;
}
```

This is more verbose but a lot easier to see what is happening.

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

Reply via email to