[clang] [Sanitizer][Doc][NFI] Update the doc for prefix:*=sanitize (PR #142659)
Qinkun Bao via cfe-commits
cfe-commits at lists.llvm.org
Tue Jun 3 16:57:53 PDT 2025
https://github.com/qinkunbao updated https://github.com/llvm/llvm-project/pull/142659
>From c3e6f0f64be652259065c4c57b9dec7cc30502d0 Mon Sep 17 00:00:00 2001
From: Qinkun Bao <qinkun at google.com>
Date: Tue, 3 Jun 2025 19:29:54 +0000
Subject: [PATCH 1/4] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20in?=
=?UTF-8?q?itial=20version?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Created using spr 1.3.6
---
clang/docs/ReleaseNotes.rst | 4 +++-
clang/docs/SanitizerSpecialCaseList.rst | 18 ++++++++++++++++--
2 files changed, 19 insertions(+), 3 deletions(-)
diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index eccee1aeef846..49ce9ef938fe9 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -1045,7 +1045,9 @@ Sanitizers
----------
- ``-fsanitize=vptr`` is no longer a part of ``-fsanitize=undefined``.
-- Sanitizer ignorelists now support the syntax ``src:*=sanitize``.
+- Sanitizer ignorelists now support the syntax ``src:*=sanitize``,
+ ``type:*=sanitize``, ``fun:*=sanitize``, ``global:*=sanitize``,
+ and ``mainfile:*=sanitize``.
Python Binding Changes
----------------------
diff --git a/clang/docs/SanitizerSpecialCaseList.rst b/clang/docs/SanitizerSpecialCaseList.rst
index 6f924cfa97a97..4d0715f8a68ce 100644
--- a/clang/docs/SanitizerSpecialCaseList.rst
+++ b/clang/docs/SanitizerSpecialCaseList.rst
@@ -79,7 +79,8 @@ instrumentation for arithmetic operations containing values of type ``int``.
The ``=sanitize`` category is also supported. Any ``=sanitize`` category
entries enable sanitizer instrumentation, even if it was ignored by entries
-before.
+before. Entries can be ``src``, ``type``, ``global``, ``fun``, and
+``mainfile``.
With this, one may disable instrumentation for some or all types and
specifically allow instrumentation for one or many types -- including types
@@ -103,7 +104,7 @@ supported sanitizers.
}
If multiple entries match the source, then the latest entry takes the
-precedence.
+precedence. Here are a few examples.
.. code-block:: bash
@@ -119,6 +120,19 @@ precedence.
src:*/mylib/test.cc
src:*/mylib/*=sanitize
+ $ cat ignorelist3.txt
+ # Type T will be instrumented.
+ type:*
+ type:T=sanitize
+ type:T
+
+ $ cat ignorelist4.txt
+ # Function `bad_bar`` will be instrumented.
+ # Function `good_bar` will not be instrumented.
+ fun:*
+ fun:bar*
+ fun:bad_bar=sanitize
+
Format
======
>From c0e758eef52bf9d9a5da56d67457b2f48f7b7b14 Mon Sep 17 00:00:00 2001
From: Qinkun Bao <qinkun at google.com>
Date: Tue, 3 Jun 2025 19:31:03 +0000
Subject: [PATCH 2/4] Update the example
Created using spr 1.3.6
---
clang/docs/SanitizerSpecialCaseList.rst | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/clang/docs/SanitizerSpecialCaseList.rst b/clang/docs/SanitizerSpecialCaseList.rst
index 4d0715f8a68ce..3ca1f419e0306 100644
--- a/clang/docs/SanitizerSpecialCaseList.rst
+++ b/clang/docs/SanitizerSpecialCaseList.rst
@@ -130,7 +130,7 @@ precedence. Here are a few examples.
# Function `bad_bar`` will be instrumented.
# Function `good_bar` will not be instrumented.
fun:*
- fun:bar*
+ fun:*bar
fun:bad_bar=sanitize
Format
>From 3ed789b2c51027f92cb39938bb45c0152364270c Mon Sep 17 00:00:00 2001
From: Qinkun Bao <qinkun at google.com>
Date: Tue, 3 Jun 2025 19:33:40 +0000
Subject: [PATCH 3/4] Update the example
Created using spr 1.3.6
---
clang/docs/SanitizerSpecialCaseList.rst | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/clang/docs/SanitizerSpecialCaseList.rst b/clang/docs/SanitizerSpecialCaseList.rst
index 3ca1f419e0306..61b6c55d8e6e4 100644
--- a/clang/docs/SanitizerSpecialCaseList.rst
+++ b/clang/docs/SanitizerSpecialCaseList.rst
@@ -121,7 +121,7 @@ precedence. Here are a few examples.
src:*/mylib/*=sanitize
$ cat ignorelist3.txt
- # Type T will be instrumented.
+ # Type T will not be instrumented.
type:*
type:T=sanitize
type:T
>From b84443b63a1655cb996c9d76a5e39a5a44c0a5ec Mon Sep 17 00:00:00 2001
From: Qinkun Bao <qinkun at google.com>
Date: Tue, 3 Jun 2025 23:57:44 +0000
Subject: [PATCH 4/4] Fix doc build
Created using spr 1.3.6
---
clang/include/clang/Basic/DiagnosticGroups.td | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/clang/include/clang/Basic/DiagnosticGroups.td b/clang/include/clang/Basic/DiagnosticGroups.td
index be75b9ee6e3f6..beda73e675fc6 100644
--- a/clang/include/clang/Basic/DiagnosticGroups.td
+++ b/clang/include/clang/Basic/DiagnosticGroups.td
@@ -813,19 +813,19 @@ changes to one object won't affect the others, the object's initializer will run
once per copy, etc.
Specifically, this warning fires when it detects an object which:
- 1. Is defined as ``inline`` in a header file (so it might get compiled into multiple libaries), and
- 2. Has external linkage (otherwise it's supposed to be duplicated), and
- 3. Has hidden visibility.
+1. Is defined as ``inline`` in a header file (so it might get compiled into multiple libaries), and
+2. Has external linkage (otherwise it's supposed to be duplicated), and
+3. Has hidden visibility.
As well as one of the following:
- 1. The object is mutable, or
- 2. The object's initializer definitely has side effects.
+1. The object is mutable, or
+2. The object's initializer definitely has side effects.
The warning can be resolved by removing one of the conditions above. In rough
order of preference, this may be done by:
- 1. Marking the object ``const`` (if possible)
- 2. Moving the object's definition to a source file
- 3. Giving the object non-hidden visibility, e.g. using ``__attribute((visibility("default")))``.
+1. Marking the object ``const`` (if possible)
+2. Moving the object's definition to a source file
+3. Giving the object non-hidden visibility, e.g. using ``__attribute((visibility("default")))``.
Note that for (2), all levels of a pointer variable must be constant;
``const int*`` will trigger the warning because the pointer itself is mutable.
More information about the cfe-commits
mailing list