[PATCH] D158671: [NFC][Clang] Fix static analyzer concerns
Aaron Ballman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Aug 24 05:34:04 PDT 2023
aaron.ballman accepted this revision.
aaron.ballman added a comment.
LGTM with some nits
================
Comment at: clang/include/clang/ExtractAPI/ExtractAPIVisitor.h:195
SymbolReference Context;
- auto Record = dyn_cast<RecordDecl>(Decl->getDeclContext());
+ auto Record = cast<RecordDecl>(Decl->getDeclContext());
Context.Name = Record->getName();
----------------
dang wrote:
> NIT: It's not immediately obvious that the check `if (Decl->isStaticDataMember())` guarantees that `Decl->getDeclContext()` is a `RecordDecl`. Would you mind adding a comment static that?
================
Comment at: clang/lib/ExtractAPI/DeclarationFragments.cpp:610-612
if (isa<CXXConstructorDecl>(Method)) {
Name = Method->getNameAsString();
+ if (cast<CXXConstructorDecl>(Method)->isExplicit())
----------------
Fznamznon wrote:
> Maybe we can just do this, so we don't `isa` two times.
>
+1 to this, `isa` followed by `cast` is a code smell.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D158671/new/
https://reviews.llvm.org/D158671
More information about the cfe-commits
mailing list