[PATCH] D74166: [AIX][Frontend] Static init implementation for AIX considering no priority

Hubert Tong via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 11 14:53:47 PDT 2020


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





More information about the cfe-commits mailing list