Skip to content

Conversation

@abidh
Copy link
Contributor

@abidh abidh commented Jun 2, 2025

As was noted in #140556 (comment), there is no documentation for CCC_OVERRIDE_OPTIONS. This adds the missing documentation. The information is duplicate of what we have for FCC_OVERRIDE_OPTIONS in flang. Once this goes in and available at https://clang.llvm.org/docs/UsersManual.html then the flang documentation can be changed to refer to it.

As was noted in llvm#140556 (comment),
there is no documentation for `CCC_OVERRIDE_OPTIONS`. This adds the
missing documentation. The information is duplicate of what we have for
`FCC_OVERRIDE_OPTIONS` in flang. Once this goes in and available at
https://clang.llvm.org/docs/UsersManual.html then the flang
documentation can be changed to refer to it.
@abidh abidh requested a review from MaskRay June 2, 2025 14:00
@llvmbot llvmbot added the clang Clang issues not falling into any other category label Jun 2, 2025
@llvmbot
Copy link
Member

llvmbot commented Jun 2, 2025

@llvm/pr-subscribers-clang

Author: Abid Qadeer (abidh)

Changes

As was noted in #140556 (comment), there is no documentation for CCC_OVERRIDE_OPTIONS. This adds the missing documentation. The information is duplicate of what we have for FCC_OVERRIDE_OPTIONS in flang. Once this goes in and available at https://clang.llvm.org/docs/UsersManual.html then the flang documentation can be changed to refer to it.


Full diff: https://github.com/llvm/llvm-project/pull/142396.diff

1 Files Affected:

  • (modified) clang/docs/UsersManual.rst (+29)
diff --git a/clang/docs/UsersManual.rst b/clang/docs/UsersManual.rst
index eb9a812f0c1c9..8c72f95b94095 100644
--- a/clang/docs/UsersManual.rst
+++ b/clang/docs/UsersManual.rst
@@ -3743,6 +3743,35 @@ Doxygen-style comments and ignores ordinary comments starting with ``//`` and
   ``-fcomment-block-commands=foo -fcomment-block-commands=bar`` does the same
   as above.
 
+.. _ccc-override-options:
+
+CCC_OVERRIDE_OPTIONS
+--------------------
+The environment variable ``CCC_OVERRIDE_OPTIONS`` can be used to edit clang's
+command line arguments. The value of this variable is a space-separated list of
+edits to perform. The edits are applied in the order in which they appear in
+``CCC_OVERRIDE_OPTIONS``. Each edit should be one of the following forms:
+
+- ``#``: Silence information about the changes to the command line arguments.
+
+- ``^FOO``: Add ``FOO`` as a new argument at the beginning of the command line
+  right after the name of the compiler executable.
+
+- ``+FOO``: Add ``FOO`` as a new argument at the end of the command line.
+
+- ``s/XXX/YYY/``: Substitute the regular expression ``XXX`` with ``YYY`` in the
+  command line.
+
+- ``xOPTION``: Removes all instances of the literal argument ``OPTION``.
+
+- ``XOPTION``: Removes all instances of the literal argument ``OPTION``, and the
+  following argument.
+
+- ``Ox``: Removes all flags matching ``O`` or ``O[sz0-9]`` and adds ``Ox`` at
+  the end of the command line.
+
+This environment variable does not affect the options added by the config files.
+
 .. _c:
 
 C Language Features

@abidh
Copy link
Contributor Author

abidh commented Jun 2, 2025

The CI failure seems to be for a separate issue. I have opened #142387 for it.

@abidh abidh merged commit 95ea436 into llvm:main Jun 3, 2025
11 of 12 checks passed
@abidh abidh deleted the ccc_override branch July 2, 2025 11:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clang Clang issues not falling into any other category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants