[PATCH] D156337: [clang] Allow setting the uninitialized attribute on record
Mariya Podchishchaeva via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Jul 27 01:50:25 PDT 2023
Fznamznon added inline comments.
================
Comment at: clang/lib/CodeGen/CGDecl.cpp:1906-1908
+ if (D.isConstexpr())
+ // Note: constexpr already initializes everything correctly.
+ trivialAutoVarInit = LangOptions::TrivialAutoVarInitKind::Uninitialized;
----------------
Should we have curly braces here?
================
Comment at: clang/lib/CodeGen/CGDecl.cpp:1909
+ trivialAutoVarInit = LangOptions::TrivialAutoVarInitKind::Uninitialized;
+ else if (D.getAttr<UninitializedAttr>())
+ trivialAutoVarInit = LangOptions::TrivialAutoVarInitKind::Uninitialized;
----------------
================
Comment at: clang/lib/Sema/SemaDeclAttr.cpp:8442
+ assert(((isa<VarDecl>(D) &&
+ cast<VarDecl>(D)->getStorageDuration() == SD_Automatic) ||
+ isa<RecordDecl>(D)) &&
----------------
AFAIK `cast` does `isa`, since it is already done here we can probably switch to `dyn_cast`.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D156337/new/
https://reviews.llvm.org/D156337
More information about the cfe-commits
mailing list