[clang] [llvm] [HLSL][DXIL] InterlockedOr and InterlockedOr64 builtins (PR #180804)

Alexander Johnston via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 9 09:53:24 PDT 2026


================
@@ -3065,6 +2999,25 @@ static bool CheckArgTypeMatches(Sema *S, Expr *Arg, QualType ExpectedType) {
   return false;
 }
 
+// checks for int or long regardless of sign
+static bool CheckArgTypeMatchesList(Sema *S, Expr *Arg,
+                                    llvm::SmallVector<QualType> ExpectedTypes) {
+  QualType ArgType = Arg->getType().getCanonicalType();
+  bool MatchedType = false;
+  for (const auto ExpectedType : ExpectedTypes)
+    if (ArgType == ExpectedType) {
+      MatchedType = true;
+      return false;
+    }
+  if (!MatchedType) {
+    for (const auto ExpectedType : ExpectedTypes)
+      S->Diag(Arg->getBeginLoc(), diag::err_typecheck_convert_incompatible)
+          << ArgType << ExpectedType << 1 << 0 << 0;
----------------
Alexander-Johnston wrote:

It is a little noisy, but the list is pretty limited and it felt nicer to give the list of legal types to the user than not. What would you prefer?

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


More information about the cfe-commits mailing list