[PATCH] D85722: [SystemZ][z/OS] enable trigraphs by default on z/OS

2020-08-13 Thread Fanbo Meng via Phabricator via cfe-commits
fanbo-meng requested changes to this revision.
fanbo-meng added a comment.
This revision now requires changes to proceed.

Can you modify `clang/test/Frontend/trigraphs.cpp` and 
`clang/test/Lexer/cxx1z-trigraphs.cpp` ? These tests are assuming trigraphs are 
disabled by `-std=gnu++11 -fms-compatibility -std=c++1z`, and it won't be the 
case here because on z/OS trigraphs are still enabled when these options are 
present.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D85722

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


[PATCH] D106890: [z/OS] Make MinGlobalAlign consistent with SystemZ

2021-07-27 Thread Fanbo Meng via Phabricator via cfe-commits
fanbo-meng created this revision.
fanbo-meng requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Remove overriding MinGlobalAlign to 0 for z/OS target to be consistent with 
SystemZ.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D106890

Files:
  clang/lib/Basic/Targets/OSTargets.h


Index: clang/lib/Basic/Targets/OSTargets.h
===
--- clang/lib/Basic/Targets/OSTargets.h
+++ clang/lib/Basic/Targets/OSTargets.h
@@ -796,7 +796,6 @@
 this->UseZeroLengthBitfieldAlignment = true;
 this->UseLeadingZeroLengthBitfield = false;
 this->ZeroLengthBitfieldBoundary = 32;
-this->MinGlobalAlign = 0;
 this->DefaultAlignForAttributeAligned = 128;
   }
 };


Index: clang/lib/Basic/Targets/OSTargets.h
===
--- clang/lib/Basic/Targets/OSTargets.h
+++ clang/lib/Basic/Targets/OSTargets.h
@@ -796,7 +796,6 @@
 this->UseZeroLengthBitfieldAlignment = true;
 this->UseLeadingZeroLengthBitfield = false;
 this->ZeroLengthBitfieldBoundary = 32;
-this->MinGlobalAlign = 0;
 this->DefaultAlignForAttributeAligned = 128;
   }
 };
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D106890: [z/OS] Make MinGlobalAlign consistent with SystemZ

2021-07-27 Thread Fanbo Meng via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGa2d4b064644b: [z/OS] Make MinGlobalAlign consistent with 
SystemZ (authored by fanbo-meng).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D106890

Files:
  clang/lib/Basic/Targets/OSTargets.h


Index: clang/lib/Basic/Targets/OSTargets.h
===
--- clang/lib/Basic/Targets/OSTargets.h
+++ clang/lib/Basic/Targets/OSTargets.h
@@ -796,7 +796,6 @@
 this->UseZeroLengthBitfieldAlignment = true;
 this->UseLeadingZeroLengthBitfield = false;
 this->ZeroLengthBitfieldBoundary = 32;
-this->MinGlobalAlign = 0;
 this->DefaultAlignForAttributeAligned = 128;
   }
 };


Index: clang/lib/Basic/Targets/OSTargets.h
===
--- clang/lib/Basic/Targets/OSTargets.h
+++ clang/lib/Basic/Targets/OSTargets.h
@@ -796,7 +796,6 @@
 this->UseZeroLengthBitfieldAlignment = true;
 this->UseLeadingZeroLengthBitfield = false;
 this->ZeroLengthBitfieldBoundary = 32;
-this->MinGlobalAlign = 0;
 this->DefaultAlignForAttributeAligned = 128;
   }
 };
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D87611: [SystemZ][z/OS] Set aligned allocation unavailable by default for z/OS

2020-09-14 Thread Fanbo Meng via Phabricator via cfe-commits
fanbo-meng created this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
fanbo-meng requested review of this revision.

Aligned allocation is not supported on z/OS.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D87611

Files:
  clang/lib/Driver/ToolChains/ZOS.cpp
  clang/lib/Driver/ToolChains/ZOS.h
  clang/test/Driver/unavailable_aligned_allocation.cpp
  clang/test/Lexer/aligned-allocation.cpp


Index: clang/test/Lexer/aligned-allocation.cpp
===
--- clang/test/Lexer/aligned-allocation.cpp
+++ clang/test/Lexer/aligned-allocation.cpp
@@ -6,10 +6,19 @@
 //
 // RUN: %clang_cc1 -triple x86_64-apple-macosx10.12.0 -fexceptions -std=c++17 
-verify %s \
 // RUN:   -faligned-allocation -faligned-alloc-unavailable
+//
+// RUN: %clang_cc1 -triple s390x-ibm-zos -fexceptions -std=c++17 -verify %s \
+// RUN:   -DEXPECT_DEFINED
+//
+// RUN: %clang_cc1 -triple s390x-ibm-zos -fexceptions -std=c++17 -verify %s \
+// RUN:   -faligned-alloc-unavailable
+//
+// RUN: %clang_cc1 -triple s390x-ibm-zos -fexceptions -std=c++17 -verify %s \
+// RUN:   -faligned-allocation -faligned-alloc-unavailable
 
 // Test that __cpp_aligned_new is not defined when CC1 is passed
-// -faligned-alloc-unavailable by the Darwin driver, even when aligned
-// allocation is actually enabled.
+// -faligned-alloc-unavailable by the Darwin and the z/OS driver, even when
+// aligned allocation is actually enabled.
 
 // expected-no-diagnostics
 #ifdef EXPECT_DEFINED
Index: clang/test/Driver/unavailable_aligned_allocation.cpp
===
--- clang/test/Driver/unavailable_aligned_allocation.cpp
+++ clang/test/Driver/unavailable_aligned_allocation.cpp
@@ -22,6 +22,9 @@
 // RUN: -c -### %s 2>&1 \
 // RUN:   | FileCheck %s -check-prefix=UNAVAILABLE
 //
+// RUN: %clang -target s390x-ibm-zos -c -### %s 2>&1 \
+// RUN:   | FileCheck %s -check-prefix=UNAVAILABLE
+
 // UNAVAILABLE: "-faligned-alloc-unavailable"
 
 // RUN: %clang -target x86_64-apple-macosx10.14 -c -### %s 2>&1 \
@@ -59,5 +62,11 @@
 //
 // RUN: %clang -target x86_64-apple-macosx10.13 -fno-aligned-allocation -c 
-### %s 2>&1 \
 // RUN:   | FileCheck %s -check-prefix=AVAILABLE
+//
+// RUN: %clang -target s390x-ibm-zos -faligned-allocation -c -### %s 2>&1 \
+// RUN:   | FileCheck %s -check-prefix=AVAILABLE
+//
+// RUN: %clang -target s390x-ibm-zos -fno-aligned-allocation -c -### %s 2>&1 \
+// RUN:   | FileCheck %s -check-prefix=AVAILABLE
 
 // AVAILABLE-NOT: "-faligned-alloc-unavailable"
Index: clang/lib/Driver/ToolChains/ZOS.h
===
--- clang/lib/Driver/ToolChains/ZOS.h
+++ clang/lib/Driver/ToolChains/ZOS.h
@@ -27,6 +27,10 @@
   bool isPICDefaultForced() const override { return false; }
 
   bool IsIntegratedAssemblerDefault() const override { return true; }
+
+  void addClangTargetOptions(
+  const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args,
+  Action::OffloadKind DeviceOffloadingKind) const override;
 };
 
 } // end namespace toolchains
Index: clang/lib/Driver/ToolChains/ZOS.cpp
===
--- clang/lib/Driver/ToolChains/ZOS.cpp
+++ clang/lib/Driver/ToolChains/ZOS.cpp
@@ -21,3 +21,13 @@
 : ToolChain(D, Triple, Args) {}
 
 ZOS::~ZOS() {}
+
+void ZOS::addClangTargetOptions(const llvm::opt::ArgList &DriverArgs,
+llvm::opt::ArgStringList &CC1Args,
+Action::OffloadKind DeviceOffloadKind) const {
+  // Pass "-faligned-alloc-unavailable" only when the user hasn't manually
+  // enabled or disabled aligned allocations.
+  if (!DriverArgs.hasArgNoClaim(options::OPT_faligned_allocation,
+options::OPT_fno_aligned_allocation))
+CC1Args.push_back("-faligned-alloc-unavailable");
+}


Index: clang/test/Lexer/aligned-allocation.cpp
===
--- clang/test/Lexer/aligned-allocation.cpp
+++ clang/test/Lexer/aligned-allocation.cpp
@@ -6,10 +6,19 @@
 //
 // RUN: %clang_cc1 -triple x86_64-apple-macosx10.12.0 -fexceptions -std=c++17 -verify %s \
 // RUN:   -faligned-allocation -faligned-alloc-unavailable
+//
+// RUN: %clang_cc1 -triple s390x-ibm-zos -fexceptions -std=c++17 -verify %s \
+// RUN:   -DEXPECT_DEFINED
+//
+// RUN: %clang_cc1 -triple s390x-ibm-zos -fexceptions -std=c++17 -verify %s \
+// RUN:   -faligned-alloc-unavailable
+//
+// RUN: %clang_cc1 -triple s390x-ibm-zos -fexceptions -std=c++17 -verify %s \
+// RUN:   -faligned-allocation -faligned-alloc-unavailable
 
 // Test that __cpp_aligned_new is not defined when CC1 is passed
-// -faligned-alloc-unavailable by the Darwin driver, even when aligned
-// allocation is actually enabled.
+// -faligned-alloc-unavailable by the Darwin and the z/OS driver, even when
+// aligned allocation is a

[PATCH] D87611: [SystemZ][z/OS] Set aligned allocation unavailable by default for z/OS

2020-09-14 Thread Fanbo Meng via Phabricator via cfe-commits
fanbo-meng updated this revision to Diff 291590.
fanbo-meng added a comment.

emit the correct diagnostics for z/OS.


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

https://reviews.llvm.org/D87611

Files:
  clang/include/clang/Basic/AlignedAllocation.h
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/lib/Basic/Targets/OSTargets.h
  clang/lib/Sema/SemaExprCXX.cpp
  clang/test/SemaCXX/unavailable_aligned_allocation.cpp

Index: clang/test/SemaCXX/unavailable_aligned_allocation.cpp
===
--- clang/test/SemaCXX/unavailable_aligned_allocation.cpp
+++ clang/test/SemaCXX/unavailable_aligned_allocation.cpp
@@ -1,12 +1,15 @@
-// RUN: %clang_cc1 -triple x86_64-apple-macosx10.13.0 -fexceptions -faligned-alloc-unavailable -std=c++1z -verify %s
+// RUN: %clang_cc1 -triple x86_64-apple-macosx10.13.0 -fexceptions -faligned-alloc-unavailable -std=c++1z -verify -DMACOS %s
 // RUN: %clang_cc1 -triple x86_64-apple-macosx10.13.0 -fexceptions -std=c++1z -verify -DNO_ERRORS %s
-// RUN: %clang_cc1 -triple x86_64-apple-macosx10.13.0 -fexceptions -faligned-allocation -faligned-alloc-unavailable -std=c++14 -verify %s
+// RUN: %clang_cc1 -triple x86_64-apple-macosx10.13.0 -fexceptions -faligned-allocation -faligned-alloc-unavailable -std=c++14 -verify -DMACOS %s
 // RUN: %clang_cc1 -triple arm64-apple-ios10.0.0 -fexceptions -faligned-alloc-unavailable -std=c++1z -verify -DIOS %s
 // RUN: %clang_cc1 -triple arm64-apple-ios10.0.0 -fexceptions -std=c++1z -verify -DNO_ERRORS %s
 // RUN: %clang_cc1 -triple arm64-apple-tvos10.0.0 -fexceptions -faligned-alloc-unavailable -std=c++1z -verify -DTVOS %s
 // RUN: %clang_cc1 -triple arm64-apple-tvos10.0.0 -fexceptions -std=c++1z -verify -DNO_ERRORS %s
 // RUN: %clang_cc1 -triple armv7k-apple-watchos3.0.0 -fexceptions -faligned-alloc-unavailable -std=c++1z -verify -DWATCHOS %s
 // RUN: %clang_cc1 -triple armv7k-apple-watchos3.0.0 -fexceptions -std=c++1z -verify -DNO_ERRORS %s
