hubert.reinterpretcast added inline comments.

================
Comment at: clang/lib/CodeGen/CGDeclCXX.cpp:305
+  if (llvm::Function *unatexitFn =
+          dyn_cast<llvm::Function>(unatexit.getCallee()))
+    unatexitFn->setDoesNotThrow();
----------------
Xiangling_L wrote:
> jasonliu wrote:
> > Is there a valid case that unatexit.getCallee() returns a type which could 
> > not be cast to llvm::Function?
> > i.e. Could we use cast instead of dyn_cast?
> I used `cast` instead of `dyn_cast` before Diff 9 actually, and then I 
> noticed that `clang-tidy` gave error and asked me to use `dyn_cast` instead. 
> Cannot recall what the error says though...
If we expect `cast` to be okay, then we should use it without the `if`.

In Diff 8, an `if` is used with `cast` (thus a `clang-tidy` error make sense):
```
  if (llvm::Function *unatexitFn = cast<llvm::Function>(unatexit.getCallee()))
```



Repository:
  rL LLVM

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

https://reviews.llvm.org/D74166



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to