Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
2109 commits
Select commit Hold shift + click to select a range
d61c6c7
[Clang] Correctly set LD_LIBRARY_PATH in env.c
boomanaiden154 Sep 23, 2025
61a4853
[LV] Check for hoisted safe-div selects in planContainsAdditionalSimp.
fhahn Sep 23, 2025
08ed7a3
[HLSL] Enable InitList code to handle zero sized structs (#160355)
spall Sep 23, 2025
91720ce
[RISCV][NFC] Rename simm12 to simm12_lo (#160380)
lenary Sep 23, 2025
00c1357
[HLSL][NFC] Builtin type declaration builder cleanup (#160375)
hekota Sep 23, 2025
e9ea00e
[WebAssembly] Remove FAKE_USEs before ExplicitLocals (#160228)
aheejin Sep 23, 2025
05e5dd1
[AMDGPU] Support `xor cond, -1` when lowering `BRCOND` (#160341)
shiltian Sep 23, 2025
d5e83cf
Speculative buildbot fix after ca2e8f
preames Sep 23, 2025
a10c9bd
[lldb] Rework how we pass the execution context to the statusline (#1…
JDevlieghere Sep 23, 2025
e91468c
[flang][cuda] Emit error when trying to print device data (#160395)
clementval Sep 23, 2025
017b747
[AMDGPU] Handle S_GETREG_B32_const in the hazard recognizer. NFCI (#1…
rampitec Sep 23, 2025
57369b9
[AMDGPU] Add s-cluster-barrier.ll test. NFC (#160353)
rampitec Sep 23, 2025
16edd1e
[AMDGPU] Add test to whole-wave-functions.ll. NFC (#160361)
rampitec Sep 23, 2025
4afad52
[AMDGPU] Add missing gfx1251 runline to gfx1250_asm_vop3_err.s. NFC. …
rampitec Sep 23, 2025
c3d823b
[RISCV] Update SiFive7's scheduling model on mask and data movement i…
mshockwave Sep 23, 2025
966f783
[lld][WebAssembly] Remove redundant assignment. NFC (#160400)
sbc100 Sep 23, 2025
e93fc0e
[GVN/MemDep] Limit the size of the cache for non-local dependencies. …
alinas Sep 23, 2025
f82de74
[OpenMP] Update documentation formatting. (#160402)
CatherineMoore Sep 23, 2025
80f5cd1
[lld][WebAssembly] Allow --import-memory to take single name (#160409)
sbc100 Sep 23, 2025
5562e1b
[ConstantFolding] Avoid use of isNonIntegralPointerType()
arichardson Sep 23, 2025
8db64dc
[flang] Handle DATA-style default component /inits/ in time (#159469)
klausler Sep 23, 2025
709670f
[flang] More graceful parse failures at EOF (#159834)
klausler Sep 23, 2025
627a143
[flang] Fix crash from undetected program error. (#159847)
klausler Sep 23, 2025
3f8dbff
[flang] Catch attempts to use assumed-rank as elemental argument (#15…
klausler Sep 23, 2025
302f6eb
[flang][runtime] Use dumber but faster check for list-directed repeti…
klausler Sep 23, 2025
65e4f65
[flang] Silence bogus error (#160173)
klausler Sep 23, 2025
3f4ada4
[BOLT] Avoid n^2 complexity in fixBranches(). NFCI (#160407)
maksfb Sep 23, 2025
a117067
[Remarks] YAMLRemarkSerializer: Fix StringRef out-of-bounds read (#15…
tobias-stadler Sep 23, 2025
6a2e170
[clang] Add missing readonly/readnone annotations (#158424)
qchateau Sep 23, 2025
0524613
Revert "Speculative buildbot fix after ca2e8f"
preames Sep 23, 2025
e7c4900
[flang][acc] Support fir.convert in type categorization (#160403)
razvanlupusoru Sep 23, 2025
877d2c7
[libc++] Fix use of static in constexpr (#160180)
Prabhuk Sep 23, 2025
1e24046
[libc++] Implement Resolution of LWG 3886 (#155356)
smallp-o-p Sep 23, 2025
f0ad34c
[lldb-dap] Bump the version to 0.2.17
JDevlieghere Sep 23, 2025
5520a39
[clang-doc] fix CSS, JS paths for HTML Mustache generation (#160360)
evelez7 Sep 24, 2025
a758ab5
[NVVM][NVPTX] Add support for tcgen05.mma (#151949)
schwarzschild-radius Sep 24, 2025
d6d2fc1
[MLIR][Python] quiet stubgen (#160368)
makslevental Sep 24, 2025
933e3c0
[MLIR][Python] Add bindings for PDL native rewrite function registeri…
PragmaTwice Sep 24, 2025
ea7220e
[RISCV] Refactor DAG-to-DAG Selection: Port lowering code for `qc.ins…
hchandel Sep 24, 2025
677d7b7
[bazel][mlir][Python] Port #159926: move PDLPatternMatch.h.inc (#160432)
rupprecht Sep 24, 2025
d35163c
[clang-tidy] improve robustness of the member initializer detection i…
HerrCai0907 Sep 24, 2025
bfad1ff
Reapply "[Coroutines] Add llvm.coro.is_in_ramp and drop return value …
NewSigma Sep 24, 2025
e36867f
[libc++] Major improvements to visualize-historical
ldionne Sep 24, 2025
3688b4c
[libc++] Add an --open option to compare-benchmarks
ldionne Sep 24, 2025
e7e73ea
[CodeGen] Fix cleanup attribute for C89 for-loop init variables (#156…
jongmyeong-choi Sep 24, 2025
b19f48d
[LoongArch][NFC] Add tests for 256-bit broadcast with undef high part
zhaoqi5 Sep 24, 2025
ece3772
[mlir][python] Cache import of ir module in type casters. (#160000)
hawkinsp Sep 24, 2025
041e95e
[RISCV] Remove bfloat vectors from AllFloatVectors. NFC (#160399)
topperc Sep 24, 2025
ea0314f
[LLDB][PDB] Fix plugin warning message style (#160398)
Nerixyz Sep 24, 2025
ceb5b96
[mlir][tosa] Fix validation check on controlflow operators (#159754)
lhutton1 Sep 24, 2025
219a9e1
[MachineScheduler] Turn SU->isScheduled check into an assert in pickN…
JonPsson1 Sep 24, 2025
bcfa088
[clang][bytecode] Use stack offsets for This/RVO ptrs (#160285)
tbaederr Sep 24, 2025
b273900
[libc++] Simplify some of the <bit> functions (#160267)
philnik777 Sep 24, 2025
554b8eb
[libc++] Simplify __memory/shared_count.h a bit (#160048)
philnik777 Sep 24, 2025
68ddca9
[libc++][NFC] Refactor __is_allocator to be a variable template (#159…
philnik777 Sep 24, 2025
4fe7831
[RISCV] Don't merge pseudo selects with stack adjustment instrs in be…
enoskova-sc Sep 24, 2025
ff3f2c4
[flang][OpenACC][NFC] remove legacy openacc-unwrap-fir-box option (#1…
jeanPerier Sep 24, 2025
f3eb75c
[libc++][C++03] cherry-pick #119801 (#158247)
philnik777 Sep 24, 2025
262fe7c
[AMDGPU] SILowerControlFlow: ensure EXEC/SCC interval recompute (#160…
perlfu Sep 24, 2025
bc17738
[MLIR][Python] add Python wheel build demo/test (#160388)
makslevental Sep 24, 2025
5d2e25b
[AMDGPU] Refine GCNHazardRecognizer hasHazard() (#138841)
perlfu Sep 24, 2025
a64bc67
[RISCV] Disable slideup optimization on the inconsistent element type…
XChy Sep 24, 2025
27bead9
[RISCV] Set riscv-fpimm-cost threshold to 3 by default (#159352)
asb Sep 24, 2025
2af9c02
[Offload] Print Image location rather than casting it (#160309)
RossBrunton Sep 24, 2025
b30a978
[NVPTX] prefetch.tensormap pattern rewriter fix (#159253)
abhilash1910 Sep 24, 2025
685d9ae
Revert "[MLIR][Python] add Python wheel build demo/test" (#160481)
makslevental Sep 24, 2025
835c4a3
[AArch64] Add a test case showing both dup and scalar_to_reg in the s…
davemgreen Sep 24, 2025
4290177
[AArch64][llvm] (NFC) Rename `[SU]DOT_ZZZI?_{S|D}` and `BFMMLA_ZZZ` t…
jthackray Sep 24, 2025
2f30802
[LV] Don't ignore invariant stores when costing (#158682)
artagnon Sep 24, 2025
aa2ae7f
[InstSimplify] Consider vscale_range for get active lane mask (#160073)
MDevereau Sep 24, 2025
5952c8b
[LLVM][NVPTX-Tests] Fix tcgen05.mma lit tests committed in 7be3c3a (#…
schwarzschild-radius Sep 24, 2025
90034da
[clang][bytecode][test] Disable a bitcast test on s390x (#160452)
tbaederr Sep 24, 2025
2601491
[LangRef] Do not make align imply dereferenceability (#158062)
nikic Sep 24, 2025
d379289
[AssumptionCache] Don't use ResultElem for assumption list (NFC) (#16…
nikic Sep 24, 2025
9cf9194
[Debug][AArch64] Do not crash on unknown subreg register sizes. (#160…
davemgreen Sep 24, 2025
cee38f5
[IR] Forbid mixing condition and operand bundle assumes (#160460)
nikic Sep 24, 2025
59af088
[Headers][X86] Allow _mm_max_pu8 / _mm_min_pu8 to be used in constexp…
RKSimon Sep 24, 2025
17f4507
[Headers][X86] _mm_cmpgt_epi64 is only available on SSE42 targets (#1…
RKSimon Sep 24, 2025
2c28313
[LoopPeel] Add test with branch that can be simplified with guards.
fhahn Sep 24, 2025
49159cb
Reland "[MLIR][Python] add Python wheel build demo/test" (#160481) (#…
makslevental Sep 24, 2025
f6a00bd
[mlir][bufferization] Support custom types at function boundaries (#1…
andrey-golubev Sep 24, 2025
01b778d
[AArch64][SME] Allow SME peephole optimizations across SME pseudos (#…
MacDue Sep 24, 2025
d7c9d6d
[Offload] Add olGetMemInfo with platform-less API (#159581)
RossBrunton Sep 24, 2025
89194fd
[LV] Don't create partial reductions if factor doesn't match accumula…
fhahn Sep 24, 2025
2c1dbcf
[AArch64] Add tests for partial reduction of shl.
fhahn Sep 24, 2025
aa4ce63
[AMDGPU] SIMemoryLegalizer: Factor out check if memory operations can…
ritter-x2a Sep 24, 2025
59263e1
[AMDGPU][AsmParser] Introduce MC representation for lit() and lit64()…
kosarev Sep 24, 2025
e9c7b84
[cmake][lldb][test] Respect LIBCXX_LIBDIR_SUBDIR (#159106)
tambry Sep 24, 2025
d1808f9
[mlir][SCF] Add scf.index_switch support for populateSCFStructuralTyp…
ArtemySkrebkov Sep 24, 2025
74d888c
[LV] Fixup a test after 66fd420 (#160505)
artagnon Sep 24, 2025
8cd84a1
[libc++] Make the benchmarking data pseudo-random (#159525)
philnik777 Sep 24, 2025
3eadbcd
[mlir] Fix bazel after `59e74a0`. (#160508)
bartchr808 Sep 24, 2025
22f2e6f
[clang][bytecode] Don't crash on a null Descriptor (#160506)
tbaederr Sep 24, 2025
3ec22c1
[Headers][X86] VectorExprEvaluator::VisitCallExpr - allow SSE/AVX2/AV…
woruyu Sep 24, 2025
d0c28e9
[mlir] Implement a memory-space cast bubbling-down transform (#159454)
fabianmcg Sep 24, 2025
0f55c2b
[RecursiveASTVisitor] Assert we skip implicit instantiations. (#110899)
hvdijk Sep 24, 2025
83ac489
[Flang][OpenMP] Implicitly map nested allocatable components in deriv…
TIFitis Sep 24, 2025
bb80f4e
[Clang] Add diagnostic for why std::is_abstract is false (#156199)
sebproell Sep 24, 2025
d9e0f8e
[libc++] Fix __gnu_cxx::hash_multiset copy construction (#160466)
philnik777 Sep 24, 2025
0c46e1c
[X86] Add missing _mm_broadcastsi128_si256 constexpr test coverage (#…
RKSimon Sep 24, 2025
28e8f17
[IR] Introduce `llvm.errno.tbaa` metadata for errno alias disambiguation
antoniofrighetto Sep 24, 2025
73f0118
[llvm-remarkutil] Introduce filter command (#159784)
tobias-stadler Sep 24, 2025
ff90e4a
[MLIR] Apply clang-tidy fixes for llvm-qualified-auto in ModuleImport…
joker-eph Aug 21, 2025
ae74d3c
[LLDB][NativePDB] Create functions with mangled name (#149701)
Nerixyz Sep 24, 2025
97b5583
[NFC][AMDGPU] Refactor common declarations (#160406)
LU-JOHN Sep 24, 2025
022ab46
[mlir] Fix bazel after 077a796. (#160533)
bartchr808 Sep 24, 2025
44b8ce8
[PowerPC] Implement VSX Vector Integer Arithmetic Instructions (#158363)
lei137 Sep 24, 2025
5d88cad
[gn build] Port 6e6a3d83245e
llvmgnsyncbot Sep 24, 2025
4c45ce9
[Remarks] YAMLRemarkSerializer: StringRef-ize apis to avoid out-of-bo…
jroelofs Sep 24, 2025
f6ccdf4
[clang][bytecode] Use existing Descriptor local in InitElem op (#160535)
tbaederr Sep 24, 2025
912e48c
[flang] Simplify the comparison of characters (#154593)
luporl Sep 24, 2025
95e9a57
[mlir][emitc] Adjust the emitc.class op description (NFC) (#152570)
EtoAndruwa Sep 24, 2025
d080d89
[AST] Fix a warning
kazutakahirata Sep 24, 2025
14b51cc
[AMDGPU] Add the support for 45-bit buffer resource (#159702)
shiltian Sep 24, 2025
0a82489
[libc][math][c++23] Add log_bf16 math function (#157811)
krishna2803 Sep 24, 2025
a1da620
[mlir] Fix bazel after 077a796 round 2. (#160542)
bartchr808 Sep 24, 2025
e99ebfe
[AMDGPU][True16][CodeGen] true16 isel pattern for fma_mix_f16/bf16 (#…
broxigarchen Sep 24, 2025
4879986
[Support] Use std::move in AllocatorHolder's move constructor (NFC) (…
kazutakahirata Sep 24, 2025
3558eca
[ADT] Use "static inline" to initialize EmptyDivergenceDesc; (NFC) (#…
kazutakahirata Sep 24, 2025
668bb1e
[ADT] Make ilist_select_iterator_type a type alias (NFC) (#160446)
kazutakahirata Sep 24, 2025
bd32533
[Support] Use list-initialization for returning pairs (#160447)
kazutakahirata Sep 24, 2025
965bf6f
[Verifier] Modify TBAAVerifier helpers signatures to accept a nullabl…
antoniofrighetto Sep 24, 2025
ef9e43a
[CIR][OpenACC] Implement pointer/array recipe destructors (#160189)
erichkeane Sep 24, 2025
1228e8c
[LLVMContext] Add OB_align assume bundle op ID. (#158078)
fhahn Sep 24, 2025
87c86cc
[MLIR][Bazel] correctly fix bazel build after 59e74a0 (#160539)
makslevental Sep 24, 2025
0dc7fc3
[Clang] Support includes translated to module imports in -header-incl…
sina-mahdavi Sep 24, 2025
a6942c5
Revert "[WebAssembly] Remove FAKE_USEs before ExplicitLocals" (#160553)
dschuff Sep 24, 2025
4ceb3ef
ELF: EhFrameSection: Remove unused template parameters
MaskRay Sep 24, 2025
95ec0c8
[AMDGPU] Update comment about coop atomics ordering. NFC (#160463)
rampitec Sep 24, 2025
70b728c
[AMDGPU] Update comments in memory legalizer. NFC (#160453)
rampitec Sep 24, 2025
54208cb
[AMDGPU] Update gfx1250 documentation. NFC (#160457)
rampitec Sep 24, 2025
d6ae47b
[HLSL] NonUniformResourceIndex implementation (#160430)
hekota Sep 24, 2025
11ac6f4
[mlir][ptr] Add `ptr.ptr_diff` operation (#157354)
fabianmcg Sep 24, 2025
03e5e9d
[InstCombine] Fold selects into masked loads (#160522)
MDevereau Sep 24, 2025
02f24de
[libc++] Improve historical benchmark visualization
ldionne Sep 24, 2025
0e85a8e
[libc++] Allow naming series and adding a subtitle in compare-benchmarks
ldionne Sep 24, 2025
54f720d
[libc++] Pin down the C version to use for SPEC
ldionne Sep 24, 2025
10d2535
[flang][cuda] Allow print of managed and unified variables (#160571)
clementval Sep 24, 2025
88add45
[AIX] Fix AIX failures due to switch to internal shell (#160566)
madanial0 Sep 24, 2025
d2b9c8c
[CIR] Implement Unary real & imag on scalar expr (#159916)
AmrDeveloper Sep 24, 2025
ae0394e
[libc][NFC] Remove usage of the C keyword `I`. (#160567)
lntue Sep 24, 2025
dcc1118
[PowerPC][NFC] Simplify vector unpacked instr classes (#160564)
lei137 Sep 24, 2025
aa57e5e
[clang][dataflow] Copy records relative to the destination type for c…
bazuzi Sep 24, 2025
b61e39c
[mlir][tosa] Use `LogicalResult` in validation functions (#160052)
lhutton1 Sep 24, 2025
dfbccc7
[mlir][tosa] Remove `log(exp(x))` and `exp(log(x))` folders (#156434)
lhutton1 Sep 24, 2025
d8dfc56
[Clang] [Sema] Fix -Wdouble-promotion in C++ list-initialization (#15…
mjacobse Sep 24, 2025
a497a30
[profcheck] Option to inject distinct small weights (#159644)
mtrofin Sep 24, 2025
51048fd
[Propeller] Read the CFG profile from the propeller directive. (#160422)
rlavaee Sep 24, 2025
85cb7d7
[lit] [test] Fix the shtest-readfile test on Python 3.13 on Windows (…
mstorsjo Sep 24, 2025
6fc8943
[MC][COFF] Add missing sections for DWO (#157239)
kikairoya Sep 24, 2025
fc42385
[NFC][OpenACC] Reorder 'recipe' generation to be lexical (#160585)
erichkeane Sep 24, 2025
49b8a46
Add executed MC/DC TestVectors to `llvm-cov export` (#159119)
kuzmich321 Sep 24, 2025
1f60d73
[AMDGPU] Remove gfx1250-scratch-scope-se.ll. NFC (#160584)
rampitec Sep 24, 2025
014a967
[compiler-rt] Disable tests for unavailable builtins (#158664)
ahatanak Sep 24, 2025
90d3c7c
[MLIR][Standalone] use narrow registration instead of RegisterEveryth…
makslevental Sep 24, 2025
7743c9c
[MLIR][XeGPU] Add unroll pattern for load_gather and store_scatter wi…
nbpatel Sep 24, 2025
431c849
[lldb][test] Unify test infrastructure for checking CPU features (#15…
yln Sep 24, 2025
d0ae7cd
[flang][cuda] Make sure global device descriptor is allocated in mana…
clementval Sep 24, 2025
a205298
[LV] Set extend kinds together with ExtOpTypes (NFC).
fhahn Sep 24, 2025
02300ee
[lldb-dap] bundle lldb-dap extension using esbuild (#160598)
matthewbastien Sep 24, 2025
c10b0e2
[lldb-dap] Bump the version to 0.2.18
JDevlieghere Sep 24, 2025
1c1cb1a
[llvm][mustache] Add support for Triple Mustache (#159183)
ilovepi Sep 24, 2025
71f0f14
[flang][cuda] Avoid I/O error in block inside a kernel (#160599)
clementval Sep 24, 2025
15efcf2
[GitHub] Bump clang-tidy version to 21th in CI (#160551)
vbvictor Sep 24, 2025
2e2f7a3
[lit] Allow retries for readfile tests (#160600)
boomanaiden154 Sep 24, 2025
0cc32d1
[mlir][linalg] Use ub.poison in data layout propagation if a packed o…
hanhanW Sep 24, 2025
e7ece97
[Clang] Change masked load / store builtin interface to take scalar p…
jhuber6 Sep 24, 2025
5e26e52
[Clang] Constexpr Structured Bindings : The easy parts (#160337)
cor3ntin Sep 24, 2025
eca5529
[AMDGPU] Add gfx1250 memory lealizer tests run lines. NFC (#160586)
rampitec Sep 24, 2025
0f35995
[llvm][mustache] Precommit test for StandaloneIndentation (#159184)
ilovepi Sep 24, 2025
b0fc07e
[SFrames] Implement .cfi_restore, remember_state, and restore_state (…
Sterling-Augustine Sep 24, 2025
add15a5
[llvm] Proofread Docker.rst (#160448)
kazutakahirata Sep 24, 2025
97ba293
[MLIR] Clarify `createOrFold()` doc as opportunistic eager folding (#…
swote-git Sep 24, 2025
f012e58
Fix a bug where an error was emitted for GCC union types. (#159401)
clayborg Sep 24, 2025
fe1cd8e
[msan][NFCI] Generalize handleAVX512VectorGenericMaskedFP() operands …
thurstond Sep 24, 2025
450f102
[ARM] Consider denormal mode in `ARMSubtarget` (#160456)
paperchalice Sep 24, 2025
f537a0c
[libc++][string] P3044R2: sub-`string_view` from `string` (#147095)
H-G-Hristov Sep 25, 2025
54c8c76
[compiler-rt] Fix coverage-reset.cpp (#160620)
boomanaiden154 Sep 25, 2025
4afd2b1
[Mips] Fixed libunwind::Registers_mips_o32::jumpto to allow for load …
Jade-Marker Sep 25, 2025
97d5698
[TargetLowering][ExpandABD] Prefer selects over usubo if we do the sa…
AZero13 Sep 25, 2025
29e373a
[TII] Split isTrivialReMaterializable into two versions [nfc] (#160377)
preames Sep 25, 2025
356ccaf
[ADT] clang-format SmallPtrSet.h (NFC)
kazutakahirata Sep 25, 2025
9189e9e
[libc++][NFC] Fix benchmark name missing a parenthesis
ldionne Sep 25, 2025
f81c494
[LV] Remove EVLIndVarSimplify pass (#160454)
lukel97 Sep 25, 2025
c0a8c79
[gn build] Port aa6a33ae6556
llvmgnsyncbot Sep 25, 2025
99a4723
[clang][bytecode] Use in `Expr::tryEvaluateString` (#160118)
tbaederr Sep 25, 2025
b592af4
[CodeGen] Extract copy-paste on PHI MachineInstr income removal. (#15…
ivafanas Sep 25, 2025
3b9c31e
[MLIR][Python] Add bindings for PDL constraint function registering (…
PragmaTwice Sep 25, 2025
bede9bd
[Clang][AMDGPU] Defer amdgcn.*to_lds builtins size diagnostics (#160140)
jmmartinez Sep 25, 2025
26fd7e1
[VPlan] Create epilogue minimum iteration check in VPlan. (#157545)
fhahn Sep 25, 2025
fee4af5
[mlir][vector]: Extend convertIntegerAttr to handle float-to-integer …
jhalakpatel Sep 25, 2025
5422d29
[libc++] Refactor some .fail.cpp tests and fix time_point_cast not SF…
philnik777 Sep 25, 2025
5b27e46
[libc++][C++03] cherry-pick #106566 (#158250)
philnik777 Sep 25, 2025
75a7e53
[libc++] Fold __search_substring into _Traits::find in case the secon…
philnik777 Sep 25, 2025
a71e16f
[LangRef][VP] Clarify 'ff' mnemonic in vp.load.ff: 'first-fault' (#16…
arcbbb Sep 25, 2025
25c7909
[clang-format] Correctly handle backward compatibility of C headers (…
owenca Sep 25, 2025
1815787
[DropUnnecessaryAssumes] Add support for operand bundles (#160311)
nikic Sep 25, 2025
df1d4f6
[VPlan] Set correct flags when creating and cloning VPWidenCastRecipe.
fhahn Sep 25, 2025
f670e56
[MLIR] Implement remark emitting policies in MLIR (#160526)
grypp Sep 25, 2025
25f1604
[AArch64] Remove AArch64TargetLowering::shouldExpandPartialReductionI…
MacDue Sep 25, 2025
18d1feb
[X86][MC][AsmParser] Reject H-byte regs with VEX/EVEX-encoded 8-bit R…
woruyu Sep 25, 2025
89f90e2
InstCombine: Check GEP operand is available (#160438)
arsenm Sep 25, 2025
cb08dde
[libc++][C++03] cherry-pick #104773 (#158244)
philnik777 Sep 25, 2025
c30a394
[AArch64] Use SVE to materialise some 128-bit vector constants (#159101)
david-arm Sep 25, 2025
089fc91
[MachineStripDebug] Remove debug instructions from inside bundles (#1…
jayfoad Sep 25, 2025
d961d6e
[LoongArch][NFC] Add tests for combining `and(add(not))` (#159055)
zhaoqi5 Sep 25, 2025
7ef86b8
[lldb][test] check if CoreDumping info is supported (#160333)
da-viper Sep 25, 2025
2db15a9
[LoongArch][NFC] Add tests for element extraction from binary add ope…
zhaoqi5 Sep 25, 2025
6be5d43
[clang][Sema] Accept gnu format attributes (#160255)
higuoxing Sep 25, 2025
dbe8b3c
[mlir][tosa] Relax constraint on matmul verifier requiring equal oper…
lhutton1 Sep 25, 2025
c2dd800
[LoongArch][NFC] Pre-commit tests for `[x]vadda.{b/h/w/d}`
zhaoqi5 Sep 25, 2025
0f7ac6b
[AMDGPU] Fix vector legalization for bf16 valu ops (#158439)
giuseros Sep 25, 2025
5de73b0
[X86] Add missing prefixes to trunc-sat tests (#160662)
RKSimon Sep 25, 2025
b512d06
[lldb][test] Make hex prefix optional in DWARF union types test
DavidSpickett Sep 25, 2025
9ce52bc
[libc++] Avoid constructing additional objects when using map::at (#1…
philnik777 Sep 25, 2025
f3edf41
[LoopInterchange] Bail out when finding a dependency with all `*` ele…
kasuga-fj Sep 25, 2025
1246b0a
AMDGPU: Ensure both wavesize features are not set (#159234)
arsenm Sep 25, 2025
80bcf26
[gn build] Port 833d5f0cd8be
llvmgnsyncbot Sep 25, 2025
6bac20d
[lldb][test] Refactor and expand TestMemoryRegionDirtyPages.py (#156035)
DavidSpickett Sep 25, 2025
945d9d3
[BOLT] Fix dwarf5-dwoid-no-dwoname.s (#160676)
Jinjie-Huang Sep 25, 2025
d8d6e31
[LoongArch] Pre-commit tests for [x]vldi instructions with special co…
ylzsx Sep 25, 2025
289373c
[NFC][InstSimplify] Refactor fminmax-folds.ll test (#160504)
LewisCrawford Sep 25, 2025
82d22b1
Revert "[MLIR] Implement remark emitting policies in MLIR" (#160681)
joker-eph Sep 25, 2025
d214d98
[LV] Add partial reduction tests multiplying extend with constants.
fhahn Sep 25, 2025
9f1e2f8
AMDGPU: Convert wave_any test to use update_mc_test_checks
arsenm Sep 25, 2025
0d6f461
[LV] Add coverage for fixing-up scalar resume values (#160492)
artagnon Sep 25, 2025
bd2411c
GlobalISel: Adjust insert point when expanding G_[SU]DIVREM
arsenm Sep 25, 2025
663d208
[LV] Fixup a test after c1f8dbb (#160688)
artagnon Sep 25, 2025
f8bab4c
[RISCV][test] Regenerate fpr-gpr-copy-rv64.ll
asb Sep 25, 2025
b75a5f2
[InstCombine] Add test with "align"(ptr %p, i32 1) assumption.
fhahn Sep 25, 2025
fae34cd
[libclang/python] Fix OpenMP and OpenACC CursorKinds name format (#16…
DeinAlptraum Sep 25, 2025
433588e
[Clang][NFC] Move GPU include directory to proper place (#160608)
jhuber6 Sep 25, 2025
aa36932
[libc] Make all targets respect LLVM_PER_TARGET_RUNTIME_DIR (#160597)
jhuber6 Sep 25, 2025
e857fe6
[flang][OpenMP] Introduce variant argument, customize OmpArgument par…
kparzysz Sep 25, 2025
25c8bdb
[LoongArch] Enable more vector tests for 32-bit target (#160656)
heiher Sep 25, 2025
7835665
[X86] masked_store_trunc.ll - add missing prefixes (#160685)
RKSimon Sep 25, 2025
08e465c
[DebugInfo] Handle followup loop metadata in updateLoopMetadataDebugL…
bjope Sep 25, 2025
e3d514b
[MLIR] Apply clang-tidy fixes for misc-use-internal-linkage in Matrix…
joker-eph Aug 21, 2025
6c88292
[AMDGPU][TargetLowering] Allow forming overflow op if it is legal (#1…
AZero13 Sep 25, 2025
f95ff06
Improvements to TextEncodingConverter (#142476)
abhina-sree Sep 25, 2025
6fef046
[libc++] Remove __time_get_storage::{__analyze,init} from the ABI (#1…
philnik777 Sep 25, 2025
4726073
[AArch64][GlobalISel] Add codegen for simd fpcvt intrinsics (#157680)
Lukacma Sep 25, 2025
508c4be
[lldb] Avoid copying header just to overwrite it (#160555)
justincady Sep 25, 2025
0f8c577
[X86][GlobalISel] Added support for llvm.set.rounding (#156591)
JaydeepChauhan14 Sep 25, 2025
3b1872e
[TableGen, CodeGen, CHERI] Add support for the cPTR wildcard value ty…
resistor Sep 25, 2025
c75d2a7
[mlir][scf] ExecuteRegionOp bufferization to consider no_inline attr …
undor Sep 25, 2025
33d9ab2
[CodeGenPrepare] Bail out of usubo creation if sub's parent is not th…
AZero13 Sep 25, 2025
0763b1c
[NFC][clang] Quote literal builtin attribute markers in Builtins.def …
bozicrHT Sep 25, 2025
e04ef6b
Reapply "[ControlHeightReduction] Drop lifetime annotations where nec…
boomanaiden154 Sep 25, 2025
f3564d2
Feedback fixes
bozicrHT Sep 26, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions clang/include/clang/Basic/Builtins.def
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
// The third value provided to the macro specifies information about attributes
// of the function. These must be kept in sync with the predicates in the
// Builtin::Context class. Currently we have:
// N -> nonnull
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should document that this option takes arguments, similarly to C below.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this the same 'N' as 86? if not, we should be documenting them separately/make it clear that they're not (ie, that the 'N' below is a placeholder). Additionally, this probably needs to be together if so?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No in this case it’s a literal N, and yeah, that’s a bit unfortunate; it’d probably be clearer if we quoted everything that’s supposed to be a literal character as opposed to a variable/placeholder, but maybe that should be a separate NFC patch?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm OK if it is a separate NFC patch, but I think we need to do it BEFORE using N to mean something, else said NFC patch gets pretty annoying (and confusing for a while if that doesn't land). I'm open to whatever, but I'd like to see that patch merged before this one.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that’s a good point; I don’t feel too strongly about this, so I suppose, @bozicrHT, feel free to make a separate patch for that or to integrate that into this one, whichever is easier for you.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I went ahead and created a separate NFC PR #160080 for quoting the literal attribute letters.

// n -> nothrow
// r -> noreturn
// U -> pure
Expand Down
4 changes: 4 additions & 0 deletions clang/include/clang/Basic/Builtins.h
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,10 @@ class Context {
bool performsCallback(unsigned ID,
llvm::SmallVectorImpl<int> &Encoding) const;

/// Return true if this builtin has parameters at fixed positions
/// that must be non-null.
bool IsNonNull(unsigned ID, llvm::SmallVectorImpl<int> &Indxs) const;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// Return true if this builtin has parameters at fixed positions
/// that must be non-null.
bool IsNonNull(unsigned ID, llvm::SmallVectorImpl<int> &Indxs) const;
/// Return true if this builtin has parameters that must be non-null.
/// The parameter indices are appended into 'Indxs'.
bool isNonNull(unsigned ID, SmallVectorImpl<int> &Indxs) const;

The other functions here seem to use camelCase, so this one should too for consistency.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, should the SmallVector take unsigneds instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it should!


/// Return true if this function has no side effects and doesn't
/// read memory, except for possibly errno or raising FP exceptions.
///
Expand Down
31 changes: 16 additions & 15 deletions clang/include/clang/Basic/Builtins.td
Original file line number Diff line number Diff line change
Expand Up @@ -3083,104 +3083,105 @@ def StrLen : LibBuiltin<"string.h"> {
// FIXME: This list is incomplete.
def Printf : LibBuiltin<"stdio.h"> {
let Spellings = ["printf"];
let Attributes = [PrintfFormat<0>];
let Attributes = [PrintfFormat<0>, NonNull<[0]>];
let Prototype = "int(char const*, ...)";
}

// FIXME: The builtin and library function should have the same signature.
def BuiltinPrintf : Builtin {
let Spellings = ["__builtin_printf"];
let Attributes = [NoThrow, PrintfFormat<0>, FunctionWithBuiltinPrefix];
let Attributes = [NoThrow, PrintfFormat<0>, FunctionWithBuiltinPrefix,
NonNull<[0]>];
let Prototype = "int(char const* restrict, ...)";
}

def FPrintf : LibBuiltin<"stdio.h"> {
let Spellings = ["fprintf"];
let Attributes = [NoThrow, PrintfFormat<1>];
let Attributes = [NoThrow, PrintfFormat<1>, NonNull<[1]>];
let Prototype = "int(FILE* restrict, char const* restrict, ...)";
let AddBuiltinPrefixedAlias = 1;
}

def SnPrintf : LibBuiltin<"stdio.h"> {
let Spellings = ["snprintf"];
let Attributes = [NoThrow, PrintfFormat<2>];
let Attributes = [NoThrow, PrintfFormat<2>, NonNull<[2]>];
let Prototype = "int(char* restrict, size_t, char const* restrict, ...)";
let AddBuiltinPrefixedAlias = 1;
}

def SPrintf : LibBuiltin<"stdio.h"> {
let Spellings = ["sprintf"];
let Attributes = [NoThrow, PrintfFormat<1>];
let Attributes = [NoThrow, PrintfFormat<1>, NonNull<[1]>];
let Prototype = "int(char* restrict, char const* restrict, ...)";
let AddBuiltinPrefixedAlias = 1;
}

def VPrintf : LibBuiltin<"stdio.h"> {
let Spellings = ["vprintf"];
let Attributes = [NoThrow, VPrintfFormat<0>];
let Attributes = [NoThrow, VPrintfFormat<0>, NonNull<[0]>];
let Prototype = "int(char const* restrict, __builtin_va_list)";
let AddBuiltinPrefixedAlias = 1;
}

def VfPrintf : LibBuiltin<"stdio.h"> {
let Spellings = ["vfprintf"];
let Attributes = [NoThrow, VPrintfFormat<1>];
let Attributes = [NoThrow, VPrintfFormat<1>, NonNull<[1]>];
let Prototype = "int(FILE* restrict, char const* restrict, __builtin_va_list)";
let AddBuiltinPrefixedAlias = 1;
}

def VsnPrintf : LibBuiltin<"stdio.h"> {
let Spellings = ["vsnprintf"];
let Attributes = [NoThrow, VPrintfFormat<2>];
let Attributes = [NoThrow, VPrintfFormat<2>, NonNull<[2]>];
let Prototype = "int(char* restrict, size_t, char const* restrict, __builtin_va_list)";
let AddBuiltinPrefixedAlias = 1;
}

def VsPrintf : LibBuiltin<"stdio.h"> {
let Spellings = ["vsprintf"];
let Attributes = [NoThrow, VPrintfFormat<1>];
let Attributes = [NoThrow, VPrintfFormat<1>, NonNull<[1]>];
let Prototype = "int(char* restrict, char const* restrict, __builtin_va_list)";
let AddBuiltinPrefixedAlias = 1;
}

def Scanf : LibBuiltin<"stdio.h"> {
let Spellings = ["scanf"];
let Attributes = [ScanfFormat<0>];
let Attributes = [ScanfFormat<0>, NonNull<[0]>];
let Prototype = "int(char const* restrict, ...)";
let AddBuiltinPrefixedAlias = 1;
}

def FScanf : LibBuiltin<"stdio.h"> {
let Spellings = ["fscanf"];
let Attributes = [ScanfFormat<1>];
let Attributes = [ScanfFormat<1>, NonNull<[1]>];
let Prototype = "int(FILE* restrict, char const* restrict, ...)";
let AddBuiltinPrefixedAlias = 1;
}

def SScanf : LibBuiltin<"stdio.h"> {
let Spellings = ["sscanf"];
let Attributes = [ScanfFormat<1>];
let Attributes = [ScanfFormat<1>, NonNull<[1]>];
let Prototype = "int(char const* restrict, char const* restrict, ...)";
let AddBuiltinPrefixedAlias = 1;
}

def VScanf : LibBuiltin<"stdio.h"> {
let Spellings = ["vscanf"];
let Attributes = [VScanfFormat<0>];
let Attributes = [VScanfFormat<0>, NonNull<[0]>];
let Prototype = "int(char const* restrict, __builtin_va_list)";
let AddBuiltinPrefixedAlias = 1;
}

def VFScanf : LibBuiltin<"stdio.h"> {
let Spellings = ["vfscanf"];
let Attributes = [VScanfFormat<1>];
let Attributes = [VScanfFormat<1>, NonNull<[1]>];
let Prototype = "int(FILE* restrict, char const* restrict, __builtin_va_list)";
let AddBuiltinPrefixedAlias = 1;
}

def VSScanf : LibBuiltin<"stdio.h"> {
let Spellings = ["vsscanf"];
let Attributes = [VScanfFormat<1>];
let Attributes = [VScanfFormat<1>, NonNull<[1]>];
let Prototype = "int(char const* restrict, char const* restrict, __builtin_va_list)";
let AddBuiltinPrefixedAlias = 1;
}
Expand Down
2 changes: 1 addition & 1 deletion clang/include/clang/Basic/BuiltinsBase.td
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ def Const : Attribute<"c">;
def NoThrow : Attribute<"n">;
def Pure : Attribute<"U">;
def ReturnsTwice : Attribute<"j">;
// FIXME: gcc has nonnull

// builtin-specific attributes
// ---------------------------
Expand Down Expand Up @@ -85,6 +84,7 @@ def Consteval : Attribute<"EG">;
// Callback behavior: the first index argument is called with the arguments
// indicated by the remaining indices.
class Callback<list<int> ArgIndices> : MultiIndexAttribute<"C", ArgIndices>;
class NonNull<list<int> ArgIndices> : MultiIndexAttribute<"N", ArgIndices>;

// Prefixes
// ========
Expand Down
28 changes: 28 additions & 0 deletions clang/lib/Basic/Builtins.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,34 @@ bool Builtin::Context::isScanfLike(unsigned ID, unsigned &FormatIdx,
return isLike(ID, FormatIdx, HasVAListArg, "sS");
}

bool Builtin::Context::IsNonNull(unsigned ID,
llvm::SmallVectorImpl<int> &Indxs) const {

const char *CalleePos = ::strchr(getAttributesString(ID), 'N');
if (!CalleePos)
return false;

++CalleePos;
assert(*CalleePos == '<' &&
"Callback callee specifier must be followed by a '<'");
++CalleePos;

char *EndPos;
int CalleeIdx = ::strtol(CalleePos, &EndPos, 10);
assert(CalleeIdx >= 0 && "Callee index is supposed to be positive!");
Indxs.push_back(CalleeIdx);

while (*EndPos == ',') {
const char *PayloadPos = EndPos + 1;

int PayloadIdx = ::strtol(PayloadPos, &EndPos, 10);
Indxs.push_back(PayloadIdx);
}

assert(*EndPos == '>' && "Callback callee specifier must end with a '>'");
return true;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is copy-pasted from performsCallback(), which is 1. not great, we should factor out some parts of it (specifically, there should be a separate function that parses a comma-separated list of integers enclosed in <> and writes them to the SmallVector and which is called by both this and performsCallback()), and 2. the naming of some of these local variables doesn’t make sense for this function (e.g. a formatting function has no ‘callee’, so CalleePos isn’t really a good name for this).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds reasonable — I’ll refactor the parsing logic into a small helper function (so both places can share it) and update the local variable names to better reflect their meaning in this context.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I refactored the parsing into a static helper parseCommaSeparatedIndices. Since performsCallback uses SmallVector<int> and isNonNull should use SmallVector<unsigned>, there are two options:

  1. Change isNonNull to use int.
  2. Make the helper templated on the element type to handle both int and unsigned.

We keep them separate because CallbackAttr::CreateImplicit requires int*, and changing that would need a separate PR. What are you thoughts, should I leave it as int or template it?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose if preexisting function already use int then I’d just stick w/ int for now.

}

bool Builtin::Context::performsCallback(unsigned ID,
SmallVectorImpl<int> &Encoding) const {
const char *CalleePos = ::strchr(getAttributesString(ID), 'C');
Expand Down
9 changes: 9 additions & 0 deletions clang/lib/Sema/SemaDecl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17097,6 +17097,15 @@ void Sema::AddKnownFunctionAttributes(FunctionDecl *FD) {
}
}

SmallVector<int, 4> Indxs;
if (Context.BuiltinInfo.IsNonNull(BuiltinID, Indxs) &&
!FD->hasAttr<NonNullAttr>()) {
llvm::SmallVector<ParamIdx, 4> ParamIndxs;
for (int I : Indxs)
ParamIndxs.push_back(ParamIdx(I + 1, FD));
FD->addAttr(NonNullAttr::CreateImplicit(Context, ParamIndxs.data(),
ParamIndxs.size()));
Comment on lines 17144 to 17151
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it’d make more sense to create the ParamIdx’s in isNonNull() directly just to avoid any potential confusion about whether they’re supposed to be zero or one-based—also, I wonder if NonNull in TableGen shouldn’t just be one-based so we don’t have to remember to add 1 here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ParamIdx requires a Decl pointer as its second argument, which is only available in Sema, not in Builtins (which is included in the preamble). Because of that, constructing ParamIdx directly inside isNonNull() isn’t possible. That’s why I opted to create them later in Sema. We could consider a small refactor (e.g. a helper in Sema) if we want to make the one-based logic cleaner, but I think the current approach is the most practical.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I forgot it requires a decl, in that case that’s fine.

}
if (Context.BuiltinInfo.isReturnsTwice(BuiltinID) &&
!FD->hasAttr<ReturnsTwiceAttr>())
FD->addAttr(ReturnsTwiceAttr::CreateImplicit(Context,
Expand Down
74 changes: 74 additions & 0 deletions clang/test/Sema/format-strings-nonnull.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
// RUN: %clang_cc1 -fsyntax-only -verify -Wnonnull -Wno-format-security %s

#include <stdarg.h>
#include <stddef.h>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#include <stdarg.h>
#include <stddef.h>
typedef __SIZE_TYPE__ size_t;

Clang tests should generally never include stdlib headers. If you need definitions from those headers, define them yourself (for size_t in particular, you can do typedef __SIZE_TYPE__ size_t).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the heads-up!


typedef struct _FILE FILE;

int printf(char const* restrict, ...);
int __builtin_printf(char const* restrict, ...);
int fprintf(FILE* restrict, char const* restrict, ...);
int snprintf(char* restrict, size_t, char const* restrict, ...);
int sprintf(char* restrict, char const* restrict, ...);
int vprintf(char const* restrict, __builtin_va_list);
int vfprintf(FILE* restrict, char const* restrict, __builtin_va_list);
int vsnprintf(char* restrict, size_t, char const* restrict, __builtin_va_list);
int vsprintf(char* restrict, char const* restrict, __builtin_va_list);

int scanf(char const* restrict, ...);
int fscanf(FILE* restrict, char const* restrict, ...);
int sscanf(char const* restrict, char const* restrict, ...);
int vscanf(char const* restrict, __builtin_va_list);
int vfscanf(FILE* restrict, char const* restrict, __builtin_va_list);
int vsscanf(char const* restrict, char const* restrict, __builtin_va_list);


void check_format_string(FILE *fp, va_list ap) {
char buf[256];
char* const fmt = NULL;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They should just work, but can you test C23 nullptr and GNU __null too?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since __null is a GCC C++ extension, should I add a small .cpp test file just for that, or include the printf/scanf tests in it as well?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think just adding some C++ tests for __null would be enough


printf(fmt);
// expected-warning@-1{{null passed to a callee that requires a non-null argument}}

__builtin_printf(NULL, "xxd");
// expected-warning@-1{{null passed to a callee that requires a non-null argument}}

fprintf(fp, NULL, 25);
// expected-warning@-1{{null passed to a callee that requires a non-null argument}}

sprintf(buf, NULL, 42);
// expected-warning@-1{{null passed to a callee that requires a non-null argument}}

snprintf(buf, 10, 0, 42);
// expected-warning@-1{{null passed to a callee that requires a non-null argument}}

vprintf(fmt, ap);
// expected-warning@-1{{null passed to a callee that requires a non-null argument}}

vfprintf(fp, 0, ap);
// expected-warning@-1{{null passed to a callee that requires a non-null argument}}

vsprintf(buf, NULL, ap);
// expected-warning@-1{{null passed to a callee that requires a non-null argument}}

vsnprintf(buf, 10, fmt, ap);
// expected-warning@-1{{null passed to a callee that requires a non-null argument}}

scanf(NULL);
// expected-warning@-1{{null passed to a callee that requires a non-null argument}}

fscanf(fp, NULL);
// expected-warning@-1{{null passed to a callee that requires a non-null argument}}

sscanf(buf, fmt);
// expected-warning@-1{{null passed to a callee that requires a non-null argument}}

vscanf(NULL, ap);
// expected-warning@-1{{null passed to a callee that requires a non-null argument}}

vfscanf(fp, fmt, ap);
// expected-warning@-1{{null passed to a callee that requires a non-null argument}}

vsscanf(buf, NULL, ap);
// expected-warning@-1{{null passed to a callee that requires a non-null argument}}
}
6 changes: 2 additions & 4 deletions clang/test/Sema/format-strings.c
Original file line number Diff line number Diff line change
Expand Up @@ -480,11 +480,9 @@ void pr7981(wint_t c, wchar_t c2) {
#endif
}

// -Wformat-security says NULL is not a string literal
void rdar8269537(void) {
// This is likely to crash in most cases, but -Wformat-nonliteral technically
// doesn't warn in this case.
printf(0); // no-warning
printf(0);
// expected-warning@-1{{null passed to a callee that requires a non-null argument}}
}

// Handle functions with multiple format attributes.
Expand Down
2 changes: 2 additions & 0 deletions clang/test/SemaCXX/format-strings-0x.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ void f(char **sp, float *fp) {
printf("%a", 1.0);
scanf("%afoobar", fp);
printf(nullptr);
// expected-warning@-1{{null passed to a callee that requires a non-null argument}}
printf(*sp); // expected-warning {{not a string literal}}
// expected-note@-1{{treat the string as an argument to avoid this}}

Expand All @@ -32,4 +33,5 @@ void f(char **sp, float *fp) {
printf("init list: %d", { 0 }); // expected-error {{cannot pass initializer list to variadic function; expected type from format string was 'int'}}
printf("void: %d", f(sp, fp)); // expected-error {{cannot pass expression of type 'void' to variadic function; expected type from format string was 'int'}}
printf(0, { 0 }); // expected-error {{cannot pass initializer list to variadic function}}
// expected-warning@-1{{null passed to a callee that requires a non-null argument}}
}
3 changes: 2 additions & 1 deletion clang/test/SemaObjC/format-strings-objc.m
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ void rdar10743758(id x) {
printf(s2); // expected-warning {{more '%' conversions than data arguments}}

const char * const s3 = (const char *)0;
printf(s3); // no-warning (NULL is a valid format string)
printf(s3); // expected-warning {{null passed to a callee that requires a non-null argument}}

NSString * const ns1 = @"constant string %s"; // expected-note {{format string is defined here}}
NSLog(ns1); // expected-warning {{more '%' conversions than data arguments}}
Expand Down Expand Up @@ -259,6 +259,7 @@ void testByValueObjectInFormat(Foo *obj) {
printf("%d %d %d", 1L, *obj, 1L); // expected-error {{cannot pass object with interface type 'Foo' by value to variadic function; expected type from format string was 'int'}} expected-warning 2 {{format specifies type 'int' but the argument has type 'long'}}
printf("%!", *obj); // expected-error {{cannot pass object with interface type 'Foo' by value through variadic function}} expected-warning {{invalid conversion specifier}}
printf(0, *obj); // expected-error {{cannot pass object with interface type 'Foo' by value through variadic function}}
// expected-warning@-1{{null passed to a callee that requires a non-null argument}}

[Bar log2:@"%d", *obj]; // expected-error {{cannot pass object with interface type 'Foo' by value to variadic method; expected type from format string was 'int'}}
}
Expand Down
Loading