+// RUN: %clang_cc1 -triple s390x-ibm-zos -fexceptions -faligned-alloc-unavailable -std=c++1z -verify -DZOS %s
+// RUN: %clang_cc1 -triple s390x-ibm-zos -fexceptions -std=c++1z -verify -DNO_ERRORS %s
+// RUN: %clang_cc1 -triple s390x-ibm-zos -fexceptions -faligned-allocation -faligned-alloc-unavailable -std=c++14 -verify -DZOS %s
 
 namespace std {
   typedef decltype(sizeof(0)) size_t;
@@ -62,40 +65,40 @@
 #ifdef NO_ERRORS
 // expected-no-diagnostics
 #else
-// expected-error@-16 {{aligned allocation function of type 'void *(unsigned long, enum std::align_val_t)' is only available on}}
+// expected-error-re@-16 {{aligned allocation function of type 'void *(unsigned long, enum std::align_val_t)' is {{only|not}} available on}}
 // expected-note@-17 {{if you supply your own aligned allocation functions}}
-// expected-error@-18 {{aligned deallocation function of type 'void (void *, enum std::align_val_t) noexcept' is only available on}}
+// expected-error-re@-18 {{aligned deallocation function of type 'void (void *, enum std::align_val_t) noexcept' is {{only|not}} available on}}
 // expected-note@-19 {{if you supply your own aligned allocation functions}}
 
-// expected-error@-20 {{aligned allocation function of type 'void *(unsigned long, enum std::align_val_t)' is only available on}}
+// expected-error-re@-20 {{aligned allocation function of type 'void *(unsigned long, enum std::align_val_t)' is {{only|not}} available on}}
 // expected-note@-21 {{if you supply your own aligned allocation functions}}
-// expected-error@-22 {{aligned deallocation function of type 'void (void *, enum std::align_val_t) noexcept' is only available on}}
+// expected-error-re@-22 {{aligned deallocation function of type 'void (void *, enum std::align_val_t) noexcept' is {{only|not}} available on}}
 // expected-note@-23 {{if you supply your own aligned allocation functions}}
 
-// expected-error@-24 {{aligned deallocation function of type 'void (void *, enum std::align_val_t) noexcept' is only available on}}
+// expected-error-re@-24 {{aligned deallocation function of type 'void (void *, enum std::align_val_t) noexcept' is {{only|not}} available on}}
 // expected-note@-25 {{if you supply your own aligned allocation functions}}
 
-// expected-error@-26 {{aligned allocation function of type 'void *(std::size_t, std::align_val_t, const std::nothrow_t &) noexcept' is only available on}}
+// expected-error-re@-26 {{aligned allocation function of type 'void *(std::size_t, std::align_val_t, const std::nothrow_t &) noexcept' is {{only|not}} available on}}
 // expected-note@-27 {{if you supply your own aligned allocation functions}}
-// expected-error@-28 {{aligned deallocation function of type 'void (void *, std::align_val_t, const std::nothrow_t &) noexcept' is only available on}}
+// expected-error-re@-28 {{aligned deallocation function of type 'void (void *, std::align_val_t, const std::nothrow_t &) noexcept' is {{only|not}} available on}}
 // expected-note@-29 {{if 

[PATCH] D87611: [SystemZ][z/OS] Set aligned allocation unavailable by default for z/OS

2020-09-14 Thread Fanbo Meng via Phabricator via cfe-commits
fanbo-meng updated this revision to Diff 291593.
fanbo-meng added a comment.

Previous diff is incorrect and didn't include the entire change set, making a 
new one.


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

https://reviews.llvm.org/D87611

Files:
  clang/include/clang/Basic/AlignedAllocation.h
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/lib/Basic/Targets/OSTargets.h
  clang/lib/Driver/ToolChains/ZOS.cpp
  clang/lib/Driver/ToolChains/ZOS.h
  clang/lib/Sema/SemaExprCXX.cpp
  clang/test/Driver/unavailable_aligned_allocation.cpp
  clang/test/Lexer/aligned-allocation.cpp
  clang/test/SemaCXX/unavailable_aligned_allocation.cpp

Index: clang/test/SemaCXX/unavailable_aligned_allocation.cpp
===
--- clang/test/SemaCXX/unavailable_aligned_allocation.cpp
+++ clang/test/SemaCXX/unavailable_aligned_allocation.cpp
@@ -1,12 +1,15 @@
-// RUN: %clang_cc1 -triple x86_64-apple-macosx10.13.0 -fexceptions -faligned-alloc-unavailable -std=c++1z -verify %s
+// RUN: %clang_cc1 -triple x86_64-apple-macosx10.13.0 -fexceptions -faligned-alloc-unavailable -std=c++1z -verify -DMACOS %s
 // RUN: %clang_cc1 -triple x86_64-apple-macosx10.13.0 -fexceptions -std=c++1z -verify -DNO_ERRORS %s
-// RUN: %clang_cc1 -triple x86_64-apple-macosx10.13.0 -fexceptions -faligned-allocation -faligned-alloc-unavailable -std=c++14 -verify %s
+// RUN: %clang_cc1 -triple x86_64-apple-macosx10.13.0 -fexceptions -faligned-allocation -faligned-alloc-unavailable -std=c++14 -verify -DMACOS %s
 // RUN: %clang_cc1 -triple arm64-apple-ios10.0.0 -fexceptions -faligned-alloc-unavailable -std=c++1z -verify -DIOS %s
 // RUN: %clang_cc1 -triple arm64-apple-ios10.0.0 -fexceptions -std=c++1z -verify -DNO_ERRORS %s
 // RUN: %clang_cc1 -triple arm64-apple-tvos10.0.0 -fexceptions -faligned-alloc-unavailable -std=c++1z -verify -DTVOS %s
 // RUN: %clang_cc1 -triple arm64-apple-tvos10.0.0 -fexceptions -std=c++1z -verify -DNO_ERRORS %s
 // RUN: %clang_cc1 -triple armv7k-apple-watchos3.0.0 -fexceptions -faligned-alloc-unavailable -std=c++1z -verify -DWATCHOS %s
 // RUN: %clang_cc1 -triple armv7k-apple-watchos3.0.0 -fexceptions -std=c++1z -verify -DNO_ERRORS %s
+// RUN: %clang_cc1 -triple s390x-ibm-zos -fexceptions -faligned-alloc-unavailable -std=c++1z -verify -DZOS %s
+// RUN: %clang_cc1 -triple s390x-ibm-zos -fexceptions -std=c++1z -verify -DNO_ERRORS %s
+// RUN: %clang_cc1 -triple s390x-ibm-zos -fexceptions -faligned-allocation -faligned-alloc-unavailable -std=c++14 -verify -DZOS %s
 
 namespace std {
   typedef decltype(sizeof(0)) size_t;
@@ -62,40 +65,40 @@
 #ifdef NO_ERRORS
 // expected-no-diagnostics
 #else
-// expected-error@-16 {{aligned allocation function of type 'void *(unsigned long, enum std::align_val_t)' is only available on}}
+// expected-error-re@-16 {{aligned allocation function of type 'void *(unsigned long, enum std::align_val_t)' is {{only|not}} available on}}
 // expected-note@-17 {{if you supply your own aligned allocation functions}}
-// expected-error@-18 {{aligned deallocation function of type 'void (void *, enum std::align_val_t) noexcept' is only available on}}
+// expected-error-re@-18 {{aligned deallocation function of type 'void (void *, enum std::align_val_t) noexcept' is {{only|not}} available on}}
 // expected-note@-19 {{if you supply your own aligned allocation functions}}
 
-// expected-error@-20 {{aligned allocation function of type 'void *(unsigned long, enum std::align_val_t)' is only available on}}
+// expected-error-re@-20 {{aligned allocation function of type 'void *(unsigned long, enum std::align_val_t)' is {{only|not}} available on}}
 // expected-note@-21 {{if you supply your own aligned allocation functions}}
-// expected-error@-22 {{aligned deallocation function of type 'void (void *, enum std::align_val_t) noexcept' is only available on}}
+// expected-error-re@-22 {{aligned deallocation function of type 'void (void *, enum std::align_val_t) noexcept' is {{only|not}} available on}}
 // expected-note@-23 {{if you supply your own aligned allocation functions}}
 
-// expected-error@-24 {{aligned deallocation function of type 'void (void *, enum std::align_val_t) noexcept' is only available on}}
+// expected-error-re@-24 {{aligned deallocation function of type 'void (void *, enum std::align_val_t) noexcept' is {{only|not}} available on}}
 // expected-note@-25 {{if you supply your own aligned allocation functions}}
 
-// expected-error@-26 {{aligned allocation function of type 'void *(std::size_t, std::align_val_t, const std::nothrow_t &) noexcept' is only available on}}
+// expected-error-re@-26 {{aligned allocation function of type 'void *(std::size_t, std::align_val_t, const std::nothrow_t &) noexcept' is {{only|not}} available on}}
 // expected-note@-27 {{if you supply your own aligned allocation functions}}
-// expected-error@-28 {{aligned deallocation function of type 'void (void *, std::align_val_t, const std::nothrow_t &) noex

[PATCH] D87611: [SystemZ][z/OS] Set aligned allocation unavailable by default for z/OS

2020-09-14 Thread Fanbo Meng via Phabricator via cfe-commits
fanbo-meng added inline comments.



Comment at: clang/lib/Sema/SemaExprCXX.cpp:1841
-<< IsDelete << FD.getType().getAsString() << OSName
-<< alignedAllocMinVersion(T.getOS()).getAsString();
 Diag(Loc, diag::note_silence_aligned_allocation_unavailable);

hubert.reinterpretcast wrote:
> Just to ensure we are on the same page:
> Passing `-Xclang -faligned-alloc-unavailable` on the non-Apple platforms does 
> very bad things (hits "unreachable" and otherwise falls off the end of a 
> function without initializing a return value). Part of this patch makes 
> passing `-Xclang -faligned-alloc-unavailable` okay on z/OS.
Yes, as we are trying to solve the same problem like Darwin (lack of support in 
system libraries), we use the same mechanism that are introduced for that.


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

https://reviews.llvm.org/D87611

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


[PATCH] D87611: [SystemZ][z/OS] Set aligned allocation unavailable by default for z/OS

2020-09-14 Thread Fanbo Meng via Phabricator via cfe-commits
fanbo-meng updated this revision to Diff 291616.
fanbo-meng added a comment.

be consistent with namespace qualification


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

https://reviews.llvm.org/D87611

Files:
  clang/include/clang/Basic/AlignedAllocation.h
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/lib/Basic/Targets/OSTargets.h
  clang/lib/Driver/ToolChains/ZOS.cpp
  clang/lib/Driver/ToolChains/ZOS.h
  clang/lib/Sema/SemaExprCXX.cpp
  clang/test/Driver/unavailable_aligned_allocation.cpp
  clang/test/Lexer/aligned-allocation.cpp
  clang/test/SemaCXX/unavailable_aligned_allocation.cpp

Index: clang/test/SemaCXX/unavailable_aligned_allocation.cpp
===
--- clang/test/SemaCXX/unavailable_aligned_allocation.cpp
+++ clang/test/SemaCXX/unavailable_aligned_allocation.cpp
@@ -1,12 +1,15 @@
-// RUN: %clang_cc1 -triple x86_64-apple-macosx10.13.0 -fexceptions -faligned-alloc-unavailable -std=c++1z -verify %s
+// RUN: %clang_cc1 -triple x86_64-apple-macosx10.13.0 -fexceptions -faligned-alloc-unavailable -std=c++1z -verify -DMACOS %s
 // RUN: %clang_cc1 -triple x86_64-apple-macosx10.13.0 -fexceptions -std=c++1z -verify -DNO_ERRORS %s
-// RUN: %clang_cc1 -triple x86_64-apple-macosx10.13.0 -fexceptions -faligned-allocation -faligned-alloc-unavailable -std=c++14 -verify %s
+// RUN: %clang_cc1 -triple x86_64-apple-macosx10.13.0 -fexceptions -faligned-allocation -faligned-alloc-unavailable -std=c++14 -verify -DMACOS %s
 // RUN: %clang_cc1 -triple arm64-apple-ios10.0.0 -fexceptions -faligned-alloc-unavailable -std=c++1z -verify -DIOS %s
 // RUN: %clang_cc1 -triple arm64-apple-ios10.0.0 -fexceptions -std=c++1z -verify -DNO_ERRORS %s
 // RUN: %clang_cc1 -triple arm64-apple-tvos10.0.0 -fexceptions -faligned-alloc-unavailable -std=c++1z -verify -DTVOS %s
 // RUN: %clang_cc1 -triple arm64-apple-tvos10.0.0 -fexceptions -std=c++1z -verify -DNO_ERRORS %s
 // RUN: %clang_cc1 -triple armv7k-apple-watchos3.0.0 -fexceptions -faligned-alloc-unavailable -std=c++1z -verify -DWATCHOS %s
 // RUN: %clang_cc1 -triple armv7k-apple-watchos3.0.0 -fexceptions -std=c++1z -verify -DNO_ERRORS %s
+// RUN: %clang_cc1 -triple s390x-ibm-zos -fexceptions -faligned-alloc-unavailable -std=c++1z -verify -DZOS %s
+// RUN: %clang_cc1 -triple s390x-ibm-zos -fexceptions -std=c++1z -verify -DNO_ERRORS %s
+// RUN: %clang_cc1 -triple s390x-ibm-zos -fexceptions -faligned-allocation -faligned-alloc-unavailable -std=c++14 -verify -DZOS %s
 
 namespace std {
   typedef decltype(sizeof(0)) size_t;
@@ -62,40 +65,40 @@
 #ifdef NO_ERRORS
 // expected-no-diagnostics
 #else
-// expected-error@-16 {{aligned allocation function of type 'void *(unsigned long, enum std::align_val_t)' is only available on}}
+// expected-error-re@-16 {{aligned allocation function of type 'void *(unsigned long, enum std::align_val_t)' is {{only|not}} available on}}
 // expected-note@-17 {{if you supply your own aligned allocation functions}}
-// expected-error@-18 {{aligned deallocation function of type 'void (void *, enum std::align_val_t) noexcept' is only available on}}
+// expected-error-re@-18 {{aligned deallocation function of type 'void (void *, enum std::align_val_t) noexcept' is {{only|not}} available on}}
 // expected-note@-19 {{if you supply your own aligned allocation functions}}
 
-// expected-error@-20 {{aligned allocation function of type 'void *(unsigned long, enum std::align_val_t)' is only available on}}
+// expected-error-re@-20 {{aligned allocation function of type 'void *(unsigned long, enum std::align_val_t)' is {{only|not}} available on}}
 // expected-note@-21 {{if you supply your own aligned allocation functions}}
-// expected-error@-22 {{aligned deallocation function of type 'void (void *, enum std::align_val_t) noexcept' is only available on}}
+// expected-error-re@-22 {{aligned deallocation function of type 'void (void *, enum std::align_val_t) noexcept' is {{only|not}} available on}}
 // expected-note@-23 {{if you supply your own aligned allocation functions}}
 
-// expected-error@-24 {{aligned deallocation function of type 'void (void *, enum std::align_val_t) noexcept' is only available on}}
+// expected-error-re@-24 {{aligned deallocation function of type 'void (void *, enum std::align_val_t) noexcept' is {{only|not}} available on}}
 // expected-note@-25 {{if you supply your own aligned allocation functions}}
 
-// expected-error@-26 {{aligned allocation function of type 'void *(std::size_t, std::align_val_t, const std::nothrow_t &) noexcept' is only available on}}
+// expected-error-re@-26 {{aligned allocation function of type 'void *(std::size_t, std::align_val_t, const std::nothrow_t &) noexcept' is {{only|not}} available on}}
 // expected-note@-27 {{if you supply your own aligned allocation functions}}
-// expected-error@-28 {{aligned deallocation function of type 'void (void *, std::align_val_t, const std::nothrow_t &) noexcept' is only available on}}
+// expected-err

[PATCH] D87611: [SystemZ][z/OS] Set aligned allocation unavailable by default for z/OS

2020-09-14 Thread Fanbo Meng via Phabricator via cfe-commits
fanbo-meng updated this revision to Diff 291638.
fanbo-meng marked an inline comment as done.
fanbo-meng added a comment.

change vendor name from ibm to none for tests.


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

https://reviews.llvm.org/D87611

Files:
  clang/include/clang/Basic/AlignedAllocation.h
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/lib/Basic/Targets/OSTargets.h
  clang/lib/Driver/ToolChains/ZOS.cpp
  clang/lib/Driver/ToolChains/ZOS.h
  clang/lib/Sema/SemaExprCXX.cpp
  clang/test/Driver/unavailable_aligned_allocation.cpp
  clang/test/Lexer/aligned-allocation.cpp
  clang/test/SemaCXX/unavailable_aligned_allocation.cpp

Index: clang/test/SemaCXX/unavailable_aligned_allocation.cpp
===
--- clang/test/SemaCXX/unavailable_aligned_allocation.cpp
+++ clang/test/SemaCXX/unavailable_aligned_allocation.cpp
@@ -1,12 +1,15 @@
-// RUN: %clang_cc1 -triple x86_64-apple-macosx10.13.0 -fexceptions -faligned-alloc-unavailable -std=c++1z -verify %s
+// RUN: %clang_cc1 -triple x86_64-apple-macosx10.13.0 -fexceptions -faligned-alloc-unavailable -std=c++1z -verify -DMACOS %s
 // RUN: %clang_cc1 -triple x86_64-apple-macosx10.13.0 -fexceptions -std=c++1z -verify -DNO_ERRORS %s
-// RUN: %clang_cc1 -triple x86_64-apple-macosx10.13.0 -fexceptions -faligned-allocation -faligned-alloc-unavailable -std=c++14 -verify %s
+// RUN: %clang_cc1 -triple x86_64-apple-macosx10.13.0 -fexceptions -faligned-allocation -faligned-alloc-unavailable -std=c++14 -verify -DMACOS %s
 // RUN: %clang_cc1 -triple arm64-apple-ios10.0.0 -fexceptions -faligned-alloc-unavailable -std=c++1z -verify -DIOS %s
 // RUN: %clang_cc1 -triple arm64-apple-ios10.0.0 -fexceptions -std=c++1z -verify -DNO_ERRORS %s
 // RUN: %clang_cc1 -triple arm64-apple-tvos10.0.0 -fexceptions -faligned-alloc-unavailable -std=c++1z -verify -DTVOS %s
 // RUN: %clang_cc1 -triple arm64-apple-tvos10.0.0 -fexceptions -std=c++1z -verify -DNO_ERRORS %s
 // RUN: %clang_cc1 -triple armv7k-apple-watchos3.0.0 -fexceptions -faligned-alloc-unavailable -std=c++1z -verify -DWATCHOS %s
 // RUN: %clang_cc1 -triple armv7k-apple-watchos3.0.0 -fexceptions -std=c++1z -verify -DNO_ERRORS %s
+// RUN: %clang_cc1 -triple s390x-none-zos -fexceptions -faligned-alloc-unavailable -std=c++1z -verify -DZOS %s
+// RUN: %clang_cc1 -triple s390x-none-zos -fexceptions -std=c++1z -verify -DNO_ERRORS %s
+// RUN: %clang_cc1 -triple s390x-none-zos -fexceptions -faligned-allocation -faligned-alloc-unavailable -std=c++14 -verify -DZOS %s
 
 namespace std {
   typedef decltype(sizeof(0)) size_t;
@@ -62,40 +65,40 @@
 #ifdef NO_ERRORS
 // expected-no-diagnostics
 #else
-// expected-error@-16 {{aligned allocation function of type 'void *(unsigned long, enum std::align_val_t)' is only available on}}
+// expected-error-re@-16 {{aligned allocation function of type 'void *(unsigned long, enum std::align_val_t)' is {{only|not}} available on}}
 // expected-note@-17 {{if you supply your own aligned allocation functions}}
-// expected-error@-18 {{aligned deallocation function of type 'void (void *, enum std::align_val_t) noexcept' is only available on}}
+// expected-error-re@-18 {{aligned deallocation function of type 'void (void *, enum std::align_val_t) noexcept' is {{only|not}} available on}}
 // expected-note@-19 {{if you supply your own aligned allocation functions}}
 
-// expected-error@-20 {{aligned allocation function of type 'void *(unsigned long, enum std::align_val_t)' is only available on}}
+// expected-error-re@-20 {{aligned allocation function of type 'void *(unsigned long, enum std::align_val_t)' is {{only|not}} available on}}
 // expected-note@-21 {{if you supply your own aligned allocation functions}}
-// expected-error@-22 {{aligned deallocation function of type 'void (void *, enum std::align_val_t) noexcept' is only available on}}
+// expected-error-re@-22 {{aligned deallocation function of type 'void (void *, enum std::align_val_t) noexcept' is {{only|not}} available on}}
 // expected-note@-23 {{if you supply your own aligned allocation functions}}
 
-// expected-error@-24 {{aligned deallocation function of type 'void (void *, enum std::align_val_t) noexcept' is only available on}}
+// expected-error-re@-24 {{aligned deallocation function of type 'void (void *, enum std::align_val_t) noexcept' is {{only|not}} available on}}
 // expected-note@-25 {{if you supply your own aligned allocation functions}}
 
-// expected-error@-26 {{aligned allocation function of type 'void *(std::size_t, std::align_val_t, const std::nothrow_t &) noexcept' is only available on}}
+// expected-error-re@-26 {{aligned allocation function of type 'void *(std::size_t, std::align_val_t, const std::nothrow_t &) noexcept' is {{only|not}} available on}}
 // expected-note@-27 {{if you supply your own aligned allocation functions}}
-// expected-error@-28 {{aligned deallocation function of type 'void (void *, std::align_val_t, const std::nothrow_t 

[PATCH] D87611: [SystemZ][z/OS] Set aligned allocation unavailable by default for z/OS

2020-09-15 Thread Fanbo Meng via Phabricator via cfe-commits
fanbo-meng added inline comments.



Comment at: clang/include/clang/Basic/DiagnosticSemaKinds.td:7216
   "aligned %select{allocation|deallocation}0 function of type '%1' is only "
   "available on %2 %3 or newer">;
+def err_aligned_allocation_unavailable_on_os : Error<

ahatanak wrote:
> Is it possible to merge these two diagnostics?
> 
> 
> ```
> "aligned %select{allocation|deallocation}0 function of type '%1' is 
> %select{only|not}4 "
> "available on %2 %select{%3 or newer|}4"
> ```
> 
Thanks for reviewing Akira! This merged format does look better, I'll make the 
change.


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

https://reviews.llvm.org/D87611

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


[PATCH] D87611: [SystemZ][z/OS] Set aligned allocation unavailable by default for z/OS

2020-09-15 Thread Fanbo Meng via Phabricator via cfe-commits
fanbo-meng updated this revision to Diff 291949.
fanbo-meng added a comment.

merge diagnostics


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

https://reviews.llvm.org/D87611

Files:
  clang/include/clang/Basic/AlignedAllocation.h
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/lib/Basic/Targets/OSTargets.h
  clang/lib/Driver/ToolChains/ZOS.cpp
  clang/lib/Driver/ToolChains/ZOS.h
  clang/lib/Sema/SemaExprCXX.cpp
  clang/test/Driver/unavailable_aligned_allocation.cpp
  clang/test/Lexer/aligned-allocation.cpp
  clang/test/SemaCXX/unavailable_aligned_allocation.cpp

Index: clang/test/SemaCXX/unavailable_aligned_allocation.cpp
===
--- clang/test/SemaCXX/unavailable_aligned_allocation.cpp
+++ clang/test/SemaCXX/unavailable_aligned_allocation.cpp
@@ -1,12 +1,15 @@
-// RUN: %clang_cc1 -triple x86_64-apple-macosx10.13.0 -fexceptions -faligned-alloc-unavailable -std=c++1z -verify %s
+// RUN: %clang_cc1 -triple x86_64-apple-macosx10.13.0 -fexceptions -faligned-alloc-unavailable -std=c++1z -verify -DMACOS %s
 // RUN: %clang_cc1 -triple x86_64-apple-macosx10.13.0 -fexceptions -std=c++1z -verify -DNO_ERRORS %s
-// RUN: %clang_cc1 -triple x86_64-apple-macosx10.13.0 -fexceptions -faligned-allocation -faligned-alloc-unavailable -std=c++14 -verify %s
+// RUN: %clang_cc1 -triple x86_64-apple-macosx10.13.0 -fexceptions -faligned-allocation -faligned-alloc-unavailable -std=c++14 -verify -DMACOS %s
 // RUN: %clang_cc1 -triple arm64-apple-ios10.0.0 -fexceptions -faligned-alloc-unavailable -std=c++1z -verify -DIOS %s
 // RUN: %clang_cc1 -triple arm64-apple-ios10.0.0 -fexceptions -std=c++1z -verify -DNO_ERRORS %s
 // RUN: %clang_cc1 -triple arm64-apple-tvos10.0.0 -fexceptions -faligned-alloc-unavailable -std=c++1z -verify -DTVOS %s
 // RUN: %clang_cc1 -triple arm64-apple-tvos10.0.0 -fexceptions -std=c++1z -verify -DNO_ERRORS %s
 // RUN: %clang_cc1 -triple armv7k-apple-watchos3.0.0 -fexceptions -faligned-alloc-unavailable -std=c++1z -verify -DWATCHOS %s
 // RUN: %clang_cc1 -triple armv7k-apple-watchos3.0.0 -fexceptions -std=c++1z -verify -DNO_ERRORS %s
+// RUN: %clang_cc1 -triple s390x-none-zos -fexceptions -faligned-alloc-unavailable -std=c++1z -verify -DZOS %s
+// RUN: %clang_cc1 -triple s390x-none-zos -fexceptions -std=c++1z -verify -DNO_ERRORS %s
+// RUN: %clang_cc1 -triple s390x-none-zos -fexceptions -faligned-allocation -faligned-alloc-unavailable -std=c++14 -verify -DZOS %s
 
 namespace std {
   typedef decltype(sizeof(0)) size_t;
@@ -62,40 +65,40 @@
 #ifdef NO_ERRORS
 // expected-no-diagnostics
 #else
-// expected-error@-16 {{aligned allocation function of type 'void *(unsigned long, enum std::align_val_t)' is only available on}}
+// expected-error-re@-16 {{aligned allocation function of type 'void *(unsigned long, enum std::align_val_t)' is {{only|not}} available on}}
 // expected-note@-17 {{if you supply your own aligned allocation functions}}
-// expected-error@-18 {{aligned deallocation function of type 'void (void *, enum std::align_val_t) noexcept' is only available on}}
+// expected-error-re@-18 {{aligned deallocation function of type 'void (void *, enum std::align_val_t) noexcept' is {{only|not}} available on}}
 // expected-note@-19 {{if you supply your own aligned allocation functions}}
 
-// expected-error@-20 {{aligned allocation function of type 'void *(unsigned long, enum std::align_val_t)' is only available on}}
+// expected-error-re@-20 {{aligned allocation function of type 'void *(unsigned long, enum std::align_val_t)' is {{only|not}} available on}}
 // expected-note@-21 {{if you supply your own aligned allocation functions}}
-// expected-error@-22 {{aligned deallocation function of type 'void (void *, enum std::align_val_t) noexcept' is only available on}}
+// expected-error-re@-22 {{aligned deallocation function of type 'void (void *, enum std::align_val_t) noexcept' is {{only|not}} available on}}
 // expected-note@-23 {{if you supply your own aligned allocation functions}}
 
-// expected-error@-24 {{aligned deallocation function of type 'void (void *, enum std::align_val_t) noexcept' is only available on}}
+// expected-error-re@-24 {{aligned deallocation function of type 'void (void *, enum std::align_val_t) noexcept' is {{only|not}} available on}}
 // expected-note@-25 {{if you supply your own aligned allocation functions}}
 
-// expected-error@-26 {{aligned allocation function of type 'void *(std::size_t, std::align_val_t, const std::nothrow_t &) noexcept' is only available on}}
+// expected-error-re@-26 {{aligned allocation function of type 'void *(std::size_t, std::align_val_t, const std::nothrow_t &) noexcept' is {{only|not}} available on}}
 // expected-note@-27 {{if you supply your own aligned allocation functions}}
-// expected-error@-28 {{aligned deallocation function of type 'void (void *, std::align_val_t, const std::nothrow_t &) noexcept' is only available on}}
+// expected-error-re@-28 {{aligned de

[PATCH] D87624: [SystemZ][z/OS] Set default wchar_t type for zOS

2020-09-16 Thread Fanbo Meng via Phabricator via cfe-commits
fanbo-meng accepted this revision.
fanbo-meng added a comment.
This revision is now accepted and ready to land.

LGTM


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D87624

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


[PATCH] D87611: [SystemZ][z/OS] Set aligned allocation unavailable by default for z/OS

2020-09-16 Thread Fanbo Meng via Phabricator via cfe-commits
fanbo-meng updated this revision to Diff 292237.
fanbo-meng added a comment.
Herald added a reviewer: aaron.ballman.

get platform name from triple instead of hardcoding, and convert its spelling


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

https://reviews.llvm.org/D87611

Files:
  clang/include/clang/Basic/AlignedAllocation.h
  clang/include/clang/Basic/Attr.td
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/lib/Basic/Targets/OSTargets.h
  clang/lib/Driver/ToolChains/ZOS.cpp
  clang/lib/Driver/ToolChains/ZOS.h
  clang/lib/Sema/SemaExprCXX.cpp
  clang/test/Driver/unavailable_aligned_allocation.cpp
  clang/test/Lexer/aligned-allocation.cpp
  clang/test/SemaCXX/unavailable_aligned_allocation.cpp

Index: clang/test/SemaCXX/unavailable_aligned_allocation.cpp
===
--- clang/test/SemaCXX/unavailable_aligned_allocation.cpp
+++ clang/test/SemaCXX/unavailable_aligned_allocation.cpp
@@ -1,12 +1,15 @@
-// RUN: %clang_cc1 -triple x86_64-apple-macosx10.13.0 -fexceptions -faligned-alloc-unavailable -std=c++1z -verify %s
+// RUN: %clang_cc1 -triple x86_64-apple-macosx10.13.0 -fexceptions -faligned-alloc-unavailable -std=c++1z -verify -DMACOS %s
 // RUN: %clang_cc1 -triple x86_64-apple-macosx10.13.0 -fexceptions -std=c++1z -verify -DNO_ERRORS %s
-// RUN: %clang_cc1 -triple x86_64-apple-macosx10.13.0 -fexceptions -faligned-allocation -faligned-alloc-unavailable -std=c++14 -verify %s
+// RUN: %clang_cc1 -triple x86_64-apple-macosx10.13.0 -fexceptions -faligned-allocation -faligned-alloc-unavailable -std=c++14 -verify -DMACOS %s
 // RUN: %clang_cc1 -triple arm64-apple-ios10.0.0 -fexceptions -faligned-alloc-unavailable -std=c++1z -verify -DIOS %s
 // RUN: %clang_cc1 -triple arm64-apple-ios10.0.0 -fexceptions -std=c++1z -verify -DNO_ERRORS %s
 // RUN: %clang_cc1 -triple arm64-apple-tvos10.0.0 -fexceptions -faligned-alloc-unavailable -std=c++1z -verify -DTVOS %s
 // RUN: %clang_cc1 -triple arm64-apple-tvos10.0.0 -fexceptions -std=c++1z -verify -DNO_ERRORS %s
 // RUN: %clang_cc1 -triple armv7k-apple-watchos3.0.0 -fexceptions -faligned-alloc-unavailable -std=c++1z -verify -DWATCHOS %s
 // RUN: %clang_cc1 -triple armv7k-apple-watchos3.0.0 -fexceptions -std=c++1z -verify -DNO_ERRORS %s
+// RUN: %clang_cc1 -triple s390x-none-zos -fexceptions -faligned-alloc-unavailable -std=c++1z -verify -DZOS %s
+// RUN: %clang_cc1 -triple s390x-none-zos -fexceptions -std=c++1z -verify -DNO_ERRORS %s
+// RUN: %clang_cc1 -triple s390x-none-zos -fexceptions -faligned-allocation -faligned-alloc-unavailable -std=c++14 -verify -DZOS %s
 
 namespace std {
   typedef decltype(sizeof(0)) size_t;
@@ -62,40 +65,40 @@
 #ifdef NO_ERRORS
 // expected-no-diagnostics
 #else
-// expected-error@-16 {{aligned allocation function of type 'void *(unsigned long, enum std::align_val_t)' is only available on}}
+// expected-error-re@-16 {{aligned allocation function of type 'void *(unsigned long, enum std::align_val_t)' is {{only|not}} available on}}
 // expected-note@-17 {{if you supply your own aligned allocation functions}}
-// expected-error@-18 {{aligned deallocation function of type 'void (void *, enum std::align_val_t) noexcept' is only available on}}
+// expected-error-re@-18 {{aligned deallocation function of type 'void (void *, enum std::align_val_t) noexcept' is {{only|not}} available on}}
 // expected-note@-19 {{if you supply your own aligned allocation functions}}
 
-// expected-error@-20 {{aligned allocation function of type 'void *(unsigned long, enum std::align_val_t)' is only available on}}
+// expected-error-re@-20 {{aligned allocation function of type 'void *(unsigned long, enum std::align_val_t)' is {{only|not}} available on}}
 // expected-note@-21 {{if you supply your own aligned allocation functions}}
-// expected-error@-22 {{aligned deallocation function of type 'void (void *, enum std::align_val_t) noexcept' is only available on}}
+// expected-error-re@-22 {{aligned deallocation function of type 'void (void *, enum std::align_val_t) noexcept' is {{only|not}} available on}}
 // expected-note@-23 {{if you supply your own aligned allocation functions}}
 
-// expected-error@-24 {{aligned deallocation function of type 'void (void *, enum std::align_val_t) noexcept' is only available on}}
+// expected-error-re@-24 {{aligned deallocation function of type 'void (void *, enum std::align_val_t) noexcept' is {{only|not}} available on}}
 // expected-note@-25 {{if you supply your own aligned allocation functions}}
 
-// expected-error@-26 {{aligned allocation function of type 'void *(std::size_t, std::align_val_t, const std::nothrow_t &) noexcept' is only available on}}
+// expected-error-re@-26 {{aligned allocation function of type 'void *(std::size_t, std::align_val_t, const std::nothrow_t &) noexcept' is {{only|not}} available on}}
 // expected-note@-27 {{if you supply your own aligned allocation functions}}
-// expected-error@-28 {{aligned deallocation function 

[PATCH] D87611: [SystemZ][z/OS] Set aligned allocation unavailable by default for z/OS

2020-09-16 Thread Fanbo Meng via Phabricator via cfe-commits
fanbo-meng updated this revision to Diff 292240.
fanbo-meng set the repository for this revision to rG LLVM Github Monorepo.
fanbo-meng added a comment.

fix typo


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D87611

Files:
  clang/include/clang/Basic/AlignedAllocation.h
  clang/include/clang/Basic/Attr.td
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/lib/Basic/Targets/OSTargets.h
  clang/lib/Driver/ToolChains/ZOS.cpp
  clang/lib/Driver/ToolChains/ZOS.h
  clang/lib/Sema/SemaExprCXX.cpp
  clang/test/Driver/unavailable_aligned_allocation.cpp
  clang/test/Lexer/aligned-allocation.cpp
  clang/test/SemaCXX/unavailable_aligned_allocation.cpp

Index: clang/test/SemaCXX/unavailable_aligned_allocation.cpp
===
--- clang/test/SemaCXX/unavailable_aligned_allocation.cpp
+++ clang/test/SemaCXX/unavailable_aligned_allocation.cpp
@@ -1,12 +1,15 @@
-// RUN: %clang_cc1 -triple x86_64-apple-macosx10.13.0 -fexceptions -faligned-alloc-unavailable -std=c++1z -verify %s
+// RUN: %clang_cc1 -triple x86_64-apple-macosx10.13.0 -fexceptions -faligned-alloc-unavailable -std=c++1z -verify -DMACOS %s
 // RUN: %clang_cc1 -triple x86_64-apple-macosx10.13.0 -fexceptions -std=c++1z -verify -DNO_ERRORS %s
-// RUN: %clang_cc1 -triple x86_64-apple-macosx10.13.0 -fexceptions -faligned-allocation -faligned-alloc-unavailable -std=c++14 -verify %s
+// RUN: %clang_cc1 -triple x86_64-apple-macosx10.13.0 -fexceptions -faligned-allocation -faligned-alloc-unavailable -std=c++14 -verify -DMACOS %s
 // RUN: %clang_cc1 -triple arm64-apple-ios10.0.0 -fexceptions -faligned-alloc-unavailable -std=c++1z -verify -DIOS %s
 // RUN: %clang_cc1 -triple arm64-apple-ios10.0.0 -fexceptions -std=c++1z -verify -DNO_ERRORS %s
 // RUN: %clang_cc1 -triple arm64-apple-tvos10.0.0 -fexceptions -faligned-alloc-unavailable -std=c++1z -verify -DTVOS %s
 // RUN: %clang_cc1 -triple arm64-apple-tvos10.0.0 -fexceptions -std=c++1z -verify -DNO_ERRORS %s
 // RUN: %clang_cc1 -triple armv7k-apple-watchos3.0.0 -fexceptions -faligned-alloc-unavailable -std=c++1z -verify -DWATCHOS %s
 // RUN: %clang_cc1 -triple armv7k-apple-watchos3.0.0 -fexceptions -std=c++1z -verify -DNO_ERRORS %s
+// RUN: %clang_cc1 -triple s390x-none-zos -fexceptions -faligned-alloc-unavailable -std=c++1z -verify -DZOS %s
+// RUN: %clang_cc1 -triple s390x-none-zos -fexceptions -std=c++1z -verify -DNO_ERRORS %s
+// RUN: %clang_cc1 -triple s390x-none-zos -fexceptions -faligned-allocation -faligned-alloc-unavailable -std=c++14 -verify -DZOS %s
 
 namespace std {
   typedef decltype(sizeof(0)) size_t;
@@ -62,40 +65,40 @@
 #ifdef NO_ERRORS
 // expected-no-diagnostics
 #else
-// expected-error@-16 {{aligned allocation function of type 'void *(unsigned long, enum std::align_val_t)' is only available on}}
+// expected-error-re@-16 {{aligned allocation function of type 'void *(unsigned long, enum std::align_val_t)' is {{only|not}} available on}}
 // expected-note@-17 {{if you supply your own aligned allocation functions}}
-// expected-error@-18 {{aligned deallocation function of type 'void (void *, enum std::align_val_t) noexcept' is only available on}}
+// expected-error-re@-18 {{aligned deallocation function of type 'void (void *, enum std::align_val_t) noexcept' is {{only|not}} available on}}
 // expected-note@-19 {{if you supply your own aligned allocation functions}}
 
-// expected-error@-20 {{aligned allocation function of type 'void *(unsigned long, enum std::align_val_t)' is only available on}}
+// expected-error-re@-20 {{aligned allocation function of type 'void *(unsigned long, enum std::align_val_t)' is {{only|not}} available on}}
 // expected-note@-21 {{if you supply your own aligned allocation functions}}
-// expected-error@-22 {{aligned deallocation function of type 'void (void *, enum std::align_val_t) noexcept' is only available on}}
+// expected-error-re@-22 {{aligned deallocation function of type 'void (void *, enum std::align_val_t) noexcept' is {{only|not}} available on}}
 // expected-note@-23 {{if you supply your own aligned allocation functions}}
 
-// expected-error@-24 {{aligned deallocation function of type 'void (void *, enum std::align_val_t) noexcept' is only available on}}
+// expected-error-re@-24 {{aligned deallocation function of type 'void (void *, enum std::align_val_t) noexcept' is {{only|not}} available on}}
 // expected-note@-25 {{if you supply your own aligned allocation functions}}
 
-// expected-error@-26 {{aligned allocation function of type 'void *(std::size_t, std::align_val_t, const std::nothrow_t &) noexcept' is only available on}}
+// expected-error-re@-26 {{aligned allocation function of type 'void *(std::size_t, std::align_val_t, const std::nothrow_t &) noexcept' is {{only|not}} available on}}
 // expected-note@-27 {{if you supply your own aligned allocation functions}}
-// expected-error@-28 {{aligned deallocation fun

[PATCH] D87611: [SystemZ][z/OS] Set aligned allocation unavailable by default for z/OS

2020-09-16 Thread Fanbo Meng via Phabricator via cfe-commits
fanbo-meng added inline comments.



Comment at: clang/include/clang/Basic/DiagnosticSemaKinds.td:7216
+  "aligned %select{allocation|deallocation}0 function of type '%1' is "
+  "%select{only|not}4 available on %2 %select{%3 or newer|}4">;
 def note_silence_aligned_allocation_unavailable : Note<

hubert.reinterpretcast wrote:
> Can something be done about the trailing space?
Thanks for catching that Hubert, I'll fix it.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D87611

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


[PATCH] D87611: [SystemZ][z/OS] Set aligned allocation unavailable by default for z/OS

2020-09-16 Thread Fanbo Meng via Phabricator via cfe-commits
fanbo-meng updated this revision to Diff 292259.
fanbo-meng added a comment.

remove trailing whitespace from diagnostic


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

https://reviews.llvm.org/D87611

Files:
  clang/include/clang/Basic/AlignedAllocation.h
  clang/include/clang/Basic/Attr.td
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/lib/Basic/Targets/OSTargets.h
  clang/lib/Driver/ToolChains/ZOS.cpp
  clang/lib/Driver/ToolChains/ZOS.h
  clang/lib/Sema/SemaExprCXX.cpp
  clang/test/Driver/unavailable_aligned_allocation.cpp
  clang/test/Lexer/aligned-allocation.cpp
  clang/test/SemaCXX/unavailable_aligned_allocation.cpp

Index: clang/test/SemaCXX/unavailable_aligned_allocation.cpp
===
--- clang/test/SemaCXX/unavailable_aligned_allocation.cpp
+++ clang/test/SemaCXX/unavailable_aligned_allocation.cpp
@@ -1,12 +1,15 @@
-// RUN: %clang_cc1 -triple x86_64-apple-macosx10.13.0 -fexceptions -faligned-alloc-unavailable -std=c++1z -verify %s
+// RUN: %clang_cc1 -triple x86_64-apple-macosx10.13.0 -fexceptions -faligned-alloc-unavailable -std=c++1z -verify -DMACOS %s
 // RUN: %clang_cc1 -triple x86_64-apple-macosx10.13.0 -fexceptions -std=c++1z -verify -DNO_ERRORS %s
-// RUN: %clang_cc1 -triple x86_64-apple-macosx10.13.0 -fexceptions -faligned-allocation -faligned-alloc-unavailable -std=c++14 -verify %s
+// RUN: %clang_cc1 -triple x86_64-apple-macosx10.13.0 -fexceptions -faligned-allocation -faligned-alloc-unavailable -std=c++14 -verify -DMACOS %s
 // RUN: %clang_cc1 -triple arm64-apple-ios10.0.0 -fexceptions -faligned-alloc-unavailable -std=c++1z -verify -DIOS %s
 // RUN: %clang_cc1 -triple arm64-apple-ios10.0.0 -fexceptions -std=c++1z -verify -DNO_ERRORS %s
 // RUN: %clang_cc1 -triple arm64-apple-tvos10.0.0 -fexceptions -faligned-alloc-unavailable -std=c++1z -verify -DTVOS %s
 // RUN: %clang_cc1 -triple arm64-apple-tvos10.0.0 -fexceptions -std=c++1z -verify -DNO_ERRORS %s
 // RUN: %clang_cc1 -triple armv7k-apple-watchos3.0.0 -fexceptions -faligned-alloc-unavailable -std=c++1z -verify -DWATCHOS %s
 // RUN: %clang_cc1 -triple armv7k-apple-watchos3.0.0 -fexceptions -std=c++1z -verify -DNO_ERRORS %s
+// RUN: %clang_cc1 -triple s390x-none-zos -fexceptions -faligned-alloc-unavailable -std=c++1z -verify -DZOS %s
+// RUN: %clang_cc1 -triple s390x-none-zos -fexceptions -std=c++1z -verify -DNO_ERRORS %s
+// RUN: %clang_cc1 -triple s390x-none-zos -fexceptions -faligned-allocation -faligned-alloc-unavailable -std=c++14 -verify -DZOS %s
 
 namespace std {
   typedef decltype(sizeof(0)) size_t;
@@ -62,40 +65,40 @@
 #ifdef NO_ERRORS
 // expected-no-diagnostics
 #else
-// expected-error@-16 {{aligned allocation function of type 'void *(unsigned long, enum std::align_val_t)' is only available on}}
+// expected-error-re@-16 {{aligned allocation function of type 'void *(unsigned long, enum std::align_val_t)' is {{only|not}} available on}}
 // expected-note@-17 {{if you supply your own aligned allocation functions}}
-// expected-error@-18 {{aligned deallocation function of type 'void (void *, enum std::align_val_t) noexcept' is only available on}}
+// expected-error-re@-18 {{aligned deallocation function of type 'void (void *, enum std::align_val_t) noexcept' is {{only|not}} available on}}
 // expected-note@-19 {{if you supply your own aligned allocation functions}}
 
-// expected-error@-20 {{aligned allocation function of type 'void *(unsigned long, enum std::align_val_t)' is only available on}}
+// expected-error-re@-20 {{aligned allocation function of type 'void *(unsigned long, enum std::align_val_t)' is {{only|not}} available on}}
 // expected-note@-21 {{if you supply your own aligned allocation functions}}
-// expected-error@-22 {{aligned deallocation function of type 'void (void *, enum std::align_val_t) noexcept' is only available on}}
+// expected-error-re@-22 {{aligned deallocation function of type 'void (void *, enum std::align_val_t) noexcept' is {{only|not}} available on}}
 // expected-note@-23 {{if you supply your own aligned allocation functions}}
 
-// expected-error@-24 {{aligned deallocation function of type 'void (void *, enum std::align_val_t) noexcept' is only available on}}
+// expected-error-re@-24 {{aligned deallocation function of type 'void (void *, enum std::align_val_t) noexcept' is {{only|not}} available on}}
 // expected-note@-25 {{if you supply your own aligned allocation functions}}
 
-// expected-error@-26 {{aligned allocation function of type 'void *(std::size_t, std::align_val_t, const std::nothrow_t &) noexcept' is only available on}}
+// expected-error-re@-26 {{aligned allocation function of type 'void *(std::size_t, std::align_val_t, const std::nothrow_t &) noexcept' is {{only|not}} available on}}
 // expected-note@-27 {{if you supply your own aligned allocation functions}}
-// expected-error@-28 {{aligned deallocation function of type 'void (void *, std::align_val_t, const std::nothrow_t &) noexcept' 

[PATCH] D88845: [SystemZ][z/OS] Set default alignment rules for z/OS target

2020-10-05 Thread Fanbo Meng via Phabricator via cfe-commits
fanbo-meng created this revision.
fanbo-meng added reviewers: abhina.sreeskantharajan, hubert.reinterpretcast, 
Kai, uweigand.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
fanbo-meng requested review of this revision.

Set the default alignment control variables for z/OS target and add test case 
for alignment rules on z/OS.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D88845

Files:
  clang/lib/Basic/Targets/OSTargets.h
  clang/test/CodeGen/zos-alignment.c

Index: clang/test/CodeGen/zos-alignment.c
===
--- /dev/null
+++ clang/test/CodeGen/zos-alignment.c
@@ -0,0 +1,129 @@
+// RUN: %clang_cc1 -emit-llvm -triple s390x-none-zos -fdump-record-layouts %s -o - | FileCheck %s
+
+struct s0 {
+  short a:3;
+  long b:5;
+  int c:1;
+  long d:10;
+  char e:5;
+} S0;
+// CHECK:  0 | struct s0
+// CHECK-NEXT: 0:0-2 |   short a
+// CHECK-NEXT: 0:3-7 |   long b
+// CHECK-NEXT: 1:0-0 |   int c
+// CHECK-NEXT:1:1-10 |   long d
+// CHECK-NEXT: 2:3-7 |   char e
+// CHECK-NEXT:   | [sizeof=3, align=1]
+
+struct s1 {
+  char a:7;
+  long b:27;
+  int c:2;
+} S1;
+// CHECK:  0 | struct s1
+// CHECK-NEXT: 0:0-6 |   char a
+// CHECK-NEXT:0:7-33 |   long b
+// CHECK-NEXT: 4:2-3 |   int c
+// CHECK-NEXT:   | [sizeof=5, align=1]
+
+struct s2 {
+  char a:7;
+  char  :0;
+  short :0;
+  short :0;
+} S2;
+// CHECK:  0 | struct s2
+// CHECK-NEXT: 0:0-6 |   char a
+// CHECK-NEXT:   4:- |   char
+// CHECK-NEXT:   4:- |   short
+// CHECK-NEXT:   4:- |   short
+// CHECK-NEXT:   | [sizeof=4, align=4]
+
+struct s3 {
+  int a;
+  int b:16;
+  char  :0;
+  char c:1;
+} S3;
+// CHECK:  0 | struct s3
+// CHECK-NEXT: 0 |   int a
+// CHECK-NEXT:4:0-15 |   int b
+// CHECK-NEXT:   8:- |   char
+// CHECK-NEXT: 8:0-0 |   char c
+// CHECK-NEXT:   | [sizeof=12, align=4]
+
+struct s4 {
+ unsigned int __attribute__((aligned(32))) a;
+} S4;
+// CHECK:  0 | struct s4
+// CHECK-NEXT: 0 |   unsigned int a
+// CHECK-NEXT:   | [sizeof=32, align=32]
+
+struct s5 {
+  char a;
+  int  b:19 __attribute__((aligned(4)));
+  int  c:22 __attribute__((aligned(8)));
+  int  :0;
+  int  d:10;
+} S5;
+// CHECK:  0 | struct s5
+// CHECK-NEXT: 0 |   char a
+// CHECK-NEXT:4:0-18 |   int b
+// CHECK-NEXT:8:0-21 |   int c
+// CHECK-NEXT:  12:- |   int
+// CHECK-NEXT:12:0-9 |   int d
+// CHECK-NEXT:   | [sizeof=16, align=8]
+
+struct s6 {
+  char * a;
+  char * b[];
+} S6;
+// CHECK:  0 | struct s6
+// CHECK-NEXT: 0 |   char * a
+// CHECK-NEXT: 8 |   char *[] b
+// CHECK-NEXT:   | [sizeof=8, align=8]
+
+struct s10 {
+ unsigned int __attribute__((aligned)) a;
+} S10;
+// CHECK:  0 | struct s10
+// CHECK-NEXT: 0 |   unsigned int a
+// CHECK-NEXT:   | [sizeof=16, align=16]
+
+union u0 {
+  unsigned short d1 __attribute__((packed));
+  intd2:10;
+  long   d3;
+} U0 __attribute__((aligned(8)));
+// CHECK:  0 | union u0
+// CHECK-NEXT: 0 |   unsigned short d1
+// CHECK-NEXT: 0:0-9 |   int d2
+// CHECK-NEXT: 0 |   long d3
+// CHECK-NEXT:   | [sizeof=8, align=8]
+
+union u1 {
+  unsigned int:0;
+  short   a;
+} U1;
+// CHECK:  0 | union u1
+// CHECK-NEXT:   0:- |   unsigned int
+// CHECK-NEXT: 0 |   short a
+// CHECK-NEXT:   | [sizeof=4, align=4]
+
+union u2 {
+  long  :0;
+  short  a;
+} U2;
+// CHECK:  0 | union u2
+// CHECK-NEXT:   0:- |   long
+// CHECK-NEXT: 0 |   short a
+// CHECK-NEXT:   | [sizeof=8, align=8]
+
+union u3 {
+  unsigned char :0;
+  unsigned short :0;
+} U3;
+// CHECK:  0 | union u3
+// CHECK-NEXT:   0:- |   unsigned char
+// CHECK-NEXT:   0:- |   unsigned short
+// CHECK-NEXT:   | [sizeof=0, align=4]
\ No newline at end of file
Index: clang/lib/Basic/Targets/OSTargets.h
===
--- clang/lib/Basic/Targets/OSTargets.h
+++ clang/lib/Basic/Targets/OSTargets.h
@@ -779,6 +779,11 @@
   ZOSTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
   : OSTargetInfo(Triple, Opts) {
 this->WCharType = TargetInfo::UnsignedInt;
+this->UseBitFieldTypeAlignment = false;
+this->UseZeroLengthBitfieldAlignment = true;
+this->ZeroLengthBitfieldBoundary = 32;
+this->MinGlobalAlign = 0;
+this->DefaultAlignForAttributeAligned = 128;
   }
 };
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D88845: [SystemZ][z/OS] Set default alignment rules for z/OS target

2020-10-05 Thread Fanbo Meng via Phabricator via cfe-commits
fanbo-meng updated this revision to Diff 296269.
fanbo-meng added a comment.

fix no newline at end of file


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

https://reviews.llvm.org/D88845

Files:
  clang/lib/Basic/Targets/OSTargets.h
  clang/test/CodeGen/zos-alignment.c

Index: clang/test/CodeGen/zos-alignment.c
===
--- /dev/null
+++ clang/test/CodeGen/zos-alignment.c
@@ -0,0 +1,129 @@
+// RUN: %clang_cc1 -emit-llvm -triple s390x-none-zos -fdump-record-layouts %s -o - | FileCheck %s
+
+struct s0 {
+  short a:3;
+  long b:5;
+  int c:1;
+  long d:10;
+  char e:5;
+} S0;
+// CHECK:  0 | struct s0
+// CHECK-NEXT: 0:0-2 |   short a
+// CHECK-NEXT: 0:3-7 |   long b
+// CHECK-NEXT: 1:0-0 |   int c
+// CHECK-NEXT:1:1-10 |   long d
+// CHECK-NEXT: 2:3-7 |   char e
+// CHECK-NEXT:   | [sizeof=3, align=1]
+
+struct s1 {
+  char a:7;
+  long b:27;
+  int c:2;
+} S1;
+// CHECK:  0 | struct s1
+// CHECK-NEXT: 0:0-6 |   char a
+// CHECK-NEXT:0:7-33 |   long b
+// CHECK-NEXT: 4:2-3 |   int c
+// CHECK-NEXT:   | [sizeof=5, align=1]
+
+struct s2 {
+  char a:7;
+  char  :0;
+  short :0;
+  short :0;
+} S2;
+// CHECK:  0 | struct s2
+// CHECK-NEXT: 0:0-6 |   char a
+// CHECK-NEXT:   4:- |   char
+// CHECK-NEXT:   4:- |   short
+// CHECK-NEXT:   4:- |   short
+// CHECK-NEXT:   | [sizeof=4, align=4]
+
+struct s3 {
+  int a;
+  int b:16;
+  char  :0;
+  char c:1;
+} S3;
+// CHECK:  0 | struct s3
+// CHECK-NEXT: 0 |   int a
+// CHECK-NEXT:4:0-15 |   int b
+// CHECK-NEXT:   8:- |   char
+// CHECK-NEXT: 8:0-0 |   char c
+// CHECK-NEXT:   | [sizeof=12, align=4]
+
+struct s4 {
+ unsigned int __attribute__((aligned(32))) a;
+} S4;
+// CHECK:  0 | struct s4
+// CHECK-NEXT: 0 |   unsigned int a
+// CHECK-NEXT:   | [sizeof=32, align=32]
+
+struct s5 {
+  char a;
+  int  b:19 __attribute__((aligned(4)));
+  int  c:22 __attribute__((aligned(8)));
+  int  :0;
+  int  d:10;
+} S5;
+// CHECK:  0 | struct s5
+// CHECK-NEXT: 0 |   char a
+// CHECK-NEXT:4:0-18 |   int b
+// CHECK-NEXT:8:0-21 |   int c
+// CHECK-NEXT:  12:- |   int
+// CHECK-NEXT:12:0-9 |   int d
+// CHECK-NEXT:   | [sizeof=16, align=8]
+
+struct s6 {
+  char * a;
+  char * b[];
+} S6;
+// CHECK:  0 | struct s6
+// CHECK-NEXT: 0 |   char * a
+// CHECK-NEXT: 8 |   char *[] b
+// CHECK-NEXT:   | [sizeof=8, align=8]
+
+struct s10 {
+ unsigned int __attribute__((aligned)) a;
+} S10;
+// CHECK:  0 | struct s10
+// CHECK-NEXT: 0 |   unsigned int a
+// CHECK-NEXT:   | [sizeof=16, align=16]
+
+union u0 {
+  unsigned short d1 __attribute__((packed));
+  intd2:10;
+  long   d3;
+} U0 __attribute__((aligned(8)));
+// CHECK:  0 | union u0
+// CHECK-NEXT: 0 |   unsigned short d1
+// CHECK-NEXT: 0:0-9 |   int d2
+// CHECK-NEXT: 0 |   long d3
+// CHECK-NEXT:   | [sizeof=8, align=8]
+
+union u1 {
+  unsigned int:0;
+  short   a;
+} U1;
+// CHECK:  0 | union u1
+// CHECK-NEXT:   0:- |   unsigned int
+// CHECK-NEXT: 0 |   short a
+// CHECK-NEXT:   | [sizeof=4, align=4]
+
+union u2 {
+  long  :0;
+  short  a;
+} U2;
+// CHECK:  0 | union u2
+// CHECK-NEXT:   0:- |   long
+// CHECK-NEXT: 0 |   short a
+// CHECK-NEXT:   | [sizeof=8, align=8]
+
+union u3 {
+  unsigned char :0;
+  unsigned short :0;
+} U3;
+// CHECK:  0 | union u3
+// CHECK-NEXT:   0:- |   unsigned char
+// CHECK-NEXT:   0:- |   unsigned short
+// CHECK-NEXT:   | [sizeof=0, align=4]
Index: clang/lib/Basic/Targets/OSTargets.h
===
--- clang/lib/Basic/Targets/OSTargets.h
+++ clang/lib/Basic/Targets/OSTargets.h
@@ -779,6 +779,11 @@
   ZOSTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
   : OSTargetInfo(Triple, Opts) {
 this->WCharType = TargetInfo::UnsignedInt;
+this->UseBitFieldTypeAlignment = false;
+this->UseZeroLengthBitfieldAlignment = true;
+this->ZeroLengthBitfieldBoundary = 32;
+this->MinGlobalAlign = 0;
+this->DefaultAlignForAttributeAligned = 128;
   }
 };
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D88963: [SystemZ][z/OS] Add test of zero length bitfield type larger than zero length bitfield boundary

2020-10-07 Thread Fanbo Meng via Phabricator via cfe-commits
fanbo-meng created this revision.
fanbo-meng added reviewers: abhina.sreeskantharajan, hubert.reinterpretcast.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
fanbo-meng requested review of this revision.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D88963

Files:
  clang/test/CodeGen/zos-alignment.c


Index: clang/test/CodeGen/zos-alignment.c
===
--- clang/test/CodeGen/zos-alignment.c
+++ clang/test/CodeGen/zos-alignment.c
@@ -90,6 +90,17 @@
 // CHECK-NEXT: 0 |   unsigned int a
 // CHECK-NEXT:   | [sizeof=16, align=16]
 
+struct s11 {
+  char a;
+  long :0;
+  char b;
+} S11;
+// CHECK:  0 | struct s11
+// CHECK-NEXT: 0 |   char a
+// CHECK-NEXT:   8:- |   long
+// CHECK-NEXT: 8 |   char b
+// CHECK-NEXT:   | [sizeof=16, align=8]
+
 union u0 {
   unsigned short d1 __attribute__((packed));
   intd2:10;


Index: clang/test/CodeGen/zos-alignment.c
===
--- clang/test/CodeGen/zos-alignment.c
+++ clang/test/CodeGen/zos-alignment.c
@@ -90,6 +90,17 @@
 // CHECK-NEXT: 0 |   unsigned int a
 // CHECK-NEXT:   | [sizeof=16, align=16]
 
+struct s11 {
+  char a;
+  long :0;
+  char b;
+} S11;
+// CHECK:  0 | struct s11
+// CHECK-NEXT: 0 |   char a
+// CHECK-NEXT:   8:- |   long
+// CHECK-NEXT: 8 |   char b
+// CHECK-NEXT:   | [sizeof=16, align=8]
+
 union u0 {
   unsigned short d1 __attribute__((packed));
   intd2:10;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D89127: [SystemZ][z/OS] Update target specific __attribute__((aligned)) value for test

2020-10-09 Thread Fanbo Meng via Phabricator via cfe-commits
fanbo-meng created this revision.
fanbo-meng added reviewers: abhina.sreeskantharajan, uweigand, Kai, 
hubert.reinterpretcast.
Herald added subscribers: cfe-commits, krytarowski.
Herald added a project: clang.
fanbo-meng requested review of this revision.

z/OS defaults to 16 bytes for  __attribute__((aligned)), modify the test to 
differentiate between z/OS and Linux on s390x.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D89127

Files:
  clang/test/Sema/struct-packed-align.c


Index: clang/test/Sema/struct-packed-align.c
===
--- clang/test/Sema/struct-packed-align.c
+++ clang/test/Sema/struct-packed-align.c
@@ -59,7 +59,7 @@
 struct __attribute__((aligned)) as1_2 {
 char c;
 };
-#if ( defined(__s390x__) || ( defined (__ARM_32BIT_STATE) && ! 
defined(__ANDROID__) ) )
+#if ((defined(__s390x__) && !defined(__MVS__)) || (defined(__ARM_32BIT_STATE) 
&& !defined(__ANDROID__)))
 extern int e1_2[sizeof(struct as1_2) == 8 ? 1 : -1];
 extern int e2_2[__alignof(struct as1_2) == 8 ? 1 : -1];
 #else


Index: clang/test/Sema/struct-packed-align.c
===
--- clang/test/Sema/struct-packed-align.c
+++ clang/test/Sema/struct-packed-align.c
@@ -59,7 +59,7 @@
 struct __attribute__((aligned)) as1_2 {
 char c;
 };
-#if ( defined(__s390x__) || ( defined (__ARM_32BIT_STATE) && ! defined(__ANDROID__) ) )
+#if ((defined(__s390x__) && !defined(__MVS__)) || (defined(__ARM_32BIT_STATE) && !defined(__ANDROID__)))
 extern int e1_2[sizeof(struct as1_2) == 8 ? 1 : -1];
 extern int e2_2[__alignof(struct as1_2) == 8 ? 1 : -1];
 #else
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D89127: [SystemZ][z/OS] Update target specific __attribute__((aligned)) value for test

2020-10-09 Thread Fanbo Meng via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGd91234b21c1a: [SystemZ][z/OS] Update target specific 
__attribute__((aligned)) value for test (authored by fanbo-meng).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D89127

Files:
  clang/test/Sema/struct-packed-align.c


Index: clang/test/Sema/struct-packed-align.c
===
--- clang/test/Sema/struct-packed-align.c
+++ clang/test/Sema/struct-packed-align.c
@@ -59,7 +59,7 @@
 struct __attribute__((aligned)) as1_2 {
 char c;
 };
-#if ( defined(__s390x__) || ( defined (__ARM_32BIT_STATE) && ! 
defined(__ANDROID__) ) )
+#if ((defined(__s390x__) && !defined(__MVS__)) || (defined(__ARM_32BIT_STATE) 
&& !defined(__ANDROID__)))
 extern int e1_2[sizeof(struct as1_2) == 8 ? 1 : -1];
 extern int e2_2[__alignof(struct as1_2) == 8 ? 1 : -1];
 #else


