[PATCH] D115521: [Templight] Don't display empty strings for names of unnamed template parameters

Kristóf Umann via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 11 01:38:48 PST 2022


Szelethus added inline comments.


================
Comment at: clang/lib/Frontend/FrontendActions.cpp:501
+
+    if (const auto *Decl = dyn_cast<TagDecl>(NamedTemplate)) {
+      if (const auto *R = dyn_cast<RecordDecl>(Decl)) {
----------------
Szelethus wrote:
> martong wrote:
> > martong wrote:
> > > Should this handle `EnumDecl`s as well? An enum declaration itself cannot be a primary template, however, it can be 1) a member of a specialization of a templated class 2)  an instantiation of a member enumeration of a class template specialization.
> > > 
> > > 
> > Should this handle variable templates (VarTemplateDecl) as well? Or it  is not possible to have unnamed variable templates?
> `EnumDecl` is a subclass of `TagDecl`, unless I misunderstood what you meant?
Right now, yes, it seems to that unnamed variable templates are not a thing.


================
Comment at: clang/lib/Frontend/FrontendActions.cpp:501-510
+    if (const auto *Decl = dyn_cast<TagDecl>(NamedTemplate)) {
+      if (const auto *R = dyn_cast<RecordDecl>(Decl)) {
+        if (R->isLambda()) {
+          OS << "lambda at ";
+          Decl->getLocation().print(OS, TheSema.getSourceManager());
+          return;
+        }
----------------
martong wrote:
> martong wrote:
> > Should this handle `EnumDecl`s as well? An enum declaration itself cannot be a primary template, however, it can be 1) a member of a specialization of a templated class 2)  an instantiation of a member enumeration of a class template specialization.
> > 
> > 
> Should this handle variable templates (VarTemplateDecl) as well? Or it  is not possible to have unnamed variable templates?
`EnumDecl` is a subclass of `TagDecl`, unless I misunderstood what you meant?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D115521/new/

https://reviews.llvm.org/D115521



More information about the cfe-commits mailing list