[PATCH] D155858: Add a concept AST node.

Corentin Jabot via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 9 00:39:47 PDT 2023


cor3ntin added inline comments.


================
Comment at: clang/include/clang/AST/ExprConcepts.h:140-143
   SourceLocation getBeginLoc() const LLVM_READONLY {
-    if (auto QualifierLoc = getNestedNameSpecifierLoc())
+    if (auto QualifierLoc = CR->getNestedNameSpecifierLoc())
       return QualifierLoc.getBeginLoc();
+    return CR->getConceptNameInfo().getBeginLoc();
----------------
Should there be a getLocation() method on `ConceptReference` ? It seems useful. maybe even a `getSourceRange()` method too


================
Comment at: clang/lib/Serialization/ASTWriter.cpp:472-484
+void ASTRecordWriter::AddConceptReference(const ConceptReference *CR) {
+  push_back(CR != nullptr);
+  if (!CR)
+    return;
+  AddNestedNameSpecifierLoc(CR->getNestedNameSpecifierLoc());
+  AddSourceLocation(CR->getTemplateKWLoc());
+  AddDeclarationNameInfo(CR->getConceptNameInfo());
----------------
I tink it would be better to only call `AddConceptReference` with non null parameters, and save in the parents whether there is a concept reference or not


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D155858



More information about the cfe-commits mailing list