[clang] [Clang] add wraps and no_wraps attributes (PR #115094)
Vitaly Buka via cfe-commits
cfe-commits at lists.llvm.org
Fri Nov 8 14:17:44 PST 2024
================
@@ -8710,3 +8710,103 @@ Declares that a function potentially allocates heap memory, and prevents any pot
of ``nonallocating`` by the compiler.
}];
}
+
+def WrapsDocs : Documentation {
+ let Category = DocCatField;
+ let Content = [{
+The ``wraps`` attribute can be used with type or variable declarations to
+denote that arithmetic containing attributed types or variables have defined
+overflow behavior. Specifically, the behavior is defined as being consistent
+with two's complement wrap-around. For the purposes of sanitizers or warnings
+that concern themselves with the definedness of integer arithmetic, they will
+cease to instrument or warn about arithmetic that directly involves operands
+attributed with the ``wraps`` attribute.
+
+The ``signed-integer-overflow``, ``unsigned-integer-overflow``,
+``implicit-signed-integer-truncation`` and the
----------------
vitalybuka wrote:
I don't think it should affect instrumentation at all.
We have -fsanitize-recover= mode.
In this case we need instrumentation to print report, regardless of "wrap", and the "wrap" or -fwrap will control how to calculate after the report.
to suppress report we have no_sanitize attribute already
https://github.com/llvm/llvm-project/pull/115094
More information about the cfe-commits
mailing list