Index: clang/test/Sema/struct-packed-align.c
===
--- clang/test/Sema/struct-packed-align.c
+++ clang/test/Sema/struct-packed-align.c
@@ -59,7 +59,7 @@
 struct __attribute__((aligned)) as1_2 {
 char c;
 };
-#if ( defined(__s390x__) || ( defined (__ARM_32BIT_STATE) && ! defined(__ANDROID__) ) )
+#if ((defined(__s390x__) && !defined(__MVS__)) || (defined(__ARM_32BIT_STATE) && !defined(__ANDROID__)))
 extern int e1_2[sizeof(struct as1_2) == 8 ? 1 : -1];
 extern int e2_2[__alignof(struct as1_2) == 8 ? 1 : -1];
 #else
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D107189: [z/OS]Remove overriding default attribute aligned value

2021-07-30 Thread Fanbo Meng via Phabricator via cfe-commits
fanbo-meng created this revision.
fanbo-meng requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Make DefaultAlignForAttributeAligned consistent with SystemZ.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D107189

Files:
  clang/lib/Basic/Targets/OSTargets.h
  clang/test/CodeGen/SystemZ/zos-alignment.c


Index: clang/test/CodeGen/SystemZ/zos-alignment.c
===
--- clang/test/CodeGen/SystemZ/zos-alignment.c
+++ clang/test/CodeGen/SystemZ/zos-alignment.c
@@ -147,7 +147,7 @@
 } S10;
 // CHECK:  0 | struct s10
 // CHECK-NEXT: 0 |   unsigned int a
