[PATCH] D27279: Store decls in prototypes on the declarator instead of in the AST
Richard Smith via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Dec 7 14:20:33 PST 2016
rsmith added inline comments.
================
Comment at: include/clang/Sema/DeclSpec.h:1240
+ /// in the prototype. These are generally tag types or enumerators.
+ unsigned NumDeclsInPrototype : 8;
+
----------------
It seems plausible that generated code could have more than 256 such declarations. This class has a pointer, a set of bit-fields, 12 `unsigned`s, and another pointer, so we could give this a full 32 bits without increasing the size of the class. Alternatively we could share the storage with `NumExceptions`, since this can only be non-zero in C and that can only be non-zero in C++.
================
Comment at: include/clang/Sema/DeclSpec.h:1311
+ /// for lookup inside the function body, if one exists.
+ NamedDecl **DeclsInPrototype;
+
----------------
Might make sense to put this into the preceding union, if we care about how big this type is.
================
Comment at: test/Misc/ast-dump-decl.c:109-110
// CHECK: FunctionDecl{{.*}} TestFunctionDecl 'int (int, enum {{.*}})'
-// CHECK-NEXT: EnumDecl
-// CHECK-NEXT: EnumConstantDecl{{.*}} e
// CHECK-NEXT: ParmVarDecl{{.*}} x
----------------
Why is this not here any more? Looks like SemaDecl.cpp:8255 should have added it to this `DeclContext`. It'd be nice for `-ast-dump` to still dump these declarations somewhere.
https://reviews.llvm.org/D27279
More information about the cfe-commits
mailing list