[PATCH] D112284: [Clang][NFC] Clang CUDA codegen: a dyn_cast -> cast instance + clang-tidy fixes

Uday Bondhugula via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 25 23:46:47 PDT 2021


bondhugula marked an inline comment as done.
bondhugula added a comment.

In D112284#3085086 <https://reviews.llvm.org/D112284#3085086>, @tra wrote:

> The description is a bit misleading. The dyn_cast->cast appears to be a minor part of this patch.
> I'd separate clang-tidy cleanups into a separate patch or would just describe all of these changes as a clean-up. dyn_cast->cast is an NFC change here, too, considering that we're operating on a type of `FunctionDecl *cudaLaunchKernelFD`.

I agree. I've done the latter.



================
Comment at: clang/lib/CodeGen/CGCUDANV.cpp:240
         llvm::FunctionType::get(IntTy, CharPtrTy, false), "hipLaunchByPtr");
-  } else {
-    // cudaError_t cudaLaunch(char *);
-    return CGM.CreateRuntimeFunction(
-        llvm::FunctionType::get(IntTy, CharPtrTy, false), "cudaLaunch");
   }
+  // cudaError_t cudaLaunch(char *);
----------------
tra wrote:
> Nit: you could remove these `{...}` now, too.
I retained this part due to the extra comment in line with LLVM style:
https://llvm.org/docs/CodingStandards.html#don-t-use-braces-on-simple-single-statement-bodies-of-if-else-loop-statements
"//We consider that readability is harmed when omitting the brace in the presence of a single statement that is accompanied by a comment (assuming the comment can’t be hoisted above the if or loop statement, see below).//"


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D112284/new/

https://reviews.llvm.org/D112284



More information about the cfe-commits mailing list