[PATCH] D82425: [SemaCXX] Fix false positive of -Wuninitialized-const-reference in empty function body.
Zequan Wu via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Jun 24 11:21:47 PDT 2020
zequanwu marked 2 inline comments as done.
zequanwu added inline comments.
================
Comment at: clang/lib/Analysis/UninitializedValues.cpp:410
+ if (FunctionDecl *fd = CE->getDirectCallee()) {
+ if (FunctionTemplateDecl *ftd = fd->getPrimaryTemplate())
+ return ftd->getTemplatedDecl()->hasTrivialBody();
----------------
hans wrote:
> Is this special check for templates necessary? Doesn't the "fd->hasTrivialBody()" check below also handle the template case?
Yes, it is necessary. If the function is a function template, `fd` doesn't have body when this analysis happens. So `fd->hasTrivialBody()` is always false in that case.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D82425/new/
https://reviews.llvm.org/D82425
More information about the cfe-commits
mailing list