[clang] e13c28e - [Driver] Remove -fno-concept-satisfaction-caching

Ilya Biryukov via cfe-commits cfe-commits at lists.llvm.org
Thu May 5 08:53:17 PDT 2022


Author: Ilya Biryukov
Date: 2022-05-05T15:53:00Z
New Revision: e13c28ec595d99e694cb7e2589e7574dcda628ef

URL: https://github.com/llvm/llvm-project/commit/e13c28ec595d99e694cb7e2589e7574dcda628ef
DIFF: https://github.com/llvm/llvm-project/commit/e13c28ec595d99e694cb7e2589e7574dcda628ef.diff

LOG: [Driver] Remove -fno-concept-satisfaction-caching

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.

Reviewed By: sammccall

Differential Revision: https://reviews.llvm.org/D125014

Added: 
    

Modified: 
    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

Removed: 
    


################################################################################
diff  --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index 04418633ec248..862d9821a977f 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -222,6 +222,10 @@ Modified Compiler Flags
 
 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
 --------------------

diff  --git a/clang/include/clang/Basic/LangOptions.def b/clang/include/clang/Basic/LangOptions.def
index bd66461f2f490..d852fe8f886ee 100644
--- a/clang/include/clang/Basic/LangOptions.def
+++ b/clang/include/clang/Basic/LangOptions.def
@@ -277,7 +277,6 @@ LANGOPT(SizedDeallocation , 1, 0, "sized deallocation")
 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")

diff  --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td
index ae95ab267c163..f4c34bcf5dea5 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -5656,10 +5656,6 @@ def ftest_module_file_extension_EQ :
            "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,

diff  --git a/clang/lib/Sema/SemaConcept.cpp b/clang/lib/Sema/SemaConcept.cpp
index 261f57e4d185b..c78b0df6ff488 100644
--- a/clang/lib/Sema/SemaConcept.cpp
+++ b/clang/lib/Sema/SemaConcept.cpp
@@ -317,10 +317,8 @@ bool Sema::CheckConstraintSatisfaction(
     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);
   }

diff  --git a/clang/test/SemaTemplate/cxx2a-constraint-caching.cpp b/clang/test/SemaTemplate/cxx2a-constraint-caching.cpp
index 62aa0446673e1..d44a42926891f 100644
--- a/clang/test/SemaTemplate/cxx2a-constraint-caching.cpp
+++ b/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 @@ namespace a {
   // 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


        


More information about the cfe-commits mailing list