[clang] [Driver][BoundsSafety] Add -fbounds-safety-experimental flag (PR #70480)

2023-11-07 Thread Yeoul Na via cfe-commits
https://github.com/rapidsna updated https://github.com/llvm/llvm-project/pull/70480 >From 99ec6e055dd32a86bf6d589a6895658dcbe1d7bd Mon Sep 17 00:00:00 2001 From: Yeoul Na Date: Fri, 27 Oct 2023 08:34:37 -0700 Subject: [PATCH 1/8] [Driver][BoundsSafety] Add -fbounds-safety-experimental flag

[clang] [Driver][BoundsSafety] Add -fbounds-safety-experimental flag (PR #70480)

2023-11-07 Thread Yeoul Na via cfe-commits
@@ -3618,6 +3618,27 @@ void CompilerInvocationBase::GenerateLangArgs(const LangOptions , GenerateArg(Consumer, OPT_frandomize_layout_seed_EQ, Opts.RandstructSeed); } +static void CheckBoundsSafetyLang(InputKind IK, DiagnosticsEngine ) { rapidsna wrote:

[clang] [Driver][BoundsSafety] Add -fbounds-safety-experimental flag (PR #70480)

2023-11-07 Thread Yeoul Na via cfe-commits
@@ -3618,6 +3618,27 @@ void CompilerInvocationBase::GenerateLangArgs(const LangOptions , GenerateArg(Consumer, OPT_frandomize_layout_seed_EQ, Opts.RandstructSeed); } +static void CheckBoundsSafetyLang(InputKind IK, DiagnosticsEngine ) { rapidsna wrote:

[clang] [Driver][BoundsSafety] Add -fbounds-safety-experimental flag (PR #70480)

2023-11-06 Thread Fangrui Song via cfe-commits
MaskRay wrote: > [Driver][BoundsSafety] Add -fbounds-safety-experimental flag #70480 The patch implements `-fexperimental-bounds-safety` https://github.com/llvm/llvm-project/pull/70480 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] [Driver][BoundsSafety] Add -fbounds-safety-experimental flag (PR #70480)

2023-11-06 Thread Fangrui Song via cfe-commits
@@ -1412,6 +1412,9 @@ def FunctionMultiVersioning def NoDeref : DiagGroup<"noderef">; +// Bounds safety specific warnings +def IgnoredBoundsSafety : DiagGroup<"ignored-bounds-safety">; MaskRay wrote: This is `-Wignored-bounds-safety` is not used.

[clang] [Driver][BoundsSafety] Add -fbounds-safety-experimental flag (PR #70480)

2023-11-06 Thread Fangrui Song via cfe-commits
@@ -3618,6 +3618,27 @@ void CompilerInvocationBase::GenerateLangArgs(const LangOptions , GenerateArg(Consumer, OPT_frandomize_layout_seed_EQ, Opts.RandstructSeed); } +static void CheckBoundsSafetyLang(InputKind IK, DiagnosticsEngine ) { MaskRay wrote: I

[clang] [Driver][BoundsSafety] Add -fbounds-safety-experimental flag (PR #70480)

2023-11-06 Thread Fangrui Song via cfe-commits
https://github.com/MaskRay edited https://github.com/llvm/llvm-project/pull/70480 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Driver][BoundsSafety] Add -fbounds-safety-experimental flag (PR #70480)

2023-11-06 Thread Fangrui Song via cfe-commits
https://github.com/MaskRay requested changes to this pull request. https://github.com/llvm/llvm-project/pull/70480 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Driver][BoundsSafety] Add -fbounds-safety-experimental flag (PR #70480)

2023-11-03 Thread Yeoul Na via cfe-commits
@@ -0,0 +1,12 @@ +// This reports a warning to follow the default behavior of ClangAs. +// RUN: %clang -fexperimental-bounds-safety -x assembler -c %s -o /dev/null 2>&1 | FileCheck -check-prefix WARN %s + + +// WARN: warning: argument unused during compilation:

[clang] [Driver][BoundsSafety] Add -fbounds-safety-experimental flag (PR #70480)

2023-11-03 Thread Dan Liew via cfe-commits
@@ -0,0 +1,12 @@ +// This reports a warning to follow the default behavior of ClangAs. +// RUN: %clang -fexperimental-bounds-safety -x assembler -c %s -o /dev/null 2>&1 | FileCheck -check-prefix WARN %s + + +// WARN: warning: argument unused during compilation:

[clang] [Driver][BoundsSafety] Add -fbounds-safety-experimental flag (PR #70480)

2023-11-03 Thread Nick Desaulniers via cfe-commits
https://github.com/nickdesaulniers approved this pull request. If you make all of the newly added tests share a similar filename prefix, it will be easier to test via `llvm-lit -vv clang/test/Driver/bounds-safety*`. `fbounds-safety.c` seems to break that convention.

[clang] [Driver][BoundsSafety] Add -fbounds-safety-experimental flag (PR #70480)

2023-11-02 Thread Yeoul Na via cfe-commits
https://github.com/rapidsna edited https://github.com/llvm/llvm-project/pull/70480 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Driver][BoundsSafety] Add -fbounds-safety-experimental flag (PR #70480)

2023-11-02 Thread Yeoul Na via cfe-commits
https://github.com/rapidsna edited https://github.com/llvm/llvm-project/pull/70480 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Driver][BoundsSafety] Add -fbounds-safety-experimental flag (PR #70480)

2023-11-02 Thread Yeoul Na via cfe-commits
https://github.com/rapidsna edited https://github.com/llvm/llvm-project/pull/70480 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Driver][BoundsSafety] Add -fbounds-safety-experimental flag (PR #70480)

2023-11-02 Thread Yeoul Na via cfe-commits
@@ -0,0 +1,12 @@ +// This reports a warning to follow the default behavior of ClangAs. +// RUN: %clang -fexperimental-bounds-safety -x assembler -c %s -o /dev/null 2>&1 | FileCheck -check-prefix WARN %s rapidsna wrote: I think `-x assembler` and `-x

[clang] [Driver][BoundsSafety] Add -fbounds-safety-experimental flag (PR #70480)

2023-11-02 Thread Dan Liew via cfe-commits
@@ -0,0 +1,12 @@ +// This reports a warning to follow the default behavior of ClangAs. +// RUN: %clang -fexperimental-bounds-safety -x assembler -c %s -o /dev/null 2>&1 | FileCheck -check-prefix WARN %s delcypher wrote: @rapidsna Maybe there should be a version

[clang] [Driver][BoundsSafety] Add -fbounds-safety-experimental flag (PR #70480)

2023-11-02 Thread Kai Luo via cfe-commits
https://github.com/bzEq updated https://github.com/llvm/llvm-project/pull/70480 >From 99ec6e055dd32a86bf6d589a6895658dcbe1d7bd Mon Sep 17 00:00:00 2001 From: Yeoul Na Date: Fri, 27 Oct 2023 08:34:37 -0700 Subject: [PATCH 1/6] [Driver][BoundsSafety] Add -fbounds-safety-experimental flag

[clang] [Driver][BoundsSafety] Add -fbounds-safety-experimental flag (PR #70480)

2023-11-02 Thread Yeoul Na via cfe-commits
https://github.com/rapidsna updated https://github.com/llvm/llvm-project/pull/70480 >From 99ec6e055dd32a86bf6d589a6895658dcbe1d7bd Mon Sep 17 00:00:00 2001 From: Yeoul Na Date: Fri, 27 Oct 2023 08:34:37 -0700 Subject: [PATCH 1/6] [Driver][BoundsSafety] Add -fbounds-safety-experimental flag

[clang] [Driver][BoundsSafety] Add -fbounds-safety-experimental flag (PR #70480)

2023-11-02 Thread Yeoul Na via cfe-commits
@@ -0,0 +1,12 @@ +// This reports a warning to follow the default behavior of ClangAs. +// RUN: %clang -fexperimental-bounds-safety -x assembler -c %s -o /dev/null 2>&1 | FileCheck -check-prefix WARN %s + + +// WARN: warning: argument unused during compilation:

[clang] [Driver][BoundsSafety] Add -fbounds-safety-experimental flag (PR #70480)

2023-11-02 Thread via cfe-commits
github-actions[bot] wrote: :warning: C/C++ code formatter, clang-format found issues in your code. :warning: You can test this locally with the following command: ``bash git-clang-format --diff 55c9f24344a49cd1deb86af1d79d4dc3a798c6fb 5e35c30414517b242a1e68d46ecc5cfae3b75130 --

[clang] [Driver][BoundsSafety] Add -fbounds-safety-experimental flag (PR #70480)

2023-11-02 Thread Yeoul Na via cfe-commits
@@ -0,0 +1,5 @@ +; RUN: %clang -fbounds-safety-experimental -x ir -S %s -o /dev/null 2>&1 | FileCheck %s +; RUN: %clang_cc1 -fbounds-safety-experimental -x ir -S %s -o /dev/null 2>&1 | FileCheck %s + rapidsna wrote: @MaskRay fixed!

[clang] [Driver][BoundsSafety] Add -fbounds-safety-experimental flag (PR #70480)

2023-11-02 Thread Yeoul Na via cfe-commits
https://github.com/rapidsna edited https://github.com/llvm/llvm-project/pull/70480 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Driver][BoundsSafety] Add -fbounds-safety-experimental flag (PR #70480)

2023-11-02 Thread Yeoul Na via cfe-commits
@@ -330,6 +330,14 @@ def warn_alias_with_section : Warning< "as the %select{aliasee|resolver}2">, InGroup; +let CategoryName = "Bounds Safety Issue" in { +def err_bounds_safety_lang_not_supported : Error< + "bounds safety is only supported for C">; +def

[clang] [Driver][BoundsSafety] Add -fbounds-safety-experimental flag (PR #70480)

2023-11-02 Thread Yeoul Na via cfe-commits
@@ -0,0 +1,25 @@ +// RUN: not %clang -fbounds-safety-experimental -x c++ %s 2>&1 | FileCheck -check-prefix ERR %s + rapidsna wrote: @MaskRay Thank you! I removed the blank lines. https://github.com/llvm/llvm-project/pull/70480

[clang] [Driver][BoundsSafety] Add -fbounds-safety-experimental flag (PR #70480)

2023-11-02 Thread Yeoul Na via cfe-commits
rapidsna wrote: > The other experimental flags I see start with experimental, this one ends > with it. Why isn't this called `-fexerimental-bounds-safety`? @tbaederr Thank you! I just renamed the flag to `-fexperimental-bounds-safety`. https://github.com/llvm/llvm-project/pull/70480

[clang] [Driver][BoundsSafety] Add -fbounds-safety-experimental flag (PR #70480)

2023-11-02 Thread Yeoul Na via cfe-commits
@@ -330,6 +330,14 @@ def warn_alias_with_section : Warning< "as the %select{aliasee|resolver}2">, InGroup; +let CategoryName = "Bounds Safety Issue" in { +def err_bounds_safety_lang_not_supported : Error< + "bounds safety is only supported for C">; +def

[clang] [Driver][BoundsSafety] Add -fbounds-safety-experimental flag (PR #70480)

2023-11-02 Thread Yeoul Na via cfe-commits
@@ -0,0 +1,11 @@ +// RUN: %clang -c %s -### 2>&1 | FileCheck -check-prefix T0 %s rapidsna wrote: @nickdesaulniers @MaskRay Thank you! I removed the new directory and moved the tests to conform to the existing layout.

[clang] [Driver][BoundsSafety] Add -fbounds-safety-experimental flag (PR #70480)

2023-11-02 Thread Yeoul Na via cfe-commits
https://github.com/rapidsna updated https://github.com/llvm/llvm-project/pull/70480 >From 99ec6e055dd32a86bf6d589a6895658dcbe1d7bd Mon Sep 17 00:00:00 2001 From: Yeoul Na Date: Fri, 27 Oct 2023 08:34:37 -0700 Subject: [PATCH 1/5] [Driver][BoundsSafety] Add -fbounds-safety-experimental flag

[clang] [Driver][BoundsSafety] Add -fbounds-safety-experimental flag (PR #70480)

2023-11-01 Thread Yeoul Na via cfe-commits
https://github.com/rapidsna edited https://github.com/llvm/llvm-project/pull/70480 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Driver][BoundsSafety] Add -fbounds-safety-experimental flag (PR #70480)

2023-11-01 Thread Yeoul Na via cfe-commits
https://github.com/rapidsna edited https://github.com/llvm/llvm-project/pull/70480 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Driver][BoundsSafety] Add -fbounds-safety-experimental flag (PR #70480)

2023-11-01 Thread Yeoul Na via cfe-commits
@@ -330,6 +330,14 @@ def warn_alias_with_section : Warning< "as the %select{aliasee|resolver}2">, InGroup; +let CategoryName = "Bounds Safety Issue" in { +def err_bounds_safety_lang_not_supported : Error< + "bounds safety is only supported for C">; +def

[clang] [Driver][BoundsSafety] Add -fbounds-safety-experimental flag (PR #70480)

2023-11-01 Thread Yeoul Na via cfe-commits
@@ -330,6 +330,14 @@ def warn_alias_with_section : Warning< "as the %select{aliasee|resolver}2">, InGroup; +let CategoryName = "Bounds Safety Issue" in { +def err_bounds_safety_lang_not_supported : Error< + "bounds safety is only supported for C">; +def

[clang] [Driver][BoundsSafety] Add -fbounds-safety-experimental flag (PR #70480)

2023-11-01 Thread Yeoul Na via cfe-commits
@@ -330,6 +330,14 @@ def warn_alias_with_section : Warning< "as the %select{aliasee|resolver}2">, InGroup; +let CategoryName = "Bounds Safety Issue" in { +def err_bounds_safety_lang_not_supported : Error< + "bounds safety is only supported for C">; +def

[clang] [Driver][BoundsSafety] Add -fbounds-safety-experimental flag (PR #70480)

2023-11-01 Thread Nick Desaulniers via cfe-commits
@@ -0,0 +1,25 @@ +// RUN: not %clang -fbounds-safety-experimental -x c++ %s 2>&1 | FileCheck -check-prefix ERR %s + +// RUN: not %clang -fbounds-safety-experimental -x objective-c %s 2>&1 | FileCheck -check-prefix ERR %s + +// RUN: not %clang -fbounds-safety-experimental -x

[clang] [Driver][BoundsSafety] Add -fbounds-safety-experimental flag (PR #70480)

2023-11-01 Thread Nick Desaulniers via cfe-commits
@@ -0,0 +1,11 @@ +// RUN: %clang -c %s -### 2>&1 | FileCheck -check-prefix T0 %s nickdesaulniers wrote: > And make it easier to run bounds safety related tests only. > Provides a very convenient way to run only -fbounds-safety tests. Then give each test a

[clang] [Driver][BoundsSafety] Add -fbounds-safety-experimental flag (PR #70480)

2023-11-01 Thread Yeoul Na via cfe-commits
@@ -330,6 +330,14 @@ def warn_alias_with_section : Warning< "as the %select{aliasee|resolver}2">, InGroup; +let CategoryName = "Bounds Safety Issue" in { +def err_bounds_safety_lang_not_supported : Error< + "bounds safety is only supported for C">; +def

[clang] [Driver][BoundsSafety] Add -fbounds-safety-experimental flag (PR #70480)

2023-10-31 Thread Fangrui Song via cfe-commits
@@ -330,6 +330,14 @@ def warn_alias_with_section : Warning< "as the %select{aliasee|resolver}2">, InGroup; +let CategoryName = "Bounds Safety Issue" in { +def err_bounds_safety_lang_not_supported : Error< + "bounds safety is only supported for C">; +def

[clang] [Driver][BoundsSafety] Add -fbounds-safety-experimental flag (PR #70480)

2023-10-31 Thread Dan Liew via cfe-commits
@@ -330,6 +330,14 @@ def warn_alias_with_section : Warning< "as the %select{aliasee|resolver}2">, InGroup; +let CategoryName = "Bounds Safety Issue" in { +def err_bounds_safety_lang_not_supported : Error< + "bounds safety is only supported for C">; +def

[clang] [Driver][BoundsSafety] Add -fbounds-safety-experimental flag (PR #70480)

2023-10-31 Thread Yeoul Na via cfe-commits
@@ -3618,6 +3618,30 @@ void CompilerInvocationBase::GenerateLangArgs(const LangOptions , GenerateArg(Consumer, OPT_frandomize_layout_seed_EQ, Opts.RandstructSeed); } +static void CheckBoundsSafetyLang(InputKind IK, DiagnosticsEngine ) { + // Currently, bounds safety is

[clang] [Driver][BoundsSafety] Add -fbounds-safety-experimental flag (PR #70480)

2023-10-31 Thread Fangrui Song via cfe-commits
https://github.com/MaskRay edited https://github.com/llvm/llvm-project/pull/70480 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Driver][BoundsSafety] Add -fbounds-safety-experimental flag (PR #70480)

2023-10-31 Thread Fangrui Song via cfe-commits
@@ -0,0 +1,11 @@ +// RUN: %clang -c %s -### 2>&1 | FileCheck -check-prefix T0 %s MaskRay wrote: Test subdirectories are added conservatively. The main use cases are target-specific tests and flang. `Driver/XRay` is somehow an unneeded use that you can ignore.

[clang] [Driver][BoundsSafety] Add -fbounds-safety-experimental flag (PR #70480)

2023-10-31 Thread Fangrui Song via cfe-commits
@@ -330,6 +330,14 @@ def warn_alias_with_section : Warning< "as the %select{aliasee|resolver}2">, InGroup; +let CategoryName = "Bounds Safety Issue" in { +def err_bounds_safety_lang_not_supported : Error< + "bounds safety is only supported for C">; +def

[clang] [Driver][BoundsSafety] Add -fbounds-safety-experimental flag (PR #70480)

2023-10-31 Thread Dan Liew via cfe-commits
@@ -0,0 +1,11 @@ +// RUN: %clang -c %s -### 2>&1 | FileCheck -check-prefix T0 %s delcypher wrote: @nickdesaulniers As @rapidsna said there are multiple reasons: 1. Provides a very convenient way to run **only `-fbounds-safety` tests**. 2. More likely to avoid

[clang] [Driver][BoundsSafety] Add -fbounds-safety-experimental flag (PR #70480)

2023-10-31 Thread Yeoul Na via cfe-commits
@@ -330,6 +330,14 @@ def warn_alias_with_section : Warning< "as the %select{aliasee|resolver}2">, InGroup; +let CategoryName = "Bounds Safety Issue" in { +def err_bounds_safety_lang_not_supported : Error< + "bounds safety is only supported for C">; +def

[clang] [Driver][BoundsSafety] Add -fbounds-safety-experimental flag (PR #70480)

2023-10-31 Thread Yeoul Na via cfe-commits
@@ -0,0 +1,25 @@ +// RUN: not %clang -fbounds-safety-experimental -x c++ %s 2>&1 | FileCheck -check-prefix ERR %s + +// RUN: not %clang -fbounds-safety-experimental -x objective-c %s 2>&1 | FileCheck -check-prefix ERR %s + +// RUN: not %clang -fbounds-safety-experimental -x

[clang] [Driver][BoundsSafety] Add -fbounds-safety-experimental flag (PR #70480)

2023-10-31 Thread Yeoul Na via cfe-commits
@@ -0,0 +1,11 @@ +// RUN: %clang -c %s -### 2>&1 | FileCheck -check-prefix T0 %s rapidsna wrote: @nickdesaulniers I was hoping that we could keep -fbounds-safety tests under a separate folder clang/test/BoundsSafety in order to avoid them from getting mixed up

[clang] [Driver][BoundsSafety] Add -fbounds-safety-experimental flag (PR #70480)

2023-10-31 Thread Yeoul Na via cfe-commits
@@ -330,6 +330,14 @@ def warn_alias_with_section : Warning< "as the %select{aliasee|resolver}2">, InGroup; +let CategoryName = "Bounds Safety Issue" in { +def err_bounds_safety_lang_not_supported : Error< + "bounds safety is only supported for C">; +def

[clang] [Driver][BoundsSafety] Add -fbounds-safety-experimental flag (PR #70480)

2023-10-31 Thread Fangrui Song via cfe-commits
@@ -0,0 +1,25 @@ +// RUN: not %clang -fbounds-safety-experimental -x c++ %s 2>&1 | FileCheck -check-prefix ERR %s + MaskRay wrote: We use a terse style and use a blank line to group different sets of tests. Here the blank line use is unnecessary and harms

[clang] [Driver][BoundsSafety] Add -fbounds-safety-experimental flag (PR #70480)

2023-10-31 Thread Fangrui Song via cfe-commits
@@ -0,0 +1,5 @@ +; RUN: %clang -fbounds-safety-experimental -x ir -S %s -o /dev/null 2>&1 | FileCheck %s +; RUN: %clang_cc1 -fbounds-safety-experimental -x ir -S %s -o /dev/null 2>&1 | FileCheck %s + MaskRay wrote: We usually test `%clang` for driver and

[clang] [Driver][BoundsSafety] Add -fbounds-safety-experimental flag (PR #70480)

2023-10-31 Thread Fangrui Song via cfe-commits
@@ -0,0 +1,11 @@ +// RUN: %clang -c %s -### 2>&1 | FileCheck -check-prefix T0 %s MaskRay wrote: `clang/test/Driver/clang_f_opts.c` mixes a lot of options. Newer `-fxxx` tests can go to a dedicated `clang/test/Driver/fxxx.c`

[clang] [Driver][BoundsSafety] Add -fbounds-safety-experimental flag (PR #70480)

2023-10-31 Thread Fangrui Song via cfe-commits
@@ -330,6 +330,14 @@ def warn_alias_with_section : Warning< "as the %select{aliasee|resolver}2">, InGroup; +let CategoryName = "Bounds Safety Issue" in { +def err_bounds_safety_lang_not_supported : Error< + "bounds safety is only supported for C">; +def

[clang] [Driver][BoundsSafety] Add -fbounds-safety-experimental flag (PR #70480)

2023-10-31 Thread Fangrui Song via cfe-commits
https://github.com/MaskRay edited https://github.com/llvm/llvm-project/pull/70480 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Driver][BoundsSafety] Add -fbounds-safety-experimental flag (PR #70480)

2023-10-31 Thread Fangrui Song via cfe-commits
https://github.com/MaskRay requested changes to this pull request. https://github.com/llvm/llvm-project/pull/70480 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Driver][BoundsSafety] Add -fbounds-safety-experimental flag (PR #70480)

2023-10-31 Thread Nick Desaulniers via cfe-commits
@@ -3618,6 +3618,30 @@ void CompilerInvocationBase::GenerateLangArgs(const LangOptions , GenerateArg(Consumer, OPT_frandomize_layout_seed_EQ, Opts.RandstructSeed); } +static void CheckBoundsSafetyLang(InputKind IK, DiagnosticsEngine ) { + // Currently, bounds safety is

[clang] [Driver][BoundsSafety] Add -fbounds-safety-experimental flag (PR #70480)

2023-10-31 Thread Nick Desaulniers via cfe-commits
@@ -0,0 +1,25 @@ +// RUN: not %clang -fbounds-safety-experimental -x c++ %s 2>&1 | FileCheck -check-prefix ERR %s + +// RUN: not %clang -fbounds-safety-experimental -x objective-c %s 2>&1 | FileCheck -check-prefix ERR %s + +// RUN: not %clang -fbounds-safety-experimental -x

[clang] [Driver][BoundsSafety] Add -fbounds-safety-experimental flag (PR #70480)

2023-10-31 Thread Nick Desaulniers via cfe-commits
@@ -330,6 +330,14 @@ def warn_alias_with_section : Warning< "as the %select{aliasee|resolver}2">, InGroup; +let CategoryName = "Bounds Safety Issue" in { +def err_bounds_safety_lang_not_supported : Error< + "bounds safety is only supported for C">; +def

[clang] [Driver][BoundsSafety] Add -fbounds-safety-experimental flag (PR #70480)

2023-10-31 Thread Nick Desaulniers via cfe-commits
@@ -0,0 +1,11 @@ +// RUN: %clang -c %s -### 2>&1 | FileCheck -check-prefix T0 %s nickdesaulniers wrote: I would have expected a test like this to be added to clang/test/Driver/clang_f_opts.c --- why are the new tests in clang/test/BoundsSafety/ rather than

[clang] [Driver][BoundsSafety] Add -fbounds-safety-experimental flag (PR #70480)

2023-10-31 Thread Yeoul Na via cfe-commits
rapidsna wrote: > The other experimental flags I see start with experimental, this one ends > with it. Why isn't this called `-fexerimental-bounds-safety`? Oh, I can see most of them start with `-fexperimental`, not everything though. I can fix this. Is there a formal convention?

[clang] [Driver][BoundsSafety] Add -fbounds-safety-experimental flag (PR #70480)

2023-10-30 Thread Timm Baeder via cfe-commits
tbaederr wrote: The other experimental flags I see start with experimental, this one ends with it. Why isn't this called `-fexerimental-bounds-safety`? https://github.com/llvm/llvm-project/pull/70480 ___ cfe-commits mailing list

[clang] [Driver][BoundsSafety] Add -fbounds-safety-experimental flag (PR #70480)

2023-10-30 Thread Yeoul Na via cfe-commits
@@ -0,0 +1,5 @@ + +// RUN: %clang -fbounds-safety-experimental -fsyntax-only %s 2>&1 | FileCheck %s +// RUN: %clang_cc1 -fbounds-safety-experimental -fsyntax-only %s 2>&1 | FileCheck %s + +// CHECK: warning: '-fbounds-safety' is ignored for assembly rapidsna

[clang] [Driver][BoundsSafety] Add -fbounds-safety-experimental flag (PR #70480)

2023-10-30 Thread Yeoul Na via cfe-commits
https://github.com/rapidsna updated https://github.com/llvm/llvm-project/pull/70480 >From 99ec6e055dd32a86bf6d589a6895658dcbe1d7bd Mon Sep 17 00:00:00 2001 From: Yeoul Na Date: Fri, 27 Oct 2023 08:34:37 -0700 Subject: [PATCH 1/2] [Driver][BoundsSafety] Add -fbounds-safety-experimental flag

[clang] [Driver][BoundsSafety] Add -fbounds-safety-experimental flag (PR #70480)

2023-10-30 Thread Dan Liew via cfe-commits
@@ -0,0 +1,5 @@ +; RUN: %clang -fbounds-safety-experimental -x ir -S %s -o /dev/null 2>&1 | FileCheck %s +; RUN: %clang_cc1 -fbounds-safety-experimental -x ir -S %s -o /dev/null 2>&1 | FileCheck %s + delcypher wrote: It might be worth having a small comment

[clang] [Driver][BoundsSafety] Add -fbounds-safety-experimental flag (PR #70480)

2023-10-30 Thread Dan Liew via cfe-commits
@@ -0,0 +1,5 @@ + +// RUN: %clang -fbounds-safety-experimental -fsyntax-only %s 2>&1 | FileCheck %s +// RUN: %clang_cc1 -fbounds-safety-experimental -fsyntax-only %s 2>&1 | FileCheck %s + +// CHECK: warning: '-fbounds-safety' is ignored for assembly delcypher

[clang] [Driver][BoundsSafety] Add -fbounds-safety-experimental flag (PR #70480)

2023-10-30 Thread Yeoul Na via cfe-commits
@@ -0,0 +1,9 @@ +// RUN: %clang -c %s -### 2>&1 | not grep fbounds-safety-experimental rapidsna wrote: Done! https://github.com/llvm/llvm-project/pull/70480 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] [Driver][BoundsSafety] Add -fbounds-safety-experimental flag (PR #70480)

2023-10-30 Thread Yeoul Na via cfe-commits
@@ -3835,6 +3852,12 @@ bool CompilerInvocation::ParseLangArgs(LangOptions , ArgList , Opts.Trigraphs = Args.hasFlag(OPT_ftrigraphs, OPT_fno_trigraphs, Opts.Trigraphs); + Opts.BoundsSafety = Args.hasFlag(OPT_fbounds_safety, OPT_fno_bounds_safety,

[clang] [Driver][BoundsSafety] Add -fbounds-safety-experimental flag (PR #70480)

2023-10-30 Thread Yeoul Na via cfe-commits
@@ -3618,6 +3618,23 @@ void CompilerInvocationBase::GenerateLangArgs(const LangOptions , GenerateArg(Consumer, OPT_frandomize_layout_seed_EQ, Opts.RandstructSeed); } +static bool SupportsBoundsSafety(Language Lang) { + // Currently, bounds safety is only supported for

[clang] [Driver][BoundsSafety] Add -fbounds-safety-experimental flag (PR #70480)

2023-10-30 Thread Yeoul Na via cfe-commits
@@ -3618,6 +3618,23 @@ void CompilerInvocationBase::GenerateLangArgs(const LangOptions , GenerateArg(Consumer, OPT_frandomize_layout_seed_EQ, Opts.RandstructSeed); } +static bool SupportsBoundsSafety(Language Lang) { + // Currently, bounds safety is only supported for

[clang] [Driver][BoundsSafety] Add -fbounds-safety-experimental flag (PR #70480)

2023-10-30 Thread Yeoul Na via cfe-commits
@@ -330,6 +330,9 @@ def warn_alias_with_section : Warning< "as the %select{aliasee|resolver}2">, InGroup; +def error_bounds_safety_lang_not_supported : Error< rapidsna wrote: Done! https://github.com/llvm/llvm-project/pull/70480

[clang] [Driver][BoundsSafety] Add -fbounds-safety-experimental flag (PR #70480)

2023-10-30 Thread Yeoul Na via cfe-commits
@@ -330,6 +330,9 @@ def warn_alias_with_section : Warning< "as the %select{aliasee|resolver}2">, InGroup; +def error_bounds_safety_lang_not_supported : Error< rapidsna wrote: Done! https://github.com/llvm/llvm-project/pull/70480

[clang] [Driver][BoundsSafety] Add -fbounds-safety-experimental flag (PR #70480)

2023-10-30 Thread Yeoul Na via cfe-commits
https://github.com/rapidsna updated https://github.com/llvm/llvm-project/pull/70480 >From 99ec6e055dd32a86bf6d589a6895658dcbe1d7bd Mon Sep 17 00:00:00 2001 From: Yeoul Na Date: Fri, 27 Oct 2023 08:34:37 -0700 Subject: [PATCH 1/2] [Driver][BoundsSafety] Add -fbounds-safety-experimental flag

[clang] [Driver][BoundsSafety] Add -fbounds-safety-experimental flag (PR #70480)

2023-10-27 Thread Dan Liew via cfe-commits
@@ -3835,6 +3852,12 @@ bool CompilerInvocation::ParseLangArgs(LangOptions , ArgList , Opts.Trigraphs = Args.hasFlag(OPT_ftrigraphs, OPT_fno_trigraphs, Opts.Trigraphs); + Opts.BoundsSafety = Args.hasFlag(OPT_fbounds_safety, OPT_fno_bounds_safety,

[clang] [Driver][BoundsSafety] Add -fbounds-safety-experimental flag (PR #70480)

2023-10-27 Thread Dan Liew via cfe-commits
@@ -3618,6 +3618,23 @@ void CompilerInvocationBase::GenerateLangArgs(const LangOptions , GenerateArg(Consumer, OPT_frandomize_layout_seed_EQ, Opts.RandstructSeed); } +static bool SupportsBoundsSafety(Language Lang) { + // Currently, bounds safety is only supported for

[clang] [Driver][BoundsSafety] Add -fbounds-safety-experimental flag (PR #70480)

2023-10-27 Thread Dan Liew via cfe-commits
@@ -330,6 +330,9 @@ def warn_alias_with_section : Warning< "as the %select{aliasee|resolver}2">, InGroup; +def error_bounds_safety_lang_not_supported : Error< delcypher wrote: Should we introduce a "bounds safety" category and have the diagnostics fall

[clang] [Driver][BoundsSafety] Add -fbounds-safety-experimental flag (PR #70480)

2023-10-27 Thread Dan Liew via cfe-commits
@@ -0,0 +1,9 @@ +// RUN: %clang -c %s -### 2>&1 | not grep fbounds-safety-experimental delcypher wrote: Could we use `FileCheck` here instead of `grep`? https://github.com/llvm/llvm-project/pull/70480 ___ cfe-commits

[clang] [Driver][BoundsSafety] Add -fbounds-safety-experimental flag (PR #70480)

2023-10-27 Thread Dan Liew via cfe-commits
@@ -330,6 +330,9 @@ def warn_alias_with_section : Warning< "as the %select{aliasee|resolver}2">, InGroup; +def error_bounds_safety_lang_not_supported : Error< delcypher wrote: Nit: A lot of the error diagnostics use `err` as a preifx rather than `error`.

[clang] [Driver][BoundsSafety] Add -fbounds-safety-experimental flag (PR #70480)

2023-10-27 Thread Dan Liew via cfe-commits
@@ -3835,6 +3852,12 @@ bool CompilerInvocation::ParseLangArgs(LangOptions , ArgList , Opts.Trigraphs = Args.hasFlag(OPT_ftrigraphs, OPT_fno_trigraphs, Opts.Trigraphs); + Opts.BoundsSafety = Args.hasFlag(OPT_fbounds_safety, OPT_fno_bounds_safety,

[clang] [Driver][BoundsSafety] Add -fbounds-safety-experimental flag (PR #70480)

2023-10-27 Thread Dan Liew via cfe-commits
https://github.com/delcypher edited https://github.com/llvm/llvm-project/pull/70480 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Driver][BoundsSafety] Add -fbounds-safety-experimental flag (PR #70480)

2023-10-27 Thread Dan Liew via cfe-commits
@@ -3618,6 +3618,23 @@ void CompilerInvocationBase::GenerateLangArgs(const LangOptions , GenerateArg(Consumer, OPT_frandomize_layout_seed_EQ, Opts.RandstructSeed); } +static bool SupportsBoundsSafety(Language Lang) { + // Currently, bounds safety is only supported for

[clang] [Driver][BoundsSafety] Add -fbounds-safety-experimental flag (PR #70480)

2023-10-27 Thread Dan Liew via cfe-commits
https://github.com/delcypher requested changes to this pull request. In general looks good but there are some minor changes I'd like made. https://github.com/llvm/llvm-project/pull/70480 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[clang] [Driver][BoundsSafety] Add -fbounds-safety-experimental flag (PR #70480)

2023-10-27 Thread Yeoul Na via cfe-commits
rapidsna wrote: I'll push BoundsSafety.rst documentation in a separate PR. https://github.com/llvm/llvm-project/pull/70480 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Driver][BoundsSafety] Add -fbounds-safety-experimental flag (PR #70480)

2023-10-27 Thread Yeoul Na via cfe-commits
https://github.com/rapidsna created https://github.com/llvm/llvm-project/pull/70480 -fbounds-safety-experimental is an experimental flag for -fbounds-safety, which is a bounds-safety extension for C. -fbounds-safety will require substantial changes across the Clang codebase. So we introduce