[clang] [Cygwin] Cygwin driver (PR #74933)

2024-04-02 Thread Xu Chiheng via cfe-commits

https://github.com/xu-chiheng closed 
https://github.com/llvm/llvm-project/pull/74933
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [Cygwin] Cygwin general 0 (PR #74936)

2024-04-02 Thread Xu Chiheng via cfe-commits

https://github.com/xu-chiheng closed 
https://github.com/llvm/llvm-project/pull/74936
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [Cygwin] Cygwin macro (PR #74973)

2024-04-02 Thread Xu Chiheng via cfe-commits

https://github.com/xu-chiheng closed 
https://github.com/llvm/llvm-project/pull/74973
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [Cygwin] Cygwin basic support (PR #76943)

2024-04-02 Thread Xu Chiheng via cfe-commits

https://github.com/xu-chiheng closed 
https://github.com/llvm/llvm-project/pull/76943
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [Cygwin] Cygwin basic support (PR #76943)

2024-04-02 Thread Xu Chiheng via cfe-commits

https://github.com/xu-chiheng converted_to_draft 
https://github.com/llvm/llvm-project/pull/76943
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [Cygwin] Cygwin CGCall.h (PR #74977)

2024-01-19 Thread Xu Chiheng via cfe-commits

https://github.com/xu-chiheng closed 
https://github.com/llvm/llvm-project/pull/74977
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [Cygwin] Cygwin basic support (PR #76943)

2024-01-19 Thread Xu Chiheng via cfe-commits

https://github.com/xu-chiheng edited 
https://github.com/llvm/llvm-project/pull/76943
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [Cygwin] Cygwin CGCall.h (PR #74977)

2024-01-19 Thread Xu Chiheng via cfe-commits

https://github.com/xu-chiheng edited 
https://github.com/llvm/llvm-project/pull/74977
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [Cygwin] Cygwin macro (PR #74973)

2024-01-19 Thread Xu Chiheng via cfe-commits

https://github.com/xu-chiheng edited 
https://github.com/llvm/llvm-project/pull/74973
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [Cygwin] Cygwin general 0 (PR #74936)

2024-01-19 Thread Xu Chiheng via cfe-commits

https://github.com/xu-chiheng edited 
https://github.com/llvm/llvm-project/pull/74936
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [Cygwin] Cygwin driver (PR #74933)

2024-01-19 Thread Xu Chiheng via cfe-commits

https://github.com/xu-chiheng edited 
https://github.com/llvm/llvm-project/pull/74933
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [Cygwin] Cygwin general 0 (PR #74936)

2024-01-04 Thread Xu Chiheng via cfe-commits

https://github.com/xu-chiheng edited 
https://github.com/llvm/llvm-project/pull/74936
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [Cygwin] Cygwin general 1 (PR #74936)

2024-01-04 Thread Xu Chiheng via cfe-commits

https://github.com/xu-chiheng edited 
https://github.com/llvm/llvm-project/pull/74936
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [Cygwin] Cygwin basic support (PR #76943)

2024-01-04 Thread Xu Chiheng via cfe-commits

xu-chiheng wrote:

> implemented

TLS is emulated on Cygwin.  This patch works from Clang/LLVM 8 or earlier.

https://github.com/llvm/llvm-project/pull/76943
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [Cygwin] Cygwin driver (PR #74933)

2024-01-04 Thread Xu Chiheng via cfe-commits

https://github.com/xu-chiheng edited 
https://github.com/llvm/llvm-project/pull/74933
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [Cygwin] Cygwin general (PR #74936)

2024-01-04 Thread Xu Chiheng via cfe-commits

https://github.com/xu-chiheng edited 
https://github.com/llvm/llvm-project/pull/74936
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [Cygwin] Cygwin macro (PR #74973)

2024-01-04 Thread Xu Chiheng via cfe-commits

https://github.com/xu-chiheng edited 
https://github.com/llvm/llvm-project/pull/74973
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [Cygwin] Cygwin CGCall.h (PR #74977)

2024-01-04 Thread Xu Chiheng via cfe-commits

https://github.com/xu-chiheng edited 
https://github.com/llvm/llvm-project/pull/74977
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [Cygwin] Cygwin basic support (PR #76943)

2024-01-04 Thread Xu Chiheng via cfe-commits

https://github.com/xu-chiheng edited 
https://github.com/llvm/llvm-project/pull/76943
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [Cygwin] Cygwin basic support (PR #76943)

2024-01-04 Thread Xu Chiheng via cfe-commits

https://github.com/xu-chiheng created 
https://github.com/llvm/llvm-project/pull/76943

Enable TLS, and set VaListKind to CharPtrBuiltinVaList.
This fix bootstrap failure on Cygwin.

From 35cb22083fc0f842e873c99518a58d673bbcb1ec Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?=
 
Date: Sat, 9 Dec 2023 00:59:00 +0800
Subject: [PATCH 1/3] [Cygwin] Cygwin basic support

---
 clang/lib/Basic/Targets/X86.h | 5 -
 clang/lib/Driver/ToolChains/Clang.cpp | 4 +++-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/clang/lib/Basic/Targets/X86.h b/clang/lib/Basic/Targets/X86.h
index 0ab1c10833db26..e77e1e690cfc0c 100644
--- a/clang/lib/Basic/Targets/X86.h
+++ b/clang/lib/Basic/Targets/X86.h
@@ -905,7 +905,6 @@ class LLVM_LIBRARY_VISIBILITY CygwinX86_64TargetInfo : 
public X86_64TargetInfo {
   CygwinX86_64TargetInfo(const llvm::Triple , const TargetOptions )
   : X86_64TargetInfo(Triple, Opts) {
 this->WCharType = TargetInfo::UnsignedShort;
-TLSSupported = false;
   }
 
   void getTargetDefines(const LangOptions ,
@@ -919,6 +918,10 @@ class LLVM_LIBRARY_VISIBILITY CygwinX86_64TargetInfo : 
public X86_64TargetInfo {
 if (Opts.CPlusPlus)
   Builder.defineMacro("_GNU_SOURCE");
   }
+
+  BuiltinVaListKind getBuiltinVaListKind() const override {
+return TargetInfo::CharPtrBuiltinVaList;
+  }
 };
 
 class LLVM_LIBRARY_VISIBILITY DarwinX86_64TargetInfo
diff --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index acfa119805068d..38b9b84cf37c5b 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -6729,7 +6729,9 @@ void Clang::ConstructJob(Compilation , const JobAction 
,
   // -fuse-cxa-atexit is default.
   if (!Args.hasFlag(
   options::OPT_fuse_cxa_atexit, options::OPT_fno_use_cxa_atexit,
-  !RawTriple.isOSAIX() && !RawTriple.isOSWindows() &&
+  !RawTriple.isOSAIX()
+  && !RawTriple.isWindowsGNUEnvironment()
+  && !RawTriple.isWindowsMSVCEnvironment() &&
   ((RawTriple.getVendor() != llvm::Triple::MipsTechnologies) ||
RawTriple.hasEnvironment())) ||
   KernelOrKext)

From 99199c9364be0d8cd83a65ea5425715a82e2a40f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?=
 
Date: Sat, 9 Dec 2023 01:08:20 +0800
Subject: [PATCH 2/3] 1

---
 clang/lib/Driver/ToolChains/Clang.cpp | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index 38b9b84cf37c5b..58b042266c6091 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -6729,9 +6729,8 @@ void Clang::ConstructJob(Compilation , const JobAction 
,
   // -fuse-cxa-atexit is default.
   if (!Args.hasFlag(
   options::OPT_fuse_cxa_atexit, options::OPT_fno_use_cxa_atexit,
-  !RawTriple.isOSAIX()
-  && !RawTriple.isWindowsGNUEnvironment()
-  && !RawTriple.isWindowsMSVCEnvironment() &&
+  !RawTriple.isOSAIX() && !RawTriple.isWindowsGNUEnvironment() &&
+  !RawTriple.isWindowsMSVCEnvironment() &&
   ((RawTriple.getVendor() != llvm::Triple::MipsTechnologies) ||
RawTriple.hasEnvironment())) ||
   KernelOrKext)

From 856ecf178a2487f7449bd291f6ce78b13f07fd24 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?=
 
Date: Sat, 9 Dec 2023 12:37:05 +0800
Subject: [PATCH 3/3] 1

---
 clang/lib/Driver/ToolChains/Clang.cpp | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index 58b042266c6091..acfa119805068d 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -6729,8 +6729,7 @@ void Clang::ConstructJob(Compilation , const JobAction 
,
   // -fuse-cxa-atexit is default.
   if (!Args.hasFlag(
   options::OPT_fuse_cxa_atexit, options::OPT_fno_use_cxa_atexit,
-  !RawTriple.isOSAIX() && !RawTriple.isWindowsGNUEnvironment() &&
-  !RawTriple.isWindowsMSVCEnvironment() &&
+  !RawTriple.isOSAIX() && !RawTriple.isOSWindows() &&
   ((RawTriple.getVendor() != llvm::Triple::MipsTechnologies) ||
RawTriple.hasEnvironment())) ||
   KernelOrKext)

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


[clang] [Cygwin] Cygwin basic support (PR #74868)

2024-01-04 Thread Xu Chiheng via cfe-commits

https://github.com/xu-chiheng edited 
https://github.com/llvm/llvm-project/pull/74868
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [Cygwin] Cygwin CGCall.h (PR #74977)

2023-12-31 Thread Xu Chiheng via cfe-commits

https://github.com/xu-chiheng edited 
https://github.com/llvm/llvm-project/pull/74977
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [Cygwin] Reduced number of inline elements of CallArgList. (PR #74977)

2023-12-31 Thread Xu Chiheng via cfe-commits

https://github.com/xu-chiheng edited 
https://github.com/llvm/llvm-project/pull/74977
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [Cygwin] Reduced number of inline elements of CallArgList. (PR #74977)

2023-12-31 Thread Xu Chiheng via cfe-commits

https://github.com/xu-chiheng updated 
https://github.com/llvm/llvm-project/pull/74977

From 36031b0f4940d31edf026882ec47cd4bee90e324 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?=
 
Date: Sun, 10 Dec 2023 14:52:29 +0800
Subject: [PATCH] 1

---
 clang/lib/CodeGen/CGCall.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang/lib/CodeGen/CGCall.h b/clang/lib/CodeGen/CGCall.h
index 1c0d15dc932ad8..e96a7edd2a511c 100644
--- a/clang/lib/CodeGen/CGCall.h
+++ b/clang/lib/CodeGen/CGCall.h
@@ -255,7 +255,7 @@ struct CallArg {
 
 /// CallArgList - Type for representing both the value and type of
 /// arguments in a call.
-class CallArgList : public SmallVector {
+class CallArgList : public SmallVector {
 public:
   CallArgList() = default;
 

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


[clang-tools-extra] [pseudo] lib Grammar.cpp (PR #74984)

2023-12-31 Thread Xu Chiheng via cfe-commits

https://github.com/xu-chiheng updated 
https://github.com/llvm/llvm-project/pull/74984

From bba8cd890cb7edcff3852ac6bf225e358d2aaac2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?=
 
Date: Sun, 10 Dec 2023 15:31:36 +0800
Subject: [PATCH] 1

---
 clang-tools-extra/pseudo/lib/grammar/Grammar.cpp | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/clang-tools-extra/pseudo/lib/grammar/Grammar.cpp 
b/clang-tools-extra/pseudo/lib/grammar/Grammar.cpp
index 3e9c5c3c7a6c42..ec6e8915a2c7d7 100644
--- a/clang-tools-extra/pseudo/lib/grammar/Grammar.cpp
+++ b/clang-tools-extra/pseudo/lib/grammar/Grammar.cpp
@@ -172,9 +172,10 @@ std::vector> followSets(const 
Grammar ) {
   return FollowSets;
 }
 
+static auto TerminalNames = new std::string[NumTerminals];
+
 static llvm::ArrayRef getTerminalNames() {
-  static const auto  = []() {
-auto TerminalNames = new std::string[NumTerminals];
+  static const auto  = []() {
 #define PUNCTUATOR(Tok, Spelling) TerminalNames[tok::Tok] = Spelling;
 #define KEYWORD(Keyword, Condition)
\
   TerminalNames[tok::kw_##Keyword] = llvm::StringRef(#Keyword).upper();
@@ -182,7 +183,7 @@ static llvm::ArrayRef getTerminalNames() {
 #include "clang/Basic/TokenKinds.def"
 return llvm::ArrayRef(TerminalNames, NumTerminals);
   }();
-  return TerminalNames;
+  return TerminalNames1;
 }
 GrammarTable::GrammarTable() : Terminals(getTerminalNames()) {}
 

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


[clang-tools-extra] [pseudo] gen Main.cpp (PR #74983)

2023-12-31 Thread Xu Chiheng via cfe-commits

https://github.com/xu-chiheng updated 
https://github.com/llvm/llvm-project/pull/74983

From 164ce88e00c341b2507618f67a8971d55f9aee9b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?=
 
Date: Sun, 10 Dec 2023 15:27:25 +0800
Subject: [PATCH 1/2] 1

---
 clang-tools-extra/pseudo/gen/Main.cpp | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/clang-tools-extra/pseudo/gen/Main.cpp 
b/clang-tools-extra/pseudo/gen/Main.cpp
index 25cb26563837a6..c9367ca16ed85e 100644
--- a/clang-tools-extra/pseudo/gen/Main.cpp
+++ b/clang-tools-extra/pseudo/gen/Main.cpp
@@ -70,13 +70,13 @@ namespace {
 //   keyword: `INT` becomes `INT`;
 //   terminal: `IDENTIFIER` becomes `IDENTIFIER`;
 std::string mangleSymbol(SymbolID SID, const Grammar ) {
-  static auto  = *new std::vector{
-#define TOK(X) llvm::StringRef(#X).upper(),
-#define KEYWORD(Keyword, Condition) llvm::StringRef(#Keyword).upper(),
+  static char const * TokNames[] = {
+#define TOK(X) #X ,
+#define KEYWORD(Keyword, Condition) #Keyword ,
 #include "clang/Basic/TokenKinds.def"
   };
   if (isToken(SID))
-return TokNames[symbolToToken(SID)];
+return llvm::StringRef(TokNames[symbolToToken(SID)]).upper();
   std::string Name = G.symbolName(SID).str();
   // translation-unit -> translation_unit
   std::replace(Name.begin(), Name.end(), '-', '_');

From 94362c452d9743c6ee78f084e9e90baafeb45beb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?=
 
Date: Sun, 10 Dec 2023 15:38:56 +0800
Subject: [PATCH 2/2] 1

---
 clang-tools-extra/pseudo/gen/Main.cpp | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/clang-tools-extra/pseudo/gen/Main.cpp 
b/clang-tools-extra/pseudo/gen/Main.cpp
index c9367ca16ed85e..2c0bf662ef405d 100644
--- a/clang-tools-extra/pseudo/gen/Main.cpp
+++ b/clang-tools-extra/pseudo/gen/Main.cpp
@@ -70,11 +70,11 @@ namespace {
 //   keyword: `INT` becomes `INT`;
 //   terminal: `IDENTIFIER` becomes `IDENTIFIER`;
 std::string mangleSymbol(SymbolID SID, const Grammar ) {
-  static char const * TokNames[] = {
-#define TOK(X) #X ,
-#define KEYWORD(Keyword, Condition) #Keyword ,
+  static char const *TokNames[] = {
+#define TOK(X) #X,
+#define KEYWORD(Keyword, Condition) #Keyword,
 #include "clang/Basic/TokenKinds.def"
-  };
+  };
   if (isToken(SID))
 return llvm::StringRef(TokNames[symbolToToken(SID)]).upper();
   std::string Name = G.symbolName(SID).str();

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


[clang] [MinGW] MinGW pthread (PR #74981)

2023-12-31 Thread Xu Chiheng via cfe-commits

https://github.com/xu-chiheng updated 
https://github.com/llvm/llvm-project/pull/74981

From 0a90989e77603a49b17eaf44cbbffa9c003afb54 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?=
 
Date: Sun, 10 Dec 2023 15:12:11 +0800
Subject: [PATCH] 1

---
 clang/lib/Driver/ToolChains/MinGW.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang/lib/Driver/ToolChains/MinGW.cpp 
b/clang/lib/Driver/ToolChains/MinGW.cpp
index 65512f16357d04..3a0bc2abf03935 100644
--- a/clang/lib/Driver/ToolChains/MinGW.cpp
+++ b/clang/lib/Driver/ToolChains/MinGW.cpp
@@ -307,7 +307,7 @@ void tools::MinGW::Linker::ConstructJob(Compilation , 
const JobAction ,
   if (Args.hasArg(options::OPT_pg))
 CmdArgs.push_back("-lgmon");
 
-  if (Args.hasArg(options::OPT_pthread))
+  if (!Args.hasArg(options::OPT_no_pthread))
 CmdArgs.push_back("-lpthread");
 
   if (Sanitize.needsAsanRt()) {

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


[clang] [MinGW] MinGW Value.h (PR #74982)

2023-12-31 Thread Xu Chiheng via cfe-commits

https://github.com/xu-chiheng updated 
https://github.com/llvm/llvm-project/pull/74982

From 79391542d94910efe25f09374ef241456609dbde Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?=
 
Date: Sun, 10 Dec 2023 15:16:38 +0800
Subject: [PATCH] 1

---
 clang/include/clang/Interpreter/Value.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/clang/include/clang/Interpreter/Value.h 
b/clang/include/clang/Interpreter/Value.h
index c380cd91550def..46e827f3ec283d 100644
--- a/clang/include/clang/Interpreter/Value.h
+++ b/clang/include/clang/Interpreter/Value.h
@@ -52,7 +52,8 @@ class ASTContext;
 class Interpreter;
 class QualType;
 
-#if defined(_WIN32)
+#if defined(LLVM_BUILD_LLVM_DYLIB) || defined(LLVM_BUILD_SHARED_LIBS)
+#if defined(_WIN32) && !(defined(__CYGWIN__) || defined(__MINGW32__))
 // REPL_EXTERNAL_VISIBILITY are symbols that we need to be able to locate
 // at runtime. On Windows, this requires them to be exported from any of the
 // modules loaded at runtime. Marking them as dllexport achieves this; both
@@ -63,7 +64,6 @@ class QualType;
 // statically linked into an EXE, it makes sure that they're exported.
 #define REPL_EXTERNAL_VISIBILITY __declspec(dllexport)
 #elif __has_attribute(visibility)
-#if defined(LLVM_BUILD_LLVM_DYLIB) || defined(LLVM_BUILD_SHARED_LIBS)
 #define REPL_EXTERNAL_VISIBILITY __attribute__((visibility("default")))
 #else
 #define REPL_EXTERNAL_VISIBILITY

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


[clang] [Cygwin] Cygwin macro (PR #74973)

2023-12-31 Thread Xu Chiheng via cfe-commits

https://github.com/xu-chiheng updated 
https://github.com/llvm/llvm-project/pull/74973

From 29f213f8921c38ca8192aa32087e99771a0cfbfb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?=
 
Date: Sun, 10 Dec 2023 14:04:36 +0800
Subject: [PATCH 1/2] 1

---
 clang/lib/Basic/Targets/ARM.cpp | 2 --
 clang/lib/Basic/Targets/X86.cpp | 9 +++--
 clang/lib/Basic/Targets/X86.h   | 4 
 3 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/clang/lib/Basic/Targets/ARM.cpp b/clang/lib/Basic/Targets/ARM.cpp
index 01f9e844da12a0..800f61c0c67864 100644
--- a/clang/lib/Basic/Targets/ARM.cpp
+++ b/clang/lib/Basic/Targets/ARM.cpp
@@ -1402,8 +1402,6 @@ void CygwinARMTargetInfo::getTargetDefines(const 
LangOptions ,
   Builder.defineMacro("__CYGWIN__");
   Builder.defineMacro("__CYGWIN32__");
   DefineStd(Builder, "unix", Opts);
-  if (Opts.CPlusPlus)
-Builder.defineMacro("_GNU_SOURCE");
 }
 
 DarwinARMTargetInfo::DarwinARMTargetInfo(const llvm::Triple ,
diff --git a/clang/lib/Basic/Targets/X86.cpp b/clang/lib/Basic/Targets/X86.cpp
index 3deaa19f8d4fc4..2e281439ae13a7 100644
--- a/clang/lib/Basic/Targets/X86.cpp
+++ b/clang/lib/Basic/Targets/X86.cpp
@@ -508,8 +508,13 @@ void X86TargetInfo::getTargetDefines(const LangOptions 
,
   Builder.defineMacro("__GCC_ASM_FLAG_OUTPUTS__");
 
   std::string CodeModel = getTargetOpts().CodeModel;
-  if (CodeModel == "default")
-CodeModel = "small";
+  if (CodeModel == "default") {
+if (getTriple().isWindowsCygwinEnvironment() && getTriple().getArch() == 
llvm::Triple::x86_64) {
+  CodeModel = "medium";
+} else {
+  CodeModel = "small";
+}
+  }
   Builder.defineMacro("__code_model_" + CodeModel + "__");
 
   // Target identification.
diff --git a/clang/lib/Basic/Targets/X86.h b/clang/lib/Basic/Targets/X86.h
index 0ab1c10833db26..1664fcc417b148 100644
--- a/clang/lib/Basic/Targets/X86.h
+++ b/clang/lib/Basic/Targets/X86.h
@@ -643,8 +643,6 @@ class LLVM_LIBRARY_VISIBILITY CygwinX86_32TargetInfo : 
public X86_32TargetInfo {
 Builder.defineMacro("__CYGWIN32__");
 addCygMingDefines(Opts, Builder);
 DefineStd(Builder, "unix", Opts);
-if (Opts.CPlusPlus)
-  Builder.defineMacro("_GNU_SOURCE");
   }
 };
 
@@ -916,8 +914,6 @@ class LLVM_LIBRARY_VISIBILITY CygwinX86_64TargetInfo : 
public X86_64TargetInfo {
 Builder.defineMacro("__CYGWIN64__");
 addCygMingDefines(Opts, Builder);
 DefineStd(Builder, "unix", Opts);
-if (Opts.CPlusPlus)
-  Builder.defineMacro("_GNU_SOURCE");
   }
 };
 

From fa807942d6be7b0f486ed7f64c0113a288fa8264 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?=
 
Date: Sun, 10 Dec 2023 14:13:02 +0800
Subject: [PATCH 2/2] 1

---
 clang/lib/Basic/Targets/X86.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/clang/lib/Basic/Targets/X86.cpp b/clang/lib/Basic/Targets/X86.cpp
index 2e281439ae13a7..e6b2d1160de9ad 100644
--- a/clang/lib/Basic/Targets/X86.cpp
+++ b/clang/lib/Basic/Targets/X86.cpp
@@ -509,7 +509,8 @@ void X86TargetInfo::getTargetDefines(const LangOptions 
,
 
   std::string CodeModel = getTargetOpts().CodeModel;
   if (CodeModel == "default") {
-if (getTriple().isWindowsCygwinEnvironment() && getTriple().getArch() == 
llvm::Triple::x86_64) {
+if (getTriple().isWindowsCygwinEnvironment() &&
+getTriple().getArch() == llvm::Triple::x86_64) {
   CodeModel = "medium";
 } else {
   CodeModel = "small";

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


[clang] [Cygwin] Cygwin general (PR #74936)

2023-12-31 Thread Xu Chiheng via cfe-commits

https://github.com/xu-chiheng updated 
https://github.com/llvm/llvm-project/pull/74936

From c9cffe8c188d32a9edd1b6316db065bbcc479c97 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?=
 
Date: Sun, 10 Dec 2023 00:34:27 +0800
Subject: [PATCH] 1

---
 clang/lib/Headers/mm_malloc.h |  6 +++---
 clang/tools/libclang/CIndexer.cpp | 10 ++
 2 files changed, 5 insertions(+), 11 deletions(-)

diff --git a/clang/lib/Headers/mm_malloc.h b/clang/lib/Headers/mm_malloc.h
index d32fe594162774..6f46f10ee50f31 100644
--- a/clang/lib/Headers/mm_malloc.h
+++ b/clang/lib/Headers/mm_malloc.h
@@ -12,7 +12,7 @@
 
 #include 
 
-#ifdef _WIN32
+#if defined(_WIN32) && !defined(__CYGWIN__)
 #include 
 #else
 #ifndef __cplusplus
@@ -41,7 +41,7 @@ _mm_malloc(size_t __size, size_t __align) {
   void *__mallocedMemory;
 #if defined(__MINGW32__)
   __mallocedMemory = __mingw_aligned_malloc(__size, __align);
-#elif defined(_WIN32)
+#elif defined(_WIN32) && !defined(__CYGWIN__)
   __mallocedMemory = _aligned_malloc(__size, __align);
 #else
   if (posix_memalign(&__mallocedMemory, __align, __size))
@@ -56,7 +56,7 @@ _mm_free(void *__p)
 {
 #if defined(__MINGW32__)
   __mingw_aligned_free(__p);
-#elif defined(_WIN32)
+#elif defined(_WIN32) && !defined(__CYGWIN__)
   _aligned_free(__p);
 #else
   free(__p);
diff --git a/clang/tools/libclang/CIndexer.cpp 
b/clang/tools/libclang/CIndexer.cpp
index 12d9d418dea51d..e7c1bed8b740fd 100644
--- a/clang/tools/libclang/CIndexer.cpp
+++ b/clang/tools/libclang/CIndexer.cpp
@@ -27,12 +27,10 @@
 #include 
 
 #ifdef __CYGWIN__
-#include 
 #include 
-#define _WIN32 1
 #endif
 
-#ifdef _WIN32
+#if defined(_WIN32) || defined(__CYGWIN__)
 #include 
 #elif defined(_AIX)
 #include 
@@ -105,7 +103,7 @@ const std::string ::getClangResourcesPath() {
   SmallString<128> LibClangPath;
 
   // Find the location where this library lives (libclang.dylib).
-#ifdef _WIN32
+#if defined(_WIN32) || defined(__CYGWIN__)
   MEMORY_BASIC_INFORMATION mbi;
   char path[MAX_PATH];
   VirtualQuery((void *)(uintptr_t)clang_createTranslationUnit, ,
@@ -115,11 +113,7 @@ const std::string ::getClangResourcesPath() {
 #ifdef __CYGWIN__
   char w32path[MAX_PATH];
   strcpy(w32path, path);
-#if CYGWIN_VERSION_API_MAJOR > 0 || CYGWIN_VERSION_API_MINOR >= 181
   cygwin_conv_path(CCP_WIN_A_TO_POSIX, w32path, path, MAX_PATH);
-#else
-  cygwin_conv_to_full_posix_path(w32path, path);
-#endif
 #endif
 
   LibClangPath += path;

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


[clang] [Cygwin] Cygwin basic support (PR #74868)

2023-12-31 Thread Xu Chiheng via cfe-commits

https://github.com/xu-chiheng updated 
https://github.com/llvm/llvm-project/pull/74868

From 35cb22083fc0f842e873c99518a58d673bbcb1ec Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?=
 
Date: Sat, 9 Dec 2023 00:59:00 +0800
Subject: [PATCH 1/3] [Cygwin] Cygwin basic support

---
 clang/lib/Basic/Targets/X86.h | 5 -
 clang/lib/Driver/ToolChains/Clang.cpp | 4 +++-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/clang/lib/Basic/Targets/X86.h b/clang/lib/Basic/Targets/X86.h
index 0ab1c10833db26..e77e1e690cfc0c 100644
--- a/clang/lib/Basic/Targets/X86.h
+++ b/clang/lib/Basic/Targets/X86.h
@@ -905,7 +905,6 @@ class LLVM_LIBRARY_VISIBILITY CygwinX86_64TargetInfo : 
public X86_64TargetInfo {
   CygwinX86_64TargetInfo(const llvm::Triple , const TargetOptions )
   : X86_64TargetInfo(Triple, Opts) {
 this->WCharType = TargetInfo::UnsignedShort;
-TLSSupported = false;
   }
 
   void getTargetDefines(const LangOptions ,
@@ -919,6 +918,10 @@ class LLVM_LIBRARY_VISIBILITY CygwinX86_64TargetInfo : 
public X86_64TargetInfo {
 if (Opts.CPlusPlus)
   Builder.defineMacro("_GNU_SOURCE");
   }
+
+  BuiltinVaListKind getBuiltinVaListKind() const override {
+return TargetInfo::CharPtrBuiltinVaList;
+  }
 };
 
 class LLVM_LIBRARY_VISIBILITY DarwinX86_64TargetInfo
diff --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index acfa119805068d..38b9b84cf37c5b 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -6729,7 +6729,9 @@ void Clang::ConstructJob(Compilation , const JobAction 
,
   // -fuse-cxa-atexit is default.
   if (!Args.hasFlag(
   options::OPT_fuse_cxa_atexit, options::OPT_fno_use_cxa_atexit,
-  !RawTriple.isOSAIX() && !RawTriple.isOSWindows() &&
+  !RawTriple.isOSAIX()
+  && !RawTriple.isWindowsGNUEnvironment()
+  && !RawTriple.isWindowsMSVCEnvironment() &&
   ((RawTriple.getVendor() != llvm::Triple::MipsTechnologies) ||
RawTriple.hasEnvironment())) ||
   KernelOrKext)

From 99199c9364be0d8cd83a65ea5425715a82e2a40f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?=
 
Date: Sat, 9 Dec 2023 01:08:20 +0800
Subject: [PATCH 2/3] 1

---
 clang/lib/Driver/ToolChains/Clang.cpp | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index 38b9b84cf37c5b..58b042266c6091 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -6729,9 +6729,8 @@ void Clang::ConstructJob(Compilation , const JobAction 
,
   // -fuse-cxa-atexit is default.
   if (!Args.hasFlag(
   options::OPT_fuse_cxa_atexit, options::OPT_fno_use_cxa_atexit,
-  !RawTriple.isOSAIX()
-  && !RawTriple.isWindowsGNUEnvironment()
-  && !RawTriple.isWindowsMSVCEnvironment() &&
+  !RawTriple.isOSAIX() && !RawTriple.isWindowsGNUEnvironment() &&
+  !RawTriple.isWindowsMSVCEnvironment() &&
   ((RawTriple.getVendor() != llvm::Triple::MipsTechnologies) ||
RawTriple.hasEnvironment())) ||
   KernelOrKext)

From 856ecf178a2487f7449bd291f6ce78b13f07fd24 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?=
 
Date: Sat, 9 Dec 2023 12:37:05 +0800
Subject: [PATCH 3/3] 1

---
 clang/lib/Driver/ToolChains/Clang.cpp | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index 58b042266c6091..acfa119805068d 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -6729,8 +6729,7 @@ void Clang::ConstructJob(Compilation , const JobAction 
,
   // -fuse-cxa-atexit is default.
   if (!Args.hasFlag(
   options::OPT_fuse_cxa_atexit, options::OPT_fno_use_cxa_atexit,
-  !RawTriple.isOSAIX() && !RawTriple.isWindowsGNUEnvironment() &&
-  !RawTriple.isWindowsMSVCEnvironment() &&
+  !RawTriple.isOSAIX() && !RawTriple.isOSWindows() &&
   ((RawTriple.getVendor() != llvm::Triple::MipsTechnologies) ||
RawTriple.hasEnvironment())) ||
   KernelOrKext)

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


[clang] [Cygwin] Cygwin driver (PR #74933)

2023-12-31 Thread Xu Chiheng via cfe-commits

https://github.com/xu-chiheng updated 
https://github.com/llvm/llvm-project/pull/74933

From 40ec69c72a4951953ce96c1ab30ec17a07f430cd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?=
 
Date: Sat, 9 Dec 2023 21:51:29 +0800
Subject: [PATCH 1/7] 1

---
 clang/lib/Driver/CMakeLists.txt|   1 +
 clang/lib/Driver/Driver.cpp|   4 +
 clang/lib/Driver/ToolChains/Cygwin.cpp | 731 +
 clang/lib/Driver/ToolChains/Cygwin.h   | 125 +
 clang/lib/Lex/InitHeaderSearch.cpp |  30 +-
 5 files changed, 865 insertions(+), 26 deletions(-)
 create mode 100644 clang/lib/Driver/ToolChains/Cygwin.cpp
 create mode 100644 clang/lib/Driver/ToolChains/Cygwin.h

diff --git a/clang/lib/Driver/CMakeLists.txt b/clang/lib/Driver/CMakeLists.txt
index 58427e3f83c420..7ab5a1ee963515 100644
--- a/clang/lib/Driver/CMakeLists.txt
+++ b/clang/lib/Driver/CMakeLists.txt
@@ -51,6 +51,7 @@ add_clang_library(clangDriver
   ToolChains/CrossWindows.cpp
   ToolChains/CSKYToolChain.cpp
   ToolChains/Cuda.cpp
+  ToolChains/Cygwin.cpp
   ToolChains/Darwin.cpp
   ToolChains/DragonFly.cpp
   ToolChains/Flang.cpp
diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
index 9b2f2a37480983..4d08c9a14c9bcf 100644
--- a/clang/lib/Driver/Driver.cpp
+++ b/clang/lib/Driver/Driver.cpp
@@ -17,6 +17,7 @@
 #include "ToolChains/Clang.h"
 #include "ToolChains/CrossWindows.h"
 #include "ToolChains/Cuda.h"
+#include "ToolChains/Cygwin.h"
 #include "ToolChains/Darwin.h"
 #include "ToolChains/DragonFly.h"
 #include "ToolChains/FreeBSD.h"
@@ -6269,6 +6270,9 @@ const ToolChain ::getToolChain(const ArgList ,
 else
   TC = std::make_unique(*this, Target, Args);
 break;
+  case llvm::Triple::Cygnus:
+TC = std::make_unique(*this, Target, Args);
+break;
   case llvm::Triple::GNU:
 TC = std::make_unique(*this, Target, Args);
 break;
diff --git a/clang/lib/Driver/ToolChains/Cygwin.cpp 
b/clang/lib/Driver/ToolChains/Cygwin.cpp
new file mode 100644
index 00..8aa9cf5c8ec034
--- /dev/null
+++ b/clang/lib/Driver/ToolChains/Cygwin.cpp
@@ -0,0 +1,731 @@
+//===--- Cygwin.cpp - CygwinToolChain Implementation 
===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#include "Cygwin.h"
+#include "CommonArgs.h"
+#include "clang/Config/config.h"
+#include "clang/Driver/Compilation.h"
+#include "clang/Driver/Driver.h"
+#include "clang/Driver/DriverDiagnostic.h"
+#include "clang/Driver/InputInfo.h"
+#include "clang/Driver/Options.h"
+#include "clang/Driver/SanitizerArgs.h"
+#include "llvm/Option/ArgList.h"
+#include "llvm/Support/FileSystem.h"
+#include "llvm/Support/Path.h"
+#include "llvm/Support/VirtualFileSystem.h"
+#include 
+
+using namespace clang::diag;
+using namespace clang::driver;
+using namespace clang;
+using namespace llvm::opt;
+
+/// Cygwin Tools
+void tools::Cygwin::Assembler::ConstructJob(Compilation , const JobAction 
,
+   const InputInfo ,
+   const InputInfoList ,
+   const ArgList ,
+   const char *LinkingOutput) const {
+  claimNoWarnArgs(Args);
+  ArgStringList CmdArgs;
+
+  if (getToolChain().getArch() == llvm::Triple::x86) {
+CmdArgs.push_back("--32");
+  } else if (getToolChain().getArch() == llvm::Triple::x86_64) {
+CmdArgs.push_back("--64");
+  }
+
+  Args.AddAllArgValues(CmdArgs, options::OPT_Wa_COMMA, 
options::OPT_Xassembler);
+
+  CmdArgs.push_back("-o");
+  CmdArgs.push_back(Output.getFilename());
+
+  for (const auto  : Inputs)
+CmdArgs.push_back(II.getFilename());
+
+  const char *Exec = Args.MakeArgString(getToolChain().GetProgramPath("as"));
+  C.addCommand(std::make_unique(JA, *this, 
ResponseFileSupport::None(),
+ Exec, CmdArgs, Inputs, Output));
+
+  if (Args.hasArg(options::OPT_gsplit_dwarf))
+SplitDebugInfo(getToolChain(), C, *this, JA, Args, Output,
+   SplitDebugName(JA, Args, Inputs[0], Output));
+}
+
+void tools::Cygwin::Linker::AddLibGCC(const ArgList ,
+ ArgStringList ) const {
+  // Make use of compiler-rt if --rtlib option is used
+  ToolChain::RuntimeLibType RLT = getToolChain().GetRuntimeLibType(Args);
+  if (RLT == ToolChain::RLT_Libgcc) {
+bool Static = Args.hasArg(options::OPT_static_libgcc) ||
+  Args.hasArg(options::OPT_static);
+bool Shared = Args.hasArg(options::OPT_shared);
+bool CXX = getToolChain().getDriver().CCCIsCXX();
+
+if (Static || (!CXX && !Shared)) {
+  CmdArgs.push_back("-lgcc");
+  

[clang] [Cygwin] Cygwin Value.h (PR #75395)

2023-12-23 Thread Xu Chiheng via cfe-commits

https://github.com/xu-chiheng edited 
https://github.com/llvm/llvm-project/pull/75395
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [Cygwin] Cygwin Value.h (PR #75395)

2023-12-23 Thread Xu Chiheng via cfe-commits

https://github.com/xu-chiheng edited 
https://github.com/llvm/llvm-project/pull/75395
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [Cygwin] Value.h consider Cygwin (PR #75395)

2023-12-20 Thread Xu Chiheng via cfe-commits

https://github.com/xu-chiheng closed 
https://github.com/llvm/llvm-project/pull/75395
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] [pseudo] lib Grammar.cpp (PR #74984)

2023-12-19 Thread Xu Chiheng via cfe-commits

https://github.com/xu-chiheng edited 
https://github.com/llvm/llvm-project/pull/74984
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [Cygwin] Cygwin general (PR #74936)

2023-12-19 Thread Xu Chiheng via cfe-commits

https://github.com/xu-chiheng edited 
https://github.com/llvm/llvm-project/pull/74936
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [MinGW] MinGW Value.h (PR #74982)

2023-12-18 Thread Xu Chiheng via cfe-commits

https://github.com/xu-chiheng edited 
https://github.com/llvm/llvm-project/pull/74982
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [MinGW] Fix the regression caused by commit 592e935e115ffb451eb9b782376711dab6558fe0, that, in MinGW, Clang can't be built by system Clang 15.0.4. (PR #74982)

2023-12-18 Thread Xu Chiheng via cfe-commits

https://github.com/xu-chiheng edited 
https://github.com/llvm/llvm-project/pull/74982
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [MinGW] Fix the regression caused by commit 592e935e115ffb451eb9b782376711dab6558fe0, that, in MinGW, Clang can't be built by system Clang 15.0.4. (PR #74982)

2023-12-18 Thread Xu Chiheng via cfe-commits

https://github.com/xu-chiheng reopened 
https://github.com/llvm/llvm-project/pull/74982
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [Cygwin] Reduced number of inline elements of CallArgList. (PR #74977)

2023-12-18 Thread Xu Chiheng via cfe-commits

https://github.com/xu-chiheng reopened 
https://github.com/llvm/llvm-project/pull/74977
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [Cygwin] Value.h consider Cygwin (PR #75395)

2023-12-13 Thread Xu Chiheng via cfe-commits

https://github.com/xu-chiheng created 
https://github.com/llvm/llvm-project/pull/75395

None

From c3da4faacc108d7cdbc92f426571eab65482f8ef Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?=
 
Date: Thu, 14 Dec 2023 06:38:09 +0800
Subject: [PATCH] 1

---
 clang/include/clang/Interpreter/Value.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang/include/clang/Interpreter/Value.h 
b/clang/include/clang/Interpreter/Value.h
index c380cd91550def..f0b26dc3c89c40 100644
--- a/clang/include/clang/Interpreter/Value.h
+++ b/clang/include/clang/Interpreter/Value.h
@@ -52,7 +52,7 @@ class ASTContext;
 class Interpreter;
 class QualType;
 
-#if defined(_WIN32)
+#if defined(_WIN32) || defined(__CYGWIN__)
 // REPL_EXTERNAL_VISIBILITY are symbols that we need to be able to locate
 // at runtime. On Windows, this requires them to be exported from any of the
 // modules loaded at runtime. Marking them as dllexport achieves this; both

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


[clang] [MinGW] Fix the regression caused by commit 592e935e115ffb451eb9b782376711dab6558fe0, that, in MinGW, Clang can't be built by system Clang 15.0.4. (PR #74982)

2023-12-13 Thread Xu Chiheng via cfe-commits

https://github.com/xu-chiheng closed 
https://github.com/llvm/llvm-project/pull/74982
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [MinGW] Fix the regression caused by commit 592e935e115ffb451eb9b782376711dab6558fe0, that, in MinGW, Clang can't be built by system Clang 15.0.4. (PR #74982)

2023-12-13 Thread Xu Chiheng via cfe-commits

xu-chiheng wrote:

As commit 49b27b150b97c190dedf8b45bf991c4b811ed953 2023-12-09, this patch is 
not needed.


https://github.com/llvm/llvm-project/pull/74982
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [Cygwin] Reduced number of inline elements of CallArgList. (PR #74977)

2023-12-13 Thread Xu Chiheng via cfe-commits

https://github.com/xu-chiheng closed 
https://github.com/llvm/llvm-project/pull/74977
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [MinGW] MinGW dynamicbase (PR #74979)

2023-12-13 Thread Xu Chiheng via cfe-commits

https://github.com/xu-chiheng closed 
https://github.com/llvm/llvm-project/pull/74979
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [Cygwin] Reduced number of inline elements of CallArgList. (PR #74977)

2023-12-13 Thread Xu Chiheng via cfe-commits

xu-chiheng wrote:

As commit 49b27b150b97c190dedf8b45bf991c4b811ed953 2023-12-09, this patch is 
not needed.


https://github.com/llvm/llvm-project/pull/74977
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [Cygwin] Reduced number of inline elements of CallArgList. (PR #74977)

2023-12-13 Thread Xu Chiheng via cfe-commits

xu-chiheng wrote:

> Adding workarounds to LLVM for host compiler bugs is something we do from 
> time to time, but any such workarounds need to be clearly documented in the 
> source code, and as narrowly targeted as possible (for example, under an 
> `#ifdef __CYGWIN__`).
> 
> Since this is an issue with the latest version of gcc, please also report it 
> to the gcc bugtracker.

As commit 49b27b150b97c190dedf8b45bf991c4b811ed953 2023-12-09, this patch is 
not needed.


https://github.com/llvm/llvm-project/pull/74977
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [Cygwin] Reduced number of inline elements of CallArgList. (PR #74977)

2023-12-13 Thread Xu Chiheng via cfe-commits

https://github.com/xu-chiheng edited 
https://github.com/llvm/llvm-project/pull/74977
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [MinGW] MinGW dynamicbase (PR #74979)

2023-12-13 Thread Xu Chiheng via cfe-commits

xu-chiheng wrote:


> > In Cygwin with binutils 2.41, --dynamicbase make a difference, so I thought 
> > MinGW also need it.
> 
> No, MinGW does not need it, as it has been enabled by default since binutils 
> 2.36.
> 
> Apparently that change, 
> https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=514b4e191d5f46de8e142fe216e677a35fa9c4bb,
>  didn't apply to Cygwin but only to MinGW. But if Cygwin works with 
> dynamicbase (I think it might have issues with it but I'm not sure?) then 
> perhaps binutils should be changed to enable dynamicbase by default there, 
> instead of changing compilers to pass the option by default.

Cygwin GCC and Clang must use dynamicbase, otherwise, there are errors like :
  0 [main] clang-17 1506 child_info_fork::abort: 
\??\D:\cygwin64-packages\clang\bin\cygclangLex-17git.dll: Loaded to different 
address: parent(0x16E) != child(0x5C12D)
clang++: error: unable to execute command: posix_spawn failed: Resource 
temporarily unavailable
  0 [main] clang-17 1507 child_info_fork::abort: 
\??\D:\cygwin64-packages\clang\bin\cygLLVMRISCVCodeGen-17git.dll: Loaded to 
different address: parent(0xE6) != child(0xEC)
clang++: error: unable to execute command: posix_spawn failed: Resource 
temporarily unavailable


https://github.com/llvm/llvm-project/pull/74979
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [Cygwin] Cygwin driver (PR #74933)

2023-12-13 Thread Xu Chiheng via cfe-commits

xu-chiheng wrote:

> @carlo-bramini has spent some effort on using Clang in Cygwin environments 
> before, so as far as I know, it does work in general from before. So this 
> change, which adds an entirely new driver for Cygwin environments, would need 
> to be explained why it does that (I don't disagree, it's probably the right 
> thing to do in general), how things worked before and how this changes 
> things. And I would like to have @carlo-bramini's eye on this (and all the 
> related Cygwin patches from @xu-chiheng).
> 
> And changes like this need some general tests, have a look at 
> `clang/test/Driver` for how other drivers are tested.

I'm not very familiar with test. I just use my build scripts to build LLVM and 
GCC on Cygwin and MinGW. 

https://github.com/llvm/llvm-project/pull/74933
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [Cygwin] Cygwin driver (PR #74933)

2023-12-13 Thread Xu Chiheng via cfe-commits

xu-chiheng wrote:

> > 
> > The Cygwin driver is basically the same as MinGW driver with minor 
> > difference.
> 
> Right. What are the actual observable differences to what was executed 
> before? (I presume this before used the `Generic_GCC` toolchain?) Also, I 
> wonder if it would make sense to share the MinGW driver code with Cygwin, and 
> just add exceptions where necessary, instead of duplicating it into a 
> separate one? Maybe, but perhaps not.

The original Generic_GCC driver can be built on Cygwin, but does not work on 
non trivial cases.
Even Cygwin's old outdated llvm patches use a driver modified from MinGW driver 
.
https://cygwin.com/git-cygwin-packages/
https://cygwin.com/git-cygwin-packages/?p=git/cygwin-packages/clang.git;a=summary
git://cygwin.com/git/cygwin-packages/clang.git
https://cygwin.com/git-cygwin-packages/?p=git/cygwin-packages/llvm.git;a=summary
git://cygwin.com/git/cygwin-packages/llvm.git


Combining Cygwin and MinGW driver is simple. But the combined code may be ugly.
 



https://github.com/llvm/llvm-project/pull/74933
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [MinGW] MinGW dynamicbase (PR #74979)

2023-12-12 Thread Xu Chiheng via cfe-commits

xu-chiheng wrote:

> Also

In Cygwin with binutils 2.41,  --dynamicbase make a difference, so I thought 
MinGW also need it.

https://github.com/llvm/llvm-project/pull/74979
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [MinGW] Fix the regression caused by commit 592e935e115ffb451eb9b782376711dab6558fe0, that, in MinGW, Clang can't be built by system Clang 15.0.4. (PR #74982)

2023-12-12 Thread Xu Chiheng via cfe-commits

xu-chiheng wrote:

> > I have build scripts and patches at: https://github.com/xu-chiheng/Note
> 
> This does not answer the question. You need to explain what is broken, and 
> why, and how this fixes it. And address the concern that this actually breaks 
> functionality in some cases. I guess this partially answers the question on 
> in what exact environment the issue occurs, although it would require me to 
> dissect your build script environment to figure it out.

It is about several month ago, I don't remember clearly.  this commit 
592e935e115ffb451eb9b782376711dab6558fe0 cause a build  failure on 
MSYS2/MinGW-w64, I just tried to partially revert the commit.  
Cygwin/MinGW/Visual Studio ClangCl can build with no problem with the patch. I 
don't know why some test fails.  I'm not very familiar with the code and test.

Maybe the patch need to be reworked.  The change is small, it should be not 
hard.


https://github.com/llvm/llvm-project/pull/74982
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [MinGW] MinGW dynamicbase (PR #74979)

2023-12-12 Thread Xu Chiheng via cfe-commits

https://github.com/xu-chiheng updated 
https://github.com/llvm/llvm-project/pull/74979

From e08d12df9f987ad4cf025d4bf1896acf2deea859 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?=
 
Date: Sun, 10 Dec 2023 15:03:28 +0800
Subject: [PATCH 1/2] 1

---
 clang/lib/Driver/ToolChains/MinGW.cpp | 1 +
 1 file changed, 1 insertion(+)

diff --git a/clang/lib/Driver/ToolChains/MinGW.cpp 
b/clang/lib/Driver/ToolChains/MinGW.cpp
index 5d7f8675daf8d2..50181837d39399 100644
--- a/clang/lib/Driver/ToolChains/MinGW.cpp
+++ b/clang/lib/Driver/ToolChains/MinGW.cpp
@@ -165,6 +165,7 @@ void tools::MinGW::Linker::ConstructJob(Compilation , 
const JobAction ,
   CmdArgs.push_back("DllMainCRTStartup");
 CmdArgs.push_back("--enable-auto-image-base");
   }
+  CmdArgs.push_back("--dynamicbase");
 
   if (Args.hasArg(options::OPT_Z_Xlinker__no_demangle))
 CmdArgs.push_back("--no-demangle");

From b7383e3b85acae68c69c7db2091356cb27067ce1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?=
 
Date: Wed, 13 Dec 2023 02:58:47 +0800
Subject: [PATCH 2/2] 1

---
 clang/lib/Driver/ToolChains/MinGW.cpp | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/clang/lib/Driver/ToolChains/MinGW.cpp 
b/clang/lib/Driver/ToolChains/MinGW.cpp
index 50181837d39399..0e51a427a66af0 100644
--- a/clang/lib/Driver/ToolChains/MinGW.cpp
+++ b/clang/lib/Driver/ToolChains/MinGW.cpp
@@ -165,7 +165,13 @@ void tools::MinGW::Linker::ConstructJob(Compilation , 
const JobAction ,
   CmdArgs.push_back("DllMainCRTStartup");
 CmdArgs.push_back("--enable-auto-image-base");
   }
-  CmdArgs.push_back("--dynamicbase");
+  switch (TC.getArch()) {
+  case llvm::Triple::x86_64:
+CmdArgs.push_back("--dynamicbase");
+break;
+  case llvm::Triple::aarch64:
+break;
+  }
 
   if (Args.hasArg(options::OPT_Z_Xlinker__no_demangle))
 CmdArgs.push_back("--no-demangle");

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


[clang] [Cygwin] Cygwin driver (PR #74933)

2023-12-12 Thread Xu Chiheng via cfe-commits

https://github.com/xu-chiheng updated 
https://github.com/llvm/llvm-project/pull/74933

From daa6702f698724655b91c4fa52272c09924d2d83 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?=
 
Date: Sat, 9 Dec 2023 21:51:29 +0800
Subject: [PATCH 1/7] 1

---
 clang/lib/Driver/CMakeLists.txt|   1 +
 clang/lib/Driver/Driver.cpp|   4 +
 clang/lib/Driver/ToolChains/Cygwin.cpp | 731 +
 clang/lib/Driver/ToolChains/Cygwin.h   | 125 +
 clang/lib/Lex/InitHeaderSearch.cpp |  30 +-
 5 files changed, 865 insertions(+), 26 deletions(-)
 create mode 100644 clang/lib/Driver/ToolChains/Cygwin.cpp
 create mode 100644 clang/lib/Driver/ToolChains/Cygwin.h

diff --git a/clang/lib/Driver/CMakeLists.txt b/clang/lib/Driver/CMakeLists.txt
index 58427e3f83c420..7ab5a1ee963515 100644
--- a/clang/lib/Driver/CMakeLists.txt
+++ b/clang/lib/Driver/CMakeLists.txt
@@ -51,6 +51,7 @@ add_clang_library(clangDriver
   ToolChains/CrossWindows.cpp
   ToolChains/CSKYToolChain.cpp
   ToolChains/Cuda.cpp
+  ToolChains/Cygwin.cpp
   ToolChains/Darwin.cpp
   ToolChains/DragonFly.cpp
   ToolChains/Flang.cpp
diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
index e241706b9082ee..b6f3da3a006f4e 100644
--- a/clang/lib/Driver/Driver.cpp
+++ b/clang/lib/Driver/Driver.cpp
@@ -17,6 +17,7 @@
 #include "ToolChains/Clang.h"
 #include "ToolChains/CrossWindows.h"
 #include "ToolChains/Cuda.h"
+#include "ToolChains/Cygwin.h"
 #include "ToolChains/Darwin.h"
 #include "ToolChains/DragonFly.h"
 #include "ToolChains/FreeBSD.h"
@@ -6263,6 +6264,9 @@ const ToolChain ::getToolChain(const ArgList ,
 else
   TC = std::make_unique(*this, Target, Args);
 break;
+  case llvm::Triple::Cygnus:
+TC = std::make_unique(*this, Target, Args);
+break;
   case llvm::Triple::GNU:
 TC = std::make_unique(*this, Target, Args);
 break;
diff --git a/clang/lib/Driver/ToolChains/Cygwin.cpp 
b/clang/lib/Driver/ToolChains/Cygwin.cpp
new file mode 100644
index 00..8aa9cf5c8ec034
--- /dev/null
+++ b/clang/lib/Driver/ToolChains/Cygwin.cpp
@@ -0,0 +1,731 @@
+//===--- Cygwin.cpp - CygwinToolChain Implementation 
===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#include "Cygwin.h"
+#include "CommonArgs.h"
+#include "clang/Config/config.h"
+#include "clang/Driver/Compilation.h"
+#include "clang/Driver/Driver.h"
+#include "clang/Driver/DriverDiagnostic.h"
+#include "clang/Driver/InputInfo.h"
+#include "clang/Driver/Options.h"
+#include "clang/Driver/SanitizerArgs.h"
+#include "llvm/Option/ArgList.h"
+#include "llvm/Support/FileSystem.h"
+#include "llvm/Support/Path.h"
+#include "llvm/Support/VirtualFileSystem.h"
+#include 
+
+using namespace clang::diag;
+using namespace clang::driver;
+using namespace clang;
+using namespace llvm::opt;
+
+/// Cygwin Tools
+void tools::Cygwin::Assembler::ConstructJob(Compilation , const JobAction 
,
+   const InputInfo ,
+   const InputInfoList ,
+   const ArgList ,
+   const char *LinkingOutput) const {
+  claimNoWarnArgs(Args);
+  ArgStringList CmdArgs;
+
+  if (getToolChain().getArch() == llvm::Triple::x86) {
+CmdArgs.push_back("--32");
+  } else if (getToolChain().getArch() == llvm::Triple::x86_64) {
+CmdArgs.push_back("--64");
+  }
+
+  Args.AddAllArgValues(CmdArgs, options::OPT_Wa_COMMA, 
options::OPT_Xassembler);
+
+  CmdArgs.push_back("-o");
+  CmdArgs.push_back(Output.getFilename());
+
+  for (const auto  : Inputs)
+CmdArgs.push_back(II.getFilename());
+
+  const char *Exec = Args.MakeArgString(getToolChain().GetProgramPath("as"));
+  C.addCommand(std::make_unique(JA, *this, 
ResponseFileSupport::None(),
+ Exec, CmdArgs, Inputs, Output));
+
+  if (Args.hasArg(options::OPT_gsplit_dwarf))
+SplitDebugInfo(getToolChain(), C, *this, JA, Args, Output,
+   SplitDebugName(JA, Args, Inputs[0], Output));
+}
+
+void tools::Cygwin::Linker::AddLibGCC(const ArgList ,
+ ArgStringList ) const {
+  // Make use of compiler-rt if --rtlib option is used
+  ToolChain::RuntimeLibType RLT = getToolChain().GetRuntimeLibType(Args);
+  if (RLT == ToolChain::RLT_Libgcc) {
+bool Static = Args.hasArg(options::OPT_static_libgcc) ||
+  Args.hasArg(options::OPT_static);
+bool Shared = Args.hasArg(options::OPT_shared);
+bool CXX = getToolChain().getDriver().CCCIsCXX();
+
+if (Static || (!CXX && !Shared)) {
+  CmdArgs.push_back("-lgcc");
+  

[clang] [Cygwin] Cygwin driver (PR #74933)

2023-12-12 Thread Xu Chiheng via cfe-commits

xu-chiheng wrote:

> @carlo-bramini has spent some effort on using Clang in Cygwin environments 
> before, so as far as I know, it does work in general from before. So this 
> change, which adds an entirely new driver for Cygwin environments, would need 
> to be explained why it does that (I don't disagree, it's probably the right 
> thing to do in general), how things worked before and how this changes 
> things. And I would like to have @carlo-bramini's eye on this (and all the 
> related Cygwin patches from @xu-chiheng).
> 
> And changes like this need some general tests, have a look at 
> `clang/test/Driver` for how other drivers are tested.

I have build scripts and patches at:
https://github.com/xu-chiheng/Note

https://github.com/llvm/llvm-project/pull/74933
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [Cygwin] Cygwin driver (PR #74933)

2023-12-12 Thread Xu Chiheng via cfe-commits

xu-chiheng wrote:

> @carlo-bramini has spent some effort on using Clang in Cygwin environments 
> before, so as far as I know, it does work in general from before. So this 
> change, which adds an entirely new driver for Cygwin environments, would need 
> to be explained why it does that (I don't disagree, it's probably the right 
> thing to do in general), how things worked before and how this changes 
> things. And I would like to have @carlo-bramini's eye on this (and all the 
> related Cygwin patches from @xu-chiheng).
> 
> And changes like this need some general tests, have a look at 
> `clang/test/Driver` for how other drivers are tested.

The Cygwin driver is basically the same as MinGW driver with minor difference.


https://github.com/llvm/llvm-project/pull/74933
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [MinGW] Fix the regression caused by commit 592e935e115ffb451eb9b782376711dab6558fe0, that, in MinGW, Clang can't be built by system Clang 15.0.4. (PR #74982)

2023-12-12 Thread Xu Chiheng via cfe-commits

xu-chiheng wrote:

> I don't know what issue/regression you're referring to. Please explain, in 
> detail, what the issue is and all the relevant aspects of your configuration. 
> Also explain what the suggested fix does, and how it handles the various 
> cases (I just tested building latest llvm-project main with Clang 15 and LLD, 
> for a mingw target, and it worked just fine, both as a regular non-dylib 
> build, and with `LLVM_LINK_LLVM_DYLIB` enabled.)
> 
> I also believe that the suggested patch would break actual use of clang-repl; 
> if `LLVM_BUILD_LLVM_DYLIB` or `LLVM_BUILD_SHARED_LIBS` aren't defined, then 
> those symbols wouldn't be dllexported at all. This causes them to not be 
> found at runtime when the JIT runtime tries to locate them.



> I don't know what issue/regression you're referring to. Please explain, in 
> detail, what the issue is and all the relevant aspects of your configuration. 
> Also explain what the suggested fix does, and how it handles the various 
> cases (I just tested building latest llvm-project main with Clang 15 and LLD, 
> for a mingw target, and it worked just fine, both as a regular non-dylib 
> build, and with `LLVM_LINK_LLVM_DYLIB` enabled.)
> 
> I also believe that the suggested patch would break actual use of clang-repl; 
> if `LLVM_BUILD_LLVM_DYLIB` or `LLVM_BUILD_SHARED_LIBS` aren't defined, then 
> those symbols wouldn't be dllexported at all. This causes them to not be 
> found at runtime when the JIT runtime tries to locate them.

I have build scripts and patches at:
https://github.com/xu-chiheng/Note

https://github.com/llvm/llvm-project/pull/74982
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [Cygwin] Reduced number of inline elements of CallArgList. (PR #74977)

2023-12-12 Thread Xu Chiheng via cfe-commits

xu-chiheng wrote:

> > I have build scripts and patches at: https://github.com/xu-chiheng/Note
> > […](#)
> > On Mon, Dec 11, 2023 at 11:25 PM Yingchi Long _**@**_._**> wrote: When 
> > bootstrapping Clang on Cygwin, there are various weird problems. What are 
> > those "weired problems" Reducing the size of CallArgList solve them all. 
> > And why reduce the size of CallArgList solve them all? Could you kindly 
> > elaborate? — Reply to this email directly, view it on GitHub <[#74977 
> > (comment)](https://github.com/llvm/llvm-project/pull/74977#issuecomment-1850302699)>,
> >  or unsubscribe 
> > https://github.com/notifications/unsubscribe-auth/AA5RCUGAE5BNGG5HBCLW66DYI4QXJAVCNFSM6ABAOLH3Y6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNJQGMYDENRZHE
> >  . You are receiving this because you authored the thread.Message ID: 
> > _**@**_.**_>
> 
> I see, can you just paste logs(e.g. compiler warnings) here or provide a 
> small reproducer? (e.g step-by-step instructions to reproduce the issue).
> 
> I think it will be nice if the patch really improves llvm portability, but it 
> is hard to reproduce bugs via a set of undocumented scripts & unknown build 
> environments.

No, currently. It was several months ago.  I don't remember the details. 
Basically speaking,  it seems that some fields of CallArgList or other types 
are overwritten, because CallArgList size exceed an unknown limit, leading to 
various weird errors and failed bootstrap.  This need to be invesgated, but I'm 
not very familiar with the code. 

This was discovered by bisect. Clang 16 can bootstrap without this patch.


https://github.com/llvm/llvm-project/pull/74977
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [Cygwin] Reduced number of inline elements of CallArgList. (PR #74977)

2023-12-11 Thread Xu Chiheng via cfe-commits

xu-chiheng wrote:

I have build scripts and patches at:
https://github.com/xu-chiheng/Note

On Mon, Dec 11, 2023 at 11:25 PM Yingchi Long ***@***.***>
wrote:

> When bootstrapping Clang on Cygwin, there are various weird problems.
>
> What are those "weired problems"
>
> Reducing the size of CallArgList solve them all.
>
> And why reduce the size of CallArgList solve them all? Could you kindly
> elaborate?
>
> —
> Reply to this email directly, view it on GitHub
> ,
> or unsubscribe
> 
> .
> You are receiving this because you authored the thread.Message ID:
> ***@***.***>
>


https://github.com/llvm/llvm-project/pull/74977
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [Cygwin] Reduced number of inline elements of CallArgList. (PR #74977)

2023-12-10 Thread Xu Chiheng via cfe-commits

xu-chiheng wrote:

> NFC, and

I have build scripts at https://github.com/xu-chiheng/Note
When bootstrapping Clang on Cygwin, there are various weird problems. 
Reducing the size of CallArgList solve them all.



https://github.com/llvm/llvm-project/pull/74977
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [Cygwin] Cygwin macro (PR #74973)

2023-12-10 Thread Xu Chiheng via cfe-commits

https://github.com/xu-chiheng edited 
https://github.com/llvm/llvm-project/pull/74973
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [Cygwin] Cygwin macro (PR #74973)

2023-12-10 Thread Xu Chiheng via cfe-commits

xu-chiheng wrote:

> Would you please add some tests about your changes?
> 
> Also maybe it will be more useful to write some detailed descriptions, so 
> others can understand your code easily. Cheers!

Does to solve any problem.


https://github.com/llvm/llvm-project/pull/74973
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [Cygwin] Cygwin macro (PR #74973)

2023-12-10 Thread Xu Chiheng via cfe-commits

xu-chiheng wrote:

> Would you please add some tests about your changes?
> 
> Also maybe it will be more useful to write some detailed descriptions, so 
> others can understand your code easily. Cheers!

To keep aligned with Cygwin GCC


https://github.com/llvm/llvm-project/pull/74973
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [Cygwin] Reduced number of inline elements of CallArgList. (PR #74977)

2023-12-10 Thread Xu Chiheng via cfe-commits

xu-chiheng wrote:

> Just FYI submitting lots of PRs with all of them having commits with a commit 
> message of 1 is not going to go anywhere. They need to be revised with proper 
> meaningful commit messages.

This fix bootstraping on Cygwin, using GCC 13.2.0 as stage 0 compiler.
It seems that the size of CallArgList can't exceed an unknown limit.


https://github.com/llvm/llvm-project/pull/74977
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [Cygwin] Cygwin driver (PR #74933)

2023-12-10 Thread Xu Chiheng via cfe-commits

https://github.com/xu-chiheng updated 
https://github.com/llvm/llvm-project/pull/74933

From daa6702f698724655b91c4fa52272c09924d2d83 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?=
 
Date: Sat, 9 Dec 2023 21:51:29 +0800
Subject: [PATCH 1/6] 1

---
 clang/lib/Driver/CMakeLists.txt|   1 +
 clang/lib/Driver/Driver.cpp|   4 +
 clang/lib/Driver/ToolChains/Cygwin.cpp | 731 +
 clang/lib/Driver/ToolChains/Cygwin.h   | 125 +
 clang/lib/Lex/InitHeaderSearch.cpp |  30 +-
 5 files changed, 865 insertions(+), 26 deletions(-)
 create mode 100644 clang/lib/Driver/ToolChains/Cygwin.cpp
 create mode 100644 clang/lib/Driver/ToolChains/Cygwin.h

diff --git a/clang/lib/Driver/CMakeLists.txt b/clang/lib/Driver/CMakeLists.txt
index 58427e3f83c420..7ab5a1ee963515 100644
--- a/clang/lib/Driver/CMakeLists.txt
+++ b/clang/lib/Driver/CMakeLists.txt
@@ -51,6 +51,7 @@ add_clang_library(clangDriver
   ToolChains/CrossWindows.cpp
   ToolChains/CSKYToolChain.cpp
   ToolChains/Cuda.cpp
+  ToolChains/Cygwin.cpp
   ToolChains/Darwin.cpp
   ToolChains/DragonFly.cpp
   ToolChains/Flang.cpp
diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
index e241706b9082ee..b6f3da3a006f4e 100644
--- a/clang/lib/Driver/Driver.cpp
+++ b/clang/lib/Driver/Driver.cpp
@@ -17,6 +17,7 @@
 #include "ToolChains/Clang.h"
 #include "ToolChains/CrossWindows.h"
 #include "ToolChains/Cuda.h"
+#include "ToolChains/Cygwin.h"
 #include "ToolChains/Darwin.h"
 #include "ToolChains/DragonFly.h"
 #include "ToolChains/FreeBSD.h"
@@ -6263,6 +6264,9 @@ const ToolChain ::getToolChain(const ArgList ,
 else
   TC = std::make_unique(*this, Target, Args);
 break;
+  case llvm::Triple::Cygnus:
+TC = std::make_unique(*this, Target, Args);
+break;
   case llvm::Triple::GNU:
 TC = std::make_unique(*this, Target, Args);
 break;
diff --git a/clang/lib/Driver/ToolChains/Cygwin.cpp 
b/clang/lib/Driver/ToolChains/Cygwin.cpp
new file mode 100644
index 00..8aa9cf5c8ec034
--- /dev/null
+++ b/clang/lib/Driver/ToolChains/Cygwin.cpp
@@ -0,0 +1,731 @@
+//===--- Cygwin.cpp - CygwinToolChain Implementation 
===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#include "Cygwin.h"
+#include "CommonArgs.h"
+#include "clang/Config/config.h"
+#include "clang/Driver/Compilation.h"
+#include "clang/Driver/Driver.h"
+#include "clang/Driver/DriverDiagnostic.h"
+#include "clang/Driver/InputInfo.h"
+#include "clang/Driver/Options.h"
+#include "clang/Driver/SanitizerArgs.h"
+#include "llvm/Option/ArgList.h"
+#include "llvm/Support/FileSystem.h"
+#include "llvm/Support/Path.h"
+#include "llvm/Support/VirtualFileSystem.h"
+#include 
+
+using namespace clang::diag;
+using namespace clang::driver;
+using namespace clang;
+using namespace llvm::opt;
+
+/// Cygwin Tools
+void tools::Cygwin::Assembler::ConstructJob(Compilation , const JobAction 
,
+   const InputInfo ,
+   const InputInfoList ,
+   const ArgList ,
+   const char *LinkingOutput) const {
+  claimNoWarnArgs(Args);
+  ArgStringList CmdArgs;
+
+  if (getToolChain().getArch() == llvm::Triple::x86) {
+CmdArgs.push_back("--32");
+  } else if (getToolChain().getArch() == llvm::Triple::x86_64) {
+CmdArgs.push_back("--64");
+  }
+
+  Args.AddAllArgValues(CmdArgs, options::OPT_Wa_COMMA, 
options::OPT_Xassembler);
+
+  CmdArgs.push_back("-o");
+  CmdArgs.push_back(Output.getFilename());
+
+  for (const auto  : Inputs)
+CmdArgs.push_back(II.getFilename());
+
+  const char *Exec = Args.MakeArgString(getToolChain().GetProgramPath("as"));
+  C.addCommand(std::make_unique(JA, *this, 
ResponseFileSupport::None(),
+ Exec, CmdArgs, Inputs, Output));
+
+  if (Args.hasArg(options::OPT_gsplit_dwarf))
+SplitDebugInfo(getToolChain(), C, *this, JA, Args, Output,
+   SplitDebugName(JA, Args, Inputs[0], Output));
+}
+
+void tools::Cygwin::Linker::AddLibGCC(const ArgList ,
+ ArgStringList ) const {
+  // Make use of compiler-rt if --rtlib option is used
+  ToolChain::RuntimeLibType RLT = getToolChain().GetRuntimeLibType(Args);
+  if (RLT == ToolChain::RLT_Libgcc) {
+bool Static = Args.hasArg(options::OPT_static_libgcc) ||
+  Args.hasArg(options::OPT_static);
+bool Shared = Args.hasArg(options::OPT_shared);
+bool CXX = getToolChain().getDriver().CCCIsCXX();
+
+if (Static || (!CXX && !Shared)) {
+  CmdArgs.push_back("-lgcc");
+  

[clang-tools-extra] [pseudo] gen Main.cpp (PR #74983)

2023-12-09 Thread Xu Chiheng via cfe-commits

https://github.com/xu-chiheng updated 
https://github.com/llvm/llvm-project/pull/74983

From 02cbefc8112d73b11f835da30db4ed3344db9d48 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?=
 
Date: Sun, 10 Dec 2023 15:27:25 +0800
Subject: [PATCH 1/2] 1

---
 clang-tools-extra/pseudo/gen/Main.cpp | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/clang-tools-extra/pseudo/gen/Main.cpp 
b/clang-tools-extra/pseudo/gen/Main.cpp
index 25cb26563837a..c9367ca16ed85 100644
--- a/clang-tools-extra/pseudo/gen/Main.cpp
+++ b/clang-tools-extra/pseudo/gen/Main.cpp
@@ -70,13 +70,13 @@ namespace {
 //   keyword: `INT` becomes `INT`;
 //   terminal: `IDENTIFIER` becomes `IDENTIFIER`;
 std::string mangleSymbol(SymbolID SID, const Grammar ) {
-  static auto  = *new std::vector{
-#define TOK(X) llvm::StringRef(#X).upper(),
-#define KEYWORD(Keyword, Condition) llvm::StringRef(#Keyword).upper(),
+  static char const * TokNames[] = {
+#define TOK(X) #X ,
+#define KEYWORD(Keyword, Condition) #Keyword ,
 #include "clang/Basic/TokenKinds.def"
   };
   if (isToken(SID))
-return TokNames[symbolToToken(SID)];
+return llvm::StringRef(TokNames[symbolToToken(SID)]).upper();
   std::string Name = G.symbolName(SID).str();
   // translation-unit -> translation_unit
   std::replace(Name.begin(), Name.end(), '-', '_');

From 078dd3071d270c720f395e0cd98c5fdfcb3b1f7e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?=
 
Date: Sun, 10 Dec 2023 15:38:56 +0800
Subject: [PATCH 2/2] 1

---
 clang-tools-extra/pseudo/gen/Main.cpp | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/clang-tools-extra/pseudo/gen/Main.cpp 
b/clang-tools-extra/pseudo/gen/Main.cpp
index c9367ca16ed85..2c0bf662ef405 100644
--- a/clang-tools-extra/pseudo/gen/Main.cpp
+++ b/clang-tools-extra/pseudo/gen/Main.cpp
@@ -70,11 +70,11 @@ namespace {
 //   keyword: `INT` becomes `INT`;
 //   terminal: `IDENTIFIER` becomes `IDENTIFIER`;
 std::string mangleSymbol(SymbolID SID, const Grammar ) {
-  static char const * TokNames[] = {
-#define TOK(X) #X ,
-#define KEYWORD(Keyword, Condition) #Keyword ,
+  static char const *TokNames[] = {
+#define TOK(X) #X,
+#define KEYWORD(Keyword, Condition) #Keyword,
 #include "clang/Basic/TokenKinds.def"
-  };
+  };
   if (isToken(SID))
 return llvm::StringRef(TokNames[symbolToToken(SID)]).upper();
   std::string Name = G.symbolName(SID).str();

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


[clang-tools-extra] [pseudo] lib Grammar.cpp (PR #74984)

2023-12-09 Thread Xu Chiheng via cfe-commits

https://github.com/xu-chiheng created 
https://github.com/llvm/llvm-project/pull/74984

None

From 3903e0093bea95fef69ca8b6c8c2a8ce74be5d42 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?=
 
Date: Sun, 10 Dec 2023 15:31:36 +0800
Subject: [PATCH] 1

---
 clang-tools-extra/pseudo/lib/grammar/Grammar.cpp | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/clang-tools-extra/pseudo/lib/grammar/Grammar.cpp 
b/clang-tools-extra/pseudo/lib/grammar/Grammar.cpp
index 3e9c5c3c7a6c4..ec6e8915a2c7d 100644
--- a/clang-tools-extra/pseudo/lib/grammar/Grammar.cpp
+++ b/clang-tools-extra/pseudo/lib/grammar/Grammar.cpp
@@ -172,9 +172,10 @@ std::vector> followSets(const 
Grammar ) {
   return FollowSets;
 }
 
+static auto TerminalNames = new std::string[NumTerminals];
+
 static llvm::ArrayRef getTerminalNames() {
-  static const auto  = []() {
-auto TerminalNames = new std::string[NumTerminals];
+  static const auto  = []() {
 #define PUNCTUATOR(Tok, Spelling) TerminalNames[tok::Tok] = Spelling;
 #define KEYWORD(Keyword, Condition)
\
   TerminalNames[tok::kw_##Keyword] = llvm::StringRef(#Keyword).upper();
@@ -182,7 +183,7 @@ static llvm::ArrayRef getTerminalNames() {
 #include "clang/Basic/TokenKinds.def"
 return llvm::ArrayRef(TerminalNames, NumTerminals);
   }();
-  return TerminalNames;
+  return TerminalNames1;
 }
 GrammarTable::GrammarTable() : Terminals(getTerminalNames()) {}
 

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


[clang-tools-extra] [pseudo] gen Main.cpp (PR #74983)

2023-12-09 Thread Xu Chiheng via cfe-commits

https://github.com/xu-chiheng created 
https://github.com/llvm/llvm-project/pull/74983

None

From 02cbefc8112d73b11f835da30db4ed3344db9d48 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?=
 
Date: Sun, 10 Dec 2023 15:27:25 +0800
Subject: [PATCH] 1

---
 clang-tools-extra/pseudo/gen/Main.cpp | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/clang-tools-extra/pseudo/gen/Main.cpp 
b/clang-tools-extra/pseudo/gen/Main.cpp
index 25cb26563837a6..c9367ca16ed85e 100644
--- a/clang-tools-extra/pseudo/gen/Main.cpp
+++ b/clang-tools-extra/pseudo/gen/Main.cpp
@@ -70,13 +70,13 @@ namespace {
 //   keyword: `INT` becomes `INT`;
 //   terminal: `IDENTIFIER` becomes `IDENTIFIER`;
 std::string mangleSymbol(SymbolID SID, const Grammar ) {
-  static auto  = *new std::vector{
-#define TOK(X) llvm::StringRef(#X).upper(),
-#define KEYWORD(Keyword, Condition) llvm::StringRef(#Keyword).upper(),
+  static char const * TokNames[] = {
+#define TOK(X) #X ,
+#define KEYWORD(Keyword, Condition) #Keyword ,
 #include "clang/Basic/TokenKinds.def"
   };
   if (isToken(SID))
-return TokNames[symbolToToken(SID)];
+return llvm::StringRef(TokNames[symbolToToken(SID)]).upper();
   std::string Name = G.symbolName(SID).str();
   // translation-unit -> translation_unit
   std::replace(Name.begin(), Name.end(), '-', '_');

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


[clang] [MinGW] Fix the regression caused by commit 592e935e115ffb451eb9b782376711dab6558fe0, that, in MinGW, Clang can't be built by system Clang 15.0.4. (PR #74982)

2023-12-09 Thread Xu Chiheng via cfe-commits

https://github.com/xu-chiheng created 
https://github.com/llvm/llvm-project/pull/74982

None

From 6be995d68575d4386cc9aeef27f09ab5b5ef5654 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?=
 
Date: Sun, 10 Dec 2023 15:16:38 +0800
Subject: [PATCH] 1

---
 clang/include/clang/Interpreter/Value.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/clang/include/clang/Interpreter/Value.h 
b/clang/include/clang/Interpreter/Value.h
index c380cd91550def..46e827f3ec283d 100644
--- a/clang/include/clang/Interpreter/Value.h
+++ b/clang/include/clang/Interpreter/Value.h
@@ -52,7 +52,8 @@ class ASTContext;
 class Interpreter;
 class QualType;
 
-#if defined(_WIN32)
+#if defined(LLVM_BUILD_LLVM_DYLIB) || defined(LLVM_BUILD_SHARED_LIBS)
+#if defined(_WIN32) && !(defined(__CYGWIN__) || defined(__MINGW32__))
 // REPL_EXTERNAL_VISIBILITY are symbols that we need to be able to locate
 // at runtime. On Windows, this requires them to be exported from any of the
 // modules loaded at runtime. Marking them as dllexport achieves this; both
@@ -63,7 +64,6 @@ class QualType;
 // statically linked into an EXE, it makes sure that they're exported.
 #define REPL_EXTERNAL_VISIBILITY __declspec(dllexport)
 #elif __has_attribute(visibility)
-#if defined(LLVM_BUILD_LLVM_DYLIB) || defined(LLVM_BUILD_SHARED_LIBS)
 #define REPL_EXTERNAL_VISIBILITY __attribute__((visibility("default")))
 #else
 #define REPL_EXTERNAL_VISIBILITY

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


[clang] [MinGW] MinGW pthread (PR #74981)

2023-12-09 Thread Xu Chiheng via cfe-commits

https://github.com/xu-chiheng created 
https://github.com/llvm/llvm-project/pull/74981

None

From ea7be98f26824e0065a8228b2986e89a52f9af11 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?=
 
Date: Sun, 10 Dec 2023 15:12:11 +0800
Subject: [PATCH] 1

---
 clang/lib/Driver/ToolChains/MinGW.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang/lib/Driver/ToolChains/MinGW.cpp 
b/clang/lib/Driver/ToolChains/MinGW.cpp
index 5d7f8675daf8d..795814f843e33 100644
--- a/clang/lib/Driver/ToolChains/MinGW.cpp
+++ b/clang/lib/Driver/ToolChains/MinGW.cpp
@@ -307,7 +307,7 @@ void tools::MinGW::Linker::ConstructJob(Compilation , 
const JobAction ,
   if (Args.hasArg(options::OPT_pg))
 CmdArgs.push_back("-lgmon");
 
-  if (Args.hasArg(options::OPT_pthread))
+  if (!Args.hasArg(options::OPT_no_pthread))
 CmdArgs.push_back("-lpthread");
 
   if (Sanitize.needsAsanRt()) {

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


[clang] [MinGW] MinGW dynamicbase (PR #74979)

2023-12-09 Thread Xu Chiheng via cfe-commits

https://github.com/xu-chiheng created 
https://github.com/llvm/llvm-project/pull/74979

None

From e08d12df9f987ad4cf025d4bf1896acf2deea859 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?=
 
Date: Sun, 10 Dec 2023 15:03:28 +0800
Subject: [PATCH] 1

---
 clang/lib/Driver/ToolChains/MinGW.cpp | 1 +
 1 file changed, 1 insertion(+)

diff --git a/clang/lib/Driver/ToolChains/MinGW.cpp 
b/clang/lib/Driver/ToolChains/MinGW.cpp
index 5d7f8675daf8d2..50181837d39399 100644
--- a/clang/lib/Driver/ToolChains/MinGW.cpp
+++ b/clang/lib/Driver/ToolChains/MinGW.cpp
@@ -165,6 +165,7 @@ void tools::MinGW::Linker::ConstructJob(Compilation , 
const JobAction ,
   CmdArgs.push_back("DllMainCRTStartup");
 CmdArgs.push_back("--enable-auto-image-base");
   }
+  CmdArgs.push_back("--dynamicbase");
 
   if (Args.hasArg(options::OPT_Z_Xlinker__no_demangle))
 CmdArgs.push_back("--no-demangle");

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


[clang] [Cygwin] Reduced number of inline elements of CallArgList. (PR #74977)

2023-12-09 Thread Xu Chiheng via cfe-commits

https://github.com/xu-chiheng created 
https://github.com/llvm/llvm-project/pull/74977

This fix bootstraping on Cygwin, using GCC 13.2.0 as stage 0 compiler.
It seems that the size of CallArgList can't exceed an unknown limit.  


From 68400fd63fd90703bb092d8f08f6c8cb7289fbe1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?=
 
Date: Sun, 10 Dec 2023 14:52:29 +0800
Subject: [PATCH] 1

---
 clang/lib/CodeGen/CGCall.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang/lib/CodeGen/CGCall.h b/clang/lib/CodeGen/CGCall.h
index aee86a3242fd3..5c181b8c00867 100644
--- a/clang/lib/CodeGen/CGCall.h
+++ b/clang/lib/CodeGen/CGCall.h
@@ -254,7 +254,7 @@ struct CallArg {
 
 /// CallArgList - Type for representing both the value and type of
 /// arguments in a call.
-class CallArgList : public SmallVector {
+class CallArgList : public SmallVector {
 public:
   CallArgList() = default;
 

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


[clang] [Cygwin] Cygwin macro (PR #74973)

2023-12-09 Thread Xu Chiheng via cfe-commits

https://github.com/xu-chiheng updated 
https://github.com/llvm/llvm-project/pull/74973

From 376c504e6a559be2b538291e066b1a67c05e5a82 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?=
 
Date: Sun, 10 Dec 2023 14:04:36 +0800
Subject: [PATCH 1/2] 1

---
 clang/lib/Basic/Targets/ARM.cpp | 2 --
 clang/lib/Basic/Targets/X86.cpp | 9 +++--
 clang/lib/Basic/Targets/X86.h   | 4 
 3 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/clang/lib/Basic/Targets/ARM.cpp b/clang/lib/Basic/Targets/ARM.cpp
index ce7e4d4639cea..c99c247924f99 100644
--- a/clang/lib/Basic/Targets/ARM.cpp
+++ b/clang/lib/Basic/Targets/ARM.cpp
@@ -1402,8 +1402,6 @@ void CygwinARMTargetInfo::getTargetDefines(const 
LangOptions ,
   Builder.defineMacro("__CYGWIN__");
   Builder.defineMacro("__CYGWIN32__");
   DefineStd(Builder, "unix", Opts);
-  if (Opts.CPlusPlus)
-Builder.defineMacro("_GNU_SOURCE");
 }
 
 DarwinARMTargetInfo::DarwinARMTargetInfo(const llvm::Triple ,
diff --git a/clang/lib/Basic/Targets/X86.cpp b/clang/lib/Basic/Targets/X86.cpp
index b97f88647fa49..29a7b089bc0db 100644
--- a/clang/lib/Basic/Targets/X86.cpp
+++ b/clang/lib/Basic/Targets/X86.cpp
@@ -508,8 +508,13 @@ void X86TargetInfo::getTargetDefines(const LangOptions 
,
   Builder.defineMacro("__GCC_ASM_FLAG_OUTPUTS__");
 
   std::string CodeModel = getTargetOpts().CodeModel;
-  if (CodeModel == "default")
-CodeModel = "small";
+  if (CodeModel == "default") {
+if (getTriple().isWindowsCygwinEnvironment() && getTriple().getArch() == 
llvm::Triple::x86_64) {
+  CodeModel = "medium";
+} else {
+  CodeModel = "small";
+}
+  }
   Builder.defineMacro("__code_model_" + CodeModel + "__");
 
   // Target identification.
diff --git a/clang/lib/Basic/Targets/X86.h b/clang/lib/Basic/Targets/X86.h
index 0ab1c10833db2..1664fcc417b14 100644
--- a/clang/lib/Basic/Targets/X86.h
+++ b/clang/lib/Basic/Targets/X86.h
@@ -643,8 +643,6 @@ class LLVM_LIBRARY_VISIBILITY CygwinX86_32TargetInfo : 
public X86_32TargetInfo {
 Builder.defineMacro("__CYGWIN32__");
 addCygMingDefines(Opts, Builder);
 DefineStd(Builder, "unix", Opts);
-if (Opts.CPlusPlus)
-  Builder.defineMacro("_GNU_SOURCE");
   }
 };
 
@@ -916,8 +914,6 @@ class LLVM_LIBRARY_VISIBILITY CygwinX86_64TargetInfo : 
public X86_64TargetInfo {
 Builder.defineMacro("__CYGWIN64__");
 addCygMingDefines(Opts, Builder);
 DefineStd(Builder, "unix", Opts);
-if (Opts.CPlusPlus)
-  Builder.defineMacro("_GNU_SOURCE");
   }
 };
 

From 582e0bf8fa69c1df436248100e9dc7938cc14b72 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?=
 
Date: Sun, 10 Dec 2023 14:13:02 +0800
Subject: [PATCH 2/2] 1

---
 clang/lib/Basic/Targets/X86.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/clang/lib/Basic/Targets/X86.cpp b/clang/lib/Basic/Targets/X86.cpp
index 29a7b089bc0db..6d62d795403aa 100644
--- a/clang/lib/Basic/Targets/X86.cpp
+++ b/clang/lib/Basic/Targets/X86.cpp
@@ -509,7 +509,8 @@ void X86TargetInfo::getTargetDefines(const LangOptions 
,
 
   std::string CodeModel = getTargetOpts().CodeModel;
   if (CodeModel == "default") {
-if (getTriple().isWindowsCygwinEnvironment() && getTriple().getArch() == 
llvm::Triple::x86_64) {
+if (getTriple().isWindowsCygwinEnvironment() &&
+getTriple().getArch() == llvm::Triple::x86_64) {
   CodeModel = "medium";
 } else {
   CodeModel = "small";

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


[clang] [Cygwin] Cygwin macro (PR #74973)

2023-12-09 Thread Xu Chiheng via cfe-commits

https://github.com/xu-chiheng created 
https://github.com/llvm/llvm-project/pull/74973

None

From 376c504e6a559be2b538291e066b1a67c05e5a82 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?=
 
Date: Sun, 10 Dec 2023 14:04:36 +0800
Subject: [PATCH] 1

---
 clang/lib/Basic/Targets/ARM.cpp | 2 --
 clang/lib/Basic/Targets/X86.cpp | 9 +++--
 clang/lib/Basic/Targets/X86.h   | 4 
 3 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/clang/lib/Basic/Targets/ARM.cpp b/clang/lib/Basic/Targets/ARM.cpp
index ce7e4d4639ceac..c99c247924f99c 100644
--- a/clang/lib/Basic/Targets/ARM.cpp
+++ b/clang/lib/Basic/Targets/ARM.cpp
@@ -1402,8 +1402,6 @@ void CygwinARMTargetInfo::getTargetDefines(const 
LangOptions ,
   Builder.defineMacro("__CYGWIN__");
   Builder.defineMacro("__CYGWIN32__");
   DefineStd(Builder, "unix", Opts);
-  if (Opts.CPlusPlus)
-Builder.defineMacro("_GNU_SOURCE");
 }
 
 DarwinARMTargetInfo::DarwinARMTargetInfo(const llvm::Triple ,
diff --git a/clang/lib/Basic/Targets/X86.cpp b/clang/lib/Basic/Targets/X86.cpp
index b97f88647fa49f..29a7b089bc0db7 100644
--- a/clang/lib/Basic/Targets/X86.cpp
+++ b/clang/lib/Basic/Targets/X86.cpp
@@ -508,8 +508,13 @@ void X86TargetInfo::getTargetDefines(const LangOptions 
,
   Builder.defineMacro("__GCC_ASM_FLAG_OUTPUTS__");
 
   std::string CodeModel = getTargetOpts().CodeModel;
-  if (CodeModel == "default")
-CodeModel = "small";
+  if (CodeModel == "default") {
+if (getTriple().isWindowsCygwinEnvironment() && getTriple().getArch() == 
llvm::Triple::x86_64) {
+  CodeModel = "medium";
+} else {
+  CodeModel = "small";
+}
+  }
   Builder.defineMacro("__code_model_" + CodeModel + "__");
 
   // Target identification.
diff --git a/clang/lib/Basic/Targets/X86.h b/clang/lib/Basic/Targets/X86.h
index 0ab1c10833db26..1664fcc417b148 100644
--- a/clang/lib/Basic/Targets/X86.h
+++ b/clang/lib/Basic/Targets/X86.h
@@ -643,8 +643,6 @@ class LLVM_LIBRARY_VISIBILITY CygwinX86_32TargetInfo : 
public X86_32TargetInfo {
 Builder.defineMacro("__CYGWIN32__");
 addCygMingDefines(Opts, Builder);
 DefineStd(Builder, "unix", Opts);
-if (Opts.CPlusPlus)
-  Builder.defineMacro("_GNU_SOURCE");
   }
 };
 
@@ -916,8 +914,6 @@ class LLVM_LIBRARY_VISIBILITY CygwinX86_64TargetInfo : 
public X86_64TargetInfo {
 Builder.defineMacro("__CYGWIN64__");
 addCygMingDefines(Opts, Builder);
 DefineStd(Builder, "unix", Opts);
-if (Opts.CPlusPlus)
-  Builder.defineMacro("_GNU_SOURCE");
   }
 };
 

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


[clang] [Cygwin] Cygwin general (PR #74936)

2023-12-09 Thread Xu Chiheng via cfe-commits

https://github.com/xu-chiheng edited 
https://github.com/llvm/llvm-project/pull/74936
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [Cygwin] Cygwin general (PR #74936)

2023-12-09 Thread Xu Chiheng via cfe-commits

https://github.com/xu-chiheng updated 
https://github.com/llvm/llvm-project/pull/74936

From 50e6b5d3cd9e1a8dbcd1608d439cbc3a0deb0a1a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?=
 
Date: Sun, 10 Dec 2023 00:34:27 +0800
Subject: [PATCH] 1

---
 clang/lib/Headers/mm_malloc.h |  6 +++---
 clang/tools/libclang/CIndexer.cpp | 10 ++
 2 files changed, 5 insertions(+), 11 deletions(-)

diff --git a/clang/lib/Headers/mm_malloc.h b/clang/lib/Headers/mm_malloc.h
index d32fe59416277..6f46f10ee50f3 100644
--- a/clang/lib/Headers/mm_malloc.h
+++ b/clang/lib/Headers/mm_malloc.h
@@ -12,7 +12,7 @@
 
 #include 
 
-#ifdef _WIN32
+#if defined(_WIN32) && !defined(__CYGWIN__)
 #include 
 #else
 #ifndef __cplusplus
@@ -41,7 +41,7 @@ _mm_malloc(size_t __size, size_t __align) {
   void *__mallocedMemory;
 #if defined(__MINGW32__)
   __mallocedMemory = __mingw_aligned_malloc(__size, __align);
-#elif defined(_WIN32)
+#elif defined(_WIN32) && !defined(__CYGWIN__)
   __mallocedMemory = _aligned_malloc(__size, __align);
 #else
   if (posix_memalign(&__mallocedMemory, __align, __size))
@@ -56,7 +56,7 @@ _mm_free(void *__p)
 {
 #if defined(__MINGW32__)
   __mingw_aligned_free(__p);
-#elif defined(_WIN32)
+#elif defined(_WIN32) && !defined(__CYGWIN__)
   _aligned_free(__p);
 #else
   free(__p);
diff --git a/clang/tools/libclang/CIndexer.cpp 
b/clang/tools/libclang/CIndexer.cpp
index 77da2e4fa5ead..d1bd7ad49c5f4 100644
--- a/clang/tools/libclang/CIndexer.cpp
+++ b/clang/tools/libclang/CIndexer.cpp
@@ -26,12 +26,10 @@
 #include 
 
 #ifdef __CYGWIN__
-#include 
 #include 
-#define _WIN32 1
 #endif
 
-#ifdef _WIN32
+#if defined(_WIN32) || defined(__CYGWIN__)
 #include 
 #elif defined(_AIX)
 #include 
@@ -104,7 +102,7 @@ const std::string ::getClangResourcesPath() {
   SmallString<128> LibClangPath;
 
   // Find the location where this library lives (libclang.dylib).
-#ifdef _WIN32
+#if defined(_WIN32) || defined(__CYGWIN__)
   MEMORY_BASIC_INFORMATION mbi;
   char path[MAX_PATH];
   VirtualQuery((void *)(uintptr_t)clang_createTranslationUnit, ,
@@ -114,11 +112,7 @@ const std::string ::getClangResourcesPath() {
 #ifdef __CYGWIN__
   char w32path[MAX_PATH];
   strcpy(w32path, path);
-#if CYGWIN_VERSION_API_MAJOR > 0 || CYGWIN_VERSION_API_MINOR >= 181
   cygwin_conv_path(CCP_WIN_A_TO_POSIX, w32path, path, MAX_PATH);
-#else
-  cygwin_conv_to_full_posix_path(w32path, path);
-#endif
 #endif
 
   LibClangPath += path;

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


[llvm] [clang] [Cygwin] Cygwin general (PR #74936)

2023-12-09 Thread Xu Chiheng via cfe-commits

https://github.com/xu-chiheng created 
https://github.com/llvm/llvm-project/pull/74936

Remove some uses of macro __CYGWIN__ .
Fix build error by Clang due to the conflict of CIndexer.cpp and mm_malloc.h. 
In mm_malloc.h, _WIN32 and __CYGWIN__ can't both be defined, but CIndexer.cpp 
define both.
Override Cygwin's buggy getpagesize() to Win32 computePageSize().


From d0578d50172d217618af652d5dfa87537225e41b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?=
 
Date: Sat, 9 Dec 2023 23:47:37 +0800
Subject: [PATCH] 1

---
 clang/lib/Headers/mm_malloc.h|  6 +++---
 clang/tools/libclang/CIndexer.cpp| 10 ++
 llvm/lib/Support/MemoryBuffer.cpp|  8 
 llvm/lib/Support/Process.cpp | 19 +++
 llvm/lib/Support/Unix/Process.inc|  4 +++-
 llvm/lib/Support/Windows/Process.inc | 13 -
 llvm/lib/Support/raw_ostream.cpp |  4 
 llvm/tools/lli/lli.cpp   |  7 ---
 8 files changed, 27 insertions(+), 44 deletions(-)

diff --git a/clang/lib/Headers/mm_malloc.h b/clang/lib/Headers/mm_malloc.h
index d32fe59416277..6f46f10ee50f3 100644
--- a/clang/lib/Headers/mm_malloc.h
+++ b/clang/lib/Headers/mm_malloc.h
@@ -12,7 +12,7 @@
 
 #include 
 
-#ifdef _WIN32
+#if defined(_WIN32) && !defined(__CYGWIN__)
 #include 
 #else
 #ifndef __cplusplus
@@ -41,7 +41,7 @@ _mm_malloc(size_t __size, size_t __align) {
   void *__mallocedMemory;
 #if defined(__MINGW32__)
   __mallocedMemory = __mingw_aligned_malloc(__size, __align);
-#elif defined(_WIN32)
+#elif defined(_WIN32) && !defined(__CYGWIN__)
   __mallocedMemory = _aligned_malloc(__size, __align);
 #else
   if (posix_memalign(&__mallocedMemory, __align, __size))
@@ -56,7 +56,7 @@ _mm_free(void *__p)
 {
 #if defined(__MINGW32__)
   __mingw_aligned_free(__p);
-#elif defined(_WIN32)
+#elif defined(_WIN32) && !defined(__CYGWIN__)
   _aligned_free(__p);
 #else
   free(__p);
diff --git a/clang/tools/libclang/CIndexer.cpp 
b/clang/tools/libclang/CIndexer.cpp
index 77da2e4fa5ead..d1bd7ad49c5f4 100644
--- a/clang/tools/libclang/CIndexer.cpp
+++ b/clang/tools/libclang/CIndexer.cpp
@@ -26,12 +26,10 @@
 #include 
 
 #ifdef __CYGWIN__
-#include 
 #include 
-#define _WIN32 1
 #endif
 
-#ifdef _WIN32
+#if defined(_WIN32) || defined(__CYGWIN__)
 #include 
 #elif defined(_AIX)
 #include 
@@ -104,7 +102,7 @@ const std::string ::getClangResourcesPath() {
   SmallString<128> LibClangPath;
 
   // Find the location where this library lives (libclang.dylib).
-#ifdef _WIN32
+#if defined(_WIN32) || defined(__CYGWIN__)
   MEMORY_BASIC_INFORMATION mbi;
   char path[MAX_PATH];
   VirtualQuery((void *)(uintptr_t)clang_createTranslationUnit, ,
@@ -114,11 +112,7 @@ const std::string ::getClangResourcesPath() {
 #ifdef __CYGWIN__
   char w32path[MAX_PATH];
   strcpy(w32path, path);
-#if CYGWIN_VERSION_API_MAJOR > 0 || CYGWIN_VERSION_API_MINOR >= 181
   cygwin_conv_path(CCP_WIN_A_TO_POSIX, w32path, path, MAX_PATH);
-#else
-  cygwin_conv_to_full_posix_path(w32path, path);
-#endif
 #endif
 
   LibClangPath += path;
diff --git a/llvm/lib/Support/MemoryBuffer.cpp 
b/llvm/lib/Support/MemoryBuffer.cpp
index 4cc4fe019b75b..8184b32575f21 100644
--- a/llvm/lib/Support/MemoryBuffer.cpp
+++ b/llvm/lib/Support/MemoryBuffer.cpp
@@ -384,14 +384,6 @@ static bool shouldUseMmap(sys::fs::file_t FD,
   if ((FileSize & (PageSize -1)) == 0)
 return false;
 
-#if defined(__CYGWIN__)
-  // Don't try to map files that are exactly a multiple of the physical page 
size
-  // if we need a null terminator.
-  // FIXME: We should reorganize again getPageSize() on Win32.
-  if ((FileSize & (4096 - 1)) == 0)
-return false;
-#endif
-
   return true;
 }
 
diff --git a/llvm/lib/Support/Process.cpp b/llvm/lib/Support/Process.cpp
index 30c64d3ed9ed1..6d4a7275f5fa6 100644
--- a/llvm/lib/Support/Process.cpp
+++ b/llvm/lib/Support/Process.cpp
@@ -23,6 +23,10 @@
 #include 
 #include  // for _Exit
 
+#if defined(_WIN32) || defined(__CYGWIN__)
+#include 
+#endif
+
 using namespace llvm;
 using namespace sys;
 
@@ -102,6 +106,21 @@ bool Process::AreCoreFilesPrevented() { return 
coreFilesPrevented; }
 ::exit(RetCode);
 }
 
+#if defined(_WIN32) || defined(__CYGWIN__)
+// This function retrieves the page size using GetNativeSystemInfo() and is
+// present solely so it can be called once to initialize the self_process 
member
+// below.
+static unsigned computePageSize() {
+  // GetNativeSystemInfo() provides the physical page size which may differ
+  // from GetSystemInfo() in 32-bit applications running under WOW64.
+  SYSTEM_INFO info;
+  GetNativeSystemInfo();
+  // FIXME: FileOffset in MapViewOfFile() should be aligned to not dwPageSize,
+  // but dwAllocationGranularity.
+  return static_cast(info.dwPageSize);
+}
+#endif
+
 // Include the platform-specific parts of this class.
 #ifdef LLVM_ON_UNIX
 #include "Unix/Process.inc"
diff --git a/llvm/lib/Support/Unix/Process.inc 
b/llvm/lib/Support/Unix/Process.inc
index 

[clang] [Cygwin] Cygwin driver (PR #74933)

2023-12-09 Thread Xu Chiheng via cfe-commits

https://github.com/xu-chiheng updated 
https://github.com/llvm/llvm-project/pull/74933

From daa6702f698724655b91c4fa52272c09924d2d83 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?=
 
Date: Sat, 9 Dec 2023 21:51:29 +0800
Subject: [PATCH 1/5] 1

---
 clang/lib/Driver/CMakeLists.txt|   1 +
 clang/lib/Driver/Driver.cpp|   4 +
 clang/lib/Driver/ToolChains/Cygwin.cpp | 731 +
 clang/lib/Driver/ToolChains/Cygwin.h   | 125 +
 clang/lib/Lex/InitHeaderSearch.cpp |  30 +-
 5 files changed, 865 insertions(+), 26 deletions(-)
 create mode 100644 clang/lib/Driver/ToolChains/Cygwin.cpp
 create mode 100644 clang/lib/Driver/ToolChains/Cygwin.h

diff --git a/clang/lib/Driver/CMakeLists.txt b/clang/lib/Driver/CMakeLists.txt
index 58427e3f83c420..7ab5a1ee963515 100644
--- a/clang/lib/Driver/CMakeLists.txt
+++ b/clang/lib/Driver/CMakeLists.txt
@@ -51,6 +51,7 @@ add_clang_library(clangDriver
   ToolChains/CrossWindows.cpp
   ToolChains/CSKYToolChain.cpp
   ToolChains/Cuda.cpp
+  ToolChains/Cygwin.cpp
   ToolChains/Darwin.cpp
   ToolChains/DragonFly.cpp
   ToolChains/Flang.cpp
diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
index e241706b9082ee..b6f3da3a006f4e 100644
--- a/clang/lib/Driver/Driver.cpp
+++ b/clang/lib/Driver/Driver.cpp
@@ -17,6 +17,7 @@
 #include "ToolChains/Clang.h"
 #include "ToolChains/CrossWindows.h"
 #include "ToolChains/Cuda.h"
+#include "ToolChains/Cygwin.h"
 #include "ToolChains/Darwin.h"
 #include "ToolChains/DragonFly.h"
 #include "ToolChains/FreeBSD.h"
@@ -6263,6 +6264,9 @@ const ToolChain ::getToolChain(const ArgList ,
 else
   TC = std::make_unique(*this, Target, Args);
 break;
+  case llvm::Triple::Cygnus:
+TC = std::make_unique(*this, Target, Args);
+break;
   case llvm::Triple::GNU:
 TC = std::make_unique(*this, Target, Args);
 break;
diff --git a/clang/lib/Driver/ToolChains/Cygwin.cpp 
b/clang/lib/Driver/ToolChains/Cygwin.cpp
new file mode 100644
index 00..8aa9cf5c8ec034
--- /dev/null
+++ b/clang/lib/Driver/ToolChains/Cygwin.cpp
@@ -0,0 +1,731 @@
+//===--- Cygwin.cpp - CygwinToolChain Implementation 
===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#include "Cygwin.h"
+#include "CommonArgs.h"
+#include "clang/Config/config.h"
+#include "clang/Driver/Compilation.h"
+#include "clang/Driver/Driver.h"
+#include "clang/Driver/DriverDiagnostic.h"
+#include "clang/Driver/InputInfo.h"
+#include "clang/Driver/Options.h"
+#include "clang/Driver/SanitizerArgs.h"
+#include "llvm/Option/ArgList.h"
+#include "llvm/Support/FileSystem.h"
+#include "llvm/Support/Path.h"
+#include "llvm/Support/VirtualFileSystem.h"
+#include 
+
+using namespace clang::diag;
+using namespace clang::driver;
+using namespace clang;
+using namespace llvm::opt;
+
+/// Cygwin Tools
+void tools::Cygwin::Assembler::ConstructJob(Compilation , const JobAction 
,
+   const InputInfo ,
+   const InputInfoList ,
+   const ArgList ,
+   const char *LinkingOutput) const {
+  claimNoWarnArgs(Args);
+  ArgStringList CmdArgs;
+
+  if (getToolChain().getArch() == llvm::Triple::x86) {
+CmdArgs.push_back("--32");
+  } else if (getToolChain().getArch() == llvm::Triple::x86_64) {
+CmdArgs.push_back("--64");
+  }
+
+  Args.AddAllArgValues(CmdArgs, options::OPT_Wa_COMMA, 
options::OPT_Xassembler);
+
+  CmdArgs.push_back("-o");
+  CmdArgs.push_back(Output.getFilename());
+
+  for (const auto  : Inputs)
+CmdArgs.push_back(II.getFilename());
+
+  const char *Exec = Args.MakeArgString(getToolChain().GetProgramPath("as"));
+  C.addCommand(std::make_unique(JA, *this, 
ResponseFileSupport::None(),
+ Exec, CmdArgs, Inputs, Output));
+
+  if (Args.hasArg(options::OPT_gsplit_dwarf))
+SplitDebugInfo(getToolChain(), C, *this, JA, Args, Output,
+   SplitDebugName(JA, Args, Inputs[0], Output));
+}
+
+void tools::Cygwin::Linker::AddLibGCC(const ArgList ,
+ ArgStringList ) const {
+  // Make use of compiler-rt if --rtlib option is used
+  ToolChain::RuntimeLibType RLT = getToolChain().GetRuntimeLibType(Args);
+  if (RLT == ToolChain::RLT_Libgcc) {
+bool Static = Args.hasArg(options::OPT_static_libgcc) ||
+  Args.hasArg(options::OPT_static);
+bool Shared = Args.hasArg(options::OPT_shared);
+bool CXX = getToolChain().getDriver().CCCIsCXX();
+
+if (Static || (!CXX && !Shared)) {
+  CmdArgs.push_back("-lgcc");
+  

[clang] [Cygwin] Cygwin driver (PR #74933)

2023-12-09 Thread Xu Chiheng via cfe-commits

https://github.com/xu-chiheng updated 
https://github.com/llvm/llvm-project/pull/74933

From daa6702f698724655b91c4fa52272c09924d2d83 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?=
 
Date: Sat, 9 Dec 2023 21:51:29 +0800
Subject: [PATCH 1/3] 1

---
 clang/lib/Driver/CMakeLists.txt|   1 +
 clang/lib/Driver/Driver.cpp|   4 +
 clang/lib/Driver/ToolChains/Cygwin.cpp | 731 +
 clang/lib/Driver/ToolChains/Cygwin.h   | 125 +
 clang/lib/Lex/InitHeaderSearch.cpp |  30 +-
 5 files changed, 865 insertions(+), 26 deletions(-)
 create mode 100644 clang/lib/Driver/ToolChains/Cygwin.cpp
 create mode 100644 clang/lib/Driver/ToolChains/Cygwin.h

diff --git a/clang/lib/Driver/CMakeLists.txt b/clang/lib/Driver/CMakeLists.txt
index 58427e3f83c42..7ab5a1ee96351 100644
--- a/clang/lib/Driver/CMakeLists.txt
+++ b/clang/lib/Driver/CMakeLists.txt
@@ -51,6 +51,7 @@ add_clang_library(clangDriver
   ToolChains/CrossWindows.cpp
   ToolChains/CSKYToolChain.cpp
   ToolChains/Cuda.cpp
+  ToolChains/Cygwin.cpp
   ToolChains/Darwin.cpp
   ToolChains/DragonFly.cpp
   ToolChains/Flang.cpp
diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
index e241706b9082e..b6f3da3a006f4 100644
--- a/clang/lib/Driver/Driver.cpp
+++ b/clang/lib/Driver/Driver.cpp
@@ -17,6 +17,7 @@
 #include "ToolChains/Clang.h"
 #include "ToolChains/CrossWindows.h"
 #include "ToolChains/Cuda.h"
+#include "ToolChains/Cygwin.h"
 #include "ToolChains/Darwin.h"
 #include "ToolChains/DragonFly.h"
 #include "ToolChains/FreeBSD.h"
@@ -6263,6 +6264,9 @@ const ToolChain ::getToolChain(const ArgList ,
 else
   TC = std::make_unique(*this, Target, Args);
 break;
+  case llvm::Triple::Cygnus:
+TC = std::make_unique(*this, Target, Args);
+break;
   case llvm::Triple::GNU:
 TC = std::make_unique(*this, Target, Args);
 break;
diff --git a/clang/lib/Driver/ToolChains/Cygwin.cpp 
b/clang/lib/Driver/ToolChains/Cygwin.cpp
new file mode 100644
index 0..8aa9cf5c8ec03
--- /dev/null
+++ b/clang/lib/Driver/ToolChains/Cygwin.cpp
@@ -0,0 +1,731 @@
+//===--- Cygwin.cpp - CygwinToolChain Implementation 
===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#include "Cygwin.h"
+#include "CommonArgs.h"
+#include "clang/Config/config.h"
+#include "clang/Driver/Compilation.h"
+#include "clang/Driver/Driver.h"
+#include "clang/Driver/DriverDiagnostic.h"
+#include "clang/Driver/InputInfo.h"
+#include "clang/Driver/Options.h"
+#include "clang/Driver/SanitizerArgs.h"
+#include "llvm/Option/ArgList.h"
+#include "llvm/Support/FileSystem.h"
+#include "llvm/Support/Path.h"
+#include "llvm/Support/VirtualFileSystem.h"
+#include 
+
+using namespace clang::diag;
+using namespace clang::driver;
+using namespace clang;
+using namespace llvm::opt;
+
+/// Cygwin Tools
+void tools::Cygwin::Assembler::ConstructJob(Compilation , const JobAction 
,
+   const InputInfo ,
+   const InputInfoList ,
+   const ArgList ,
+   const char *LinkingOutput) const {
+  claimNoWarnArgs(Args);
+  ArgStringList CmdArgs;
+
+  if (getToolChain().getArch() == llvm::Triple::x86) {
+CmdArgs.push_back("--32");
+  } else if (getToolChain().getArch() == llvm::Triple::x86_64) {
+CmdArgs.push_back("--64");
+  }
+
+  Args.AddAllArgValues(CmdArgs, options::OPT_Wa_COMMA, 
options::OPT_Xassembler);
+
+  CmdArgs.push_back("-o");
+  CmdArgs.push_back(Output.getFilename());
+
+  for (const auto  : Inputs)
+CmdArgs.push_back(II.getFilename());
+
+  const char *Exec = Args.MakeArgString(getToolChain().GetProgramPath("as"));
+  C.addCommand(std::make_unique(JA, *this, 
ResponseFileSupport::None(),
+ Exec, CmdArgs, Inputs, Output));
+
+  if (Args.hasArg(options::OPT_gsplit_dwarf))
+SplitDebugInfo(getToolChain(), C, *this, JA, Args, Output,
+   SplitDebugName(JA, Args, Inputs[0], Output));
+}
+
+void tools::Cygwin::Linker::AddLibGCC(const ArgList ,
+ ArgStringList ) const {
+  // Make use of compiler-rt if --rtlib option is used
+  ToolChain::RuntimeLibType RLT = getToolChain().GetRuntimeLibType(Args);
+  if (RLT == ToolChain::RLT_Libgcc) {
+bool Static = Args.hasArg(options::OPT_static_libgcc) ||
+  Args.hasArg(options::OPT_static);
+bool Shared = Args.hasArg(options::OPT_shared);
+bool CXX = getToolChain().getDriver().CCCIsCXX();
+
+if (Static || (!CXX && !Shared)) {
+  CmdArgs.push_back("-lgcc");
+  

[clang] [Cygwin] Cygwin driver (PR #74933)

2023-12-09 Thread Xu Chiheng via cfe-commits

https://github.com/xu-chiheng updated 
https://github.com/llvm/llvm-project/pull/74933

From daa6702f698724655b91c4fa52272c09924d2d83 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?=
 
Date: Sat, 9 Dec 2023 21:51:29 +0800
Subject: [PATCH 1/2] 1

---
 clang/lib/Driver/CMakeLists.txt|   1 +
 clang/lib/Driver/Driver.cpp|   4 +
 clang/lib/Driver/ToolChains/Cygwin.cpp | 731 +
 clang/lib/Driver/ToolChains/Cygwin.h   | 125 +
 clang/lib/Lex/InitHeaderSearch.cpp |  30 +-
 5 files changed, 865 insertions(+), 26 deletions(-)
 create mode 100644 clang/lib/Driver/ToolChains/Cygwin.cpp
 create mode 100644 clang/lib/Driver/ToolChains/Cygwin.h

diff --git a/clang/lib/Driver/CMakeLists.txt b/clang/lib/Driver/CMakeLists.txt
index 58427e3f83c420..7ab5a1ee963515 100644
--- a/clang/lib/Driver/CMakeLists.txt
+++ b/clang/lib/Driver/CMakeLists.txt
@@ -51,6 +51,7 @@ add_clang_library(clangDriver
   ToolChains/CrossWindows.cpp
   ToolChains/CSKYToolChain.cpp
   ToolChains/Cuda.cpp
+  ToolChains/Cygwin.cpp
   ToolChains/Darwin.cpp
   ToolChains/DragonFly.cpp
   ToolChains/Flang.cpp
diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
index e241706b9082ee..b6f3da3a006f4e 100644
--- a/clang/lib/Driver/Driver.cpp
+++ b/clang/lib/Driver/Driver.cpp
@@ -17,6 +17,7 @@
 #include "ToolChains/Clang.h"
 #include "ToolChains/CrossWindows.h"
 #include "ToolChains/Cuda.h"
+#include "ToolChains/Cygwin.h"
 #include "ToolChains/Darwin.h"
 #include "ToolChains/DragonFly.h"
 #include "ToolChains/FreeBSD.h"
@@ -6263,6 +6264,9 @@ const ToolChain ::getToolChain(const ArgList ,
 else
   TC = std::make_unique(*this, Target, Args);
 break;
+  case llvm::Triple::Cygnus:
+TC = std::make_unique(*this, Target, Args);
+break;
   case llvm::Triple::GNU:
 TC = std::make_unique(*this, Target, Args);
 break;
diff --git a/clang/lib/Driver/ToolChains/Cygwin.cpp 
b/clang/lib/Driver/ToolChains/Cygwin.cpp
new file mode 100644
index 00..8aa9cf5c8ec034
--- /dev/null
+++ b/clang/lib/Driver/ToolChains/Cygwin.cpp
@@ -0,0 +1,731 @@
+//===--- Cygwin.cpp - CygwinToolChain Implementation 
===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#include "Cygwin.h"
+#include "CommonArgs.h"
+#include "clang/Config/config.h"
+#include "clang/Driver/Compilation.h"
+#include "clang/Driver/Driver.h"
+#include "clang/Driver/DriverDiagnostic.h"
+#include "clang/Driver/InputInfo.h"
+#include "clang/Driver/Options.h"
+#include "clang/Driver/SanitizerArgs.h"
+#include "llvm/Option/ArgList.h"
+#include "llvm/Support/FileSystem.h"
+#include "llvm/Support/Path.h"
+#include "llvm/Support/VirtualFileSystem.h"
+#include 
+
+using namespace clang::diag;
+using namespace clang::driver;
+using namespace clang;
+using namespace llvm::opt;
+
+/// Cygwin Tools
+void tools::Cygwin::Assembler::ConstructJob(Compilation , const JobAction 
,
+   const InputInfo ,
+   const InputInfoList ,
+   const ArgList ,
+   const char *LinkingOutput) const {
+  claimNoWarnArgs(Args);
+  ArgStringList CmdArgs;
+
+  if (getToolChain().getArch() == llvm::Triple::x86) {
+CmdArgs.push_back("--32");
+  } else if (getToolChain().getArch() == llvm::Triple::x86_64) {
+CmdArgs.push_back("--64");
+  }
+
+  Args.AddAllArgValues(CmdArgs, options::OPT_Wa_COMMA, 
options::OPT_Xassembler);
+
+  CmdArgs.push_back("-o");
+  CmdArgs.push_back(Output.getFilename());
+
+  for (const auto  : Inputs)
+CmdArgs.push_back(II.getFilename());
+
+  const char *Exec = Args.MakeArgString(getToolChain().GetProgramPath("as"));
+  C.addCommand(std::make_unique(JA, *this, 
ResponseFileSupport::None(),
+ Exec, CmdArgs, Inputs, Output));
+
+  if (Args.hasArg(options::OPT_gsplit_dwarf))
+SplitDebugInfo(getToolChain(), C, *this, JA, Args, Output,
+   SplitDebugName(JA, Args, Inputs[0], Output));
+}
+
+void tools::Cygwin::Linker::AddLibGCC(const ArgList ,
+ ArgStringList ) const {
+  // Make use of compiler-rt if --rtlib option is used
+  ToolChain::RuntimeLibType RLT = getToolChain().GetRuntimeLibType(Args);
+  if (RLT == ToolChain::RLT_Libgcc) {
+bool Static = Args.hasArg(options::OPT_static_libgcc) ||
+  Args.hasArg(options::OPT_static);
+bool Shared = Args.hasArg(options::OPT_shared);
+bool CXX = getToolChain().getDriver().CCCIsCXX();
+
+if (Static || (!CXX && !Shared)) {
+  CmdArgs.push_back("-lgcc");
+  

[clang] [Cygwin] Cygwin driver (PR #74933)

2023-12-09 Thread Xu Chiheng via cfe-commits

https://github.com/xu-chiheng updated 
https://github.com/llvm/llvm-project/pull/74933

From daa6702f698724655b91c4fa52272c09924d2d83 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?=
 
Date: Sat, 9 Dec 2023 21:51:29 +0800
Subject: [PATCH] 1

---
 clang/lib/Driver/CMakeLists.txt|   1 +
 clang/lib/Driver/Driver.cpp|   4 +
 clang/lib/Driver/ToolChains/Cygwin.cpp | 731 +
 clang/lib/Driver/ToolChains/Cygwin.h   | 125 +
 clang/lib/Lex/InitHeaderSearch.cpp |  30 +-
 5 files changed, 865 insertions(+), 26 deletions(-)
 create mode 100644 clang/lib/Driver/ToolChains/Cygwin.cpp
 create mode 100644 clang/lib/Driver/ToolChains/Cygwin.h

diff --git a/clang/lib/Driver/CMakeLists.txt b/clang/lib/Driver/CMakeLists.txt
index 58427e3f83c42..7ab5a1ee96351 100644
--- a/clang/lib/Driver/CMakeLists.txt
+++ b/clang/lib/Driver/CMakeLists.txt
@@ -51,6 +51,7 @@ add_clang_library(clangDriver
   ToolChains/CrossWindows.cpp
   ToolChains/CSKYToolChain.cpp
   ToolChains/Cuda.cpp
+  ToolChains/Cygwin.cpp
   ToolChains/Darwin.cpp
   ToolChains/DragonFly.cpp
   ToolChains/Flang.cpp
diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
index e241706b9082e..b6f3da3a006f4 100644
--- a/clang/lib/Driver/Driver.cpp
+++ b/clang/lib/Driver/Driver.cpp
@@ -17,6 +17,7 @@
 #include "ToolChains/Clang.h"
 #include "ToolChains/CrossWindows.h"
 #include "ToolChains/Cuda.h"
+#include "ToolChains/Cygwin.h"
 #include "ToolChains/Darwin.h"
 #include "ToolChains/DragonFly.h"
 #include "ToolChains/FreeBSD.h"
@@ -6263,6 +6264,9 @@ const ToolChain ::getToolChain(const ArgList ,
 else
   TC = std::make_unique(*this, Target, Args);
 break;
+  case llvm::Triple::Cygnus:
+TC = std::make_unique(*this, Target, Args);
+break;
   case llvm::Triple::GNU:
 TC = std::make_unique(*this, Target, Args);
 break;
diff --git a/clang/lib/Driver/ToolChains/Cygwin.cpp 
b/clang/lib/Driver/ToolChains/Cygwin.cpp
new file mode 100644
index 0..8aa9cf5c8ec03
--- /dev/null
+++ b/clang/lib/Driver/ToolChains/Cygwin.cpp
@@ -0,0 +1,731 @@
+//===--- Cygwin.cpp - CygwinToolChain Implementation 
===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#include "Cygwin.h"
+#include "CommonArgs.h"
+#include "clang/Config/config.h"
+#include "clang/Driver/Compilation.h"
+#include "clang/Driver/Driver.h"
+#include "clang/Driver/DriverDiagnostic.h"
+#include "clang/Driver/InputInfo.h"
+#include "clang/Driver/Options.h"
+#include "clang/Driver/SanitizerArgs.h"
+#include "llvm/Option/ArgList.h"
+#include "llvm/Support/FileSystem.h"
+#include "llvm/Support/Path.h"
+#include "llvm/Support/VirtualFileSystem.h"
+#include 
+
+using namespace clang::diag;
+using namespace clang::driver;
+using namespace clang;
+using namespace llvm::opt;
+
+/// Cygwin Tools
+void tools::Cygwin::Assembler::ConstructJob(Compilation , const JobAction 
,
+   const InputInfo ,
+   const InputInfoList ,
+   const ArgList ,
+   const char *LinkingOutput) const {
+  claimNoWarnArgs(Args);
+  ArgStringList CmdArgs;
+
+  if (getToolChain().getArch() == llvm::Triple::x86) {
+CmdArgs.push_back("--32");
+  } else if (getToolChain().getArch() == llvm::Triple::x86_64) {
+CmdArgs.push_back("--64");
+  }
+
+  Args.AddAllArgValues(CmdArgs, options::OPT_Wa_COMMA, 
options::OPT_Xassembler);
+
+  CmdArgs.push_back("-o");
+  CmdArgs.push_back(Output.getFilename());
+
+  for (const auto  : Inputs)
+CmdArgs.push_back(II.getFilename());
+
+  const char *Exec = Args.MakeArgString(getToolChain().GetProgramPath("as"));
+  C.addCommand(std::make_unique(JA, *this, 
ResponseFileSupport::None(),
+ Exec, CmdArgs, Inputs, Output));
+
+  if (Args.hasArg(options::OPT_gsplit_dwarf))
+SplitDebugInfo(getToolChain(), C, *this, JA, Args, Output,
+   SplitDebugName(JA, Args, Inputs[0], Output));
+}
+
+void tools::Cygwin::Linker::AddLibGCC(const ArgList ,
+ ArgStringList ) const {
+  // Make use of compiler-rt if --rtlib option is used
+  ToolChain::RuntimeLibType RLT = getToolChain().GetRuntimeLibType(Args);
+  if (RLT == ToolChain::RLT_Libgcc) {
+bool Static = Args.hasArg(options::OPT_static_libgcc) ||
+  Args.hasArg(options::OPT_static);
+bool Shared = Args.hasArg(options::OPT_shared);
+bool CXX = getToolChain().getDriver().CCCIsCXX();
+
+if (Static || (!CXX && !Shared)) {
+  CmdArgs.push_back("-lgcc");
+  

[clang] [Cygwin] Cygwin driver (PR #74933)

2023-12-09 Thread Xu Chiheng via cfe-commits

https://github.com/xu-chiheng updated 
https://github.com/llvm/llvm-project/pull/74933

From daa6702f698724655b91c4fa52272c09924d2d83 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?=
 
Date: Sat, 9 Dec 2023 21:51:29 +0800
Subject: [PATCH 1/2] 1

---
 clang/lib/Driver/CMakeLists.txt|   1 +
 clang/lib/Driver/Driver.cpp|   4 +
 clang/lib/Driver/ToolChains/Cygwin.cpp | 731 +
 clang/lib/Driver/ToolChains/Cygwin.h   | 125 +
 clang/lib/Lex/InitHeaderSearch.cpp |  30 +-
 5 files changed, 865 insertions(+), 26 deletions(-)
 create mode 100644 clang/lib/Driver/ToolChains/Cygwin.cpp
 create mode 100644 clang/lib/Driver/ToolChains/Cygwin.h

diff --git a/clang/lib/Driver/CMakeLists.txt b/clang/lib/Driver/CMakeLists.txt
index 58427e3f83c42..7ab5a1ee96351 100644
--- a/clang/lib/Driver/CMakeLists.txt
+++ b/clang/lib/Driver/CMakeLists.txt
@@ -51,6 +51,7 @@ add_clang_library(clangDriver
   ToolChains/CrossWindows.cpp
   ToolChains/CSKYToolChain.cpp
   ToolChains/Cuda.cpp
+  ToolChains/Cygwin.cpp
   ToolChains/Darwin.cpp
   ToolChains/DragonFly.cpp
   ToolChains/Flang.cpp
diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
index e241706b9082e..b6f3da3a006f4 100644
--- a/clang/lib/Driver/Driver.cpp
+++ b/clang/lib/Driver/Driver.cpp
@@ -17,6 +17,7 @@
 #include "ToolChains/Clang.h"
 #include "ToolChains/CrossWindows.h"
 #include "ToolChains/Cuda.h"
+#include "ToolChains/Cygwin.h"
 #include "ToolChains/Darwin.h"
 #include "ToolChains/DragonFly.h"
 #include "ToolChains/FreeBSD.h"
@@ -6263,6 +6264,9 @@ const ToolChain ::getToolChain(const ArgList ,
 else
   TC = std::make_unique(*this, Target, Args);
 break;
+  case llvm::Triple::Cygnus:
+TC = std::make_unique(*this, Target, Args);
+break;
   case llvm::Triple::GNU:
 TC = std::make_unique(*this, Target, Args);
 break;
diff --git a/clang/lib/Driver/ToolChains/Cygwin.cpp 
b/clang/lib/Driver/ToolChains/Cygwin.cpp
new file mode 100644
index 0..8aa9cf5c8ec03
--- /dev/null
+++ b/clang/lib/Driver/ToolChains/Cygwin.cpp
@@ -0,0 +1,731 @@
+//===--- Cygwin.cpp - CygwinToolChain Implementation 
===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#include "Cygwin.h"
+#include "CommonArgs.h"
+#include "clang/Config/config.h"
+#include "clang/Driver/Compilation.h"
+#include "clang/Driver/Driver.h"
+#include "clang/Driver/DriverDiagnostic.h"
+#include "clang/Driver/InputInfo.h"
+#include "clang/Driver/Options.h"
+#include "clang/Driver/SanitizerArgs.h"
+#include "llvm/Option/ArgList.h"
+#include "llvm/Support/FileSystem.h"
+#include "llvm/Support/Path.h"
+#include "llvm/Support/VirtualFileSystem.h"
+#include 
+
+using namespace clang::diag;
+using namespace clang::driver;
+using namespace clang;
+using namespace llvm::opt;
+
+/// Cygwin Tools
+void tools::Cygwin::Assembler::ConstructJob(Compilation , const JobAction 
,
+   const InputInfo ,
+   const InputInfoList ,
+   const ArgList ,
+   const char *LinkingOutput) const {
+  claimNoWarnArgs(Args);
+  ArgStringList CmdArgs;
+
+  if (getToolChain().getArch() == llvm::Triple::x86) {
+CmdArgs.push_back("--32");
+  } else if (getToolChain().getArch() == llvm::Triple::x86_64) {
+CmdArgs.push_back("--64");
+  }
+
+  Args.AddAllArgValues(CmdArgs, options::OPT_Wa_COMMA, 
options::OPT_Xassembler);
+
+  CmdArgs.push_back("-o");
+  CmdArgs.push_back(Output.getFilename());
+
+  for (const auto  : Inputs)
+CmdArgs.push_back(II.getFilename());
+
+  const char *Exec = Args.MakeArgString(getToolChain().GetProgramPath("as"));
+  C.addCommand(std::make_unique(JA, *this, 
ResponseFileSupport::None(),
+ Exec, CmdArgs, Inputs, Output));
+
+  if (Args.hasArg(options::OPT_gsplit_dwarf))
+SplitDebugInfo(getToolChain(), C, *this, JA, Args, Output,
+   SplitDebugName(JA, Args, Inputs[0], Output));
+}
+
+void tools::Cygwin::Linker::AddLibGCC(const ArgList ,
+ ArgStringList ) const {
+  // Make use of compiler-rt if --rtlib option is used
+  ToolChain::RuntimeLibType RLT = getToolChain().GetRuntimeLibType(Args);
+  if (RLT == ToolChain::RLT_Libgcc) {
+bool Static = Args.hasArg(options::OPT_static_libgcc) ||
+  Args.hasArg(options::OPT_static);
+bool Shared = Args.hasArg(options::OPT_shared);
+bool CXX = getToolChain().getDriver().CCCIsCXX();
+
+if (Static || (!CXX && !Shared)) {
+  CmdArgs.push_back("-lgcc");
+  

[clang] [Cygwin] Cygwin driver (PR #74933)

2023-12-09 Thread Xu Chiheng via cfe-commits

https://github.com/xu-chiheng created 
https://github.com/llvm/llvm-project/pull/74933

None

From daa6702f698724655b91c4fa52272c09924d2d83 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?=
 
Date: Sat, 9 Dec 2023 21:51:29 +0800
Subject: [PATCH] 1

---
 clang/lib/Driver/CMakeLists.txt|   1 +
 clang/lib/Driver/Driver.cpp|   4 +
 clang/lib/Driver/ToolChains/Cygwin.cpp | 731 +
 clang/lib/Driver/ToolChains/Cygwin.h   | 125 +
 clang/lib/Lex/InitHeaderSearch.cpp |  30 +-
 5 files changed, 865 insertions(+), 26 deletions(-)
 create mode 100644 clang/lib/Driver/ToolChains/Cygwin.cpp
 create mode 100644 clang/lib/Driver/ToolChains/Cygwin.h

diff --git a/clang/lib/Driver/CMakeLists.txt b/clang/lib/Driver/CMakeLists.txt
index 58427e3f83c42..7ab5a1ee96351 100644
--- a/clang/lib/Driver/CMakeLists.txt
+++ b/clang/lib/Driver/CMakeLists.txt
@@ -51,6 +51,7 @@ add_clang_library(clangDriver
   ToolChains/CrossWindows.cpp
   ToolChains/CSKYToolChain.cpp
   ToolChains/Cuda.cpp
+  ToolChains/Cygwin.cpp
   ToolChains/Darwin.cpp
   ToolChains/DragonFly.cpp
   ToolChains/Flang.cpp
diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
index e241706b9082e..b6f3da3a006f4 100644
--- a/clang/lib/Driver/Driver.cpp
+++ b/clang/lib/Driver/Driver.cpp
@@ -17,6 +17,7 @@
 #include "ToolChains/Clang.h"
 #include "ToolChains/CrossWindows.h"
 #include "ToolChains/Cuda.h"
+#include "ToolChains/Cygwin.h"
 #include "ToolChains/Darwin.h"
 #include "ToolChains/DragonFly.h"
 #include "ToolChains/FreeBSD.h"
@@ -6263,6 +6264,9 @@ const ToolChain ::getToolChain(const ArgList ,
 else
   TC = std::make_unique(*this, Target, Args);
 break;
+  case llvm::Triple::Cygnus:
+TC = std::make_unique(*this, Target, Args);
+break;
   case llvm::Triple::GNU:
 TC = std::make_unique(*this, Target, Args);
 break;
diff --git a/clang/lib/Driver/ToolChains/Cygwin.cpp 
b/clang/lib/Driver/ToolChains/Cygwin.cpp
new file mode 100644
index 0..8aa9cf5c8ec03
--- /dev/null
+++ b/clang/lib/Driver/ToolChains/Cygwin.cpp
@@ -0,0 +1,731 @@
+//===--- Cygwin.cpp - CygwinToolChain Implementation 
===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#include "Cygwin.h"
+#include "CommonArgs.h"
+#include "clang/Config/config.h"
+#include "clang/Driver/Compilation.h"
+#include "clang/Driver/Driver.h"
+#include "clang/Driver/DriverDiagnostic.h"
+#include "clang/Driver/InputInfo.h"
+#include "clang/Driver/Options.h"
+#include "clang/Driver/SanitizerArgs.h"
+#include "llvm/Option/ArgList.h"
+#include "llvm/Support/FileSystem.h"
+#include "llvm/Support/Path.h"
+#include "llvm/Support/VirtualFileSystem.h"
+#include 
+
+using namespace clang::diag;
+using namespace clang::driver;
+using namespace clang;
+using namespace llvm::opt;
+
+/// Cygwin Tools
+void tools::Cygwin::Assembler::ConstructJob(Compilation , const JobAction 
,
+   const InputInfo ,
+   const InputInfoList ,
+   const ArgList ,
+   const char *LinkingOutput) const {
+  claimNoWarnArgs(Args);
+  ArgStringList CmdArgs;
+
+  if (getToolChain().getArch() == llvm::Triple::x86) {
+CmdArgs.push_back("--32");
+  } else if (getToolChain().getArch() == llvm::Triple::x86_64) {
+CmdArgs.push_back("--64");
+  }
+
+  Args.AddAllArgValues(CmdArgs, options::OPT_Wa_COMMA, 
options::OPT_Xassembler);
+
+  CmdArgs.push_back("-o");
+  CmdArgs.push_back(Output.getFilename());
+
+  for (const auto  : Inputs)
+CmdArgs.push_back(II.getFilename());
+
+  const char *Exec = Args.MakeArgString(getToolChain().GetProgramPath("as"));
+  C.addCommand(std::make_unique(JA, *this, 
ResponseFileSupport::None(),
+ Exec, CmdArgs, Inputs, Output));
+
+  if (Args.hasArg(options::OPT_gsplit_dwarf))
+SplitDebugInfo(getToolChain(), C, *this, JA, Args, Output,
+   SplitDebugName(JA, Args, Inputs[0], Output));
+}
+
+void tools::Cygwin::Linker::AddLibGCC(const ArgList ,
+ ArgStringList ) const {
+  // Make use of compiler-rt if --rtlib option is used
+  ToolChain::RuntimeLibType RLT = getToolChain().GetRuntimeLibType(Args);
+  if (RLT == ToolChain::RLT_Libgcc) {
+bool Static = Args.hasArg(options::OPT_static_libgcc) ||
+  Args.hasArg(options::OPT_static);
+bool Shared = Args.hasArg(options::OPT_shared);
+bool CXX = getToolChain().getDriver().CCCIsCXX();
+
+if (Static || (!CXX && !Shared)) {
+  CmdArgs.push_back("-lgcc");
+  

[clang] [Cygwin] Cygwin -fuse-cxa-atexit (PR #74913)

2023-12-09 Thread Xu Chiheng via cfe-commits

https://github.com/xu-chiheng updated 
https://github.com/llvm/llvm-project/pull/74913

From 75a8486443ef200abe12b4047ac89011ada15802 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?=
 
Date: Sat, 9 Dec 2023 13:04:02 +0800
Subject: [PATCH 01/15] 1

---
 clang/lib/Driver/ToolChains/Clang.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index eb26bfade47b7a..df062ccc9021f7 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -6656,7 +6656,8 @@ void Clang::ConstructJob(Compilation , const JobAction 
,
   // -fuse-cxa-atexit is default.
   if (!Args.hasFlag(
   options::OPT_fuse_cxa_atexit, options::OPT_fno_use_cxa_atexit,
-  !RawTriple.isOSAIX() && !RawTriple.isOSWindows() &&
+  !RawTriple.isOSAIX() && !RawTriple.isWindowsGNUEnvironment() &&
+  !RawTriple.isWindowsMSVCEnvironment() &&
   ((RawTriple.getVendor() != llvm::Triple::MipsTechnologies) ||
RawTriple.hasEnvironment())) ||
   KernelOrKext)

From 899b095dd1953fc8a766dee221723dfbf1e3a3e5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?=
 
Date: Sat, 9 Dec 2023 13:24:01 +0800
Subject: [PATCH 02/15] 1

---
 clang/lib/Driver/ToolChains/Clang.cpp | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index df062ccc9021f7..eb26bfade47b7a 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -6656,8 +6656,7 @@ void Clang::ConstructJob(Compilation , const JobAction 
,
   // -fuse-cxa-atexit is default.
   if (!Args.hasFlag(
   options::OPT_fuse_cxa_atexit, options::OPT_fno_use_cxa_atexit,
-  !RawTriple.isOSAIX() && !RawTriple.isWindowsGNUEnvironment() &&
-  !RawTriple.isWindowsMSVCEnvironment() &&
+  !RawTriple.isOSAIX() && !RawTriple.isOSWindows() &&
   ((RawTriple.getVendor() != llvm::Triple::MipsTechnologies) ||
RawTriple.hasEnvironment())) ||
   KernelOrKext)

From 4fd5b816334bd8ccd8215f69f88dcbcc56f71857 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?=
 
Date: Sat, 9 Dec 2023 13:39:22 +0800
Subject: [PATCH 03/15] 1

---
 clang/lib/Driver/ToolChains/Clang.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index eb26bfade47b7a..fd75ad033c4dca 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -6656,7 +6656,7 @@ void Clang::ConstructJob(Compilation , const JobAction 
,
   // -fuse-cxa-atexit is default.
   if (!Args.hasFlag(
   options::OPT_fuse_cxa_atexit, options::OPT_fno_use_cxa_atexit,
-  !RawTriple.isOSAIX() && !RawTriple.isOSWindows() &&
+  !RawTriple.isOSAIX() && !(RawTriple.isOSWindows() && 
!RawTriple.isWindowsCygwinEnvironment()) &&
   ((RawTriple.getVendor() != llvm::Triple::MipsTechnologies) ||
RawTriple.hasEnvironment())) ||
   KernelOrKext)

From a51bba69eb1e2f7f509e42830e54ce71de99e74a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?=
 
Date: Sat, 9 Dec 2023 13:44:11 +0800
Subject: [PATCH 04/15] 1

---
 clang/lib/Driver/ToolChains/Clang.cpp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index fd75ad033c4dca..3e2c07399387d5 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -6656,7 +6656,9 @@ void Clang::ConstructJob(Compilation , const JobAction 
,
   // -fuse-cxa-atexit is default.
   if (!Args.hasFlag(
   options::OPT_fuse_cxa_atexit, options::OPT_fno_use_cxa_atexit,
-  !RawTriple.isOSAIX() && !(RawTriple.isOSWindows() && 
!RawTriple.isWindowsCygwinEnvironment()) &&
+  !RawTriple.isOSAIX() &&
+  !(RawTriple.isOSWindows() &&
+!RawTriple.isWindowsCygwinEnvironment()) &&
   ((RawTriple.getVendor() != llvm::Triple::MipsTechnologies) ||
RawTriple.hasEnvironment())) ||
   KernelOrKext)

From 3b906c82e613d08c6b153b355019dbf939045896 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?=
 
Date: Sat, 9 Dec 2023 14:07:41 +0800
Subject: [PATCH 05/15] 1

---
 clang/lib/Driver/ToolChains/Clang.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index 3e2c07399387d5..e67adf3d6616e6 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -6658,7 +6658,7 @@ void Clang::ConstructJob(Compilation , const 

[clang] [Cygwin] Cygwin -fuse-cxa-atexit (PR #74913)

2023-12-09 Thread Xu Chiheng via cfe-commits

https://github.com/xu-chiheng updated 
https://github.com/llvm/llvm-project/pull/74913

From 75a8486443ef200abe12b4047ac89011ada15802 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?=
 
Date: Sat, 9 Dec 2023 13:04:02 +0800
Subject: [PATCH 01/14] 1

---
 clang/lib/Driver/ToolChains/Clang.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index eb26bfade47b7a..df062ccc9021f7 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -6656,7 +6656,8 @@ void Clang::ConstructJob(Compilation , const JobAction 
,
   // -fuse-cxa-atexit is default.
   if (!Args.hasFlag(
   options::OPT_fuse_cxa_atexit, options::OPT_fno_use_cxa_atexit,
-  !RawTriple.isOSAIX() && !RawTriple.isOSWindows() &&
+  !RawTriple.isOSAIX() && !RawTriple.isWindowsGNUEnvironment() &&
+  !RawTriple.isWindowsMSVCEnvironment() &&
   ((RawTriple.getVendor() != llvm::Triple::MipsTechnologies) ||
RawTriple.hasEnvironment())) ||
   KernelOrKext)

From 899b095dd1953fc8a766dee221723dfbf1e3a3e5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?=
 
Date: Sat, 9 Dec 2023 13:24:01 +0800
Subject: [PATCH 02/14] 1

---
 clang/lib/Driver/ToolChains/Clang.cpp | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index df062ccc9021f7..eb26bfade47b7a 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -6656,8 +6656,7 @@ void Clang::ConstructJob(Compilation , const JobAction 
,
   // -fuse-cxa-atexit is default.
   if (!Args.hasFlag(
   options::OPT_fuse_cxa_atexit, options::OPT_fno_use_cxa_atexit,
-  !RawTriple.isOSAIX() && !RawTriple.isWindowsGNUEnvironment() &&
-  !RawTriple.isWindowsMSVCEnvironment() &&
+  !RawTriple.isOSAIX() && !RawTriple.isOSWindows() &&
   ((RawTriple.getVendor() != llvm::Triple::MipsTechnologies) ||
RawTriple.hasEnvironment())) ||
   KernelOrKext)

From 4fd5b816334bd8ccd8215f69f88dcbcc56f71857 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?=
 
Date: Sat, 9 Dec 2023 13:39:22 +0800
Subject: [PATCH 03/14] 1

---
 clang/lib/Driver/ToolChains/Clang.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index eb26bfade47b7a..fd75ad033c4dca 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -6656,7 +6656,7 @@ void Clang::ConstructJob(Compilation , const JobAction 
,
   // -fuse-cxa-atexit is default.
   if (!Args.hasFlag(
   options::OPT_fuse_cxa_atexit, options::OPT_fno_use_cxa_atexit,
-  !RawTriple.isOSAIX() && !RawTriple.isOSWindows() &&
+  !RawTriple.isOSAIX() && !(RawTriple.isOSWindows() && 
!RawTriple.isWindowsCygwinEnvironment()) &&
   ((RawTriple.getVendor() != llvm::Triple::MipsTechnologies) ||
RawTriple.hasEnvironment())) ||
   KernelOrKext)

From a51bba69eb1e2f7f509e42830e54ce71de99e74a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?=
 
Date: Sat, 9 Dec 2023 13:44:11 +0800
Subject: [PATCH 04/14] 1

---
 clang/lib/Driver/ToolChains/Clang.cpp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index fd75ad033c4dca..3e2c07399387d5 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -6656,7 +6656,9 @@ void Clang::ConstructJob(Compilation , const JobAction 
,
   // -fuse-cxa-atexit is default.
   if (!Args.hasFlag(
   options::OPT_fuse_cxa_atexit, options::OPT_fno_use_cxa_atexit,
-  !RawTriple.isOSAIX() && !(RawTriple.isOSWindows() && 
!RawTriple.isWindowsCygwinEnvironment()) &&
+  !RawTriple.isOSAIX() &&
+  !(RawTriple.isOSWindows() &&
+!RawTriple.isWindowsCygwinEnvironment()) &&
   ((RawTriple.getVendor() != llvm::Triple::MipsTechnologies) ||
RawTriple.hasEnvironment())) ||
   KernelOrKext)

From 3b906c82e613d08c6b153b355019dbf939045896 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?=
 
Date: Sat, 9 Dec 2023 14:07:41 +0800
Subject: [PATCH 05/14] 1

---
 clang/lib/Driver/ToolChains/Clang.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index 3e2c07399387d5..e67adf3d6616e6 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -6658,7 +6658,7 @@ void Clang::ConstructJob(Compilation , const 

[clang] [Cygwin] Cygwin -fuse-cxa-atexit (PR #74913)

2023-12-09 Thread Xu Chiheng via cfe-commits

https://github.com/xu-chiheng updated 
https://github.com/llvm/llvm-project/pull/74913

From 75a8486443ef200abe12b4047ac89011ada15802 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?=
 
Date: Sat, 9 Dec 2023 13:04:02 +0800
Subject: [PATCH 01/13] 1

---
 clang/lib/Driver/ToolChains/Clang.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index eb26bfade47b7..df062ccc9021f 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -6656,7 +6656,8 @@ void Clang::ConstructJob(Compilation , const JobAction 
,
   // -fuse-cxa-atexit is default.
   if (!Args.hasFlag(
   options::OPT_fuse_cxa_atexit, options::OPT_fno_use_cxa_atexit,
-  !RawTriple.isOSAIX() && !RawTriple.isOSWindows() &&
+  !RawTriple.isOSAIX() && !RawTriple.isWindowsGNUEnvironment() &&
+  !RawTriple.isWindowsMSVCEnvironment() &&
   ((RawTriple.getVendor() != llvm::Triple::MipsTechnologies) ||
RawTriple.hasEnvironment())) ||
   KernelOrKext)

From 899b095dd1953fc8a766dee221723dfbf1e3a3e5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?=
 
Date: Sat, 9 Dec 2023 13:24:01 +0800
Subject: [PATCH 02/13] 1

---
 clang/lib/Driver/ToolChains/Clang.cpp | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index df062ccc9021f..eb26bfade47b7 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -6656,8 +6656,7 @@ void Clang::ConstructJob(Compilation , const JobAction 
,
   // -fuse-cxa-atexit is default.
   if (!Args.hasFlag(
   options::OPT_fuse_cxa_atexit, options::OPT_fno_use_cxa_atexit,
-  !RawTriple.isOSAIX() && !RawTriple.isWindowsGNUEnvironment() &&
-  !RawTriple.isWindowsMSVCEnvironment() &&
+  !RawTriple.isOSAIX() && !RawTriple.isOSWindows() &&
   ((RawTriple.getVendor() != llvm::Triple::MipsTechnologies) ||
RawTriple.hasEnvironment())) ||
   KernelOrKext)

From 4fd5b816334bd8ccd8215f69f88dcbcc56f71857 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?=
 
Date: Sat, 9 Dec 2023 13:39:22 +0800
Subject: [PATCH 03/13] 1

---
 clang/lib/Driver/ToolChains/Clang.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index eb26bfade47b7..fd75ad033c4dc 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -6656,7 +6656,7 @@ void Clang::ConstructJob(Compilation , const JobAction 
,
   // -fuse-cxa-atexit is default.
   if (!Args.hasFlag(
   options::OPT_fuse_cxa_atexit, options::OPT_fno_use_cxa_atexit,
-  !RawTriple.isOSAIX() && !RawTriple.isOSWindows() &&
+  !RawTriple.isOSAIX() && !(RawTriple.isOSWindows() && 
!RawTriple.isWindowsCygwinEnvironment()) &&
   ((RawTriple.getVendor() != llvm::Triple::MipsTechnologies) ||
RawTriple.hasEnvironment())) ||
   KernelOrKext)

From a51bba69eb1e2f7f509e42830e54ce71de99e74a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?=
 
Date: Sat, 9 Dec 2023 13:44:11 +0800
Subject: [PATCH 04/13] 1

---
 clang/lib/Driver/ToolChains/Clang.cpp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index fd75ad033c4dc..3e2c07399387d 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -6656,7 +6656,9 @@ void Clang::ConstructJob(Compilation , const JobAction 
,
   // -fuse-cxa-atexit is default.
   if (!Args.hasFlag(
   options::OPT_fuse_cxa_atexit, options::OPT_fno_use_cxa_atexit,
-  !RawTriple.isOSAIX() && !(RawTriple.isOSWindows() && 
!RawTriple.isWindowsCygwinEnvironment()) &&
+  !RawTriple.isOSAIX() &&
+  !(RawTriple.isOSWindows() &&
+!RawTriple.isWindowsCygwinEnvironment()) &&
   ((RawTriple.getVendor() != llvm::Triple::MipsTechnologies) ||
RawTriple.hasEnvironment())) ||
   KernelOrKext)

From 3b906c82e613d08c6b153b355019dbf939045896 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?=
 
Date: Sat, 9 Dec 2023 14:07:41 +0800
Subject: [PATCH 05/13] 1

---
 clang/lib/Driver/ToolChains/Clang.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index 3e2c07399387d..e67adf3d6616e 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -6658,7 +6658,7 @@ void Clang::ConstructJob(Compilation , const JobAction 

[clang] [Cygwin] Cygwin -fuse-cxa-atexit (PR #74913)

2023-12-08 Thread Xu Chiheng via cfe-commits

https://github.com/xu-chiheng updated 
https://github.com/llvm/llvm-project/pull/74913

From 75a8486443ef200abe12b4047ac89011ada15802 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?=
 
Date: Sat, 9 Dec 2023 13:04:02 +0800
Subject: [PATCH 01/12] 1

---
 clang/lib/Driver/ToolChains/Clang.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index eb26bfade47b7a..df062ccc9021f7 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -6656,7 +6656,8 @@ void Clang::ConstructJob(Compilation , const JobAction 
,
   // -fuse-cxa-atexit is default.
   if (!Args.hasFlag(
   options::OPT_fuse_cxa_atexit, options::OPT_fno_use_cxa_atexit,
-  !RawTriple.isOSAIX() && !RawTriple.isOSWindows() &&
+  !RawTriple.isOSAIX() && !RawTriple.isWindowsGNUEnvironment() &&
+  !RawTriple.isWindowsMSVCEnvironment() &&
   ((RawTriple.getVendor() != llvm::Triple::MipsTechnologies) ||
RawTriple.hasEnvironment())) ||
   KernelOrKext)

From 899b095dd1953fc8a766dee221723dfbf1e3a3e5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?=
 
Date: Sat, 9 Dec 2023 13:24:01 +0800
Subject: [PATCH 02/12] 1

---
 clang/lib/Driver/ToolChains/Clang.cpp | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index df062ccc9021f7..eb26bfade47b7a 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -6656,8 +6656,7 @@ void Clang::ConstructJob(Compilation , const JobAction 
,
   // -fuse-cxa-atexit is default.
   if (!Args.hasFlag(
   options::OPT_fuse_cxa_atexit, options::OPT_fno_use_cxa_atexit,
-  !RawTriple.isOSAIX() && !RawTriple.isWindowsGNUEnvironment() &&
-  !RawTriple.isWindowsMSVCEnvironment() &&
+  !RawTriple.isOSAIX() && !RawTriple.isOSWindows() &&
   ((RawTriple.getVendor() != llvm::Triple::MipsTechnologies) ||
RawTriple.hasEnvironment())) ||
   KernelOrKext)

From 4fd5b816334bd8ccd8215f69f88dcbcc56f71857 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?=
 
Date: Sat, 9 Dec 2023 13:39:22 +0800
Subject: [PATCH 03/12] 1

---
 clang/lib/Driver/ToolChains/Clang.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index eb26bfade47b7a..fd75ad033c4dca 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -6656,7 +6656,7 @@ void Clang::ConstructJob(Compilation , const JobAction 
,
   // -fuse-cxa-atexit is default.
   if (!Args.hasFlag(
   options::OPT_fuse_cxa_atexit, options::OPT_fno_use_cxa_atexit,
-  !RawTriple.isOSAIX() && !RawTriple.isOSWindows() &&
+  !RawTriple.isOSAIX() && !(RawTriple.isOSWindows() && 
!RawTriple.isWindowsCygwinEnvironment()) &&
   ((RawTriple.getVendor() != llvm::Triple::MipsTechnologies) ||
RawTriple.hasEnvironment())) ||
   KernelOrKext)

From a51bba69eb1e2f7f509e42830e54ce71de99e74a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?=
 
Date: Sat, 9 Dec 2023 13:44:11 +0800
Subject: [PATCH 04/12] 1

---
 clang/lib/Driver/ToolChains/Clang.cpp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index fd75ad033c4dca..3e2c07399387d5 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -6656,7 +6656,9 @@ void Clang::ConstructJob(Compilation , const JobAction 
,
   // -fuse-cxa-atexit is default.
   if (!Args.hasFlag(
   options::OPT_fuse_cxa_atexit, options::OPT_fno_use_cxa_atexit,
-  !RawTriple.isOSAIX() && !(RawTriple.isOSWindows() && 
!RawTriple.isWindowsCygwinEnvironment()) &&
+  !RawTriple.isOSAIX() &&
+  !(RawTriple.isOSWindows() &&
+!RawTriple.isWindowsCygwinEnvironment()) &&
   ((RawTriple.getVendor() != llvm::Triple::MipsTechnologies) ||
RawTriple.hasEnvironment())) ||
   KernelOrKext)

From 3b906c82e613d08c6b153b355019dbf939045896 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?=
 
Date: Sat, 9 Dec 2023 14:07:41 +0800
Subject: [PATCH 05/12] 1

---
 clang/lib/Driver/ToolChains/Clang.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index 3e2c07399387d5..e67adf3d6616e6 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -6658,7 +6658,7 @@ void Clang::ConstructJob(Compilation , const 

[clang] [Cygwin] Cygwin -fuse-cxa-atexit (PR #74913)

2023-12-08 Thread Xu Chiheng via cfe-commits

https://github.com/xu-chiheng updated 
https://github.com/llvm/llvm-project/pull/74913

From 75a8486443ef200abe12b4047ac89011ada15802 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?=
 
Date: Sat, 9 Dec 2023 13:04:02 +0800
Subject: [PATCH 01/11] 1

---
 clang/lib/Driver/ToolChains/Clang.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index eb26bfade47b7a..df062ccc9021f7 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -6656,7 +6656,8 @@ void Clang::ConstructJob(Compilation , const JobAction 
,
   // -fuse-cxa-atexit is default.
   if (!Args.hasFlag(
   options::OPT_fuse_cxa_atexit, options::OPT_fno_use_cxa_atexit,
-  !RawTriple.isOSAIX() && !RawTriple.isOSWindows() &&
+  !RawTriple.isOSAIX() && !RawTriple.isWindowsGNUEnvironment() &&
+  !RawTriple.isWindowsMSVCEnvironment() &&
   ((RawTriple.getVendor() != llvm::Triple::MipsTechnologies) ||
RawTriple.hasEnvironment())) ||
   KernelOrKext)

From 899b095dd1953fc8a766dee221723dfbf1e3a3e5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?=
 
Date: Sat, 9 Dec 2023 13:24:01 +0800
Subject: [PATCH 02/11] 1

---
 clang/lib/Driver/ToolChains/Clang.cpp | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index df062ccc9021f7..eb26bfade47b7a 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -6656,8 +6656,7 @@ void Clang::ConstructJob(Compilation , const JobAction 
,
   // -fuse-cxa-atexit is default.
   if (!Args.hasFlag(
   options::OPT_fuse_cxa_atexit, options::OPT_fno_use_cxa_atexit,
-  !RawTriple.isOSAIX() && !RawTriple.isWindowsGNUEnvironment() &&
-  !RawTriple.isWindowsMSVCEnvironment() &&
+  !RawTriple.isOSAIX() && !RawTriple.isOSWindows() &&
   ((RawTriple.getVendor() != llvm::Triple::MipsTechnologies) ||
RawTriple.hasEnvironment())) ||
   KernelOrKext)

From 4fd5b816334bd8ccd8215f69f88dcbcc56f71857 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?=
 
Date: Sat, 9 Dec 2023 13:39:22 +0800
Subject: [PATCH 03/11] 1

---
 clang/lib/Driver/ToolChains/Clang.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index eb26bfade47b7a..fd75ad033c4dca 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -6656,7 +6656,7 @@ void Clang::ConstructJob(Compilation , const JobAction 
,
   // -fuse-cxa-atexit is default.
   if (!Args.hasFlag(
   options::OPT_fuse_cxa_atexit, options::OPT_fno_use_cxa_atexit,
-  !RawTriple.isOSAIX() && !RawTriple.isOSWindows() &&
+  !RawTriple.isOSAIX() && !(RawTriple.isOSWindows() && 
!RawTriple.isWindowsCygwinEnvironment()) &&
   ((RawTriple.getVendor() != llvm::Triple::MipsTechnologies) ||
RawTriple.hasEnvironment())) ||
   KernelOrKext)

From a51bba69eb1e2f7f509e42830e54ce71de99e74a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?=
 
Date: Sat, 9 Dec 2023 13:44:11 +0800
Subject: [PATCH 04/11] 1

---
 clang/lib/Driver/ToolChains/Clang.cpp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index fd75ad033c4dca..3e2c07399387d5 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -6656,7 +6656,9 @@ void Clang::ConstructJob(Compilation , const JobAction 
,
   // -fuse-cxa-atexit is default.
   if (!Args.hasFlag(
   options::OPT_fuse_cxa_atexit, options::OPT_fno_use_cxa_atexit,
-  !RawTriple.isOSAIX() && !(RawTriple.isOSWindows() && 
!RawTriple.isWindowsCygwinEnvironment()) &&
+  !RawTriple.isOSAIX() &&
+  !(RawTriple.isOSWindows() &&
+!RawTriple.isWindowsCygwinEnvironment()) &&
   ((RawTriple.getVendor() != llvm::Triple::MipsTechnologies) ||
RawTriple.hasEnvironment())) ||
   KernelOrKext)

From 3b906c82e613d08c6b153b355019dbf939045896 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?=
 
Date: Sat, 9 Dec 2023 14:07:41 +0800
Subject: [PATCH 05/11] 1

---
 clang/lib/Driver/ToolChains/Clang.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index 3e2c07399387d5..e67adf3d6616e6 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -6658,7 +6658,7 @@ void Clang::ConstructJob(Compilation , const 

[clang] [Cygwin] Cygwin -fuse-cxa-atexit (PR #74913)

2023-12-08 Thread Xu Chiheng via cfe-commits

https://github.com/xu-chiheng updated 
https://github.com/llvm/llvm-project/pull/74913

From 75a8486443ef200abe12b4047ac89011ada15802 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?=
 
Date: Sat, 9 Dec 2023 13:04:02 +0800
Subject: [PATCH 01/10] 1

---
 clang/lib/Driver/ToolChains/Clang.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index eb26bfade47b7a..df062ccc9021f7 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -6656,7 +6656,8 @@ void Clang::ConstructJob(Compilation , const JobAction 
,
   // -fuse-cxa-atexit is default.
   if (!Args.hasFlag(
   options::OPT_fuse_cxa_atexit, options::OPT_fno_use_cxa_atexit,
-  !RawTriple.isOSAIX() && !RawTriple.isOSWindows() &&
+  !RawTriple.isOSAIX() && !RawTriple.isWindowsGNUEnvironment() &&
+  !RawTriple.isWindowsMSVCEnvironment() &&
   ((RawTriple.getVendor() != llvm::Triple::MipsTechnologies) ||
RawTriple.hasEnvironment())) ||
   KernelOrKext)

From 899b095dd1953fc8a766dee221723dfbf1e3a3e5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?=
 
Date: Sat, 9 Dec 2023 13:24:01 +0800
Subject: [PATCH 02/10] 1

---
 clang/lib/Driver/ToolChains/Clang.cpp | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index df062ccc9021f7..eb26bfade47b7a 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -6656,8 +6656,7 @@ void Clang::ConstructJob(Compilation , const JobAction 
,
   // -fuse-cxa-atexit is default.
   if (!Args.hasFlag(
   options::OPT_fuse_cxa_atexit, options::OPT_fno_use_cxa_atexit,
-  !RawTriple.isOSAIX() && !RawTriple.isWindowsGNUEnvironment() &&
-  !RawTriple.isWindowsMSVCEnvironment() &&
+  !RawTriple.isOSAIX() && !RawTriple.isOSWindows() &&
   ((RawTriple.getVendor() != llvm::Triple::MipsTechnologies) ||
RawTriple.hasEnvironment())) ||
   KernelOrKext)

From 4fd5b816334bd8ccd8215f69f88dcbcc56f71857 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?=
 
Date: Sat, 9 Dec 2023 13:39:22 +0800
Subject: [PATCH 03/10] 1

---
 clang/lib/Driver/ToolChains/Clang.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index eb26bfade47b7a..fd75ad033c4dca 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -6656,7 +6656,7 @@ void Clang::ConstructJob(Compilation , const JobAction 
,
   // -fuse-cxa-atexit is default.
   if (!Args.hasFlag(
   options::OPT_fuse_cxa_atexit, options::OPT_fno_use_cxa_atexit,
-  !RawTriple.isOSAIX() && !RawTriple.isOSWindows() &&
+  !RawTriple.isOSAIX() && !(RawTriple.isOSWindows() && 
!RawTriple.isWindowsCygwinEnvironment()) &&
   ((RawTriple.getVendor() != llvm::Triple::MipsTechnologies) ||
RawTriple.hasEnvironment())) ||
   KernelOrKext)

From a51bba69eb1e2f7f509e42830e54ce71de99e74a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?=
 
Date: Sat, 9 Dec 2023 13:44:11 +0800
Subject: [PATCH 04/10] 1

---
 clang/lib/Driver/ToolChains/Clang.cpp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index fd75ad033c4dca..3e2c07399387d5 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -6656,7 +6656,9 @@ void Clang::ConstructJob(Compilation , const JobAction 
,
   // -fuse-cxa-atexit is default.
   if (!Args.hasFlag(
   options::OPT_fuse_cxa_atexit, options::OPT_fno_use_cxa_atexit,
-  !RawTriple.isOSAIX() && !(RawTriple.isOSWindows() && 
!RawTriple.isWindowsCygwinEnvironment()) &&
+  !RawTriple.isOSAIX() &&
+  !(RawTriple.isOSWindows() &&
+!RawTriple.isWindowsCygwinEnvironment()) &&
   ((RawTriple.getVendor() != llvm::Triple::MipsTechnologies) ||
RawTriple.hasEnvironment())) ||
   KernelOrKext)

From 3b906c82e613d08c6b153b355019dbf939045896 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?=
 
Date: Sat, 9 Dec 2023 14:07:41 +0800
Subject: [PATCH 05/10] 1

---
 clang/lib/Driver/ToolChains/Clang.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index 3e2c07399387d5..e67adf3d6616e6 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -6658,7 +6658,7 @@ void Clang::ConstructJob(Compilation , const 

[clang] [Cygwin] Cygwin -fuse-cxa-atexit (PR #74913)

2023-12-08 Thread Xu Chiheng via cfe-commits

https://github.com/xu-chiheng updated 
https://github.com/llvm/llvm-project/pull/74913

From 75a8486443ef200abe12b4047ac89011ada15802 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?=
 
Date: Sat, 9 Dec 2023 13:04:02 +0800
Subject: [PATCH 1/9] 1

---
 clang/lib/Driver/ToolChains/Clang.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index eb26bfade47b7a..df062ccc9021f7 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -6656,7 +6656,8 @@ void Clang::ConstructJob(Compilation , const JobAction 
,
   // -fuse-cxa-atexit is default.
   if (!Args.hasFlag(
   options::OPT_fuse_cxa_atexit, options::OPT_fno_use_cxa_atexit,
-  !RawTriple.isOSAIX() && !RawTriple.isOSWindows() &&
+  !RawTriple.isOSAIX() && !RawTriple.isWindowsGNUEnvironment() &&
+  !RawTriple.isWindowsMSVCEnvironment() &&
   ((RawTriple.getVendor() != llvm::Triple::MipsTechnologies) ||
RawTriple.hasEnvironment())) ||
   KernelOrKext)

From 899b095dd1953fc8a766dee221723dfbf1e3a3e5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?=
 
Date: Sat, 9 Dec 2023 13:24:01 +0800
Subject: [PATCH 2/9] 1

---
 clang/lib/Driver/ToolChains/Clang.cpp | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index df062ccc9021f7..eb26bfade47b7a 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -6656,8 +6656,7 @@ void Clang::ConstructJob(Compilation , const JobAction 
,
   // -fuse-cxa-atexit is default.
   if (!Args.hasFlag(
   options::OPT_fuse_cxa_atexit, options::OPT_fno_use_cxa_atexit,
-  !RawTriple.isOSAIX() && !RawTriple.isWindowsGNUEnvironment() &&
-  !RawTriple.isWindowsMSVCEnvironment() &&
+  !RawTriple.isOSAIX() && !RawTriple.isOSWindows() &&
   ((RawTriple.getVendor() != llvm::Triple::MipsTechnologies) ||
RawTriple.hasEnvironment())) ||
   KernelOrKext)

From 4fd5b816334bd8ccd8215f69f88dcbcc56f71857 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?=
 
Date: Sat, 9 Dec 2023 13:39:22 +0800
Subject: [PATCH 3/9] 1

---
 clang/lib/Driver/ToolChains/Clang.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index eb26bfade47b7a..fd75ad033c4dca 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -6656,7 +6656,7 @@ void Clang::ConstructJob(Compilation , const JobAction 
,
   // -fuse-cxa-atexit is default.
   if (!Args.hasFlag(
   options::OPT_fuse_cxa_atexit, options::OPT_fno_use_cxa_atexit,
-  !RawTriple.isOSAIX() && !RawTriple.isOSWindows() &&
+  !RawTriple.isOSAIX() && !(RawTriple.isOSWindows() && 
!RawTriple.isWindowsCygwinEnvironment()) &&
   ((RawTriple.getVendor() != llvm::Triple::MipsTechnologies) ||
RawTriple.hasEnvironment())) ||
   KernelOrKext)

From a51bba69eb1e2f7f509e42830e54ce71de99e74a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?=
 
Date: Sat, 9 Dec 2023 13:44:11 +0800
Subject: [PATCH 4/9] 1

---
 clang/lib/Driver/ToolChains/Clang.cpp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index fd75ad033c4dca..3e2c07399387d5 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -6656,7 +6656,9 @@ void Clang::ConstructJob(Compilation , const JobAction 
,
   // -fuse-cxa-atexit is default.
   if (!Args.hasFlag(
   options::OPT_fuse_cxa_atexit, options::OPT_fno_use_cxa_atexit,
-  !RawTriple.isOSAIX() && !(RawTriple.isOSWindows() && 
!RawTriple.isWindowsCygwinEnvironment()) &&
+  !RawTriple.isOSAIX() &&
+  !(RawTriple.isOSWindows() &&
+!RawTriple.isWindowsCygwinEnvironment()) &&
   ((RawTriple.getVendor() != llvm::Triple::MipsTechnologies) ||
RawTriple.hasEnvironment())) ||
   KernelOrKext)

From 3b906c82e613d08c6b153b355019dbf939045896 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?=
 
Date: Sat, 9 Dec 2023 14:07:41 +0800
Subject: [PATCH 5/9] 1

---
 clang/lib/Driver/ToolChains/Clang.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index 3e2c07399387d5..e67adf3d6616e6 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -6658,7 +6658,7 @@ void Clang::ConstructJob(Compilation , const JobAction 

[clang] [Cygwin] Cygwin -fuse-cxa-atexit (PR #74913)

2023-12-08 Thread Xu Chiheng via cfe-commits

https://github.com/xu-chiheng updated 
https://github.com/llvm/llvm-project/pull/74913

From 75a8486443ef200abe12b4047ac89011ada15802 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?=
 
Date: Sat, 9 Dec 2023 13:04:02 +0800
Subject: [PATCH 1/8] 1

---
 clang/lib/Driver/ToolChains/Clang.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index eb26bfade47b7..df062ccc9021f 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -6656,7 +6656,8 @@ void Clang::ConstructJob(Compilation , const JobAction 
,
   // -fuse-cxa-atexit is default.
   if (!Args.hasFlag(
   options::OPT_fuse_cxa_atexit, options::OPT_fno_use_cxa_atexit,
-  !RawTriple.isOSAIX() && !RawTriple.isOSWindows() &&
+  !RawTriple.isOSAIX() && !RawTriple.isWindowsGNUEnvironment() &&
+  !RawTriple.isWindowsMSVCEnvironment() &&
   ((RawTriple.getVendor() != llvm::Triple::MipsTechnologies) ||
RawTriple.hasEnvironment())) ||
   KernelOrKext)

From 899b095dd1953fc8a766dee221723dfbf1e3a3e5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?=
 
Date: Sat, 9 Dec 2023 13:24:01 +0800
Subject: [PATCH 2/8] 1

---
 clang/lib/Driver/ToolChains/Clang.cpp | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index df062ccc9021f..eb26bfade47b7 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -6656,8 +6656,7 @@ void Clang::ConstructJob(Compilation , const JobAction 
,
   // -fuse-cxa-atexit is default.
   if (!Args.hasFlag(
   options::OPT_fuse_cxa_atexit, options::OPT_fno_use_cxa_atexit,
-  !RawTriple.isOSAIX() && !RawTriple.isWindowsGNUEnvironment() &&
-  !RawTriple.isWindowsMSVCEnvironment() &&
+  !RawTriple.isOSAIX() && !RawTriple.isOSWindows() &&
   ((RawTriple.getVendor() != llvm::Triple::MipsTechnologies) ||
RawTriple.hasEnvironment())) ||
   KernelOrKext)

From 4fd5b816334bd8ccd8215f69f88dcbcc56f71857 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?=
 
Date: Sat, 9 Dec 2023 13:39:22 +0800
Subject: [PATCH 3/8] 1

---
 clang/lib/Driver/ToolChains/Clang.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index eb26bfade47b7..fd75ad033c4dc 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -6656,7 +6656,7 @@ void Clang::ConstructJob(Compilation , const JobAction 
,
   // -fuse-cxa-atexit is default.
   if (!Args.hasFlag(
   options::OPT_fuse_cxa_atexit, options::OPT_fno_use_cxa_atexit,
-  !RawTriple.isOSAIX() && !RawTriple.isOSWindows() &&
+  !RawTriple.isOSAIX() && !(RawTriple.isOSWindows() && 
!RawTriple.isWindowsCygwinEnvironment()) &&
   ((RawTriple.getVendor() != llvm::Triple::MipsTechnologies) ||
RawTriple.hasEnvironment())) ||
   KernelOrKext)

From a51bba69eb1e2f7f509e42830e54ce71de99e74a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?=
 
Date: Sat, 9 Dec 2023 13:44:11 +0800
Subject: [PATCH 4/8] 1

---
 clang/lib/Driver/ToolChains/Clang.cpp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index fd75ad033c4dc..3e2c07399387d 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -6656,7 +6656,9 @@ void Clang::ConstructJob(Compilation , const JobAction 
,
   // -fuse-cxa-atexit is default.
   if (!Args.hasFlag(
   options::OPT_fuse_cxa_atexit, options::OPT_fno_use_cxa_atexit,
-  !RawTriple.isOSAIX() && !(RawTriple.isOSWindows() && 
!RawTriple.isWindowsCygwinEnvironment()) &&
+  !RawTriple.isOSAIX() &&
+  !(RawTriple.isOSWindows() &&
+!RawTriple.isWindowsCygwinEnvironment()) &&
   ((RawTriple.getVendor() != llvm::Triple::MipsTechnologies) ||
RawTriple.hasEnvironment())) ||
   KernelOrKext)

From 3b906c82e613d08c6b153b355019dbf939045896 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?=
 
Date: Sat, 9 Dec 2023 14:07:41 +0800
Subject: [PATCH 5/8] 1

---
 clang/lib/Driver/ToolChains/Clang.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index 3e2c07399387d..e67adf3d6616e 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -6658,7 +6658,7 @@ void Clang::ConstructJob(Compilation , const JobAction 
,
   

[clang] [Cygwin] Cygwin -fuse-cxa-atexit (PR #74913)

2023-12-08 Thread Xu Chiheng via cfe-commits

https://github.com/xu-chiheng updated 
https://github.com/llvm/llvm-project/pull/74913

From 75a8486443ef200abe12b4047ac89011ada15802 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?=
 
Date: Sat, 9 Dec 2023 13:04:02 +0800
Subject: [PATCH 1/7] 1

---
 clang/lib/Driver/ToolChains/Clang.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index eb26bfade47b7a..df062ccc9021f7 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -6656,7 +6656,8 @@ void Clang::ConstructJob(Compilation , const JobAction 
,
   // -fuse-cxa-atexit is default.
   if (!Args.hasFlag(
   options::OPT_fuse_cxa_atexit, options::OPT_fno_use_cxa_atexit,
-  !RawTriple.isOSAIX() && !RawTriple.isOSWindows() &&
+  !RawTriple.isOSAIX() && !RawTriple.isWindowsGNUEnvironment() &&
+  !RawTriple.isWindowsMSVCEnvironment() &&
   ((RawTriple.getVendor() != llvm::Triple::MipsTechnologies) ||
RawTriple.hasEnvironment())) ||
   KernelOrKext)

From 899b095dd1953fc8a766dee221723dfbf1e3a3e5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?=
 
Date: Sat, 9 Dec 2023 13:24:01 +0800
Subject: [PATCH 2/7] 1

---
 clang/lib/Driver/ToolChains/Clang.cpp | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index df062ccc9021f7..eb26bfade47b7a 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -6656,8 +6656,7 @@ void Clang::ConstructJob(Compilation , const JobAction 
,
   // -fuse-cxa-atexit is default.
   if (!Args.hasFlag(
   options::OPT_fuse_cxa_atexit, options::OPT_fno_use_cxa_atexit,
-  !RawTriple.isOSAIX() && !RawTriple.isWindowsGNUEnvironment() &&
-  !RawTriple.isWindowsMSVCEnvironment() &&
+  !RawTriple.isOSAIX() && !RawTriple.isOSWindows() &&
   ((RawTriple.getVendor() != llvm::Triple::MipsTechnologies) ||
RawTriple.hasEnvironment())) ||
   KernelOrKext)

From 4fd5b816334bd8ccd8215f69f88dcbcc56f71857 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?=
 
Date: Sat, 9 Dec 2023 13:39:22 +0800
Subject: [PATCH 3/7] 1

---
 clang/lib/Driver/ToolChains/Clang.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index eb26bfade47b7a..fd75ad033c4dca 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -6656,7 +6656,7 @@ void Clang::ConstructJob(Compilation , const JobAction 
,
   // -fuse-cxa-atexit is default.
   if (!Args.hasFlag(
   options::OPT_fuse_cxa_atexit, options::OPT_fno_use_cxa_atexit,
-  !RawTriple.isOSAIX() && !RawTriple.isOSWindows() &&
+  !RawTriple.isOSAIX() && !(RawTriple.isOSWindows() && 
!RawTriple.isWindowsCygwinEnvironment()) &&
   ((RawTriple.getVendor() != llvm::Triple::MipsTechnologies) ||
RawTriple.hasEnvironment())) ||
   KernelOrKext)

From a51bba69eb1e2f7f509e42830e54ce71de99e74a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?=
 
Date: Sat, 9 Dec 2023 13:44:11 +0800
Subject: [PATCH 4/7] 1

---
 clang/lib/Driver/ToolChains/Clang.cpp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index fd75ad033c4dca..3e2c07399387d5 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -6656,7 +6656,9 @@ void Clang::ConstructJob(Compilation , const JobAction 
,
   // -fuse-cxa-atexit is default.
   if (!Args.hasFlag(
   options::OPT_fuse_cxa_atexit, options::OPT_fno_use_cxa_atexit,
-  !RawTriple.isOSAIX() && !(RawTriple.isOSWindows() && 
!RawTriple.isWindowsCygwinEnvironment()) &&
+  !RawTriple.isOSAIX() &&
+  !(RawTriple.isOSWindows() &&
+!RawTriple.isWindowsCygwinEnvironment()) &&
   ((RawTriple.getVendor() != llvm::Triple::MipsTechnologies) ||
RawTriple.hasEnvironment())) ||
   KernelOrKext)

From 3b906c82e613d08c6b153b355019dbf939045896 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?=
 
Date: Sat, 9 Dec 2023 14:07:41 +0800
Subject: [PATCH 5/7] 1

---
 clang/lib/Driver/ToolChains/Clang.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index 3e2c07399387d5..e67adf3d6616e6 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -6658,7 +6658,7 @@ void Clang::ConstructJob(Compilation , const JobAction 

[clang] [Cygwin] Cygwin -fuse-cxa-atexit (PR #74913)

2023-12-08 Thread Xu Chiheng via cfe-commits

https://github.com/xu-chiheng updated 
https://github.com/llvm/llvm-project/pull/74913

From 75a8486443ef200abe12b4047ac89011ada15802 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?=
 
Date: Sat, 9 Dec 2023 13:04:02 +0800
Subject: [PATCH 1/6] 1

---
 clang/lib/Driver/ToolChains/Clang.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index eb26bfade47b7a..df062ccc9021f7 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -6656,7 +6656,8 @@ void Clang::ConstructJob(Compilation , const JobAction 
,
   // -fuse-cxa-atexit is default.
   if (!Args.hasFlag(
   options::OPT_fuse_cxa_atexit, options::OPT_fno_use_cxa_atexit,
-  !RawTriple.isOSAIX() && !RawTriple.isOSWindows() &&
+  !RawTriple.isOSAIX() && !RawTriple.isWindowsGNUEnvironment() &&
+  !RawTriple.isWindowsMSVCEnvironment() &&
   ((RawTriple.getVendor() != llvm::Triple::MipsTechnologies) ||
RawTriple.hasEnvironment())) ||
   KernelOrKext)

From 899b095dd1953fc8a766dee221723dfbf1e3a3e5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?=
 
Date: Sat, 9 Dec 2023 13:24:01 +0800
Subject: [PATCH 2/6] 1

---
 clang/lib/Driver/ToolChains/Clang.cpp | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index df062ccc9021f7..eb26bfade47b7a 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -6656,8 +6656,7 @@ void Clang::ConstructJob(Compilation , const JobAction 
,
   // -fuse-cxa-atexit is default.
   if (!Args.hasFlag(
   options::OPT_fuse_cxa_atexit, options::OPT_fno_use_cxa_atexit,
-  !RawTriple.isOSAIX() && !RawTriple.isWindowsGNUEnvironment() &&
-  !RawTriple.isWindowsMSVCEnvironment() &&
+  !RawTriple.isOSAIX() && !RawTriple.isOSWindows() &&
   ((RawTriple.getVendor() != llvm::Triple::MipsTechnologies) ||
RawTriple.hasEnvironment())) ||
   KernelOrKext)

From 4fd5b816334bd8ccd8215f69f88dcbcc56f71857 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?=
 
Date: Sat, 9 Dec 2023 13:39:22 +0800
Subject: [PATCH 3/6] 1

---
 clang/lib/Driver/ToolChains/Clang.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index eb26bfade47b7a..fd75ad033c4dca 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -6656,7 +6656,7 @@ void Clang::ConstructJob(Compilation , const JobAction 
,
   // -fuse-cxa-atexit is default.
   if (!Args.hasFlag(
   options::OPT_fuse_cxa_atexit, options::OPT_fno_use_cxa_atexit,
-  !RawTriple.isOSAIX() && !RawTriple.isOSWindows() &&
+  !RawTriple.isOSAIX() && !(RawTriple.isOSWindows() && 
!RawTriple.isWindowsCygwinEnvironment()) &&
   ((RawTriple.getVendor() != llvm::Triple::MipsTechnologies) ||
RawTriple.hasEnvironment())) ||
   KernelOrKext)

From a51bba69eb1e2f7f509e42830e54ce71de99e74a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?=
 
Date: Sat, 9 Dec 2023 13:44:11 +0800
Subject: [PATCH 4/6] 1

---
 clang/lib/Driver/ToolChains/Clang.cpp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index fd75ad033c4dca..3e2c07399387d5 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -6656,7 +6656,9 @@ void Clang::ConstructJob(Compilation , const JobAction 
,
   // -fuse-cxa-atexit is default.
   if (!Args.hasFlag(
   options::OPT_fuse_cxa_atexit, options::OPT_fno_use_cxa_atexit,
-  !RawTriple.isOSAIX() && !(RawTriple.isOSWindows() && 
!RawTriple.isWindowsCygwinEnvironment()) &&
+  !RawTriple.isOSAIX() &&
+  !(RawTriple.isOSWindows() &&
+!RawTriple.isWindowsCygwinEnvironment()) &&
   ((RawTriple.getVendor() != llvm::Triple::MipsTechnologies) ||
RawTriple.hasEnvironment())) ||
   KernelOrKext)

From 3b906c82e613d08c6b153b355019dbf939045896 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?=
 
Date: Sat, 9 Dec 2023 14:07:41 +0800
Subject: [PATCH 5/6] 1

---
 clang/lib/Driver/ToolChains/Clang.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index 3e2c07399387d5..e67adf3d6616e6 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -6658,7 +6658,7 @@ void Clang::ConstructJob(Compilation , const JobAction 

[clang] [Cygwin] Cygwin -fuse-cxa-atexit (PR #74913)

2023-12-08 Thread Xu Chiheng via cfe-commits

https://github.com/xu-chiheng updated 
https://github.com/llvm/llvm-project/pull/74913

From 75a8486443ef200abe12b4047ac89011ada15802 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?=
 
Date: Sat, 9 Dec 2023 13:04:02 +0800
Subject: [PATCH 1/5] 1

---
 clang/lib/Driver/ToolChains/Clang.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index eb26bfade47b7a..df062ccc9021f7 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -6656,7 +6656,8 @@ void Clang::ConstructJob(Compilation , const JobAction 
,
   // -fuse-cxa-atexit is default.
   if (!Args.hasFlag(
   options::OPT_fuse_cxa_atexit, options::OPT_fno_use_cxa_atexit,
-  !RawTriple.isOSAIX() && !RawTriple.isOSWindows() &&
+  !RawTriple.isOSAIX() && !RawTriple.isWindowsGNUEnvironment() &&
+  !RawTriple.isWindowsMSVCEnvironment() &&
   ((RawTriple.getVendor() != llvm::Triple::MipsTechnologies) ||
RawTriple.hasEnvironment())) ||
   KernelOrKext)

From 899b095dd1953fc8a766dee221723dfbf1e3a3e5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?=
 
Date: Sat, 9 Dec 2023 13:24:01 +0800
Subject: [PATCH 2/5] 1

---
 clang/lib/Driver/ToolChains/Clang.cpp | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index df062ccc9021f7..eb26bfade47b7a 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -6656,8 +6656,7 @@ void Clang::ConstructJob(Compilation , const JobAction 
,
   // -fuse-cxa-atexit is default.
   if (!Args.hasFlag(
   options::OPT_fuse_cxa_atexit, options::OPT_fno_use_cxa_atexit,
-  !RawTriple.isOSAIX() && !RawTriple.isWindowsGNUEnvironment() &&
-  !RawTriple.isWindowsMSVCEnvironment() &&
+  !RawTriple.isOSAIX() && !RawTriple.isOSWindows() &&
   ((RawTriple.getVendor() != llvm::Triple::MipsTechnologies) ||
RawTriple.hasEnvironment())) ||
   KernelOrKext)

From 4fd5b816334bd8ccd8215f69f88dcbcc56f71857 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?=
 
Date: Sat, 9 Dec 2023 13:39:22 +0800
Subject: [PATCH 3/5] 1

---
 clang/lib/Driver/ToolChains/Clang.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index eb26bfade47b7a..fd75ad033c4dca 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -6656,7 +6656,7 @@ void Clang::ConstructJob(Compilation , const JobAction 
,
   // -fuse-cxa-atexit is default.
   if (!Args.hasFlag(
   options::OPT_fuse_cxa_atexit, options::OPT_fno_use_cxa_atexit,
-  !RawTriple.isOSAIX() && !RawTriple.isOSWindows() &&
+  !RawTriple.isOSAIX() && !(RawTriple.isOSWindows() && 
!RawTriple.isWindowsCygwinEnvironment()) &&
   ((RawTriple.getVendor() != llvm::Triple::MipsTechnologies) ||
RawTriple.hasEnvironment())) ||
   KernelOrKext)

From a51bba69eb1e2f7f509e42830e54ce71de99e74a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?=
 
Date: Sat, 9 Dec 2023 13:44:11 +0800
Subject: [PATCH 4/5] 1

---
 clang/lib/Driver/ToolChains/Clang.cpp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index fd75ad033c4dca..3e2c07399387d5 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -6656,7 +6656,9 @@ void Clang::ConstructJob(Compilation , const JobAction 
,
   // -fuse-cxa-atexit is default.
   if (!Args.hasFlag(
   options::OPT_fuse_cxa_atexit, options::OPT_fno_use_cxa_atexit,
-  !RawTriple.isOSAIX() && !(RawTriple.isOSWindows() && 
!RawTriple.isWindowsCygwinEnvironment()) &&
+  !RawTriple.isOSAIX() &&
+  !(RawTriple.isOSWindows() &&
+!RawTriple.isWindowsCygwinEnvironment()) &&
   ((RawTriple.getVendor() != llvm::Triple::MipsTechnologies) ||
RawTriple.hasEnvironment())) ||
   KernelOrKext)

From 3b906c82e613d08c6b153b355019dbf939045896 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?=
 
Date: Sat, 9 Dec 2023 14:07:41 +0800
Subject: [PATCH 5/5] 1

---
 clang/lib/Driver/ToolChains/Clang.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index 3e2c07399387d5..e67adf3d6616e6 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -6658,7 +6658,7 @@ void Clang::ConstructJob(Compilation , const JobAction 

[clang] [Cygwin] Cygwin -fuse-cxa-atexit (PR #74913)

2023-12-08 Thread Xu Chiheng via cfe-commits

https://github.com/xu-chiheng updated 
https://github.com/llvm/llvm-project/pull/74913

From 75a8486443ef200abe12b4047ac89011ada15802 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?=
 
Date: Sat, 9 Dec 2023 13:04:02 +0800
Subject: [PATCH 1/4] 1

---
 clang/lib/Driver/ToolChains/Clang.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index eb26bfade47b7..df062ccc9021f 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -6656,7 +6656,8 @@ void Clang::ConstructJob(Compilation , const JobAction 
,
   // -fuse-cxa-atexit is default.
   if (!Args.hasFlag(
   options::OPT_fuse_cxa_atexit, options::OPT_fno_use_cxa_atexit,
-  !RawTriple.isOSAIX() && !RawTriple.isOSWindows() &&
+  !RawTriple.isOSAIX() && !RawTriple.isWindowsGNUEnvironment() &&
+  !RawTriple.isWindowsMSVCEnvironment() &&
   ((RawTriple.getVendor() != llvm::Triple::MipsTechnologies) ||
RawTriple.hasEnvironment())) ||
   KernelOrKext)

From 899b095dd1953fc8a766dee221723dfbf1e3a3e5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?=
 
Date: Sat, 9 Dec 2023 13:24:01 +0800
Subject: [PATCH 2/4] 1

---
 clang/lib/Driver/ToolChains/Clang.cpp | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index df062ccc9021f..eb26bfade47b7 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -6656,8 +6656,7 @@ void Clang::ConstructJob(Compilation , const JobAction 
,
   // -fuse-cxa-atexit is default.
   if (!Args.hasFlag(
   options::OPT_fuse_cxa_atexit, options::OPT_fno_use_cxa_atexit,
-  !RawTriple.isOSAIX() && !RawTriple.isWindowsGNUEnvironment() &&
-  !RawTriple.isWindowsMSVCEnvironment() &&
+  !RawTriple.isOSAIX() && !RawTriple.isOSWindows() &&
   ((RawTriple.getVendor() != llvm::Triple::MipsTechnologies) ||
RawTriple.hasEnvironment())) ||
   KernelOrKext)

From 4fd5b816334bd8ccd8215f69f88dcbcc56f71857 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?=
 
Date: Sat, 9 Dec 2023 13:39:22 +0800
Subject: [PATCH 3/4] 1

---
 clang/lib/Driver/ToolChains/Clang.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index eb26bfade47b7..fd75ad033c4dc 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -6656,7 +6656,7 @@ void Clang::ConstructJob(Compilation , const JobAction 
,
   // -fuse-cxa-atexit is default.
   if (!Args.hasFlag(
   options::OPT_fuse_cxa_atexit, options::OPT_fno_use_cxa_atexit,
-  !RawTriple.isOSAIX() && !RawTriple.isOSWindows() &&
+  !RawTriple.isOSAIX() && !(RawTriple.isOSWindows() && 
!RawTriple.isWindowsCygwinEnvironment()) &&
   ((RawTriple.getVendor() != llvm::Triple::MipsTechnologies) ||
RawTriple.hasEnvironment())) ||
   KernelOrKext)

From a51bba69eb1e2f7f509e42830e54ce71de99e74a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?=
 
Date: Sat, 9 Dec 2023 13:44:11 +0800
Subject: [PATCH 4/4] 1

---
 clang/lib/Driver/ToolChains/Clang.cpp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index fd75ad033c4dc..3e2c07399387d 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -6656,7 +6656,9 @@ void Clang::ConstructJob(Compilation , const JobAction 
,
   // -fuse-cxa-atexit is default.
   if (!Args.hasFlag(
   options::OPT_fuse_cxa_atexit, options::OPT_fno_use_cxa_atexit,
-  !RawTriple.isOSAIX() && !(RawTriple.isOSWindows() && 
!RawTriple.isWindowsCygwinEnvironment()) &&
+  !RawTriple.isOSAIX() &&
+  !(RawTriple.isOSWindows() &&
+!RawTriple.isWindowsCygwinEnvironment()) &&
   ((RawTriple.getVendor() != llvm::Triple::MipsTechnologies) ||
RawTriple.hasEnvironment())) ||
   KernelOrKext)

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


[clang] [Cygwin] Cygwin -fuse-cxa-atexit (PR #74913)

2023-12-08 Thread Xu Chiheng via cfe-commits

https://github.com/xu-chiheng updated 
https://github.com/llvm/llvm-project/pull/74913

From 75a8486443ef200abe12b4047ac89011ada15802 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?=
 
Date: Sat, 9 Dec 2023 13:04:02 +0800
Subject: [PATCH 1/3] 1

---
 clang/lib/Driver/ToolChains/Clang.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index eb26bfade47b7..df062ccc9021f 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -6656,7 +6656,8 @@ void Clang::ConstructJob(Compilation , const JobAction 
,
   // -fuse-cxa-atexit is default.
   if (!Args.hasFlag(
   options::OPT_fuse_cxa_atexit, options::OPT_fno_use_cxa_atexit,
-  !RawTriple.isOSAIX() && !RawTriple.isOSWindows() &&
+  !RawTriple.isOSAIX() && !RawTriple.isWindowsGNUEnvironment() &&
+  !RawTriple.isWindowsMSVCEnvironment() &&
   ((RawTriple.getVendor() != llvm::Triple::MipsTechnologies) ||
RawTriple.hasEnvironment())) ||
   KernelOrKext)

From 899b095dd1953fc8a766dee221723dfbf1e3a3e5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?=
 
Date: Sat, 9 Dec 2023 13:24:01 +0800
Subject: [PATCH 2/3] 1

---
 clang/lib/Driver/ToolChains/Clang.cpp | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index df062ccc9021f..eb26bfade47b7 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -6656,8 +6656,7 @@ void Clang::ConstructJob(Compilation , const JobAction 
,
   // -fuse-cxa-atexit is default.
   if (!Args.hasFlag(
   options::OPT_fuse_cxa_atexit, options::OPT_fno_use_cxa_atexit,
-  !RawTriple.isOSAIX() && !RawTriple.isWindowsGNUEnvironment() &&
-  !RawTriple.isWindowsMSVCEnvironment() &&
+  !RawTriple.isOSAIX() && !RawTriple.isOSWindows() &&
   ((RawTriple.getVendor() != llvm::Triple::MipsTechnologies) ||
RawTriple.hasEnvironment())) ||
   KernelOrKext)

From 4fd5b816334bd8ccd8215f69f88dcbcc56f71857 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?=
 
Date: Sat, 9 Dec 2023 13:39:22 +0800
Subject: [PATCH 3/3] 1

---
 clang/lib/Driver/ToolChains/Clang.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index eb26bfade47b7..fd75ad033c4dc 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -6656,7 +6656,7 @@ void Clang::ConstructJob(Compilation , const JobAction 
,
   // -fuse-cxa-atexit is default.
   if (!Args.hasFlag(
   options::OPT_fuse_cxa_atexit, options::OPT_fno_use_cxa_atexit,
-  !RawTriple.isOSAIX() && !RawTriple.isOSWindows() &&
+  !RawTriple.isOSAIX() && !(RawTriple.isOSWindows() && 
!RawTriple.isWindowsCygwinEnvironment()) &&
   ((RawTriple.getVendor() != llvm::Triple::MipsTechnologies) ||
RawTriple.hasEnvironment())) ||
   KernelOrKext)

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


[clang] [Cygwin] Cygwin -fuse-cxa-atexit (PR #74913)

2023-12-08 Thread Xu Chiheng via cfe-commits

https://github.com/xu-chiheng updated 
https://github.com/llvm/llvm-project/pull/74913

From 75a8486443ef200abe12b4047ac89011ada15802 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?=
 
Date: Sat, 9 Dec 2023 13:04:02 +0800
Subject: [PATCH 1/2] 1

---
 clang/lib/Driver/ToolChains/Clang.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index eb26bfade47b7a..df062ccc9021f7 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -6656,7 +6656,8 @@ void Clang::ConstructJob(Compilation , const JobAction 
,
   // -fuse-cxa-atexit is default.
   if (!Args.hasFlag(
   options::OPT_fuse_cxa_atexit, options::OPT_fno_use_cxa_atexit,
-  !RawTriple.isOSAIX() && !RawTriple.isOSWindows() &&
+  !RawTriple.isOSAIX() && !RawTriple.isWindowsGNUEnvironment() &&
+  !RawTriple.isWindowsMSVCEnvironment() &&
   ((RawTriple.getVendor() != llvm::Triple::MipsTechnologies) ||
RawTriple.hasEnvironment())) ||
   KernelOrKext)

From 899b095dd1953fc8a766dee221723dfbf1e3a3e5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?=
 
Date: Sat, 9 Dec 2023 13:24:01 +0800
Subject: [PATCH 2/2] 1

---
 clang/lib/Driver/ToolChains/Clang.cpp | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index df062ccc9021f7..eb26bfade47b7a 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -6656,8 +6656,7 @@ void Clang::ConstructJob(Compilation , const JobAction 
,
   // -fuse-cxa-atexit is default.
   if (!Args.hasFlag(
   options::OPT_fuse_cxa_atexit, options::OPT_fno_use_cxa_atexit,
-  !RawTriple.isOSAIX() && !RawTriple.isWindowsGNUEnvironment() &&
-  !RawTriple.isWindowsMSVCEnvironment() &&
+  !RawTriple.isOSAIX() && !RawTriple.isOSWindows() &&
   ((RawTriple.getVendor() != llvm::Triple::MipsTechnologies) ||
RawTriple.hasEnvironment())) ||
   KernelOrKext)

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


[clang] [Cygwin] Cygwin -fuse-cxa-atexit (PR #74913)

2023-12-08 Thread Xu Chiheng via cfe-commits

https://github.com/xu-chiheng created 
https://github.com/llvm/llvm-project/pull/74913

None

From 75a8486443ef200abe12b4047ac89011ada15802 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=BE=90=E6=8C=81=E6=81=92=20Xu=20Chiheng?=
 
Date: Sat, 9 Dec 2023 13:04:02 +0800
Subject: [PATCH] 1

---
 clang/lib/Driver/ToolChains/Clang.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/clang/lib/Driver/ToolChains/Clang.cpp 
b/clang/lib/Driver/ToolChains/Clang.cpp
index eb26bfade47b7a..df062ccc9021f7 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -6656,7 +6656,8 @@ void Clang::ConstructJob(Compilation , const JobAction 
,
   // -fuse-cxa-atexit is default.
   if (!Args.hasFlag(
   options::OPT_fuse_cxa_atexit, options::OPT_fno_use_cxa_atexit,
-  !RawTriple.isOSAIX() && !RawTriple.isOSWindows() &&
+  !RawTriple.isOSAIX() && !RawTriple.isWindowsGNUEnvironment() &&
+  !RawTriple.isWindowsMSVCEnvironment() &&
   ((RawTriple.getVendor() != llvm::Triple::MipsTechnologies) ||
RawTriple.hasEnvironment())) ||
   KernelOrKext)

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


  1   2   >