[PATCH] D132414: [Clang] follow-up D128745, use ClangABICompat15 instead of ClangABICompat14

2022-08-23 Thread Yuanfang Chen via Phabricator via cfe-commits
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  int (T *, U...);
-  template  void g(T);
-
-  template  struct S;
-  template  struct S {};
-
-  void h(int i) {
-int  = g();
-S 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  int (T *, U...);
+template  void g(T);
+template  struct S;
+template  struct S {};
+void gg(int i, int ) {
+  r = g();
+  S a;
 }
 
-#else
+// CHECK: @_Z1hIJiEEvDpPT_
+template void h(T*...) {}
+templatevoid 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 void f(T*, U...){}
+template 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 struct A;
-  template struct A {};
-  template struct A;
-  template struct A;
-  void f() { A a; }
-}
-
-namespace temp_deduct_type_example3 {
-  template void f(T*, U...){}
-  template void f(T){}
-  template void f(int*);
-}
+template struct A;
+template struct A {};
+template struct A;
+template struct A;
 
 #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 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 

[PATCH] D132414: [Clang] follow-up D128745, use ClangABICompat15 instead of ClangABICompat14

2022-08-23 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman accepted this revision.
aaron.ballman added a comment.
This revision is now accepted and ready to land.

Good catch @royjacobson on the ABI version number needing to be bumped! LGTM


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D132414

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


[PATCH] D132414: [Clang] follow-up D128745, use ClangABICompat15 instead of ClangABICompat14 Since the patch missed release 15.x and will be included in release 16.x.

2022-08-22 Thread Yuanfang Chen via Phabricator via cfe-commits
ychen created this revision.
ychen added reviewers: aaron.ballman, royjacobson.
Herald added a project: All.
ychen requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Also, simplify related tests.


Repository:
  rG LLVM Github Monorepo

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  int (T *, U...);
-  template  void g(T);
-
-  template  struct S;
-  template  struct S {};
-
-  void h(int i) {
-int  = g();
-S 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  int (T *, U...);
+template  void g(T);
+template  struct S;
+template  struct S {};
+void gg(int i, int ) {
+  r = g();
+  S a;
 }
 
-#else
+// CHECK: @_Z1hIJiEEvDpPT_
+template void h(T*...) {}
+templatevoid 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 void f(T*, U...){}
+template 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 struct A;
-  template struct A {};
-  template struct A;
-  template struct A;
-  void f() { A a; }
-}
-
-namespace temp_deduct_type_example3 {
-  template void f(T*, U...){}
-  template void f(T){}
-  template void f(int*);
-}
+template struct A;
+template struct A {};
+template struct A;
+template struct A;
 
 #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 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 &&