-// CHECK-NEXT:   | [sizeof=16, align=16]
+// CHECK-NEXT:   | [sizeof=8, align=8]
 
 struct s11 {
   char a;
Index: clang/lib/Basic/Targets/OSTargets.h
===
--- clang/lib/Basic/Targets/OSTargets.h
+++ clang/lib/Basic/Targets/OSTargets.h
@@ -796,7 +796,6 @@
 this->UseZeroLengthBitfieldAlignment = true;
 this->UseLeadingZeroLengthBitfield = false;
 this->ZeroLengthBitfieldBoundary = 32;
-this->DefaultAlignForAttributeAligned = 128;
   }
 };
 


Index: clang/test/CodeGen/SystemZ/zos-alignment.c
===
--- clang/test/CodeGen/SystemZ/zos-alignment.c
+++ clang/test/CodeGen/SystemZ/zos-alignment.c
@@ -147,7 +147,7 @@
 } S10;
 // CHECK:  0 | struct s10
 // CHECK-NEXT: 0 |   unsigned int a
-// CHECK-NEXT:   | [sizeof=16, align=16]
+// CHECK-NEXT:   | [sizeof=8, align=8]
 
 struct s11 {
   char a;
Index: clang/lib/Basic/Targets/OSTargets.h
===
--- clang/lib/Basic/Targets/OSTargets.h
+++ clang/lib/Basic/Targets/OSTargets.h
@@ -796,7 +796,6 @@
 this->UseZeroLengthBitfieldAlignment = true;
 this->UseLeadingZeroLengthBitfield = false;
 this->ZeroLengthBitfieldBoundary = 32;
-this->DefaultAlignForAttributeAligned = 128;
   }
 };
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D107189: [z/OS]Remove overriding default attribute aligned value

