[PATCH] D112024: [clang] diagnose_as attribute for Fortify diagnosing like builtins.
Aaron Ballman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Dec 7 10:16:38 PST 2021
aaron.ballman added inline comments.
================
Comment at: clang/include/clang/Basic/Attr.td:3873
+ let Subjects = SubjectList<[Function]>;
+ let LateParsed = 1;
+ let Documentation = [DiagnoseAsBuiltinDocs];
----------------
Why does this need to be late parsed? I don't think the arguments to the attribute are ones that name class members or anything like that.
================
Comment at: clang/lib/Sema/SemaDeclAttr.cpp:1006-1009
+ const auto *DeclFD = dyn_cast<FunctionDecl>(D);
+ if (!DeclFD)
+ // User will have already been warned.
+ return;
----------------
aaron.ballman wrote:
> Sorry, I should have suggested this earlier -- might as well assert if `D` is something we should have already validated is a `FunctionDecl` before calling this helper.
Sorry, my suggestion wasn't as clear as it could have been -- `cast<>` does the assertion for you, so you can switch `dyn_cast` to `cast` and remove the explicit `assert` here.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D112024/new/
https://reviews.llvm.org/D112024
More information about the cfe-commits
mailing list