[PATCH] D90073: [Clang][CodeGen] fix failed assertion
Aaron Ballman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sat Oct 24 06:45:25 PDT 2020
aaron.ballman added inline comments.
================
Comment at: clang/lib/CodeGen/CodeGenModule.cpp:4640
/*D=*/nullptr);
- LT = getLLVMLinkageVarDefinition(cast<VarDecl>(GD.getDecl()),
- D->getType().isConstQualified());
+ if (isa<VarDecl>(GD.getDecl()))
+ LT = getLLVMLinkageVarDefinition(cast<VarDecl>(GD.getDecl()),
----------------
Rather than `isa<>` followed by `cast<>`, this should be using `dyn_cast<>`. e.g.,
```
if (const auto *VD = dyn_cast<VarDecl>(GD.getDecl()))
...
else
...
```
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D90073/new/
https://reviews.llvm.org/D90073
More information about the cfe-commits
mailing list