2021-07-30 Thread Fanbo Meng via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGbdf4c7b738ee: [z/OS]Remove overriding default attribute 
aligned value (authored by fanbo-meng).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D107189

Files:
  clang/lib/Basic/Targets/OSTargets.h
  clang/test/CodeGen/SystemZ/zos-alignment.c


Index: clang/test/CodeGen/SystemZ/zos-alignment.c
===
--- clang/test/CodeGen/SystemZ/zos-alignment.c
+++ clang/test/CodeGen/SystemZ/zos-alignment.c
@@ -147,7 +147,7 @@
 } S10;
 // CHECK:  0 | struct s10
 // CHECK-NEXT: 0 |   unsigned int a
-// CHECK-NEXT:   | [sizeof=16, align=16]
+// CHECK-NEXT:   | [sizeof=8, align=8]
 
 struct s11 {
   char a;
Index: clang/lib/Basic/Targets/OSTargets.h
===
--- clang/lib/Basic/Targets/OSTargets.h
+++ clang/lib/Basic/Targets/OSTargets.h
@@ -796,7 +796,6 @@
 this->UseZeroLengthBitfieldAlignment = true;
 this->UseLeadingZeroLengthBitfield = false;
 this->ZeroLengthBitfieldBoundary = 32;
-this->DefaultAlignForAttributeAligned = 128;
   }
 };
 


Index: clang/test/CodeGen/SystemZ/zos-alignment.c
===
--- clang/test/CodeGen/SystemZ/zos-alignment.c
+++ clang/test/CodeGen/SystemZ/zos-alignment.c
@@ -147,7 +147,7 @@
 } S10;
 // CHECK:  0 | struct s10
 // CHECK-NEXT: 0 |   unsigned int a
-// CHECK-NEXT:   | [sizeof=16, align=16]
+// CHECK-NEXT:   | [sizeof=8, align=8]
 
 struct s11 {
   char a;
Index: clang/lib/Basic/Targets/OSTargets.h
===
--- clang/lib/Basic/Targets/OSTargets.h
+++ clang/lib/Basic/Targets/OSTargets.h
@@ -796,7 +796,6 @@
 this->UseZeroLengthBitfieldAlignment = true;
 this->UseLeadingZeroLengthBitfield = false;
 this->ZeroLengthBitfieldBoundary = 32;
-this->DefaultAlignForAttributeAligned = 128;
   }
 };
 
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D107565: Revert "[SystemZ][z/OS] Update target specific __attribute__((aligned)) value for test"

2021-08-05 Thread Fanbo Meng via Phabricator via cfe-commits
fanbo-meng created this revision.
Herald added a subscriber: krytarowski.
fanbo-meng requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

This reverts commit d91234b21c1a1a34d98157089a8769d8f9a32f06 
.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D107565

Files:
  clang/test/Sema/struct-packed-align.c


Index: clang/test/Sema/struct-packed-align.c
===
--- clang/test/Sema/struct-packed-align.c
+++ clang/test/Sema/struct-packed-align.c
@@ -59,7 +59,7 @@
 struct __attribute__((aligned)) as1_2 {
 char c;
 };
-#if ((defined(__s390x__) && !defined(__MVS__)) || (defined(__ARM_32BIT_STATE) 
&& !defined(__ANDROID__)))
+#if ( defined(__s390x__) || ( defined (__ARM_32BIT_STATE) && ! 
defined(__ANDROID__) ) )
 extern int e1_2[sizeof(struct as1_2) == 8 ? 1 : -1];
 extern int e2_2[__alignof(struct as1_2) == 8 ? 1 : -1];
 #else


Index: clang/test/Sema/struct-packed-align.c
===
--- clang/test/Sema/struct-packed-align.c
+++ clang/test/Sema/struct-packed-align.c
@@ -59,7 +59,7 @@
 struct __attribute__((aligned)) as1_2 {
 char c;
 };
-#if ((defined(__s390x__) && !defined(__MVS__)) || (defined(__ARM_32BIT_STATE) && !defined(__ANDROID__)))
+#if ( defined(__s390x__) || ( defined (__ARM_32BIT_STATE) && ! defined(__ANDROID__) ) )
 extern int e1_2[sizeof(struct as1_2) == 8 ? 1 : -1];
 extern int e2_2[__alignof(struct as1_2) == 8 ? 1 : -1];
 #else
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D107565: Revert "[SystemZ][z/OS] Update target specific __attribute__((aligned)) value for test"

2021-08-05 Thread Fanbo Meng via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG91e399519580: Revert "[SystemZ][z/OS] Update target 
specific __attribute__((aligned)) value… (authored by fanbo-meng).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D107565

Files:
  clang/test/Sema/struct-packed-align.c


Index: clang/test/Sema/struct-packed-align.c
===
--- clang/test/Sema/struct-packed-align.c
+++ clang/test/Sema/struct-packed-align.c
@@ -59,7 +59,7 @@
 struct __attribute__((aligned)) as1_2 {
 char c;
 };
-#if ((defined(__s390x__) && !defined(__MVS__)) || (defined(__ARM_32BIT_STATE) 
&& !defined(__ANDROID__)))
+#if ( defined(__s390x__) || ( defined (__ARM_32BIT_STATE) && ! 
defined(__ANDROID__) ) )
 extern int e1_2[sizeof(struct as1_2) == 8 ? 1 : -1];
 extern int e2_2[__alignof(struct as1_2) == 8 ? 1 : -1];
 #else


Index: clang/test/Sema/struct-packed-align.c
===
--- clang/test/Sema/struct-packed-align.c
+++ clang/test/Sema/struct-packed-align.c
@@ -59,7 +59,7 @@
 struct __attribute__((aligned)) as1_2 {
 char c;
 };
-#if ((defined(__s390x__) && !defined(__MVS__)) || (defined(__ARM_32BIT_STATE) && !defined(__ANDROID__)))
+#if ( defined(__s390x__) || ( defined (__ARM_32BIT_STATE) && ! defined(__ANDROID__) ) )
 extern int e1_2[sizeof(struct as1_2) == 8 ? 1 : -1];
 extern int e2_2[__alignof(struct as1_2) == 8 ? 1 : -1];
 #else
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D134034: [test] Use host platform specific error message substitution

2022-09-16 Thread Fanbo Meng via Phabricator via cfe-commits
fanbo-meng accepted this revision.
fanbo-meng added a comment.
This revision is now accepted and ready to land.

LGTM


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D134034

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


[PATCH] D145158: Make clang/test/C/C2x/n2934.c compatible with targets that do not support thread_local storage.

2023-03-02 Thread Fanbo Meng via Phabricator via cfe-commits
fanbo-meng created this revision.
Herald added a project: All.
fanbo-meng requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D145158

Files:
  clang/test/C/C2x/n2934.c


Index: clang/test/C/C2x/n2934.c
===
--- clang/test/C/C2x/n2934.c
+++ clang/test/C/C2x/n2934.c
@@ -7,6 +7,7 @@
 
 thread_local struct alignas(int) S { // c2x-warning {{'alignas' is 
incompatible with C standards before C2x}} \
 c2x-warning {{'thread_local' is 
incompatible with C standards before C2x}} \
+c2x-error 0+ {{thread-local storage is 
not supported for the current target}} \
 c17-error {{unknown type name 
'thread_local'}} \
 c17-error {{expected identifier or 
'('}} \
 c17-error {{expected ')'}} \


Index: clang/test/C/C2x/n2934.c
===
--- clang/test/C/C2x/n2934.c
+++ clang/test/C/C2x/n2934.c
@@ -7,6 +7,7 @@
 
 thread_local struct alignas(int) S { // c2x-warning {{'alignas' is incompatible with C standards before C2x}} \
 c2x-warning {{'thread_local' is incompatible with C standards before C2x}} \
+c2x-error 0+ {{thread-local storage is not supported for the current target}} \
 c17-error {{unknown type name 'thread_local'}} \
 c17-error {{expected identifier or '('}} \
 c17-error {{expected ')'}} \
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D145158: Make clang/test/C/C2x/n2934.c compatible with targets that do not support thread_local storage.

2023-03-02 Thread Fanbo Meng via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGbe646ef39298: Make clang/test/C/C2x/n2934.c compatible with 
targets that do not support… (authored by fanbo-meng).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D145158

Files:
  clang/test/C/C2x/n2934.c


Index: clang/test/C/C2x/n2934.c
===
--- clang/test/C/C2x/n2934.c
+++ clang/test/C/C2x/n2934.c
@@ -7,6 +7,7 @@
 
 thread_local struct alignas(int) S { // c2x-warning {{'alignas' is 
incompatible with C standards before C2x}} \
 c2x-warning {{'thread_local' is 
incompatible with C standards before C2x}} \
+c2x-error 0+ {{thread-local storage is 
not supported for the current target}} \
 c17-error {{unknown type name 
'thread_local'}} \
 c17-error {{expected identifier or 
'('}} \
 c17-error {{expected ')'}} \


Index: clang/test/C/C2x/n2934.c
===
--- clang/test/C/C2x/n2934.c
+++ clang/test/C/C2x/n2934.c
@@ -7,6 +7,7 @@
 
 thread_local struct alignas(int) S { // c2x-warning {{'alignas' is incompatible with C standards before C2x}} \
 c2x-warning {{'thread_local' is incompatible with C standards before C2x}} \
+c2x-error 0+ {{thread-local storage is not supported for the current target}} \
 c17-error {{unknown type name 'thread_local'}} \
 c17-error {{expected identifier or '('}} \
 c17-error {{expected ')'}} \
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D153582: [SystemZ][z/OS] Add required options/macro/etc for z/os compilation step

2023-06-26 Thread Fanbo Meng via Phabricator via cfe-commits
fanbo-meng accepted this revision.
fanbo-meng added a comment.

LGTM


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

https://reviews.llvm.org/D153582

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


[PATCH] D98864: [SystemZ][z/OS] Set maximum value to truncate attribute aligned to for static variables on z/OS target

2021-03-18 Thread Fanbo Meng via Phabricator via cfe-commits
fanbo-meng created this revision.
fanbo-meng added reviewers: abhina.sreeskantharajan, muiez, Kai, anirudhp, 
DanielMcIntosh-IBM.
fanbo-meng requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

On z/OS there is a hard limitation on on the maximum requestable alignment in 
aligned attribute for static variables. We need to truncate values greater than 
that.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D98864

Files:
  clang/include/clang/Basic/TargetInfo.h
  clang/lib/AST/ASTContext.cpp
  clang/lib/Basic/TargetInfo.cpp
  clang/lib/Basic/Targets/OSTargets.h
  clang/test/CodeGen/SystemZ/zos-alignment.c


Index: clang/test/CodeGen/SystemZ/zos-alignment.c
===
--- clang/test/CodeGen/SystemZ/zos-alignment.c
+++ clang/test/CodeGen/SystemZ/zos-alignment.c
@@ -1,4 +1,16 @@
-// RUN: %clang_cc1 -emit-llvm-only -triple s390x-none-zos 
-fdump-record-layouts %s | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm-only -triple s390x-none-zos 
-fdump-record-layouts %s | FileCheck %s --check-prefix=CHECK
+// RUN: %clang_cc1 -emit-llvm -triple s390x-none-zos %s -o - | FileCheck %s 
--check-prefix=DECL
+
+static int __attribute__((aligned(32))) v0;
+int __attribute__((aligned(32))) v1;
+typedef int __attribute__((aligned(32))) int32;
+static int32 v2;
+int32 v3;
+int f0() { return v0 + v1 + v2 + v3; }
+// DECL:  @v0 {{.*}} align 16
+// DECL-NEXT: @v1 {{.*}} align 32
+// DECL-NEXT: @v2 {{.*}} align 16
+// DECL-NEXT: @v3 {{.*}} align 32
 
 struct s0 {
   short a:3;
Index: clang/lib/Basic/Targets/OSTargets.h
===
--- clang/lib/Basic/Targets/OSTargets.h
+++ clang/lib/Basic/Targets/OSTargets.h
@@ -788,6 +788,7 @@
   ZOSTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
   : OSTargetInfo(Triple, Opts) {
 this->WCharType = TargetInfo::UnsignedInt;
+this->MaxAlignedAttribute = 128;
 this->UseBitFieldTypeAlignment = false;
 this->UseZeroLengthBitfieldAlignment = true;
 this->ZeroLengthBitfieldBoundary = 32;
Index: clang/lib/Basic/TargetInfo.cpp
===
--- clang/lib/Basic/TargetInfo.cpp
+++ clang/lib/Basic/TargetInfo.cpp
@@ -106,6 +106,7 @@
   UseZeroLengthBitfieldAlignment = false;
   UseExplicitBitFieldAlignment = true;
   ZeroLengthBitfieldBoundary = 0;
+  MaxAlignedAttribute = 0;
   HalfFormat = &llvm::APFloat::IEEEhalf();
   FloatFormat = &llvm::APFloat::IEEEsingle();
   DoubleFormat = &llvm::APFloat::IEEEdouble();
Index: clang/lib/AST/ASTContext.cpp
===
--- clang/lib/AST/ASTContext.cpp
+++ clang/lib/AST/ASTContext.cpp
@@ -1783,6 +1783,13 @@
 }
   }
 
+  // Some targets have hard limitation on the maximum requestable alignment in
+  // aligned attribute for static variables.
+  const unsigned MaxAlignedAttr = getTargetInfo().getMaxAlignedAttribute();
+  const auto *VD = dyn_cast(D);
+  if (MaxAlignedAttr && VD && VD->getStorageClass() == SC_Static)
+Align = std::min(Align, MaxAlignedAttr);
+
   return toCharUnitsFromBits(Align);
 }
 
