hazohelet added a comment.

To generate only the necessary diagnostic information, we need to know the 
evaluation result of the entire constraint expression.
So, the ideal way I can think of would be first to evaluate the nodes and, 
simultaneously, cache the results using `DenseMap` or something, and then 
traverse the nodes again to generate diagnostic information.

I was going in this way, but 
(https://github.com/llvm/llvm-project/blob/6f8b17703da2fbabba974b82578530b152b79c26/clang/lib/Sema/SemaConcept.cpp#L365)
 needs to use `TemplateDeductionInfo::takeSFINAEDiagnostic` to generate the 
diagnostic information. Generating this `TemplateDeductionInfo` in the second 
traversal seems unreasonable or impossible because it involves template 
instantiation.

Also, I'm unsure whether this refactor is worth the additional traversal and 
the cache data cost.

I would like to hear opinions about the direction from reviewers.

Note: The current implementation adds diagnostic information in the following 
places:

- 
https://github.com/llvm/llvm-project/blob/6f8b17703da2fbabba974b82578530b152b79c26/clang/lib/Sema/SemaConcept.cpp#L258
- 
https://github.com/llvm/llvm-project/blob/6f8b17703da2fbabba974b82578530b152b79c26/clang/lib/Sema/SemaConcept.cpp#L288
- 
https://github.com/llvm/llvm-project/blob/6f8b17703da2fbabba974b82578530b152b79c26/clang/lib/Sema/SemaConcept.cpp#L378


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D157526

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to