[PATCH] D53847: [C++2a] P0634r3: Down with typename!

Shafik Yaghmour via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 7 14:31:09 PDT 2022


shafik added a comment.

First set of comments.



================
Comment at: clang/include/clang/Parse/Parser.h:2418
+        DS, TemplateInfo, AS, DSC, LateAttrs,
+        (ImplicitTypenameContext)isImplicitTypenameContext(DSC));
+  }
----------------
Why don't we just have `isImplicitTypenameContext(...)` return an `ImplicitTypenameContext`?


================
Comment at: clang/include/clang/Sema/DeclSpec.h:1809
+enum class ImplicitTypenameContext {
+  Never,
+  Yes,
----------------
Since you use `Yes` for the positive option how about `No` for the negative option? `Yes`/`Never` feel like an odd pair.


================
Comment at: clang/lib/Parse/ParseDecl.cpp:3608
           Actions.isCurrentClassName(*Tok.getIdentifierInfo(), getCurScope()) &&
-          isConstructorDeclarator(/*Unqualified*/true))
+          isConstructorDeclarator(/*Unqualified*/ true,
+                                  /*DeductionGuide*/ false,
----------------



================
Comment at: clang/lib/Parse/ParseDecl.cpp:3609
+          isConstructorDeclarator(/*Unqualified*/ true,
+                                  /*DeductionGuide*/ false,
+                                  DS.isFriendSpecified()))
----------------



================
Comment at: clang/lib/Parse/ParseDeclCXX.cpp:1248
     if (TemplateId->mightBeType()) {
-      AnnotateTemplateIdTokenAsType(SS, /*IsClassName*/ true);
+      AnnotateTemplateIdTokenAsType(SS, ImplicitTypenameContext::Never, /*IsClassName*/ true);
 
----------------



================
Comment at: clang/lib/Parse/ParseDeclCXX.cpp:1290
         takeTemplateIdAnnotation(Tok)->mightBeType())
-      AnnotateTemplateIdTokenAsType(SS, /*IsClassName*/ true);
+      AnnotateTemplateIdTokenAsType(SS, ImplicitTypenameContext::Never, /*IsClassName*/ true);
 
----------------



================
Comment at: clang/lib/Parse/ParseDeclCXX.cpp:1311
       /*WantNontrivialTypeSourceInfo=*/true,
-      /*IsClassTemplateDeductionContext*/ false, &CorrectedII);
+      /*IsClassTemplateDeductionContext*/ false, ImplicitTypenameContext::Never,&CorrectedII);
   if (!Type) {
----------------



================
Comment at: clang/lib/Parse/ParseTentative.cpp:446
+  TPResult R = isCXXDeclarationSpecifier(ImplicitTypenameContext::Never, 
+                                         /*BracedCastResult*/ TPResult::True,
                                          &InvalidAsDeclSpec);
----------------



================
Comment at: clang/lib/Parse/Parser.cpp:2035
             /*IsCtorOrDtorName=*/false,
-            /*NonTrivialTypeSourceInfo*/true,
-            /*IsClassTemplateDeductionContext*/true)) {
+            /*NonTrivialTypeSourceInfo*/ true,
+            /*IsClassTemplateDeductionContext*/ true, AllowImplicitTypename)) {
----------------



================
Comment at: clang/lib/Parse/Parser.cpp:2036
+            /*NonTrivialTypeSourceInfo*/ true,
+            /*IsClassTemplateDeductionContext*/ true, AllowImplicitTypename)) {
       SourceLocation BeginLoc = Tok.getLocation();
----------------



================
Comment at: clang/lib/Sema/DeclSpec.cpp:27
 #include "clang/Sema/SemaDiagnostic.h"
+#include "clang/Sema/Lookup.h"
 #include "llvm/ADT/STLExtras.h"
----------------
Duplicate include.


================
Comment at: clang/lib/Sema/DeclSpec.cpp:1474
+
+// Declarator::Declarator(const DeclSpec &ds, DeclaratorContext C)
+//       : DS(ds), Range(ds.getSourceRange()), Context(C),
----------------
Dead code?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D53847



More information about the cfe-commits mailing list