[PATCH] D40381: Parse concept definition

Nicolas Lesser via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 24 04:46:37 PST 2017


Rakete1111 added inline comments.


================
Comment at: lib/Parse/ParseTemplate.cpp:161
   // Parse the actual template declaration.
-  return ParseSingleDeclarationAfterTemplate(Context,
-                                             ParsedTemplateInfo(&ParamLists,
-                                                             isSpecialization,
-                                                         LastParamListWasEmpty),
-                                             ParsingTemplateParams,
-                                             DeclEnd, AS, AccessAttrs);
+  if (!TryConsumeToken(tok::kw_concept)) {
+    return ParseSingleDeclarationAfterTemplate(Context,
----------------
No braces here please.


================
Comment at: lib/Parse/ParseTemplate.cpp:168
+                                               DeclEnd, AS, AccessAttrs);
+  } else {
+    return ParseConceptDefinition(Context,
----------------
No `else` needed here.


================
Comment at: lib/Parse/ParseTemplate.cpp:382
+
+  return ThisDecl;
+}
----------------
Do we really need `ThisDecl`?


================
Comment at: lib/Sema/SemaTemplate.cpp:3936
 
+  if (R.getAsSingle<ConceptDecl>()) {
+    return CheckConceptTemplateId(SS, R.getLookupNameInfo(),
----------------
saar.raz wrote:
> We're gonna want to check
> ```
> !TemplateSpecializationType::anyDependentTemplateArguments(*TemplateArgs, InstantiationDependent)
> ``` 
> here as well - so that we can instantiate a ConceptSpecializationExpr later when we have it (we're not gonna want to instantiate a ConceptSpecializationExpr with dependent arguments.
No braces here please.


================
Comment at: lib/Sema/SemaTemplate.cpp:3938
+    return CheckConceptTemplateId(SS, R.getLookupNameInfo(),
+                              R.getAsSingle<ConceptDecl>(),
+                              TemplateKWLoc, TemplateArgs);
----------------
clang-format please :)


================
Comment at: lib/Sema/SemaTemplate.cpp:7693
+Decl *Sema::ActOnConceptDefinition(Scope *S,
+                              MultiTemplateParamsArg TemplateParameterLists,
+                                   IdentifierInfo *Name, SourceLocation L,
----------------
Did you run this through clang-format?


================
Comment at: test/CXX/concepts-ts/expr/expr.prim/expr.prim.id/p3.cpp:1
+// RUN:  %clang_cc1 -std=c++1z -fconcepts-ts -fcxx-exceptions -x c++ -verify %s
+// expected-no-diagnostics
----------------
There is no `-fconcepts-ts` flag AFAIK. Also, why `-fcxx-exceptions`, it's not needed here. The `-x c++` part too. It should also be `-std=c++2a`.


https://reviews.llvm.org/D40381





More information about the cfe-commits mailing list