[clang] [clang] Fix --entry command line option (PR #69114)
Tuur Martens via cfe-commits
cfe-commits at lists.llvm.org
Fri Oct 27 05:15:23 PDT 2023
https://github.com/JohnyTheCarrot updated https://github.com/llvm/llvm-project/pull/69114
>From 111d19a7e03e2c59afc8d40c8210a901378594ee Mon Sep 17 00:00:00 2001
From: Tuur Martens <tuurmartens4 at gmail.com>
Date: Sun, 15 Oct 2023 18:08:35 +0200
Subject: [PATCH 1/3] [clang] Fix --entry command line option
---
clang/include/clang/Driver/Options.td | 3 ++-
clang/test/Driver/entry.c | 5 +++++
2 files changed, 7 insertions(+), 1 deletion(-)
create mode 100644 clang/test/Driver/entry.c
diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td
index 3f2058a5d4650ca..6737af0a8b68728 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -5474,7 +5474,8 @@ def _dyld_prefix_EQ : Joined<["--"], "dyld-prefix=">;
def _dyld_prefix : Separate<["--"], "dyld-prefix">, Alias<_dyld_prefix_EQ>;
def _encoding_EQ : Joined<["--"], "encoding=">, Alias<fencoding_EQ>;
def _encoding : Separate<["--"], "encoding">, Alias<fencoding_EQ>;
-def _entry : Flag<["--"], "entry">, Alias<e>;
+def _entry_EQ : Joined<["--"], "entry=">, Flags<[LinkerInput]>, Group<Link_Group>, Alias<e>;
+def _entry : Separate<["--"], "entry">, Flags<[LinkerInput]>, Group<Link_Group>, Alias<e>;
def _extdirs_EQ : Joined<["--"], "extdirs=">, Alias<fextdirs_EQ>;
def _extdirs : Separate<["--"], "extdirs">, Alias<fextdirs_EQ>;
def _extra_warnings : Flag<["--"], "extra-warnings">, Alias<W_Joined>;
diff --git a/clang/test/Driver/entry.c b/clang/test/Driver/entry.c
new file mode 100644
index 000000000000000..773e9676332e517
--- /dev/null
+++ b/clang/test/Driver/entry.c
@@ -0,0 +1,5 @@
+// RUN: %clang -### --entry test %s 2>&1 | FileCheck %s
+// RUN: %clang -### --entry=test %s 2>&1 | FileCheck %s
+// RUN: %clang -### -etest %s 2>&1 | FileCheck %s
+
+// CHECK: "-e" "test"
>From 3bd714bd17d12d24d014362056374e0838a271c0 Mon Sep 17 00:00:00 2001
From: Tuur Martens <tuurmartens4 at gmail.com>
Date: Mon, 16 Oct 2023 08:58:47 +0200
Subject: [PATCH 2/3] make requested changes
---
clang/include/clang/Driver/Options.td | 2 +-
clang/test/Driver/entry.c | 5 -----
clang/test/Driver/linker-opts.c | 7 +++++++
3 files changed, 8 insertions(+), 6 deletions(-)
delete mode 100644 clang/test/Driver/entry.c
diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td
index 6737af0a8b68728..084907a2a1696d2 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -5474,7 +5474,7 @@ def _dyld_prefix_EQ : Joined<["--"], "dyld-prefix=">;
def _dyld_prefix : Separate<["--"], "dyld-prefix">, Alias<_dyld_prefix_EQ>;
def _encoding_EQ : Joined<["--"], "encoding=">, Alias<fencoding_EQ>;
def _encoding : Separate<["--"], "encoding">, Alias<fencoding_EQ>;
-def _entry_EQ : Joined<["--"], "entry=">, Flags<[LinkerInput]>, Group<Link_Group>, Alias<e>;
+def : Joined<["--"], "entry=">, Flags<[LinkerInput]>, Group<Link_Group>, Alias<e>;
def _entry : Separate<["--"], "entry">, Flags<[LinkerInput]>, Group<Link_Group>, Alias<e>;
def _extdirs_EQ : Joined<["--"], "extdirs=">, Alias<fextdirs_EQ>;
def _extdirs : Separate<["--"], "extdirs">, Alias<fextdirs_EQ>;
diff --git a/clang/test/Driver/entry.c b/clang/test/Driver/entry.c
deleted file mode 100644
index 773e9676332e517..000000000000000
--- a/clang/test/Driver/entry.c
+++ /dev/null
@@ -1,5 +0,0 @@
-// RUN: %clang -### --entry test %s 2>&1 | FileCheck %s
-// RUN: %clang -### --entry=test %s 2>&1 | FileCheck %s
-// RUN: %clang -### -etest %s 2>&1 | FileCheck %s
-
-// CHECK: "-e" "test"
diff --git a/clang/test/Driver/linker-opts.c b/clang/test/Driver/linker-opts.c
index 181aeadb8dc97db..72b33916ec79cbe 100644
--- a/clang/test/Driver/linker-opts.c
+++ b/clang/test/Driver/linker-opts.c
@@ -20,3 +20,10 @@
// Make sure that we do warn in other cases.
// RUN: %clang %s -lfoo -c -o %t/tmp2.o -### 2>&1 | FileCheck %s --check-prefix=UNUSED
// UNUSED: warning:{{.*}}unused
+
+// Make sure -e and its aliases --entry and --entry= are properly passed on.
+// RUN: %clang -### -target x86_64-unknown-linux-gnu --entry test %s 2>&1 | FileCheck --check-prefix=ENTRY %s
+// RUN: %clang -### -target x86_64-unknown-linux-gnu --entry=test %s 2>&1 | FileCheck --check-prefix=ENTRY %s
+// RUN: %clang -### -target x86_64-unknown-linux-gnu -etest %s 2>&1 | FileCheck --check-prefix=ENTRY %s
+
+// ENTRY: "-e" "test"
>From 03566b32cfa6c407f17c81fa9f8884024d0954a6 Mon Sep 17 00:00:00 2001
From: Tuur Martens <tuurmartens4 at gmail.com>
Date: Fri, 27 Oct 2023 14:14:48 +0200
Subject: [PATCH 3/3] make requested changes
---
clang/include/clang/Driver/Options.td | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td
index 084907a2a1696d2..3253463003ee0e8 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -5474,8 +5474,8 @@ def _dyld_prefix_EQ : Joined<["--"], "dyld-prefix=">;
def _dyld_prefix : Separate<["--"], "dyld-prefix">, Alias<_dyld_prefix_EQ>;
def _encoding_EQ : Joined<["--"], "encoding=">, Alias<fencoding_EQ>;
def _encoding : Separate<["--"], "encoding">, Alias<fencoding_EQ>;
-def : Joined<["--"], "entry=">, Flags<[LinkerInput]>, Group<Link_Group>, Alias<e>;
-def _entry : Separate<["--"], "entry">, Flags<[LinkerInput]>, Group<Link_Group>, Alias<e>;
+def : Joined<["--"], "entry=">, Alias<e>;
+def : Separate<["--"], "entry">, Alias<e>;
def _extdirs_EQ : Joined<["--"], "extdirs=">, Alias<fextdirs_EQ>;
def _extdirs : Separate<["--"], "extdirs">, Alias<fextdirs_EQ>;
def _extra_warnings : Flag<["--"], "extra-warnings">, Alias<W_Joined>;
More information about the cfe-commits
mailing list