Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AutoBump] Merge with 894d3eeb (Aug 15) (4) #357

Open
wants to merge 132 commits into
base: feature/fused-ops
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
132 commits
Select commit Hold shift + click to select a range
f53e355
[libc] Add definitions for totalordermag(,f, l, f128), dsqrt(l, f128)…
wldfngrs Aug 14, 2024
df57833
[AMDGPU] Generate checks for llvm.amdgcn.is.private/shared (#103859)
jayfoad Aug 14, 2024
b72ac6f
[MLIR] Let matchers work on int ranges (#102494)
gysit Aug 14, 2024
6183665
[X86] combineEXTRACT_SUBVECTOR - fold extractions from UNPCK nodes.
RKSimon Aug 14, 2024
503ba62
[X86] combineEXTRACT_SUBVECTOR - fold extractions from BLENDI nodes.
RKSimon Aug 14, 2024
b006007
[NFC][VP] Reduce parameters in `LoopVectorizePass::runImpl` (#103551)
sunshaoce Aug 14, 2024
5ececb4
LowerAtomic: Use explicit alignment in lowerAtomicCmpXchgInst (#103767)
arsenm Aug 14, 2024
340be6c
[analyzer] Delete `alpha.security.MallocOverflow` (#103059)
NagyDonat Aug 14, 2024
3f0d3fd
[clang][test][RISCV] Add simple litmus test for --print-enabled-exten…
asb Aug 14, 2024
66bd5d7
[clang-repl] Fix PCH with delayed template parsing (#103028)
hahnjo Aug 14, 2024
0edd077
AMDGPU: Preserve alignment when custom expanding atomicrmw (#103768)
arsenm Aug 14, 2024
3efcc8e
[LV] Add test where diff checks not used when re-trying with RT checks.
fhahn Aug 14, 2024
91e602f
[clang][NFC] sort C standards on status page in reverse chronological…
h-vetinari Aug 14, 2024
486adc5
Revert "[clang][Interp][NFC] Move _Complex compiler code to separate …
tbaederr Aug 14, 2024
cba9166
[gn build] Port 486adc500c8e
llvmgnsyncbot Aug 14, 2024
1f995b5
[M68k] Remove use of APInt::getRawData(). NFC (#103529)
topperc Aug 14, 2024
5e990b0
[PowerPC][GlobalMerge] Reduce TOC usage by merging internal and priva…
amy-kwan Aug 14, 2024
8320b97
[InstCombine] Fold an unsigned comparison of `add nsw X, C` with a co…
Poseydon42 Aug 14, 2024
019ef52
[clang][AArch64] Point the nofp ABI check diagnostics at the callee (…
jroelofs Aug 14, 2024
80c5ccd
[libc][math] Fix missing const in hdrgen signatures for totalordermag…
overmighty Aug 14, 2024
d9b9ae6
[SLP][NFC]Use transform nodes before building external uses, NFC.
alexey-bataev Aug 14, 2024
5ce326c
[SelectionDAG] Construct SmallVector with ArrayRef (NFC) (#103705)
kazutakahirata Aug 14, 2024
bd42177
[MLIR][AMDGPU] Add rocdl.attr translation for waves_per_eu & unsafe_f…
manupak Aug 14, 2024
1115dee
[Analysis] Use range-based for loops (NFC) (#103540)
kazutakahirata Aug 14, 2024
4c2f90f
[MLIR][LLVM] Turn the inliner interface into a promised interface (#1…
Dinistro Aug 14, 2024
20b2c9f
[SLP][NFC]Use GatheredScalars vector instead of the original E->Scala…
alexey-bataev Aug 14, 2024
294ed6a
[RISCV] Use if init statement to reduce scope of variable. NFC
topperc Aug 14, 2024
abc1acf
[TargetLowering][AMDGPU][ARM][RISCV][X86] Teach SimplifyDemandedBits …
topperc Aug 14, 2024
b5e47d2
[mlir][vector] Add extra check on distribute types to avoid crashes (…
bangtianliu Aug 14, 2024
8345289
[LLVM] Fix missing includes for function declarations that will be ne…
fsfod Aug 14, 2024
f0fe6c6
[AMDGPU][NFC] Rename isHi() to isHi16Reg() for clarity. (#103888)
kosarev Aug 14, 2024
f3f465e
Do not use dirname in test (#103395)
fmayer Aug 14, 2024
234cb4c
[SelectionDAG] Scalarize binary ops of splats before legal types (#10…
Fros1er Aug 14, 2024
fdc4955
Revert "[scudo] Separated committed and decommitted entries." (#104045)
ChiaHungDuan Aug 14, 2024
d0c16a6
Fix prctl test to execute all test cases if the first condition fails…
kstoimenov Aug 14, 2024
d213981
[clang] Implement `__builtin_is_implicit_lifetime()` (#101807)
Endilll Aug 14, 2024
9c70205
[libc++] Remove duplicate C++17 LWG issues from the CSVs
ldionne Aug 14, 2024
efe3db2
[mlir][vector] Add tests for `populateSinkVectorBroadcastPatterns` (1…
banach-space Aug 14, 2024
d2f0d99
[TextAPI] Use range-based for loops (NFC) (#103530)
kazutakahirata Aug 14, 2024
cce2271
[LLDB][OSX] Add a fallback support exe directory (#103458)
walter-erquinigo Aug 14, 2024
7e5cd8f
[libc++] Mechanical adjustments for the C++14 Paper status files
ldionne Aug 14, 2024
ac00ce2
[libc++] Add mechanical update to CxxPapers.rst to git-blame-ignore-revs
ldionne Aug 14, 2024
36a0f20
AMDGPU/NewPM: Fill out addPreISelPasses (#102814)
arsenm Aug 14, 2024
2766728
CodeGen/NewPM: Add ExpandLarge* passes to isel IR passes (#102815)
arsenm Aug 14, 2024
5eb6330
Fix bazel build (#104054)
quanwanandy Aug 14, 2024
0eb1fc8
[libcxx] Set `_LIBCPP_HAS_CLOCK_GETTIME` for GPU targets (#99243)
jhuber6 Aug 14, 2024
8aacbfc
[X86] combineEXTRACT_SUBVECTOR - treat oneuse extractions from loads …
RKSimon Aug 14, 2024
85c79d6
[X86] Add test coverage for #103564
RKSimon Aug 14, 2024
ea9df09
[X86] concat(permv3(x0,m0,y0),permv3(x0,m1,y0)) -> permv3(concat(x0,u…
RKSimon Aug 14, 2024
a0be705
[SystemZ][z/OS] Continuation of __ptr32 support (#103393)
abhina-sree Aug 14, 2024
715c303
[RISCV][GISel] Support G_SEXT_INREG for Zbb. (#102682)
topperc Aug 14, 2024
6b652f6
[attributes][-Wunsafe-buffer-usage] Support adding unsafe_buffer_usag…
malavikasamak Aug 14, 2024
bdf4b9a
[NVPTX] Fix typo causing GCC warning (#103045)
gonzalobg Aug 14, 2024
21cea3f
AMDGPU: Stop promoting allocas with addrspacecast users (#104051)
arsenm Aug 14, 2024
3287a2e
[AArch64] Add some uxtw peephole tests. NFC
davemgreen Aug 14, 2024
c4ae8b1
[SandboxIR] Implement Instruction flags (#103343)
vporpo Aug 14, 2024
0dedd6f
[Clang] Adjust concept definition locus (#103867)
cor3ntin Aug 14, 2024
0ca0d55
[libc] Fix 'float type' incorrectly being used as the return type
jhuber6 Aug 14, 2024
0f08aa4
AMDGPU: Avoid manually reconstructing atomicrmw (#103769)
arsenm Aug 14, 2024
4d08bb1
[libc++] Fix ambiguous constructors for std::complex and std::optiona…
ldionne Aug 14, 2024
eae1d65
[HLSL] Split out the ROV attribute from the resource attribute, make …
bob80905 Aug 14, 2024
15e1e3b
[flang] Read the extra field from the in box when doing reboxing (#10…
clementval Aug 14, 2024
86db215
[vscode-mlir] Added per-LSP-server executable arguments (#79671)
jjalowie Aug 14, 2024
74d23f1
[OpenMP] Implement 'omp_alloc' on the device (#102526)
jhuber6 Aug 14, 2024
394162f
[Clang] Fix 'nvlink-wrapper' not ignoring `-plugin` like lld does (#1…
jhuber6 Aug 14, 2024
3b7b2f2
[libcxx] Add fallback to standard C when `unistd` is unavailable (#10…
jhuber6 Aug 14, 2024
23617f2
[libcxx] Disable invalid `__start/__stop` reference on NVPTX (#99381)
jhuber6 Aug 14, 2024
51ed383
[lld-macho] Make relative method lists work on x86-64 (#103905)
BertalanD Aug 14, 2024
9e87061
[libcxx] Adjust inline assembly constraints for the AMDGPU target (#1…
jhuber6 Aug 14, 2024
2dec83c
[clang] Turn -Wenum-constexpr-conversion into a hard error (#102364)
carlosgalvezp Aug 14, 2024
161e250
[OpenMP] Fix buildbot failing on allocator test
jhuber6 Aug 14, 2024
e687a9f
[TargetLowering] Remove unncessary null check. NFC
topperc Aug 14, 2024
e1b1550
[SLP][NFC]Remove unused using declarations, reduce mem usage in conta…
alexey-bataev Aug 14, 2024
00ab8a6
[flang][cuda] Use cuda runtime API (#103488)
clementval Aug 14, 2024
2c12c1e
[X86] Check if an invoked function clobbers fp or bp (#103446)
weiguozhi Aug 14, 2024
099bf20
[NVPTX] Add idp2a, idp4a intrinsics (#102763)
AlexMaclean Aug 14, 2024
6cafebe
[RISCV][GISel] Remove support for s32 G_VAARG on RV64. (#102533)
topperc Aug 14, 2024
a845dba
[libc++] Remove non-existent LWG issue from the .csv files
ldionne Aug 14, 2024
f6e3dbc
Revert "[flang][cuda] Use cuda runtime API" (#104232)
clementval Aug 14, 2024
a95ad2d
[mlir] Add bubbling patterns for non intersecting reshapes (#103401)
IanWood1 Aug 14, 2024
372ddcd
[DXIL][Analysis] Boilerplate for DXILResourceAnalysis pass
bogner Aug 14, 2024
1ca9fe6
Reapply "[Attributor][AMDGPU] Enable AAIndirectCallInfo for AMDAttrib…
shiltian Aug 14, 2024
28d577e
[DXIL][Analysis] Implement enough of DXILResourceAnalysis for buffers
bogner Aug 14, 2024
3265dfe
[RISCV] Add signext attribute to return of fmv_x_w test in float-conv…
topperc Aug 14, 2024
4bac8fd
[llvm-lit][test][NFC] Moved cat command tests into separate lit test …
connieyzhu Aug 14, 2024
e9b7983
[llvm-lit] Fix Unhashable TypeError when using lit's internal shell (…
Harini0924 Aug 14, 2024
a88f3a3
[Clang] Add `__CLANG_GPU_DISABLE_MATH_WRAPPERS` macro for offloading …
jhuber6 Aug 14, 2024
743e99d
Reland "[flang][cuda] Use cuda runtime API #103488"
clementval Aug 13, 2024
f1779ae
[bazel] Port 4bac8fd8904904bc7d502f39851eef50b5afff73 (#104278)
keith Aug 14, 2024
48809fa
Remove unused variable, and unneeded extract element instruction (#10…
bob80905 Aug 14, 2024
4f7ce10
[RISCV] Don't combine (sext_inreg (fmv_x_anyexth X), i16) with Zhinx.
topperc Aug 14, 2024
539bf49
[Sanitizers] Disable prctl test on Android.
kstoimenov Aug 14, 2024
2b959bd
[Clang] Error on extraneous template headers by default. (#104046)
cor3ntin Aug 14, 2024
9a666de
[Clang] Overflow Pattern Exclusions (#100272)
JustinStitt Aug 15, 2024
9a9ca98
[mlir][MemRef] Add more ops to narrow type support, strided metadata …
krzysz00 Aug 15, 2024
564efe2
utils/git: Add linkify script.
pcc Aug 15, 2024
7275919
Use clang_cc1 and specify the target explicitly.
bwendling Aug 15, 2024
5873aa8
Remove '-emit-llvm' and use '-triple'
bwendling Aug 15, 2024
4411d1e
[sanitizer] Remove GetCurrentThread nullness checks from Allocate
MaskRay Aug 15, 2024
aca01bf
[ctx_prof] CtxProfAnalysis: populate module data (#102930)
mtrofin Aug 15, 2024
bd47ba7
[ELF][NFC] Allow non-GotSection for addAddendOnlyRelocIfNonPreemptibl…
jrtc27 Aug 15, 2024
0df9189
[lld-macho] Fix crash: ObjC category merge + relative method lists (#…
alx32 Aug 15, 2024
abaa531
[RISCV] Implement RISCVTTIImpl::shouldConsiderAddressTypePromotion fo…
LiqinWeng Aug 15, 2024
b57038a
[OpenMP] Use range-based for loops (NFC) (#103511)
kazutakahirata Aug 15, 2024
b4dc986
[LLDB][OSX] Removed semi colon generating a warning during build (#10…
boredhuman Aug 15, 2024
e0d173d
[Clang] [AST] Fix placeholder return type name mangling for MSVC 1920…
MaxEW707 Aug 15, 2024
6e2d9df
Fix testcases. Use -emit-llvm and not -S. Use LABEL checking.
bwendling Aug 15, 2024
94b8b11
[Clang][NFC] Move FindCountedByField into FieldDecl (#104235)
bwendling Aug 15, 2024
07a8cba
Remove failing test until it can be fixed properly.
bwendling Aug 15, 2024
fb9e685
Intrinsic: introduce minimumnum and maximumnum for IR and SelectionDA…
wzssyqa Aug 15, 2024
8d03710
[ctx_prof] Remove an unneeded include in CtxProfAnalysis.cpp
hokein Aug 15, 2024
372842b
[X86][MC] Remove CMPCCXADD's CondCode flavor. (#103898)
FreddyLeaf Aug 15, 2024
1e34706
[mlir][tosa] Add verifier for `tosa.table` (#103708)
CoTinker Aug 15, 2024
3eaf483
[include-cleaner] Remove two commented-out lines of code.
hokein Aug 15, 2024
12763a0
[VPlan] Move VPWidenStoreRecipe::execute to VPlanRecipes.cpp (NFC).
fhahn Aug 15, 2024
fa343be
Fix warnings in #102848 [-Wunused-but-set-variable]
chapuni Aug 15, 2024
845431a
[UnitTests] Convert some data layout parsing tests to GTest (#104346)
s-barannikov Aug 15, 2024
4a00f1a
[mlir][test] XFAIL little-endian-only tests on SPARC (#103726)
rorth Aug 15, 2024
cf2e101
[flang][test] Fix Lower/default-initialization-globals.f90 on SPARC (…
rorth Aug 15, 2024
e1e47ac
[DataLayout] Move '*AlignElem' structs and enum inside DataLayout (NF…
s-barannikov Aug 15, 2024
3d06de5
[lldb] Remove Phabricator usernames from Code Owners file (#102590)
DavidSpickett Aug 15, 2024
6d9cae1
[flang][test] Run Driver/fveclib-codegen.f90 for aarch64 and x86_64 (…
rorth Aug 15, 2024
6f6422f
[lldb][test] Mark sys_info zdump test unsupported on 32 bit Arm Linux
DavidSpickett Aug 15, 2024
1415365
[MLIR][LLVM]: Add an IR utility to perform slice walking (#103053)
Dinistro Aug 15, 2024
5f15c17
[llvm][Docs] `_or_null` -> `_if_present` in Programmer's Manual (#98586)
zwuis Aug 15, 2024
05dfac2
[DAG] Adding m_FPToUI and m_FPToSI to SDPatternMatch.h (#104044)
jf-botto Aug 15, 2024
9a9ce91
[bazel] Port for 141536544f4ec1d1bf24256157f4ff1a3bc07dae
hokein Aug 15, 2024
7227b44
[clang][driver] Fix -print-target-triple OS version for apple targets…
Xazax-hun Aug 15, 2024
3a3990c
[Flang][OpenMP] Move assert for wrapper syms and block args to genLoo…
skatrak Aug 15, 2024
8107810
[DirectX] Use a more consistent pass name for DXILTranslateMetadata
bogner Aug 15, 2024
894d3ee
Remove empty line.
bwendling Aug 15, 2024
7f35dc8
[AutoBump] Merge with 894d3eeb (Aug 15)
mgehre-amd Sep 20, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
Expand Up @@ -93,3 +93,4 @@ b32931c5b32eb0d2cf37d688b34f8548c9674c19
b6262880b34629e9d7a72b5a42f315a3c9ed8139
39c7dc7207e76e72da21cf4fedda21b5311bf62d
e80bc777749331e9519575f416c342f7626dd14d
7e5cd8f1b6c5263ed5e2cc03d60c8779a8d3e9f7
2 changes: 0 additions & 2 deletions clang-tools-extra/include-cleaner/lib/WalkAST.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -271,15 +271,13 @@ class ASTWalker : public RecursiveASTVisitor<ASTWalker> {
// specialized template. Implicit ones are filtered out by RAV.
bool
VisitClassTemplateSpecializationDecl(ClassTemplateSpecializationDecl *CTSD) {
// if (CTSD->isExplicitSpecialization())
if (clang::isTemplateExplicitInstantiationOrSpecialization(
CTSD->getTemplateSpecializationKind()))
report(CTSD->getLocation(),
CTSD->getSpecializedTemplate()->getTemplatedDecl());
return true;
}
bool VisitVarTemplateSpecializationDecl(VarTemplateSpecializationDecl *VTSD) {
// if (VTSD->isExplicitSpecialization())
if (clang::isTemplateExplicitInstantiationOrSpecialization(
VTSD->getTemplateSpecializationKind()))
report(VTSD->getLocation(),
Expand Down
1 change: 1 addition & 0 deletions clang/docs/LanguageExtensions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1547,6 +1547,7 @@ The following type trait primitives are supported by Clang. Those traits marked
* ``__array_extent(type, dim)`` (Embarcadero):
The ``dim``'th array bound in the type ``type``, or ``0`` if
``dim >= __array_rank(type)``.
* ``__builtin_is_implicit_lifetime`` (C++, GNU, Microsoft)
* ``__builtin_is_virtual_base_of`` (C++, GNU, Microsoft)
* ``__can_pass_in_regs`` (C++)
Returns whether a class can be passed in registers under the current
Expand Down
74 changes: 73 additions & 1 deletion clang/docs/ReleaseNotes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,36 @@ C++ Specific Potentially Breaking Changes
few users and can be written as ``__is_same(__remove_cv(T), decltype(nullptr))``,
which GCC supports as well.

- Clang will now correctly diagnose as ill-formed a constant expression where an
enum without a fixed underlying type is set to a value outside the range of
the enumeration's values.

.. code-block:: c++

enum E { Zero, One, Two, Three, Four };
constexpr E Val1 = (E)3; // Ok
constexpr E Val2 = (E)7; // Ok
constexpr E Val3 = (E)8; // Now ill-formed, out of the range [0, 7]
constexpr E Val4 = (E)-1; // Now ill-formed, out of the range [0, 7]

Since Clang 16, it has been possible to suppress the diagnostic via
`-Wno-enum-constexpr-conversion`, to allow for a transition period for users.
Now, in Clang 20, **it is no longer possible to suppress the diagnostic**.

- Extraneous template headers are now ill-formed by default.
This error can be disable with ``-Wno-error=extraneous-template-head``.

.. code-block:: c++

template <> // error: extraneous template head
template <typename T>
void f();

ABI Changes in This Version
---------------------------

- Fixed Microsoft name mangling of placeholder, auto and decltype(auto), return types for MSVC 1920+. This change resolves incompatibilities with code compiled by MSVC 1920+ but will introduce incompatibilities with code compiled by earlier versions of Clang unless such code is built with the compiler option -fms-compatibility-version=19.14 to imitate the MSVC 1914 mangling behavior.

AST Dumping Potentially Breaking Changes
----------------------------------------

Expand Down Expand Up @@ -95,6 +122,9 @@ C++23 Feature Support
C++2c Feature Support
^^^^^^^^^^^^^^^^^^^^^

- Add ``__builtin_is_implicit_lifetime`` intrinsic, which supports
`P2647R1 A trait for implicit lifetime types <https://wg21.link/p2674r1>`_

- Add ``__builtin_is_virtual_base_of`` intrinsic, which supports
`P2985R0 A type trait for detecting virtual base classes <https://wg21.link/p2985r0>`_

Expand Down Expand Up @@ -140,6 +170,11 @@ Modified Compiler Flags
Removed Compiler Flags
-------------------------

- The compiler flag `-Wenum-constexpr-conversion` (and the `Wno-`, `Wno-error-`
derivatives) is now removed, since it's no longer possible to suppress the
diagnostic (see above). Users can expect an `unknown warning` diagnostic if
it's still in use.

Attribute Changes in Clang
--------------------------

Expand Down Expand Up @@ -217,8 +252,10 @@ Bug Fixes to C++ Support
- Clang now preserves the unexpanded flag in a lambda transform used for pack expansion. (#GH56852), (#GH85667),
(#GH99877).
- Fixed a bug when diagnosing ambiguous explicit specializations of constrained member functions.
- Fixed an assertion failure when selecting a function from an overload set that includes a
- Fixed an assertion failure when selecting a function from an overload set that includes a
specialization of a conversion function template.
- Correctly diagnose attempts to use a concept name in its own definition;
A concept name is introduced to its scope sooner to match the C++ standard. (#GH55875)

Bug Fixes to AST Handling
^^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down Expand Up @@ -347,11 +384,46 @@ Improvements
Moved checkers
^^^^^^^^^^^^^^

- The checker ``alpha.security.MallocOverflow`` was deleted because it was
badly implemented and its agressive logic produced too many false positives.
To detect too large arguments passed to malloc, consider using the checker
``alpha.taint.TaintedAlloc``.

.. _release-notes-sanitizers:

Sanitizers
----------

- Added the ``-fsanitize-overflow-pattern-exclusion=`` flag which can be used
to disable specific overflow-dependent code patterns. The supported patterns
are: ``add-overflow-test``, ``negated-unsigned-const``, and
``post-decr-while``. The sanitizer instrumentation can be toggled off for all
available patterns by specifying ``all``. Conversely, you can disable all
exclusions with ``none``.

.. code-block:: c++

/// specified with ``-fsanitize-overflow-pattern-exclusion=add-overflow-test``
int common_overflow_check_pattern(unsigned base, unsigned offset) {
if (base + offset < base) { /* ... */ } // The pattern of `a + b < a`, and other re-orderings, won't be instrumented
}

/// specified with ``-fsanitize-overflow-pattern-exclusion=negated-unsigned-const``
void negation_overflow() {
unsigned long foo = -1UL; // No longer causes a negation overflow warning
unsigned long bar = -2UL; // and so on...
}

/// specified with ``-fsanitize-overflow-pattern-exclusion=post-decr-while``
void while_post_decrement() {
unsigned char count = 16;
while (count--) { /* ... */} // No longer causes unsigned-integer-overflow sanitizer to trip
}

Many existing projects have a large amount of these code patterns present.
This new flag should allow those projects to enable integer sanitizers with
less noise.

Python Binding Changes
----------------------
- Fixed an issue that led to crashes when calling ``Type.get_exception_specification_kind``.
Expand Down
42 changes: 42 additions & 0 deletions clang/docs/UndefinedBehaviorSanitizer.rst
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,48 @@ To silence reports from unsigned integer overflow, you can set
``-fsanitize-recover=unsigned-integer-overflow``, is particularly useful for
providing fuzzing signal without blowing up logs.

Disabling instrumentation for common overflow patterns
------------------------------------------------------

There are certain overflow-dependent or overflow-prone code patterns which
produce a lot of noise for integer overflow/truncation sanitizers. Negated
unsigned constants, post-decrements in a while loop condition and simple
overflow checks are accepted and pervasive code patterns. However, the signal
received from sanitizers instrumenting these code patterns may be too noisy for
some projects. To disable instrumentation for these common patterns one should
use ``-fsanitize-overflow-pattern-exclusion=``.

Currently, this option supports three overflow-dependent code idioms:

``negated-unsigned-const``

.. code-block:: c++

/// -fsanitize-overflow-pattern-exclusion=negated-unsigned-const
unsigned long foo = -1UL; // No longer causes a negation overflow warning
unsigned long bar = -2UL; // and so on...

``post-decr-while``

.. code-block:: c++

/// -fsanitize-overflow-pattern-exclusion=post-decr-while
unsigned char count = 16;
while (count--) { /* ... */ } // No longer causes unsigned-integer-overflow sanitizer to trip

``add-overflow-test``

.. code-block:: c++

/// -fsanitize-overflow-pattern-exclusion=add-overflow-test
if (base + offset < base) { /* ... */ } // The pattern of `a + b < a`, and other re-orderings,
// won't be instrumented (same for signed types)

You can enable all exclusions with
``-fsanitize-overflow-pattern-exclusion=all`` or disable all exclusions with
``-fsanitize-overflow-pattern-exclusion=none``. Specifying ``none`` has
precedence over other values.

Issue Suppression
=================

Expand Down
43 changes: 0 additions & 43 deletions clang/docs/analyzer/checkers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2951,49 +2951,6 @@ Warn about buffer overflows (newer checker).
char c = s[x]; // warn: index is tainted
}

.. _alpha-security-MallocOverflow:

alpha.security.MallocOverflow (C)
"""""""""""""""""""""""""""""""""
Check for overflows in the arguments to ``malloc()``.
It tries to catch ``malloc(n * c)`` patterns, where:

- ``n``: a variable or member access of an object
- ``c``: a constant foldable integral

This checker was designed for code audits, so expect false-positive reports.
One is supposed to silence this checker by ensuring proper bounds checking on
the variable in question using e.g. an ``assert()`` or a branch.

.. code-block:: c

void test(int n) {
void *p = malloc(n * sizeof(int)); // warn
}

void test2(int n) {
if (n > 100) // gives an upper-bound
return;
void *p = malloc(n * sizeof(int)); // no warning
}

void test3(int n) {
assert(n <= 100 && "Contract violated.");
void *p = malloc(n * sizeof(int)); // no warning
}

Limitations:

- The checker won't warn for variables involved in explicit casts,
since that might limit the variable's domain.
E.g.: ``(unsigned char)int x`` would limit the domain to ``[0,255]``.
The checker will miss the true-positive cases when the explicit cast would
not tighten the domain to prevent the overflow in the subsequent
multiplication operation.

- It is an AST-based checker, thus it does not make use of the
path-sensitive taint-analysis.

.. _alpha-security-MmapWriteExec:

alpha.security.MmapWriteExec (C)
Expand Down
4 changes: 4 additions & 0 deletions clang/include/clang/AST/Decl.h
Original file line number Diff line number Diff line change
Expand Up @@ -3206,6 +3206,10 @@ class FieldDecl : public DeclaratorDecl, public Mergeable<FieldDecl> {
/// Set the C++11 in-class initializer for this member.
void setInClassInitializer(Expr *NewInit);

/// Find the FieldDecl specified in a FAM's "counted_by" attribute. Returns
/// \p nullptr if either the attribute or the field doesn't exist.
const FieldDecl *findCountedByField() const;

private:
void setLazyInClassInitializer(LazyDeclStmtPtr NewInit);

Expand Down
13 changes: 9 additions & 4 deletions clang/include/clang/AST/DeclTemplate.h
Original file line number Diff line number Diff line change
Expand Up @@ -3146,19 +3146,24 @@ class ConceptDecl : public TemplateDecl, public Mergeable<ConceptDecl> {
: TemplateDecl(Concept, DC, L, Name, Params),
ConstraintExpr(ConstraintExpr) {};
public:
static ConceptDecl *Create(ASTContext &C, DeclContext *DC,
SourceLocation L, DeclarationName Name,
static ConceptDecl *Create(ASTContext &C, DeclContext *DC, SourceLocation L,
DeclarationName Name,
TemplateParameterList *Params,
Expr *ConstraintExpr);
Expr *ConstraintExpr = nullptr);
static ConceptDecl *CreateDeserialized(ASTContext &C, GlobalDeclID ID);

Expr *getConstraintExpr() const {
return ConstraintExpr;
}

bool hasDefinition() const { return ConstraintExpr != nullptr; }

void setDefinition(Expr *E) { ConstraintExpr = E; }

SourceRange getSourceRange() const override LLVM_READONLY {
return SourceRange(getTemplateParameters()->getTemplateLoc(),
ConstraintExpr->getEndLoc());
ConstraintExpr ? ConstraintExpr->getEndLoc()
: SourceLocation());
}

bool isTypeConcept() const {
Expand Down
9 changes: 9 additions & 0 deletions clang/include/clang/AST/Expr.h
Original file line number Diff line number Diff line change
Expand Up @@ -4043,6 +4043,15 @@ class BinaryOperator : public Expr {
void setHasStoredFPFeatures(bool B) { BinaryOperatorBits.HasFPFeatures = B; }
bool hasStoredFPFeatures() const { return BinaryOperatorBits.HasFPFeatures; }

/// Set and get the bit that informs arithmetic overflow sanitizers whether
/// or not they should exclude certain BinaryOperators from instrumentation
void setExcludedOverflowPattern(bool B) {
BinaryOperatorBits.ExcludedOverflowPattern = B;
}
bool hasExcludedOverflowPattern() const {
return BinaryOperatorBits.ExcludedOverflowPattern;
}

/// Get FPFeatures from trailing storage
FPOptionsOverride getStoredFPFeatures() const {
assert(hasStoredFPFeatures());
Expand Down
5 changes: 5 additions & 0 deletions clang/include/clang/AST/Stmt.h
Original file line number Diff line number Diff line change
Expand Up @@ -650,6 +650,11 @@ class alignas(void *) Stmt {
LLVM_PREFERRED_TYPE(bool)
unsigned HasFPFeatures : 1;

/// Whether or not this BinaryOperator should be excluded from integer
/// overflow sanitization.
LLVM_PREFERRED_TYPE(bool)
unsigned ExcludedOverflowPattern : 1;

SourceLocation OpLoc;
};

Expand Down
12 changes: 9 additions & 3 deletions clang/include/clang/Basic/Attr.td
Original file line number Diff line number Diff line change
Expand Up @@ -4467,7 +4467,7 @@ def ReleaseHandle : InheritableParamAttr {

def UnsafeBufferUsage : InheritableAttr {
let Spellings = [Clang<"unsafe_buffer_usage">];
let Subjects = SubjectList<[Function]>;
let Subjects = SubjectList<[Function, Field]>;
let Documentation = [UnsafeBufferUsageDocs];
}

Expand Down Expand Up @@ -4599,12 +4599,18 @@ def HLSLResource : InheritableAttr {
"CBuffer", "Sampler", "TBuffer", "RTAccelerationStructure",
"FeedbackTexture2D", "FeedbackTexture2DArray"
],
/*opt=*/0, /*fake=*/0, /*isExternalType=*/1, /*isCovered=*/0>,
DefaultBoolArgument<"isROV", /*default=*/0>
/*opt=*/0, /*fake=*/0, /*isExternalType=*/1, /*isCovered=*/0>
];
let Documentation = [InternalOnly];
}

def HLSLROV : InheritableAttr {
let Spellings = [CXX11<"hlsl", "is_rov">];
let Subjects = SubjectList<[Struct]>;
let LangOpts = [HLSL];
let Documentation = [InternalOnly];
}

def HLSLResourceClass : InheritableAttr {
let Spellings = [CXX11<"hlsl", "resource_class">];
let Subjects = SubjectList<[Struct]>;
Expand Down
Loading