[PATCH] D136975: [Concepts] Correctly handle failure when checking concepts recursively

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 1 06:35:50 PDT 2022


aaron.ballman added inline comments.


================
Comment at: clang/docs/ReleaseNotes.rst:272
+- Fix a number of recursively-instantiated constraint issues, which would possibly
+  result in clang's stack-exhaustion.
+  `Issue 44304 <https://github.com/llvm/llvm-project/issues/44304>`_
----------------



================
Comment at: clang/include/clang/Sema/Sema.h:7235
+
+  bool SatisfactionStackContains(const llvm::FoldingSetNodeID &ID) {
+    return llvm::find(SatisfactionStack, ID) != SatisfactionStack.end();
----------------



================
Comment at: clang/lib/Sema/SemaConcept.cpp:150
+namespace {
+struct SatisfactionStackRAII {
+  Sema &SemaRef;
----------------
Er, it'd be nice for this not to shadow the name of the class from `Sema`, that's pretty confusing.


================
Comment at: clang/lib/Sema/SemaConcept.cpp:276-278
+  for (const auto &List : MLTAL)
+    for (const auto &TemplateArg : List.Args)
+      TemplateArg.Profile(ID, S.Context);
----------------
What are the chances that this `O(N^2)` operation is going to come back to bite us in terms of compile time performance?


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

https://reviews.llvm.org/D136975



More information about the cfe-commits mailing list