This revision was automatically updated to reflect the committed changes.
Closed by commit rG088ba8efeb49: [Clang] follow-up D128745, use 
ClangABICompat15 instead of ClangABICompat14 (authored by ychen).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D132414

Files:
  clang/docs/ReleaseNotes.rst
  clang/include/clang/Basic/LangOptions.h
  clang/lib/Frontend/CompilerInvocation.cpp
  clang/lib/Sema/SemaTemplateDeduction.cpp
  clang/test/CXX/temp/temp.decls/temp.class.spec/p8-0x.cpp
  clang/test/CodeGen/partial-order-variadic.cpp

Index: clang/test/CodeGen/partial-order-variadic.cpp
===================================================================
--- clang/test/CodeGen/partial-order-variadic.cpp
+++ clang/test/CodeGen/partial-order-variadic.cpp
@@ -1,62 +1,33 @@
-// RUN: %clang_cc1 -triple x86_64-unknown-unknown -fclang-abi-compat=14 -DCLANG_ABI_COMPAT=14 %s -emit-llvm -disable-llvm-passes -o - | FileCheck %s --check-prefix=CHECK-14
-// RUN: %clang_cc1 -triple x86_64-unknown-unknown %s -emit-llvm -disable-llvm-passes -o - | FileCheck %s
-
-#if defined(CLANG_ABI_COMPAT) && CLANG_ABI_COMPAT <= 14
-
-// CHECK-14: %"struct.temp_func_order_example3::S" = type { i8 }
-
-// CHECK-14: define dso_local void @_ZN24temp_func_order_example31hEi(i32 noundef %i)
-// CHECK-14-NEXT:  entry:
-// CHECK-14-NEXT:    %i.addr = alloca i32, align 4
-// CHECK-14-NEXT:    %r = alloca ptr, align 8
-// CHECK-14-NEXT:    %a = alloca %"struct.temp_func_order_example3::S", align 1
-// CHECK-14-NEXT:    store i32 %i, ptr %i.addr, align 4
-// CHECK-14-NEXT:    %call = call noundef nonnull align 4 dereferenceable(4) ptr @_ZN24temp_func_order_example31gIiJEEERiPT_DpT0_(ptr noundef %i.addr)
-// CHECK-14-NEXT:    store ptr %call, ptr %r, align 8
-// CHECK-14-NEXT:    ret void
-
-namespace temp_func_order_example3 {
-  template <typename T, typename... U> int &g(T *, U...);
-  template <typename T> void g(T);
-
-  template <typename T, typename... Ts> struct S;
-  template <typename T> struct S<T> {};
-
-  void h(int i) {
-    int &r = g(&i);
-    S<int> a;
-  }
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown -fclang-abi-compat=15 -DCLANG_ABI_COMPAT=15 %s -emit-llvm -disable-llvm-passes -o - | FileCheck %s
+// RUN: %clang_cc1 -triple x86_64-unknown-unknown %s -emit-llvm -disable-llvm-passes -o - | FileCheck %s --check-prefixes=CHECK,AFTER-15
+
+// CHECK: %struct.S = type { i8 }
+// CHECK: @_Z2ggiRi
+// CHECK: @_Z1gIiJEERiPT_DpT0_
+template <typename T, typename... U> int &g(T *, U...);
+template <typename T> void g(T);
+template <typename T, typename... Ts> struct S;
+template <typename T> struct S<T> {};
+void gg(int i, int &r) {
+  r = g(&i);
+  S<int> a;
 }
 
-#else
+// CHECK: @_Z1hIJiEEvDpPT_
+template<class ...T> void h(T*...) {}
+template<class T>    void h(const T&) {}
+template void h(int*);
 
-// CHECK: %"struct.temp_deduct_type_example1::A" = type { i8 }
+#if !defined(CLANG_ABI_COMPAT)
 
-// CHECK: $_ZN25temp_deduct_type_example31fIiJEEEvPT_DpT0_ = comdat any
+// AFTER-15: @_Z1fIiJEEvPT_DpT0_
+template<class T, class... U> void f(T*, U...){}
+template<class T> void f(T){}
+template void f(int*);
 
-// CHECK: define dso_local void @_ZN25temp_deduct_type_example11fEv()
-// CHECK-NEXT: entry:
-// CHECK-NEXT:   %a = alloca %"struct.temp_deduct_type_example1::A", align 1
-// CHECK-NEXT:   ret void
-
-// CHECK: define weak_odr void @_ZN25temp_deduct_type_example31fIiJEEEvPT_DpT0_(ptr noundef %0)
-// CHECK-NEXT: entry:
-// CHECK-NEXT:   %.addr = alloca ptr, align 8
-// CHECK-NEXT:   store ptr %0, ptr %.addr, align 8
-// CHECK-NEXT:   ret void
-
-namespace temp_deduct_type_example1 {
-  template<class T, class... U> struct A;
-  template<class T1, class T2, class... U> struct A<T1,T2*,U...> {};
-  template<class T1, class T2> struct A<T1,T2>;
-  template struct A<int, int*>;
-  void f() { A<int, int*> a; }
-}
-
-namespace temp_deduct_type_example3 {
-  template<class T, class... U> void f(T*, U...){}
-  template<class T> void f(T){}
-  template void f(int*);
-}
+template<class T, class... U> struct A;
+template<class T1, class T2, class... U> struct A<T1,T2*,U...> {};
+template<class T1, class T2> struct A<T1,T2>;
+template struct A<int, int*>;
 
 #endif
Index: clang/test/CXX/temp/temp.decls/temp.class.spec/p8-0x.cpp
===================================================================
--- clang/test/CXX/temp/temp.decls/temp.class.spec/p8-0x.cpp
+++ clang/test/CXX/temp/temp.decls/temp.class.spec/p8-0x.cpp
@@ -1,4 +1,5 @@
 // RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fclang-abi-compat=15.0 -std=c++11 -fsyntax-only -verify %s
 
 template<int ...Values> struct X1;
 
Index: clang/lib/Sema/SemaTemplateDeduction.cpp
===================================================================
--- clang/lib/Sema/SemaTemplateDeduction.cpp
+++ clang/lib/Sema/SemaTemplateDeduction.cpp
@@ -1107,9 +1107,9 @@
   // During partial ordering, if Ai was originally a function parameter pack:
   // - if P does not contain a function parameter type corresponding to Ai then
   //   Ai is ignored;
-  bool ClangABICompat14 = S.Context.getLangOpts().getClangABICompat() <=
-                          LangOptions::ClangABI::Ver14;
-  if (!ClangABICompat14 && PartialOrdering && ArgIdx + 1 == NumArgs &&
+  bool ClangABICompat15 = S.Context.getLangOpts().getClangABICompat() <=
+                          LangOptions::ClangABI::Ver15;
+  if (!ClangABICompat15 && PartialOrdering && ArgIdx + 1 == NumArgs &&
       isa<PackExpansionType>(Args[ArgIdx]))
     return Sema::TDK_Success;
 
@@ -2445,8 +2445,8 @@
   if (X.getKind() != Y.getKind())
     return false;
 
-  bool ClangABICompat14 =
-      Context.getLangOpts().getClangABICompat() <= LangOptions::ClangABI::Ver14;
+  bool ClangABICompat15 =
+      Context.getLangOpts().getClangABICompat() <= LangOptions::ClangABI::Ver15;
 
   switch (X.getKind()) {
     case TemplateArgument::Null:
@@ -2480,7 +2480,7 @@
     }
 
     case TemplateArgument::Pack:
-      if (ClangABICompat14) {
+      if (ClangABICompat15) {
         if (X.pack_size() != Y.pack_size())
           return false;
 
@@ -5464,9 +5464,9 @@
     return nullptr;
 
   if (Better1 && Better2) {
-    bool ClangABICompat14 = S.Context.getLangOpts().getClangABICompat() <=
-                            LangOptions::ClangABI::Ver14;
-    if (!ClangABICompat14) {
+    bool ClangABICompat15 = S.Context.getLangOpts().getClangABICompat() <=
+                            LangOptions::ClangABI::Ver15;
+    if (!ClangABICompat15) {
       // Consider this a fix for CWG1432. Similar to the fix for CWG1395.
       auto *TST1 = T1->castAs<TemplateSpecializationType>();
       auto *TST2 = T2->castAs<TemplateSpecializationType>();
Index: clang/lib/Frontend/CompilerInvocation.cpp
===================================================================
--- clang/lib/Frontend/CompilerInvocation.cpp
+++ clang/lib/Frontend/CompilerInvocation.cpp
@@ -3522,6 +3522,8 @@
     GenerateArg(Args, OPT_fclang_abi_compat_EQ, "12.0", SA);
   else if (Opts.getClangABICompat() == LangOptions::ClangABI::Ver14)
     GenerateArg(Args, OPT_fclang_abi_compat_EQ, "14.0", SA);
+  else if (Opts.getClangABICompat() == LangOptions::ClangABI::Ver15)
+    GenerateArg(Args, OPT_fclang_abi_compat_EQ, "15.0", SA);
 
   if (Opts.getSignReturnAddressScope() ==
       LangOptions::SignReturnAddressScopeKind::All)
@@ -4014,6 +4016,8 @@
         Opts.setClangABICompat(LangOptions::ClangABI::Ver12);
       else if (Major <= 14)
         Opts.setClangABICompat(LangOptions::ClangABI::Ver14);
+      else if (Major <= 15)
+        Opts.setClangABICompat(LangOptions::ClangABI::Ver15);
     } else if (Ver != "latest") {
       Diags.Report(diag::err_drv_invalid_value)
           << A->getAsString(Args) << A->getValue();
Index: clang/include/clang/Basic/LangOptions.h
===================================================================
--- clang/include/clang/Basic/LangOptions.h
+++ clang/include/clang/Basic/LangOptions.h
@@ -223,6 +223,11 @@
     ///     implicit declaration.
     Ver14,
 
+    /// Attempt to be ABI-compatible with code generated by Clang 15.0.x.
+    /// This causes clang to:
+    ///   - Reverse the implementation for DR692, DR1395 and DR1432.
+    Ver15,
+
     /// Conform to the underlying platform's C and C++ ABIs as closely
     /// as we can.
     Latest
Index: clang/docs/ReleaseNotes.rst
===================================================================
--- clang/docs/ReleaseNotes.rst
+++ clang/docs/ReleaseNotes.rst
@@ -144,7 +144,7 @@
 C++ Language Changes in Clang
 -----------------------------
 
-- Implemented DR692, DR1395 and DR1432. Use the ``-fclang-abi-compat=14`` option
+- Implemented DR692, DR1395 and DR1432. Use the ``-fclang-abi-compat=15`` option
   to get the old partial ordering behavior regarding packs.
 
 C++20 Feature Support
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to