[PATCH] D24508: PR28752: Do not instantiate var decls which are not visible.
Richard Smith via cfe-commits
cfe-commits at lists.llvm.org
Tue Oct 11 14:33:19 PDT 2016
rsmith added inline comments.
================
Comment at: include/clang/AST/Decl.h:1213
+ bool isThisDeclarationADemotedDefinition() const {
+ return NonParmVarDeclBits.IsThisDeclarationADemotedDefinition;
+ }
----------------
This is the bug. You can't read this bit here without first checking whether you are a ParmVarDecl, because ParmVarDecls don't have this bit at all.
================
Comment at: include/clang/AST/Decl.h:1222
+ void demoteThisDefinitionToDeclaration() {
+ assert (!isThisDeclarationADemotedDefinition() && "Aleady demoted!");
+ assert (isThisDeclarationADefinition() && "Not a definition!");
----------------
v.g.vassilev wrote:
> rsmith wrote:
> > You can remove this; it's covered by the next line.
> Ok. This would allow calling the method on already demoted definition. Do we want to allow that?
Demoted definitions return false from `isThisDeclarationADefinition()`, so the next line catches this case.
https://reviews.llvm.org/D24508
More information about the cfe-commits
mailing list