Index: clang/include/clang/Basic/TargetInfo.h
===
--- clang/include/clang/Basic/TargetInfo.h
+++ clang/include/clang/Basic/TargetInfo.h
@@ -161,6 +161,10 @@
   /// If non-zero, specifies a fixed alignment value for bitfields that follow
   /// zero length bitfield, regardless of the zero length bitfield type.
   unsigned ZeroLengthBitfieldBoundary;
+
+  /// If non-zero, specifies a maximum alignment to truncate alignment
+  /// specified in the aligned attribute of a static variable to this value.
+  unsigned MaxAlignedAttribute;
 };
 
 /// OpenCL type kinds.
@@ -774,6 +778,12 @@
 return ZeroLengthBitfieldBoundary;
   }
 
+  /// Get the maximum alignment in bits for a static variable with
+  /// aligned attribute.
+  unsigned getMaxAlignedAttribute() const {
+return MaxAlignedAttribute;
+  }
+
   /// Check whether explicit bitfield alignment attributes should be
   //  honored, as in "__attribute__((aligned(2))) int b : 1;".
   bool useExplicitBitFieldAlignment() const {


Index: clang/test/CodeGen/SystemZ/zos-alignment.c
===
--- clang/test/CodeGen/SystemZ/zos-alignment.c
+++ clang/test/CodeGen/SystemZ/zos-alignment.c
@@ -1,4 +1,16 @@
-// RUN: %clang_cc1 -emit-llvm-only -triple s390x-none-zos -fdump-record-layouts %s | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm-only -triple s390x-none-zos -fdump-record-layouts %s | FileCheck %s --check-prefix=CHECK
+// RUN: %clang_cc1 -emit-llvm -triple s390x-none-zos %s -o - | FileCheck %s --check-prefix=DECL
+
+static int __attribute__((aligned(32))) v0;
+int __attribute__((aligned(32))) v1;
+typedef int __attribute__((aligned(32))) int32;
+static int32 v2;
+int32 v3

[PATCH] D98864: [SystemZ][z/OS] Set maximum value to truncate attribute aligned to for static variables on z/OS target

2021-03-18 Thread Fanbo Meng via Phabricator via cfe-commits
fanbo-meng updated this revision to Diff 331553.
fanbo-meng added a comment.
Herald added subscribers: sstefan1, phosek, s.egerton, jfb, mgrang, simoncook, 
fedor.sergeev, aheejin, krytarowski, dschuff.
Herald added a reviewer: jfb.
Herald added a reviewer: jdoerfert.

clang-formatted


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

https://reviews.llvm.org/D98864

Files:
  clang/include/clang/Basic/TargetInfo.h
  clang/lib/AST/ASTContext.cpp
  clang/lib/Basic/TargetInfo.cpp
  clang/lib/Basic/Targets/OSTargets.h
  clang/test/CodeGen/SystemZ/zos-alignment.c
  myPatch.diff

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


[PATCH] D98864: [SystemZ][z/OS] Set maximum value to truncate attribute aligned to for static variables on z/OS target

2021-03-18 Thread Fanbo Meng via Phabricator via cfe-commits
fanbo-meng updated this revision to Diff 331559.
fanbo-meng added a comment.

remove accidentally included diff patch file


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

https://reviews.llvm.org/D98864

Files:
  clang/include/clang/Basic/TargetInfo.h
  clang/lib/AST/ASTContext.cpp
  clang/lib/Basic/TargetInfo.cpp
  clang/lib/Basic/Targets/OSTargets.h
  clang/test/CodeGen/SystemZ/zos-alignment.c


Index: clang/test/CodeGen/SystemZ/zos-alignment.c
===
--- clang/test/CodeGen/SystemZ/zos-alignment.c
+++ clang/test/CodeGen/SystemZ/zos-alignment.c
@@ -1,4 +1,16 @@
-// RUN: %clang_cc1 -emit-llvm-only -triple s390x-none-zos 
-fdump-record-layouts %s | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm-only -triple s390x-none-zos 
-fdump-record-layouts %s | FileCheck %s --check-prefix=CHECK
+// RUN: %clang_cc1 -emit-llvm -triple s390x-none-zos %s -o - | FileCheck %s 
--check-prefix=DECL
+
+static int __attribute__((aligned(32))) v0;
+int __attribute__((aligned(32))) v1;
+typedef int __attribute__((aligned(32))) int32;
+static int32 v2;
+int32 v3;
+int f0() { return v0 + v1 + v2 + v3; }
+// DECL:  @v0 {{.*}} align 16
+// DECL-NEXT: @v1 {{.*}} align 32
+// DECL-NEXT: @v2 {{.*}} align 16
+// DECL-NEXT: @v3 {{.*}} align 32
 
 struct s0 {
   short a:3;
Index: clang/lib/Basic/Targets/OSTargets.h
===
--- clang/lib/Basic/Targets/OSTargets.h
+++ clang/lib/Basic/Targets/OSTargets.h
@@ -788,6 +788,7 @@
   ZOSTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
   : OSTargetInfo(Triple, Opts) {
 this->WCharType = TargetInfo::UnsignedInt;
+this->MaxAlignedAttribute = 128;
 this->UseBitFieldTypeAlignment = false;
 this->UseZeroLengthBitfieldAlignment = true;
 this->ZeroLengthBitfieldBoundary = 32;
Index: clang/lib/Basic/TargetInfo.cpp
===
--- clang/lib/Basic/TargetInfo.cpp
+++ clang/lib/Basic/TargetInfo.cpp
@@ -106,6 +106,7 @@
   UseZeroLengthBitfieldAlignment = false;
   UseExplicitBitFieldAlignment = true;
   ZeroLengthBitfieldBoundary = 0;
+  MaxAlignedAttribute = 0;
   HalfFormat = &llvm::APFloat::IEEEhalf();
   FloatFormat = &llvm::APFloat::IEEEsingle();
   DoubleFormat = &llvm::APFloat::IEEEdouble();
Index: clang/lib/AST/ASTContext.cpp
===
--- clang/lib/AST/ASTContext.cpp
+++ clang/lib/AST/ASTContext.cpp
@@ -1783,6 +1783,13 @@
 }
   }
 
+  // Some targets have hard limitation on the maximum requestable alignment in
+  // aligned attribute for static variables.
+  const unsigned MaxAlignedAttr = getTargetInfo().getMaxAlignedAttribute();
+  const auto *VD = dyn_cast(D);
+  if (MaxAlignedAttr && VD && VD->getStorageClass() == SC_Static)
+Align = std::min(Align, MaxAlignedAttr);
+
   return toCharUnitsFromBits(Align);
 }
 
Index: clang/include/clang/Basic/TargetInfo.h
===
--- clang/include/clang/Basic/TargetInfo.h
+++ clang/include/clang/Basic/TargetInfo.h
@@ -161,6 +161,10 @@
   /// If non-zero, specifies a fixed alignment value for bitfields that follow
   /// zero length bitfield, regardless of the zero length bitfield type.
   unsigned ZeroLengthBitfieldBoundary;
+
+  /// If non-zero, specifies a maximum alignment to truncate alignment
+  /// specified in the aligned attribute of a static variable to this value.
+  unsigned MaxAlignedAttribute;
 };
 
 /// OpenCL type kinds.
@@ -774,6 +778,10 @@
 return ZeroLengthBitfieldBoundary;
   }
 
+  /// Get the maximum alignment in bits for a static variable with
+  /// aligned attribute.
+  unsigned getMaxAlignedAttribute() const { return MaxAlignedAttribute; }
+
   /// Check whether explicit bitfield alignment attributes should be
   //  honored, as in "__attribute__((aligned(2))) int b : 1;".
   bool useExplicitBitFieldAlignment() const {


Index: clang/test/CodeGen/SystemZ/zos-alignment.c
===
--- clang/test/CodeGen/SystemZ/zos-alignment.c
+++ clang/test/CodeGen/SystemZ/zos-alignment.c
@@ -1,4 +1,16 @@
-// RUN: %clang_cc1 -emit-llvm-only -triple s390x-none-zos -fdump-record-layouts %s | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm-only -triple s390x-none-zos -fdump-record-layouts %s | FileCheck %s --check-prefix=CHECK
+// RUN: %clang_cc1 -emit-llvm -triple s390x-none-zos %s -o - | FileCheck %s --check-prefix=DECL
+
+static int __attribute__((aligned(32))) v0;
+int __attribute__((aligned(32))) v1;
+typedef int __attribute__((aligned(32))) int32;
+static int32 v2;
+int32 v3;
+int f0() { return v0 + v1 + v2 + v3; }
+// DECL:  @v0 {{.*}} align 16
+// DECL-NEXT: @v1 {{.*}} align 32
+// DECL-NEXT: @v2 {{.*}} align 16
+// DECL-NEXT: @v3 {{.*}} align 32
 
 struct s0 {
   short a:3;
Index: clang/lib/Basic/Targets/OSTargets.h
==

[PATCH] D98890: [SystemZ][z/OS] Ignore leading zero width bitfield alignment on z/OS target

2021-03-18 Thread Fanbo Meng via Phabricator via cfe-commits
fanbo-meng created this revision.
fanbo-meng added reviewers: abhina.sreeskantharajan, hubert.reinterpretcast, 
Kai, SeanP, rsmith.
fanbo-meng requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Zero length bitfield alignment is not respected if they are leading members on 
z/OS target.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D98890

Files:
  clang/include/clang/Basic/TargetInfo.h
  clang/lib/AST/RecordLayoutBuilder.cpp
  clang/lib/Basic/TargetInfo.cpp
  clang/lib/Basic/Targets/OSTargets.h
  clang/test/CodeGen/SystemZ/zos-alignment.c

Index: clang/test/CodeGen/SystemZ/zos-alignment.c
===
--- clang/test/CodeGen/SystemZ/zos-alignment.c
+++ clang/test/CodeGen/SystemZ/zos-alignment.c
@@ -83,6 +83,35 @@
 // CHECK-NEXT: 8 |   char *[] b
 // CHECK-NEXT:   | [sizeof=8, align=8]
 
+struct s7 {
+  long  :0;
+  short a;
+} S7;
+// CHECK:  0 | struct s7
+// CHECK-NEXT:   0:- |   long
+// CHECK-NEXT: 0 |   short a
+// CHECK-NEXT:   | [sizeof=2, align=2]
+
+#pragma pack(2)
+struct s8 {
+  unsigned long   :0;
+  long long   a;
+} S8;
+#pragma pack()
+// CHECK:  0 | struct s8
+// CHECK-NEXT:   0:- |   unsigned long
+// CHECK-NEXT: 0 |   long long a
+// CHECK-NEXT:   | [sizeof=8, align=2]
+
+struct s9 {
+  unsigned int   :0;
+  unsigned short :0;
+} S9;
+// CHECK:  0 | struct s9
+// CHECK-NEXT:   0:- |   unsigned int
+// CHECK-NEXT:   0:- |   unsigned short
+// CHECK-NEXT:   | [sizeof=0, align=1]
+
 struct s10 {
  unsigned int __attribute__((aligned)) a;
 } S10;
Index: clang/lib/Basic/Targets/OSTargets.h
===
--- clang/lib/Basic/Targets/OSTargets.h
+++ clang/lib/Basic/Targets/OSTargets.h
@@ -790,6 +790,7 @@
 this->WCharType = TargetInfo::UnsignedInt;
 this->UseBitFieldTypeAlignment = false;
 this->UseZeroLengthBitfieldAlignment = true;
+this->UseLeadingZeroLengthBitfield = false;
 this->ZeroLengthBitfieldBoundary = 32;
 this->MinGlobalAlign = 0;
 this->DefaultAlignForAttributeAligned = 128;
Index: clang/lib/Basic/TargetInfo.cpp
===
--- clang/lib/Basic/TargetInfo.cpp
+++ clang/lib/Basic/TargetInfo.cpp
@@ -104,6 +104,7 @@
   UseSignedCharForObjCBool = true;
   UseBitFieldTypeAlignment = true;
   UseZeroLengthBitfieldAlignment = false;
+  UseLeadingZeroLengthBitfield = true;
   UseExplicitBitFieldAlignment = true;
   ZeroLengthBitfieldBoundary = 0;
   HalfFormat = &llvm::APFloat::IEEEhalf();
Index: clang/lib/AST/RecordLayoutBuilder.cpp
===
--- clang/lib/AST/RecordLayoutBuilder.cpp
+++ clang/lib/AST/RecordLayoutBuilder.cpp
@@ -1627,12 +1627,17 @@
 // Some such targets do honor it on zero-width bitfields.
 if (FieldSize == 0 &&
 Context.getTargetInfo().useZeroLengthBitfieldAlignment()) {
-  // The alignment to round up to is the max of the field's natural
-  // alignment and a target-specific fixed value (sometimes zero).
-  unsigned ZeroLengthBitfieldBoundary =
-Context.getTargetInfo().getZeroLengthBitfieldBoundary();
-  FieldAlign = std::max(FieldAlign, ZeroLengthBitfieldBoundary);
-
+  // Some targets don't honor leading zero-width bitfield.
+  if (!IsUnion && FieldOffset == 0 &&
+  !Context.getTargetInfo().useLeadingZeroLengthBitfield())
+FieldAlign = 1;
+  else {
+// The alignment to round up to is the max of the field's natural
+// alignment and a target-specific fixed value (sometimes zero).
+unsigned ZeroLengthBitfieldBoundary =
+Context.getTargetInfo().getZeroLengthBitfieldBoundary();
+FieldAlign = std::max(FieldAlign, ZeroLengthBitfieldBoundary);
+  }
 // If that doesn't apply, just ignore the field alignment.
 } else {
   FieldAlign = 1;
Index: clang/include/clang/Basic/TargetInfo.h
===
--- clang/include/clang/Basic/TargetInfo.h
+++ clang/include/clang/Basic/TargetInfo.h
@@ -155,6 +155,10 @@
   /// zero-length bitfield.
   unsigned UseZeroLengthBitfieldAlignment : 1;
 
+  /// Whether zero length bitfield alignment is respected if they are the
+  /// leading members.
+  unsigned UseLeadingZeroLengthBitfield : 1;
+
   ///  Whether explicit bit field alignment attributes are honored.
   unsigned UseExplicitBitFieldAlignment : 1;
 
@@ -768,6 +772,12 @@
 return UseZeroLengthBitfieldAlignment;
   }
 
+  /// Check whether zero length bitfield alignment is respected if they are
+  /// leading members.
+  bool useLeadingZeroLengthBitfield() const {
+return UseLeadingZeroLengthBitfield;
+  }
+
   /// Get the fixed alignment value in bits for a member that 

[PATCH] D98890: [SystemZ][z/OS] Ignore leading zero width bitfield alignment on z/OS target

2021-03-26 Thread Fanbo Meng via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG6f91cf75d7f5: [SystemZ][z/OS] Ignore leading zero width 
bitfield alignment on z/OS target (authored by fanbo-meng).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D98890

Files:
  clang/include/clang/Basic/TargetInfo.h
  clang/lib/AST/RecordLayoutBuilder.cpp
  clang/lib/Basic/TargetInfo.cpp
  clang/lib/Basic/Targets/OSTargets.h
  clang/test/CodeGen/SystemZ/zos-alignment.c

Index: clang/test/CodeGen/SystemZ/zos-alignment.c
===
--- clang/test/CodeGen/SystemZ/zos-alignment.c
+++ clang/test/CodeGen/SystemZ/zos-alignment.c
@@ -83,6 +83,35 @@
 // CHECK-NEXT: 8 |   char *[] b
 // CHECK-NEXT:   | [sizeof=8, align=8]
 
+struct s7 {
+  long  :0;
+  short a;
+} S7;
+// CHECK:  0 | struct s7
+// CHECK-NEXT:   0:- |   long
+// CHECK-NEXT: 0 |   short a
+// CHECK-NEXT:   | [sizeof=2, align=2]
+
+#pragma pack(2)
+struct s8 {
+  unsigned long   :0;
+  long long   a;
+} S8;
+#pragma pack()
+// CHECK:  0 | struct s8
+// CHECK-NEXT:   0:- |   unsigned long
+// CHECK-NEXT: 0 |   long long a
+// CHECK-NEXT:   | [sizeof=8, align=2]
+
+struct s9 {
+  unsigned int   :0;
+  unsigned short :0;
+} S9;
+// CHECK:  0 | struct s9
+// CHECK-NEXT:   0:- |   unsigned int
+// CHECK-NEXT:   0:- |   unsigned short
+// CHECK-NEXT:   | [sizeof=0, align=1]
+
 struct s10 {
  unsigned int __attribute__((aligned)) a;
 } S10;
Index: clang/lib/Basic/Targets/OSTargets.h
===
--- clang/lib/Basic/Targets/OSTargets.h
+++ clang/lib/Basic/Targets/OSTargets.h
@@ -796,6 +796,7 @@
 this->WCharType = TargetInfo::UnsignedInt;
 this->UseBitFieldTypeAlignment = false;
 this->UseZeroLengthBitfieldAlignment = true;
+this->UseLeadingZeroLengthBitfield = false;
 this->ZeroLengthBitfieldBoundary = 32;
 this->MinGlobalAlign = 0;
 this->DefaultAlignForAttributeAligned = 128;
Index: clang/lib/Basic/TargetInfo.cpp
===
--- clang/lib/Basic/TargetInfo.cpp
+++ clang/lib/Basic/TargetInfo.cpp
@@ -104,6 +104,7 @@
   UseSignedCharForObjCBool = true;
   UseBitFieldTypeAlignment = true;
   UseZeroLengthBitfieldAlignment = false;
+  UseLeadingZeroLengthBitfield = true;
   UseExplicitBitFieldAlignment = true;
   ZeroLengthBitfieldBoundary = 0;
   HalfFormat = &llvm::APFloat::IEEEhalf();
Index: clang/lib/AST/RecordLayoutBuilder.cpp
===
--- clang/lib/AST/RecordLayoutBuilder.cpp
+++ clang/lib/AST/RecordLayoutBuilder.cpp
@@ -1627,12 +1627,17 @@
 // Some such targets do honor it on zero-width bitfields.
 if (FieldSize == 0 &&
 Context.getTargetInfo().useZeroLengthBitfieldAlignment()) {
-  // The alignment to round up to is the max of the field's natural
-  // alignment and a target-specific fixed value (sometimes zero).
-  unsigned ZeroLengthBitfieldBoundary =
-Context.getTargetInfo().getZeroLengthBitfieldBoundary();
-  FieldAlign = std::max(FieldAlign, ZeroLengthBitfieldBoundary);
-
+  // Some targets don't honor leading zero-width bitfield.
+  if (!IsUnion && FieldOffset == 0 &&
+  !Context.getTargetInfo().useLeadingZeroLengthBitfield())
+FieldAlign = 1;
+  else {
+// The alignment to round up to is the max of the field's natural
+// alignment and a target-specific fixed value (sometimes zero).
+unsigned ZeroLengthBitfieldBoundary =
+Context.getTargetInfo().getZeroLengthBitfieldBoundary();
+FieldAlign = std::max(FieldAlign, ZeroLengthBitfieldBoundary);
+  }
 // If that doesn't apply, just ignore the field alignment.
 } else {
   FieldAlign = 1;
Index: clang/include/clang/Basic/TargetInfo.h
===
--- clang/include/clang/Basic/TargetInfo.h
+++ clang/include/clang/Basic/TargetInfo.h
@@ -155,6 +155,10 @@
   /// zero-length bitfield.
   unsigned UseZeroLengthBitfieldAlignment : 1;
 
+  /// Whether zero length bitfield alignment is respected if they are the
+  /// leading members.
+  unsigned UseLeadingZeroLengthBitfield : 1;
+
   ///  Whether explicit bit field alignment attributes are honored.
   unsigned UseExplicitBitFieldAlignment : 1;
 
@@ -768,6 +772,12 @@
 return UseZeroLengthBitfieldAlignment;
   }
 
+  /// Check whether zero length bitfield alignment is respected if they are
+  /// leading members.
+  bool useLeadingZeroLengthBitfield() const {
+return UseLeadingZeroLengthBitfield;
+  }
+
   /// Get the fixed alignment value in bits for a member that follows
   /// a zero length bitfield.
   unsigned getZeroLengthBitf

[PATCH] D98864: [SystemZ][z/OS] Set maximum value to truncate attribute aligned to for static variables on z/OS target

2021-03-28 Thread Fanbo Meng via Phabricator via cfe-commits
fanbo-meng updated this revision to Diff 333737.
fanbo-meng set the repository for this revision to rG LLVM Github Monorepo.
fanbo-meng added a comment.

rebasing to latest master


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D98864

Files:
  clang/include/clang/Basic/TargetInfo.h
  clang/lib/AST/ASTContext.cpp
  clang/lib/Basic/TargetInfo.cpp
  clang/lib/Basic/Targets/OSTargets.h
  clang/test/CodeGen/SystemZ/zos-alignment.c


Index: clang/test/CodeGen/SystemZ/zos-alignment.c
===
--- clang/test/CodeGen/SystemZ/zos-alignment.c
+++ clang/test/CodeGen/SystemZ/zos-alignment.c
@@ -1,4 +1,16 @@
-// RUN: %clang_cc1 -emit-llvm-only -triple s390x-none-zos 
-fdump-record-layouts %s | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm-only -triple s390x-none-zos 
-fdump-record-layouts %s | FileCheck %s --check-prefix=CHECK
+// RUN: %clang_cc1 -emit-llvm -triple s390x-none-zos %s -o - | FileCheck %s 
--check-prefix=DECL
+
+static int __attribute__((aligned(32))) v0;
+int __attribute__((aligned(32))) v1;
+typedef int __attribute__((aligned(32))) int32;
+static int32 v2;
+int32 v3;
+int f0() { return v0 + v1 + v2 + v3; }
+// DECL:  @v0 {{.*}} align 16
+// DECL-NEXT: @v1 {{.*}} align 32
+// DECL-NEXT: @v2 {{.*}} align 16
+// DECL-NEXT: @v3 {{.*}} align 32
 
 struct s0 {
   short a:3;
Index: clang/lib/Basic/Targets/OSTargets.h
===
--- clang/lib/Basic/Targets/OSTargets.h
+++ clang/lib/Basic/Targets/OSTargets.h
@@ -794,6 +794,7 @@
   ZOSTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
   : OSTargetInfo(Triple, Opts) {
 this->WCharType = TargetInfo::UnsignedInt;
+this->MaxAlignedAttribute = 128;
 this->UseBitFieldTypeAlignment = false;
 this->UseZeroLengthBitfieldAlignment = true;
 this->UseLeadingZeroLengthBitfield = false;
Index: clang/lib/Basic/TargetInfo.cpp
===
--- clang/lib/Basic/TargetInfo.cpp
+++ clang/lib/Basic/TargetInfo.cpp
@@ -107,6 +107,7 @@
   UseLeadingZeroLengthBitfield = true;
   UseExplicitBitFieldAlignment = true;
   ZeroLengthBitfieldBoundary = 0;
+  MaxAlignedAttribute = 0;
   HalfFormat = &llvm::APFloat::IEEEhalf();
   FloatFormat = &llvm::APFloat::IEEEsingle();
   DoubleFormat = &llvm::APFloat::IEEEdouble();
Index: clang/lib/AST/ASTContext.cpp
===
--- clang/lib/AST/ASTContext.cpp
+++ clang/lib/AST/ASTContext.cpp
@@ -1783,6 +1783,13 @@
 }
   }
 
+  // Some targets have hard limitation on the maximum requestable alignment in
+  // aligned attribute for static variables.
+  const unsigned MaxAlignedAttr = getTargetInfo().getMaxAlignedAttribute();
+  const auto *VD = dyn_cast(D);
+  if (MaxAlignedAttr && VD && VD->getStorageClass() == SC_Static)
+Align = std::min(Align, MaxAlignedAttr);
+
   return toCharUnitsFromBits(Align);
 }
 
Index: clang/include/clang/Basic/TargetInfo.h
===
--- clang/include/clang/Basic/TargetInfo.h
+++ clang/include/clang/Basic/TargetInfo.h
@@ -165,6 +165,10 @@
   /// If non-zero, specifies a fixed alignment value for bitfields that follow
   /// zero length bitfield, regardless of the zero length bitfield type.
   unsigned ZeroLengthBitfieldBoundary;
+
+  /// If non-zero, specifies a maximum alignment to truncate alignment
+  /// specified in the aligned attribute of a static variable to this value.
+  unsigned MaxAlignedAttribute;
 };
 
 /// OpenCL type kinds.
