[PATCH] D55948: Modify DeclaratorChuck::getFunction to use DeclSpec for qualifiers

John McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 20 13:40:18 PST 2018

rjmccall added inline comments.

Comment at: include/clang/Sema/DeclSpec.h:1304
+    /// DeclSpec for the function with the qualifier related info. 
+    DeclSpec *TypeDeclSpec;
Can we give this a better name?  I know we use "type qualifiers" for this concept in the AST, but it's not a good name, and we should really rename it in the AST.  How about `MethodQualifiers`?

Comment at: lib/Parse/ParseDecl.cpp:6129
+      // create DeclSpec here to be populated later.
+      DS = new DeclSpec(AttrFactory);
Is it possible to just build into a local DS and then move that DS to the heap if it contains qualifiers or attributes?  It'd be nice to not do a heap allocation every time we parse a function declarator in C++ since the vast majority of them don't have qualifiers.  (It probably has to be a move to handle attributes and `AttributeFactory` correctly.)

That would also side-step any concerns about memory management.



More information about the cfe-commits mailing list