[PATCH] D125014: [Driver] Remove -fno-concept-satisfaction-caching

Ilya Biryukov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu May 5 07:46:11 PDT 2022


ilya-biryukov created this revision.
ilya-biryukov added a reviewer: kadircet.
Herald added a project: All.
ilya-biryukov requested review of this revision.
Herald added a project: clang.

The flag was added when the C++20 draft did not allow for concept
caching. The final C++20 standard permits the caching, so flag is
redundant. See http://wg21.link/p2104r0.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D125014

Files:
  clang/docs/ReleaseNotes.rst
  clang/include/clang/Basic/LangOptions.def
  clang/include/clang/Driver/Options.td
  clang/lib/Sema/SemaConcept.cpp
  clang/test/SemaTemplate/cxx2a-constraint-caching.cpp


Index: clang/test/SemaTemplate/cxx2a-constraint-caching.cpp
===================================================================
--- clang/test/SemaTemplate/cxx2a-constraint-caching.cpp
+++ clang/test/SemaTemplate/cxx2a-constraint-caching.cpp
@@ -1,5 +1,4 @@
 // RUN:  %clang_cc1 -std=c++2a -verify %s
-// RUN:  %clang_cc1 -std=c++2a -verify %s -fno-concept-satisfaction-caching -DNO_CACHE
 // expected-no-diagnostics
 
 template<typename T>
@@ -25,10 +24,5 @@
   // because the constraint satisfaction results are cached.
   constexpr void f(A a, int = 2) {}
 }
-#ifdef NO_CACHE
-static_assert(!C<a::A>);
-static_assert(!foo<a::A>());
-#else
 static_assert(C<a::A>);
 static_assert(foo<a::A>());
-#endif
Index: clang/lib/Sema/SemaConcept.cpp
===================================================================
--- clang/lib/Sema/SemaConcept.cpp
+++ clang/lib/Sema/SemaConcept.cpp
@@ -317,10 +317,8 @@
     OutSatisfaction.IsSatisfied = true;
     return false;
   }
-
-  bool ShouldCache = LangOpts.ConceptSatisfactionCaching && Template;
-  if (!ShouldCache) {
-    return ::CheckConstraintSatisfaction(*this, Template, ConstraintExprs,
+  if (!Template) {
+    return ::CheckConstraintSatisfaction(*this, nullptr, ConstraintExprs,
                                          TemplateArgs, TemplateIDRange,
                                          OutSatisfaction);
   }
Index: clang/include/clang/Driver/Options.td
===================================================================
--- clang/include/clang/Driver/Options.td
+++ clang/include/clang/Driver/Options.td
@@ -5656,10 +5656,6 @@
            "The argument is parsed as blockname:major:minor:hashed:user info">;
 def fconcepts_ts : Flag<["-"], "fconcepts-ts">,
   HelpText<"Enable C++ Extensions for Concepts. (deprecated - use -std=c++2a)">;
-def fno_concept_satisfaction_caching : Flag<["-"],
-                                            "fno-concept-satisfaction-caching">,
-  HelpText<"Disable satisfaction caching for C++2a Concepts.">,
-  MarshallingInfoNegativeFlag<LangOpts<"ConceptSatisfactionCaching">>;
 
 defm recovery_ast : BoolOption<"f", "recovery-ast",
   LangOpts<"RecoveryAST">, DefaultTrue,
Index: clang/include/clang/Basic/LangOptions.def
===================================================================
--- clang/include/clang/Basic/LangOptions.def
+++ clang/include/clang/Basic/LangOptions.def
@@ -277,7 +277,6 @@
 LANGOPT(AlignedAllocation , 1, 0, "aligned allocation")
 LANGOPT(AlignedAllocationUnavailable, 1, 0, "aligned allocation functions are unavailable")
 LANGOPT(NewAlignOverride  , 32, 0, "maximum alignment guaranteed by '::operator new(size_t)'")
-LANGOPT(ConceptSatisfactionCaching , 1, 1, "enable satisfaction caching for C++20 Concepts")
 BENIGN_LANGOPT(ModulesCodegen , 1, 0, "Modules code generation")
 BENIGN_LANGOPT(ModulesDebugInfo , 1, 0, "Modules debug info")
 BENIGN_LANGOPT(ElideConstructors , 1, 1, "C++ copy constructor elision")
Index: clang/docs/ReleaseNotes.rst
===================================================================
--- clang/docs/ReleaseNotes.rst
+++ clang/docs/ReleaseNotes.rst
@@ -222,6 +222,10 @@
 
 Removed Compiler Flags
 -------------------------
+- Removed the ``-fno-concept-satisfaction-caching`` flag. The flag was added
+  at the time when the draft of C++20 standard did not permit caching of
+  atomic constraints. The final standard permits such caching, see
+  `WG21 P2104R0<http://wg21.link/p2104r0>`_.
 
 New Pragmas in Clang
 --------------------


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D125014.427321.patch
Type: text/x-patch
Size: 3495 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220505/a0fd85ee/attachment.bin>


More information about the cfe-commits mailing list