@@ -784,6 +788,10 @@
 return ZeroLengthBitfieldBoundary;
   }
 
+  /// Get the maximum alignment in bits for a static variable with
+  /// aligned attribute.
+  unsigned getMaxAlignedAttribute() const { return MaxAlignedAttribute; }
+
   /// Check whether explicit bitfield alignment attributes should be
   //  honored, as in "__attribute__((aligned(2))) int b : 1;".
   bool useExplicitBitFieldAlignment() const {


Index: clang/test/CodeGen/SystemZ/zos-alignment.c
===
--- clang/test/CodeGen/SystemZ/zos-alignment.c
+++ clang/test/CodeGen/SystemZ/zos-alignment.c
@@ -1,4 +1,16 @@
-// RUN: %clang_cc1 -emit-llvm-only -triple s390x-none-zos -fdump-record-layouts %s | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm-only -triple s390x-none-zos -fdump-record-layouts %s | FileCheck %s --check-prefix=CHECK
+// RUN: %clang_cc1 -emit-llvm -triple s390x-none-zos %s -o - | FileCheck %s --check-prefix=DECL
+
+static int __attribute__((aligned(32))) v0;
+int __attribute__((aligned(32))) v1;
+typedef int __attribute__((aligned(32))) int32;
+static int32 v2;
+int32 v3;
+int f0() { return v0 + v1 + v2 + v3; }
+// DECL:  @v0 {{.*}} align 16
+// DECL-NEXT: @v1 {{.*}} align 32
+// DECL-NEXT: @v2 {{.*}} align 16
+// DECL-NEXT: @v3 {{.*}} a

[PATCH] D98864: [SystemZ][z/OS] Set maximum value to truncate attribute aligned to for static variables on z/OS target

2021-03-29 Thread Fanbo Meng via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG0858f0e09e33: [SystemZ][z/OS] Set maximum value to truncate 
attribute aligned to for static… (authored by fanbo-meng).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D98864

Files:
  clang/include/clang/Basic/TargetInfo.h
  clang/lib/AST/ASTContext.cpp
  clang/lib/Basic/TargetInfo.cpp
  clang/lib/Basic/Targets/OSTargets.h
  clang/test/CodeGen/SystemZ/zos-alignment.c


Index: clang/test/CodeGen/SystemZ/zos-alignment.c
===
--- clang/test/CodeGen/SystemZ/zos-alignment.c
+++ clang/test/CodeGen/SystemZ/zos-alignment.c
@@ -1,4 +1,16 @@
-// RUN: %clang_cc1 -emit-llvm-only -triple s390x-none-zos 
-fdump-record-layouts %s | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm-only -triple s390x-none-zos 
-fdump-record-layouts %s | FileCheck %s --check-prefix=CHECK
+// RUN: %clang_cc1 -emit-llvm -triple s390x-none-zos %s -o - | FileCheck %s 
--check-prefix=DECL
+
+static int __attribute__((aligned(32))) v0;
+int __attribute__((aligned(32))) v1;
+typedef int __attribute__((aligned(32))) int32;
+static int32 v2;
+int32 v3;
+int f0() { return v0 + v1 + v2 + v3; }
+// DECL:  @v0 {{.*}} align 16
+// DECL-NEXT: @v1 {{.*}} align 32
+// DECL-NEXT: @v2 {{.*}} align 16
+// DECL-NEXT: @v3 {{.*}} align 32
 
 struct s0 {
   short a:3;
Index: clang/lib/Basic/Targets/OSTargets.h
===
--- clang/lib/Basic/Targets/OSTargets.h
+++ clang/lib/Basic/Targets/OSTargets.h
@@ -794,6 +794,7 @@
   ZOSTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
   : OSTargetInfo(Triple, Opts) {
 this->WCharType = TargetInfo::UnsignedInt;
+this->MaxAlignedAttribute = 128;
 this->UseBitFieldTypeAlignment = false;
 this->UseZeroLengthBitfieldAlignment = true;
 this->UseLeadingZeroLengthBitfield = false;
Index: clang/lib/Basic/TargetInfo.cpp
===
--- clang/lib/Basic/TargetInfo.cpp
+++ clang/lib/Basic/TargetInfo.cpp
@@ -107,6 +107,7 @@
   UseLeadingZeroLengthBitfield = true;
   UseExplicitBitFieldAlignment = true;
   ZeroLengthBitfieldBoundary = 0;
+  MaxAlignedAttribute = 0;
   HalfFormat = &llvm::APFloat::IEEEhalf();
   FloatFormat = &llvm::APFloat::IEEEsingle();
   DoubleFormat = &llvm::APFloat::IEEEdouble();
Index: clang/lib/AST/ASTContext.cpp
===
--- clang/lib/AST/ASTContext.cpp
+++ clang/lib/AST/ASTContext.cpp
@@ -1783,6 +1783,13 @@
 }
   }
 
+  // Some targets have hard limitation on the maximum requestable alignment in
+  // aligned attribute for static variables.
+  const unsigned MaxAlignedAttr = getTargetInfo().getMaxAlignedAttribute();
+  const auto *VD = dyn_cast(D);
+  if (MaxAlignedAttr && VD && VD->getStorageClass() == SC_Static)
+Align = std::min(Align, MaxAlignedAttr);
+
   return toCharUnitsFromBits(Align);
 }
 
Index: clang/include/clang/Basic/TargetInfo.h
===
--- clang/include/clang/Basic/TargetInfo.h
+++ clang/include/clang/Basic/TargetInfo.h
@@ -165,6 +165,10 @@
   /// If non-zero, specifies a fixed alignment value for bitfields that follow
   /// zero length bitfield, regardless of the zero length bitfield type.
   unsigned ZeroLengthBitfieldBoundary;
+
+  /// If non-zero, specifies a maximum alignment to truncate alignment
+  /// specified in the aligned attribute of a static variable to this value.
+  unsigned MaxAlignedAttribute;
 };
 
 /// OpenCL type kinds.
@@ -784,6 +788,10 @@
 return ZeroLengthBitfieldBoundary;
   }
 
