davrec added a comment.
I like the late changes, just need to add comments to the public methods, and
maybe move `getReplacedTemplateParameterList` over to `Decl`.
================
Comment at: clang/include/clang/AST/DeclTemplate.h:3427
+TemplateParameterList *getReplacedTemplateParameterList(Decl *D);
+
----------------
I don't object with making this public, and I can see the argument for making
this its own function rather than a Decl method all things being equal, but
given that we already have `Decl::getDescribedTemplateParams`, I think that
# this should probably also go in Decl,
# a good comment is needed explaining the difference between the two (e.g. that
the `D` is the template/template-like decl itself, not a templated decl as
required by `getDescribedTemplateParams`, or whatever), and what happens when
it is called on a non-template decl, and
# it probably should be named just `getTemplateParams` or something that
suggests its difference with `getDescribedTemplateParams`.
================
Comment at: clang/include/clang/AST/ExprCXX.h:4307
- NonTypeTemplateParmDecl *getParameter() const {
- return ParamAndRef.getPointer();
+ Decl *getAssociatedDecl() const { return AssociatedDeclAndRef.getPointer(); }
+
----------------
Add comment
================
Comment at: clang/include/clang/AST/ExprCXX.h:4321
+
+ bool isReferenceParameter() const { return AssociatedDeclAndRef.getInt(); }
----------------
(Not your responsibility but while you're adding comments maybe you could add
one for this too.)
================
Comment at: clang/include/clang/AST/ExprCXX.h:4378-4380
+ Decl *getAssociatedDecl() const { return AssociatedDecl; }
+
+ unsigned getIndex() const { return Index; }
----------------
Add comments
================
Comment at: clang/include/clang/AST/TemplateName.h:153-154
+
+ Decl *getAssociatedDecl() const { return AssociatedDecl; }
+ unsigned getIndex() const { return Bits.Index; }
----------------
Add comments
================
Comment at: clang/include/clang/AST/TemplateName.h:386-387
public:
- TemplateTemplateParmDecl *getParameter() const { return Parameter; }
+ Decl *getAssociatedDecl() const { return AssociatedDecl; }
+ unsigned getIndex() const { return Bits.Index; }
+
----------------
Add comments
================
Comment at: clang/lib/AST/DeclTemplate.cpp:1610
+ default:
+ llvm_unreachable("Unhandled templated declaration kind");
+ }
----------------
Now that this is public, probably should return nullptr - otherwise users need
the same huge switch just to decide whether they can call this function.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D131858/new/
https://reviews.llvm.org/D131858
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits