[clang] ed80d0c - [NFC][analyzer][docs] Restore/remove orphaned images (#122481)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Jan 13 05:31:25 PST 2025
Author: DonĂ¡t Nagy
Date: 2025-01-13T14:31:21+01:00
New Revision: ed80d0c2ae41888d8d0be90e73026bc126d82161
URL: https://github.com/llvm/llvm-project/commit/ed80d0c2ae41888d8d0be90e73026bc126d82161
DIFF: https://github.com/llvm/llvm-project/commit/ed80d0c2ae41888d8d0be90e73026bc126d82161.diff
LOG: [NFC][analyzer][docs] Restore/remove orphaned images (#122481)
When commit 61a76f58ebf1 converted the static analyzer FAQ from HTML to
RST, it accidentally left out three images (`example_*.png`) that were
previously present in that document. This commit re-adds those three
images to the FAQ (and moves them to the directory for the image assets
of the RST documentation).
Moreover commit 093aaca2b0ad _copied_ the file `scan_build_cmd.png` to
the RST documentation directory instead of just moving it; so this
commit removes its "old" copy which is no longer used (because the old
HTML-based documentation file was replaced by a stub that redirects to
the RST docs).
Added:
clang/docs/analyzer/images/example_custom_assert.png
clang/docs/analyzer/images/example_null_pointer.png
clang/docs/analyzer/images/example_use_assert.png
Modified:
clang/docs/analyzer/user-docs/FAQ.rst
Removed:
clang/www/analyzer/images/example_custom_assert.png
clang/www/analyzer/images/example_null_pointer.png
clang/www/analyzer/images/example_use_assert.png
clang/www/analyzer/images/scan_build_cmd.png
################################################################################
diff --git a/clang/www/analyzer/images/example_custom_assert.png b/clang/docs/analyzer/images/example_custom_assert.png
similarity index 100%
rename from clang/www/analyzer/images/example_custom_assert.png
rename to clang/docs/analyzer/images/example_custom_assert.png
diff --git a/clang/www/analyzer/images/example_null_pointer.png b/clang/docs/analyzer/images/example_null_pointer.png
similarity index 100%
rename from clang/www/analyzer/images/example_null_pointer.png
rename to clang/docs/analyzer/images/example_null_pointer.png
diff --git a/clang/www/analyzer/images/example_use_assert.png b/clang/docs/analyzer/images/example_use_assert.png
similarity index 100%
rename from clang/www/analyzer/images/example_use_assert.png
rename to clang/docs/analyzer/images/example_use_assert.png
diff --git a/clang/docs/analyzer/user-docs/FAQ.rst b/clang/docs/analyzer/user-docs/FAQ.rst
index e1147916a767cf..58eac783efccd1 100644
--- a/clang/docs/analyzer/user-docs/FAQ.rst
+++ b/clang/docs/analyzer/user-docs/FAQ.rst
@@ -9,6 +9,8 @@ Custom Assertions
Q: How do I tell the analyzer that I do not want the bug being reported here since my custom error handler will safely end the execution before the bug is reached?
+.. image:: ../images/example_custom_assert.png
+
You can tell the analyzer that this path is unreachable by teaching it about your `custom assertion handlers <Annotations.html#custom-assertion-handlers>`__. For example, you can modify the code segment as following:
.. code-block:: c
@@ -25,6 +27,8 @@ Null Pointer Dereference
Q: The analyzer reports a null dereference, but I know that the pointer is never null. How can I tell the analyzer that a pointer can never be null?
+.. image:: ../images/example_null_pointer.png
+
The reason the analyzer often thinks that a pointer can be null is because the preceding code checked compared it against null. If you are absolutely sure that it cannot be null, remove the preceding check and, preferably, add an assertion as well. For example:
.. code-block:: c
@@ -143,6 +147,8 @@ Ensuring Loop Body Execution
Q: The analyzer assumes that a loop body is never entered. How can I tell it that the loop body will be entered at least once?
+.. image:: ../images/example_use_assert.png
+
In cases where you know that a loop will always be entered at least once, you can use assertions to inform the analyzer. For example:
.. code-block:: c
diff --git a/clang/www/analyzer/images/scan_build_cmd.png b/clang/www/analyzer/images/scan_build_cmd.png
deleted file mode 100644
index 464fd4e129a208..00000000000000
Binary files a/clang/www/analyzer/images/scan_build_cmd.png and /dev/null
diff er
More information about the cfe-commits
mailing list