+  /// Get the maximum alignment in bits for a static variable with
+  /// aligned attribute.
+  unsigned getMaxAlignedAttribute() const { return MaxAlignedAttribute; }
+
   /// Check whether explicit bitfield alignment attributes should be
   //  honored, as in "__attribute__((aligned(2))) int b : 1;".
   bool useExplicitBitFieldAlignment() const {


Index: clang/test/CodeGen/SystemZ/zos-alignment.c
===
--- clang/test/CodeGen/SystemZ/zos-alignment.c
+++ clang/test/CodeGen/SystemZ/zos-alignment.c
@@ -1,4 +1,16 @@
-// RUN: %clang_cc1 -emit-llvm-only -triple s390x-none-zos -fdump-record-layouts %s | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm-only -triple s390x-none-zos -fdump-record-layouts %s | FileCheck %s --check-prefix=CHECK
+// RUN: %clang_cc1 -emit-llvm -triple s390x-none-zos %s -o - | FileCheck %s --check-prefix=DECL
+
+static int __attribute__((aligned(32))) v0;
+int __attribute__((aligned(32))) v1;
+typedef int __attribute__((aligned(32))) int32;
+static int32 v2;
+int32 v3;
+int f0() { return v0 + v1 + v2 + v3; }
+// DECL:  @v0 {{.*}} align 16
+// DECL-

[PATCH] D99508: [SystemZ][z/OS] Add test of leading zero length bitfield in const/volatile struct

2021-03-29 Thread Fanbo Meng via Phabricator via cfe-commits
fanbo-meng created this revision.
fanbo-meng added a reviewer: abhina.sreeskantharajan.
fanbo-meng requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D99508

Files:
  clang/test/CodeGen/SystemZ/zos-alignment.c


Index: clang/test/CodeGen/SystemZ/zos-alignment.c
===
--- clang/test/CodeGen/SystemZ/zos-alignment.c
+++ clang/test/CodeGen/SystemZ/zos-alignment.c
@@ -12,6 +12,24 @@
 // DECL-NEXT: @v2 {{.*}} align 16
 // DECL-NEXT: @v3 {{.*}} align 32
 
+const struct cs0 {
+  unsigned long   :0;
+  long longa;
+} CS0 = {};
+// CHECK:  0 | struct cs0
+// CHECK-NEXT:   0:- |   unsigned long
+// CHECK-NEXT: 0 |   long long a
+// CHECK-NEXT:   | [sizeof=8, align=8]
+
+volatile struct vs0 {
+  long:0;
+  short   a;
+} VS0;
+// CHECK:  0 | struct vs0
+// CHECK-NEXT:   0:- |   long
+// CHECK-NEXT: 0 |   short a
+// CHECK-NEXT:   | [sizeof=2, align=2]
+
 struct s0 {
   short a:3;
   long b:5;


Index: clang/test/CodeGen/SystemZ/zos-alignment.c
===
--- clang/test/CodeGen/SystemZ/zos-alignment.c
+++ clang/test/CodeGen/SystemZ/zos-alignment.c
@@ -12,6 +12,24 @@
 // DECL-NEXT: @v2 {{.*}} align 16
 // DECL-NEXT: @v3 {{.*}} align 32
 
+const struct cs0 {
+  unsigned long   :0;
+  long longa;
+} CS0 = {};
+// CHECK:  0 | struct cs0
+// CHECK-NEXT:   0:- |   unsigned long
+// CHECK-NEXT: 0 |   long long a
+// CHECK-NEXT:   | [sizeof=8, align=8]
+
+volatile struct vs0 {
+  long:0;
+  short   a;
+} VS0;
+// CHECK:  0 | struct vs0
+// CHECK-NEXT:   0:- |   long
+// CHECK-NEXT: 0 |   short a
+// CHECK-NEXT:   | [sizeof=2, align=2]
+
 struct s0 {
   short a:3;
   long b:5;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D99508: [SystemZ][z/OS] Add test of leading zero length bitfield in const/volatile struct

2021-03-29 Thread Fanbo Meng via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGf1e0c7fdd720: [SystemZ][z/OS] Add test of leading zero 
length bitfield in const/volatile… (authored by fanbo-meng).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99508

Files:
  clang/test/CodeGen/SystemZ/zos-alignment.c


Index: clang/test/CodeGen/SystemZ/zos-alignment.c
===
--- clang/test/CodeGen/SystemZ/zos-alignment.c
+++ clang/test/CodeGen/SystemZ/zos-alignment.c
@@ -12,6 +12,24 @@
 // DECL-NEXT: @v2 {{.*}} align 16
 // DECL-NEXT: @v3 {{.*}} align 32
 
+const struct cs0 {
+  unsigned long   :0;
+  long longa;
+} CS0 = {};
+// CHECK:  0 | struct cs0
+// CHECK-NEXT:   0:- |   unsigned long
+// CHECK-NEXT: 0 |   long long a
+// CHECK-NEXT:   | [sizeof=8, align=8]
+
+volatile struct vs0 {
+  long:0;
+  short   a;
+} VS0;
+// CHECK:  0 | struct vs0
+// CHECK-NEXT:   0:- |   long
+// CHECK-NEXT: 0 |   short a
+// CHECK-NEXT:   | [sizeof=2, align=2]
+
 struct s0 {
   short a:3;
   long b:5;


Index: clang/test/CodeGen/SystemZ/zos-alignment.c
===
--- clang/test/CodeGen/SystemZ/zos-alignment.c
+++ clang/test/CodeGen/SystemZ/zos-alignment.c
@@ -12,6 +12,24 @@
 // DECL-NEXT: @v2 {{.*}} align 16
 // DECL-NEXT: @v3 {{.*}} align 32
 
+const struct cs0 {
+  unsigned long   :0;
+  long longa;
+} CS0 = {};
+// CHECK:  0 | struct cs0
+// CHECK-NEXT:   0:- |   unsigned long
+// CHECK-NEXT: 0 |   long long a
+// CHECK-NEXT:   | [sizeof=8, align=8]
+
+volatile struct vs0 {
+  long:0;
+  short   a;
+} VS0;
+// CHECK:  0 | struct vs0
+// CHECK-NEXT:   0:- |   long
+// CHECK-NEXT: 0 |   short a
+// CHECK-NEXT:   | [sizeof=2, align=2]
+
 struct s0 {
   short a:3;
   long b:5;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D99514: [NFC] clang-formatting zos-alignment.c

2021-03-29 Thread Fanbo Meng via Phabricator via cfe-commits
fanbo-meng created this revision.
fanbo-meng added a reviewer: abhina.sreeskantharajan.
fanbo-meng requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D99514

Files:
  clang/test/CodeGen/SystemZ/zos-alignment.c

Index: clang/test/CodeGen/SystemZ/zos-alignment.c
===
--- clang/test/CodeGen/SystemZ/zos-alignment.c
+++ clang/test/CodeGen/SystemZ/zos-alignment.c
@@ -13,8 +13,8 @@
 // DECL-NEXT: @v3 {{.*}} align 32
 
 const struct cs0 {
-  unsigned long   :0;
-  long longa;
+  unsigned long : 0;
+  long long a;
 } CS0 = {};
 // CHECK:  0 | struct cs0
 // CHECK-NEXT:   0:- |   unsigned long
@@ -22,8 +22,8 @@
 // CHECK-NEXT:   | [sizeof=8, align=8]
 
 volatile struct vs0 {
-  long:0;
-  short   a;
+  long : 0;
+  short a;
 } VS0;
 // CHECK:  0 | struct vs0
 // CHECK-NEXT:   0:- |   long
@@ -31,11 +31,11 @@
 // CHECK-NEXT:   | [sizeof=2, align=2]
 
 struct s0 {
-  short a:3;
-  long b:5;
-  int c:1;
-  long d:10;
-  char e:5;
+  short a : 3;
+  long b : 5;
+  int c : 1;
+  long d : 10;
+  char e : 5;
 } S0;
 // CHECK:  0 | struct s0
 // CHECK-NEXT: 0:0-2 |   short a
@@ -46,9 +46,9 @@
 // CHECK-NEXT:   | [sizeof=3, align=1]
 
 struct s1 {
-  char a:7;
-  long b:27;
-  int c:2;
+  char a : 7;
+  long b : 27;
+  int c : 2;
 } S1;
 // CHECK:  0 | struct s1
 // CHECK-NEXT: 0:0-6 |   char a
@@ -57,10 +57,10 @@
 // CHECK-NEXT:   | [sizeof=5, align=1]
 
 struct s2 {
-  char a:7;
-  char  :0;
-  short :0;
-  short :0;
+  char a : 7;
+  char : 0;
+  short : 0;
+  short : 0;
 } S2;
 // CHECK:  0 | struct s2
 // CHECK-NEXT: 0:0-6 |   char a
@@ -71,9 +71,9 @@
 
 struct s3 {
   int a;
-  int b:16;
-  char  :0;
-  char c:1;
+  int b : 16;
+  char : 0;
+  char c : 1;
 } S3;
 // CHECK:  0 | struct s3
 // CHECK-NEXT: 0 |   int a
@@ -83,7 +83,7 @@
 // CHECK-NEXT:   | [sizeof=12, align=4]
 
 struct s4 {
- unsigned int __attribute__((aligned(32))) a;
+  unsigned int __attribute__((aligned(32))) a;
 } S4;
 // CHECK:  0 | struct s4
 // CHECK-NEXT: 0 |   unsigned int a
@@ -91,10 +91,10 @@
 
 struct s5 {
   char a;
-  int  b:19 __attribute__((aligned(4)));
-  int  c:22 __attribute__((aligned(8)));
-  int  :0;
-  int  d:10;
+  int b : 19 __attribute__((aligned(4)));
+  int c : 22 __attribute__((aligned(8)));
+  int : 0;
+  int d : 10;
 } S5;
 // CHECK:  0 | struct s5
 // CHECK-NEXT: 0 |   char a
@@ -105,8 +105,8 @@
 // CHECK-NEXT:   | [sizeof=16, align=8]
 
 struct s6 {
-  char * a;
-  char * b[];
+  char *a;
+  char *b[];
 } S6;
 // CHECK:  0 | struct s6
 // CHECK-NEXT: 0 |   char * a
@@ -114,7 +114,7 @@
 // CHECK-NEXT:   | [sizeof=8, align=8]
 
 struct s7 {
-  long  :0;
+  long : 0;
   short a;
 } S7;
 // CHECK:  0 | struct s7
@@ -124,8 +124,8 @@
 
 #pragma pack(2)
 struct s8 {
-  unsigned long   :0;
-  long long   a;
+  unsigned long : 0;
+  long long a;
 } S8;
 #pragma pack()
 // CHECK:  0 | struct s8
@@ -134,8 +134,8 @@
 // CHECK-NEXT:   | [sizeof=8, align=2]
 
 struct s9 {
-  unsigned int   :0;
-  unsigned short :0;
+  unsigned int : 0;
+  unsigned short : 0;
 } S9;
 // CHECK:  0 | struct s9
 // CHECK-NEXT:   0:- |   unsigned int
@@ -143,7 +143,7 @@
 // CHECK-NEXT:   | [sizeof=0, align=1]
 
 struct s10 {
- unsigned int __attribute__((aligned)) a;
+  unsigned int __attribute__((aligned)) a;
 } S10;
 // CHECK:  0 | struct s10
 // CHECK-NEXT: 0 |   unsigned int a
@@ -151,7 +151,7 @@
 
 struct s11 {
   char a;
-  long :0;
+  long : 0;
   char b;
 } S11;
 // CHECK:  0 | struct s11
@@ -161,9 +161,9 @@
 // CHECK-NEXT:   | [sizeof=16, align=8]
 
 union u0 {
-  unsigned short d1 __attribute__((packed));
-  intd2:10;
-  long   d3;
+  unsigned short d1 __attribute__((packed));
+  int d2 : 10;
+  long d3;
 } U0 __attribute__((aligned(8)));
 // CHECK:  0 | union u0
 // CHECK-NEXT: 0 |   unsigned short d1
@@ -172,8 +172,8 @@
 // CHECK-NEXT:   | [sizeof=8, align=8]
 
 union u1 {
-  unsigned int:0;
-  short   a;
+  unsigned int : 0;
+  short a;
 } U1;
 // CHECK:  0 | union u1
 // CHECK-NEXT:   0:- |   unsigned int
@@ -181,8 +181,8 @@
 // CHECK-NEXT:   | [sizeof=4, align=4]
 
 union u2 {
-  long  :0;
-  short  a;
+  long : 0;
+  short a;
 } U2;
 // CHECK:  0 | union u2
 // CHECK-NEXT:   0:- |   long
@@ -190,8 +190,8 @@
 // CHECK-NEXT:   | [sizeof=8, align=8]
 
 union u3 {
-  unsigned char :0;
-  unsigned short :0;
+  unsigned char : 0;
+  unsigned short : 0;
 } U3;
 // CHECK:  0 | 

[PATCH] D99514: [NFC] clang-formatting zos-alignment.c

2021-03-29 Thread Fanbo Meng via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGbd8dd580ffd2: [NFC] clang-formatting zos-alignment.c 
(authored by fanbo-meng).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99514

Files:
  clang/test/CodeGen/SystemZ/zos-alignment.c

Index: clang/test/CodeGen/SystemZ/zos-alignment.c
===
--- clang/test/CodeGen/SystemZ/zos-alignment.c
+++ clang/test/CodeGen/SystemZ/zos-alignment.c
@@ -13,8 +13,8 @@
 // DECL-NEXT: @v3 {{.*}} align 32
 
 const struct cs0 {
-  unsigned long   :0;
-  long longa;
+  unsigned long : 0;
+  long long a;
 } CS0 = {};
 // CHECK:  0 | struct cs0
 // CHECK-NEXT:   0:- |   unsigned long
@@ -22,8 +22,8 @@
 // CHECK-NEXT:   | [sizeof=8, align=8]
 
 volatile struct vs0 {
-  long:0;
-  short   a;
+  long : 0;
+  short a;
 } VS0;
 // CHECK:  0 | struct vs0
 // CHECK-NEXT:   0:- |   long
@@ -31,11 +31,11 @@
 // CHECK-NEXT:   | [sizeof=2, align=2]
 
 struct s0 {
-  short a:3;
-  long b:5;
-  int c:1;
-  long d:10;
-  char e:5;
+  short a : 3;
+  long b : 5;
+  int c : 1;
+  long d : 10;
+  char e : 5;
 } S0;
 // CHECK:  0 | struct s0
 // CHECK-NEXT: 0:0-2 |   short a
@@ -46,9 +46,9 @@
 // CHECK-NEXT:   | [sizeof=3, align=1]
 
 struct s1 {
-  char a:7;
-  long b:27;
-  int c:2;
+  char a : 7;
+  long b : 27;
+  int c : 2;
 } S1;
 // CHECK:  0 | struct s1
 // CHECK-NEXT: 0:0-6 |   char a
@@ -57,10 +57,10 @@
 // CHECK-NEXT:   | [sizeof=5, align=1]
 
 struct s2 {
-  char a:7;
-  char  :0;
-  short :0;
-  short :0;
+  char a : 7;
+  char : 0;
+  short : 0;
+  short : 0;
 } S2;
 // CHECK:  0 | struct s2
 // CHECK-NEXT: 0:0-6 |   char a
@@ -71,9 +71,9 @@
 
 struct s3 {
   int a;
-  int b:16;
-  char  :0;
-  char c:1;
+  int b : 16;
+  char : 0;
+  char c : 1;
 } S3;
 // CHECK:  0 | struct s3
 // CHECK-NEXT: 0 |   int a
@@ -83,7 +83,7 @@
 // CHECK-NEXT:   | [sizeof=12, align=4]
 
 struct s4 {
- unsigned int __attribute__((aligned(32))) a;
+  unsigned int __attribute__((aligned(32))) a;
 } S4;
 // CHECK:  0 | struct s4
 // CHECK-NEXT: 0 |   unsigned int a
@@ -91,10 +91,10 @@
 
 struct s5 {
   char a;
-  int  b:19 __attribute__((aligned(4)));
-  int  c:22 __attribute__((aligned(8)));
-  int  :0;
-  int  d:10;
+  int b : 19 __attribute__((aligned(4)));
+  int c : 22 __attribute__((aligned(8)));
+  int : 0;
+  int d : 10;
 } S5;
 // CHECK:  0 | struct s5
 // CHECK-NEXT: 0 |   char a
@@ -105,8 +105,8 @@
 // CHECK-NEXT:   | [sizeof=16, align=8]
 
 struct s6 {
-  char * a;
-  char * b[];
+  char *a;
+  char *b[];
 } S6;
 // CHECK:  0 | struct s6
 // CHECK-NEXT: 0 |   char * a
@@ -114,7 +114,7 @@
 // CHECK-NEXT:   | [sizeof=8, align=8]
 
 struct s7 {
-  long  :0;
+  long : 0;
   short a;
 } S7;
 // CHECK:  0 | struct s7
@@ -124,8 +124,8 @@
 
 #pragma pack(2)
 struct s8 {
-  unsigned long   :0;
-  long long   a;
+  unsigned long : 0;
+  long long a;
 } S8;
 #pragma pack()
 // CHECK:  0 | struct s8
@@ -134,8 +134,8 @@
 // CHECK-NEXT:   | [sizeof=8, align=2]
 
 struct s9 {
-  unsigned int   :0;
-  unsigned short :0;
+  unsigned int : 0;
+  unsigned short : 0;
 } S9;
 // CHECK:  0 | struct s9
 // CHECK-NEXT:   0:- |   unsigned int
@@ -143,7 +143,7 @@
 // CHECK-NEXT:   | [sizeof=0, align=1]
 
 struct s10 {
- unsigned int __attribute__((aligned)) a;
+  unsigned int __attribute__((aligned)) a;
 } S10;
 // CHECK:  0 | struct s10
 // CHECK-NEXT: 0 |   unsigned int a
@@ -151,7 +151,7 @@
 
 struct s11 {
   char a;
-  long :0;
+  long : 0;
   char b;
 } S11;
 // CHECK:  0 | struct s11
@@ -161,9 +161,9 @@
 // CHECK-NEXT:   | [sizeof=16, align=8]
 
 union u0 {
-  unsigned short d1 __attribute__((packed));
-  intd2:10;
-  long   d3;
+  unsigned short d1 __attribute__((packed));
+  int d2 : 10;
+  long d3;
 } U0 __attribute__((aligned(8)));
 // CHECK:  0 | union u0
 // CHECK-NEXT: 0 |   unsigned short d1
@@ -172,8 +172,8 @@
 // CHECK-NEXT:   | [sizeof=8, align=8]
 
 union u1 {
-  unsigned int:0;
-  short   a;
+  unsigned int : 0;
+  short a;
 } U1;
 // CHECK:  0 | union u1
 // CHECK-NEXT:   0:- |   unsigned int
@@ -181,8 +181,8 @@
 // CHECK-NEXT:   | [sizeof=4, align=4]
 
 union u2 {
-  long  :0;
-  short  a;
+  long : 0;
+  short a;
 } U2;
 // CHECK:  0 | union u2
 // CHECK-NEXT:   0:- |   long
@@ -190,8 +190,8 @@
 // CHECK-NEXT:   | [sizeof=8, align=8]
 
 union u3 {
-  unsigned char :0;
-  unsigned short :0;
+  unsigned char : 0;
+  unsigned short : 0;
 

[PATCH] D108819: [MCParser][z/OS] Mark test as unsupported for the z/OS Target

2021-08-27 Thread Fanbo Meng via Phabricator via cfe-commits
fanbo-meng created this revision.
fanbo-meng requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Marking test as unsupported for the same reason as 
https://reviews.llvm.org/D105204


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D108819

Files:
  clang/test/Driver/as-version.s


Index: clang/test/Driver/as-version.s
===
--- clang/test/Driver/as-version.s
+++ clang/test/Driver/as-version.s
@@ -1,5 +1,6 @@
 // Test version information.
 
+// UNSUPPORTED: -zos
 // RUN: %clang -Wa,--version -c -fintegrated-as %s -o /dev/null \
 // RUN:   | FileCheck --check-prefix=IAS %s
 // IAS: clang version


Index: clang/test/Driver/as-version.s
===
--- clang/test/Driver/as-version.s
+++ clang/test/Driver/as-version.s
@@ -1,5 +1,6 @@
 // Test version information.
 
+// UNSUPPORTED: -zos
 // RUN: %clang -Wa,--version -c -fintegrated-as %s -o /dev/null \
 // RUN:   | FileCheck --check-prefix=IAS %s
 // IAS: clang version
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D108819: [MCParser][z/OS] Mark test as unsupported for the z/OS Target

2021-08-27 Thread Fanbo Meng via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG9d7a77c26d2f: [MCParser][z/OS] Mark test as unsupported for 
the z/OS Target (authored by fanbo-meng).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108819

Files:
  clang/test/Driver/as-version.s


Index: clang/test/Driver/as-version.s
===
--- clang/test/Driver/as-version.s
+++ clang/test/Driver/as-version.s
@@ -1,5 +1,6 @@
 // Test version information.
 
+// UNSUPPORTED: -zos
 // RUN: %clang -Wa,--version -c -fintegrated-as %s -o /dev/null \
 // RUN:   | FileCheck --check-prefix=IAS %s
 // IAS: clang version


Index: clang/test/Driver/as-version.s
===
--- clang/test/Driver/as-version.s
+++ clang/test/Driver/as-version.s
@@ -1,5 +1,6 @@
 // Test version information.
 
+// UNSUPPORTED: -zos
 // RUN: %clang -Wa,--version -c -fintegrated-as %s -o /dev/null \
 // RUN:   | FileCheck --check-prefix=IAS %s
 // IAS: clang version
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D108998: [SystemZ][z/OS] Create html report file with text flag

2021-08-31 Thread Fanbo Meng via Phabricator via cfe-commits
fanbo-meng created this revision.
Herald added a subscriber: martong.
fanbo-meng requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Change OF_None to OF_Text flag in file creation, same reasoning as 
https://reviews.llvm.org/D97785


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D108998

Files:
  clang/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp


Index: clang/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp
===
--- clang/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp
+++ clang/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp
@@ -344,7 +344,7 @@
 
   if (std::error_code EC = llvm::sys::fs::openFileForReadWrite(
   ResultPath, FD, llvm::sys::fs::CD_CreateNew,
-  llvm::sys::fs::OF_None)) {
+  llvm::sys::fs::OF_Text)) {
 // Existence of the file corresponds to the situation where a different
 // Clang instance has emitted a bug report with the same issue hash.
 // This is an entirely normal situation that does not deserve a warning,


Index: clang/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp
===
--- clang/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp
+++ clang/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp
@@ -344,7 +344,7 @@
 
   if (std::error_code EC = llvm::sys::fs::openFileForReadWrite(
   ResultPath, FD, llvm::sys::fs::CD_CreateNew,
-  llvm::sys::fs::OF_None)) {
+  llvm::sys::fs::OF_Text)) {
 // Existence of the file corresponds to the situation where a different
 // Clang instance has emitted a bug report with the same issue hash.
 // This is an entirely normal situation that does not deserve a warning,
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D108998: [SystemZ][z/OS] Create html report file with text flag

2021-08-31 Thread Fanbo Meng via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGae206db2d653: [SystemZ][z/OS] Create html report file with 
text flag (authored by fanbo-meng).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D108998

Files:
  clang/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp


Index: clang/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp
===
--- clang/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp
+++ clang/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp
@@ -344,7 +344,7 @@
 
   if (std::error_code EC = llvm::sys::fs::openFileForReadWrite(
   ResultPath, FD, llvm::sys::fs::CD_CreateNew,
-  llvm::sys::fs::OF_None)) {
+  llvm::sys::fs::OF_Text)) {
 // Existence of the file corresponds to the situation where a different
 // Clang instance has emitted a bug report with the same issue hash.
 // This is an entirely normal situation that does not deserve a warning,


Index: clang/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp
===
--- clang/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp
+++ clang/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp
@@ -344,7 +344,7 @@
 
   if (std::error_code EC = llvm::sys::fs::openFileForReadWrite(
   ResultPath, FD, llvm::sys::fs::CD_CreateNew,
-  llvm::sys::fs::OF_None)) {
+  llvm::sys::fs::OF_Text)) {
 // Existence of the file corresponds to the situation where a different
 // Clang instance has emitted a bug report with the same issue hash.
 // This is an entirely normal situation that does not deserve a warning,
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits