forked from llvm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 0
Bugprone-default-lambda-capture #1
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
Open
jjmarr-amd
wants to merge
861
commits into
main
Choose a base branch
from
DefaultLambdaCapture
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
861 commits
Select commit
Hold shift + click to select a range
02746f8
[ARM] Remove -fno-unsafe-math from a number of tests. NFC
davemgreen e38e0bd
[mlir] Add splitDebugFilename field in DIComplileUnitAttr. (#160704)
abidh 0aad055
[X86] Add test showing failure to fold freeze(insertps(x,y,i)) -> ins…
RKSimon 3fa3e09
[X86] canCreateUndefOrPoisonForTargetNode/isGuaranteedNotToBeUndefOrP…
RKSimon 42dd926
[libc++] Switch back to plotting on revlist order for visualize-histo…
ldionne 83ef38a
[Flang][OpenMP] Enable no-loop kernels (#155818)
DominikAdamski 9be276e
[SCEV] Add tests for computing trip counts with align assumptions.
fhahn eaf36c6
[ASan] Update meminstrinsics to use library memmove rather than inter…
DanBlackwell bb38b48
[flang-rt] Set _POSIX_C_SOURCE on Darwin (#160130)
luporl e2d5efd
[libc] Update the memory helper functions for simd types (#160174)
jhuber6 acb826e
[MLIR][TBLGen] Added compound assignment operator for any BitEnum (#1…
a-sidorova 3e746bd
Allowing RDV to call `getArgOperandsMutable()` (#160415)
FranciscoThiesen 69194be
[NFC][OpenACC][CIR] Extract 'base' class for Recipe generation (#160603)
erichkeane 7ab7bc7
[MLIR] Fix LivenessAnalysis/RemoveDeadValues handling of dead functio…
joker-eph 84df412
[CodeGen] Adjust global-split remat heuristic to match LICM (#160709)
preames 78da592
[RegAlloc] Add additional tracing in InlineSpiller::rematerializeFor …
preames bba9172
[RegAlloc] Strengthen asserts in LiveRangeEdit::scanRemattable [nfc] …
preames d404c37
[Clang][RVV][SVE] Cache getScalableVectorType lookups (#160108)
sunshaoce 0b8c775
[AArch64][GlobalISel] Add support for ldexp (#160517)
HolyMolyCowMan def68dc
llvm-tli-checker: Take ifunc symbols into account (#158596)
arrowd 550d425
[RegAlloc] Add printer and dump for VNInfo [nfc] (#160758)
preames 9412769
Revert "[RegAlloc] Strengthen asserts in LiveRangeEdit::scanRemattabl…
preames 2347324
[clang][bytecode][NFC] Use switches for pointer type distinction (#16…
tbaederr 129394e
Greedy: Make trySplitAroundHintReg try to match hints with subreg cop…
arsenm 0e3c316
[llvm][clang] Use the VFS in `FileCollector` (#160788)
jansvoboda11 88324f1
[clang][bytecode][NFC] Simplify align_up/down implementation (#160880)
tbaederr d636dc8
[libc++] Support comparison of more than two data sets in compare-ben…
ldionne 446b9dc
PeepholeOpt: Use initializer list (#160898)
arsenm e8e563b
[ADT] Reduce code duplication in SmallDenseMap (NFC) (#160813)
kazutakahirata 6598e31
[ADT] Refactor SmallPtrSetIterator (NFC) (#160814)
kazutakahirata 88ef274
[ADT] Apply Rule of Five to StringTable::Iterator (#160815)
kazutakahirata 8f9385c
[Support] Consolidate runOnNewStack (NFC) (#160816)
kazutakahirata 6d1c19b
[llvm] Proofread BugLifeCycle.rst (#160817)
kazutakahirata f026cb0
[BOLT][AArch64] Fix BUILD_SHARED_LIBS after #158738 (#160854)
paschalis-mpeis f8b79e6
[ARM] Add extra mulh tests with known-bits. NFC
davemgreen fc71b1c
[NFC][LLVM] Fix line endings for DXILABI.cpp (#160791)
jurahul 8eb0ab7
[NFC][LLVM] Use Unix line endings for a few source files (#160794)
jurahul 2a72522
[NFC][LLVM] Pass/return SMLoc by value instead of const reference (#1…
jurahul d2239fb
[clang][CodeGen] Fix sub-optimal clang CodeGen for __atomic_test_and_…
Lancern c06f354
[DirectX] Adding missing descriptor table validations (#153276)
joaosaffran 7d2f6fd
[DirectX] Updating DXContainer Yaml to represent Root Signature 1.2 (…
joaosaffran 3aaa58f
[Clang] Fix Codegen UO real/imag crash on scalar with type promotion …
AmrDeveloper d6e20c4
[flang] Clean-up for fir.do_loop generation in lowering. (#160630)
vzakhari e7dfa2c
[X86] shuffle-strided-with-offset-512.ll - add missing prefixes (#160…
RKSimon 12b7411
[NFC][PowerPC] Consolidate predicate definitions into PPC.td (#160579)
lei137 65d730b
[SYCL] Add offload wrapping for SYCL kind (#147508)
maksimsab 4ff986a
[DirectX] Updating DXContainer logic to read version 1.2 of static sa…
joaosaffran 4bdf545
Add note for base class to bugprone-throw-keyword-missing (#160751)
aaronpuchert 0e35f56
[clang][Dependency Scanning][NFC] Move `DependencyScanningAction` to …
qiongsiwu ff98e51
[gn build] Port 0e35f56d40d3
llvmgnsyncbot 37282bc
[clang] Load `-fembed-offload-object=` through the VFS (#160906)
jansvoboda11 f7e8350
Revert "[compiler-rt] Disable tests for unavailable builtins (#158664)"
mstorsjo 9d7628d
[Intrinsic] Unify IIT_STRUCT{2-9} into ITT_STRUCT to support upto 257…
darkbuck e28a559
[DirectX] Validating Root flags are denying shader stage (#160919)
joaosaffran b427182
[AMDGPU] Ensure divergence for v_alignbit (#129159)
jrbyrnes e9185af
[compiler-rt] Fix some tests to work with lit internal shell. (#160728)
cmtice 24bc1a6
[RISCV] Update SiFive7's scheduling models with their optimizations o…
mshockwave d48bda5
[flang][cuda] Handle zero sized allocation correctly (#160929)
clementval 5abb4b2
[LLVM][M68k] Fix build failure caused by #160797 (#160926)
jurahul a45f20b
[RISCV][test] Add additional check-prefixes to fix conflicts in tests…
asb 2484f4a
[AMDGPU][True16][CodeGen] Avoid setting hi part in copysign (#160891)
piotrAMD 01d761a
[Offload] Use Error for allocating/deallocating in plugins (#160811)
kevinsala 814a3a6
[OpenMP][clang] Set num_threads 'strict' to unsupported on GPUs (#160…
ro-i d2c189b
[ASan][RISCV] Teach AddressSanitizer to support indexed load/store. (…
HankChang736 c580ad4
[clang] Use the VFS to create the OpenMP region entry ID (#160918)
jansvoboda11 5cb1641
[bazel] Fix build after 0e35f56d40d3b4fe44fd69066ba94f54cb9b844a (#16…
slackito 99a29f6
Revert "[clang][DebugInfo][NFC] Simplify CollectRecordLambdaFields" (…
petrhosek 26e370b
Fix the formatting script: do not try to update a GitHub PR without c…
joker-eph 95386cc
[clang-tidy][docs] Avoid recommending links to non-free coding guidel…
jjmarr-amd cccc9d3
[BOLT] Don't emit invalid (gdb-breaking) address ranges in gdb-index …
itrofimow 727aad1
[flang][OpenMP] Use OmpDirectiveSpecification in DECLARE_TARGET (#160…
kparzysz 9534190
Revert "[compiler-rt] Fix some tests to work with lit internal shell.…
cmtice 0e93ab8
[clang-tidy] Improve `bugprone-exception-escape`'s handling of lambda…
localspook e05bad4
[NVPTX] legalize v2i32 to improve compatibility with v2f32 (#153478)
Prince781 d2f14bc
[profcheck][SimplifyCFG] Propagate !prof from `switch` to `select` (#…
mtrofin 098767c
Revert changes to llvm-string stdin test and XFAIL on AIX (#160821)
madanial0 1aefabe
[clang] Use the VFS to check the system framework marker (#160946)
jansvoboda11 34ebdaf
[clang][analyzer] Use the VFS to check model files (#160950)
jansvoboda11 7b3d285
[clang] Use the VFS to get the unique file ID (#160936)
jansvoboda11 220ad03
[clang] Use the VFS to get the OpenMP entry info (#160935)
jansvoboda11 f9065fc
[llvm][mustache] Avoid excessive hash lookups in EscapeStringStream (…
ilovepi 37e7ad1
[libcxx] Add local %T substitution
boomanaiden154 f8d547f
[lit] Remove %T from tests
boomanaiden154 597f93d
AMDGPU: Check if immediate is legal for av_mov_b32_imm_pseudo (#160819)
arsenm e925e52
[lld][WebAssembly] Fix check for implicitly exported mutable globals …
sbc100 727ce02
[lld][macho] Rename test to fix spelling (#160938)
ellishg 2be906b
Revert "[TTI][RISCV] Add cost modelling for intrinsic vp.load.ff (#16…
arcbbb be6c5d0
[NFC] [compiler-rt] fix typos (#160803)
co63oc 7ff6973
[lit] Remove support for %T
boomanaiden154 0e72c3d
[NFC] Lockdown instructions of vspltisw for addition of vector of 1s …
Himadhith dee28f9
[InstCombine] Rotate transformation port from SelectionDAG to InstCom…
axelcool1234 538cd20
[clang][bytecode][NFC] Simplify a few builtin implementations (#160910)
tbaederr 779adf1
[clang-tools-extra] Fix python syntax - pull in Queue from module que…
moinakb001 6101248
[clang] Fix a use-after free in ASTContext::getSubstBuiltinTemplatePa…
alexfh d0a260b
[scudo] Use TestAllocator wrapper to ensure proper cleanup (#160800)
fabio-d 8fb2e2a
[CIR] Implement UO real on result from real with type promotion (#160…
AmrDeveloper e276000
[CIR] Implement logical not for VectorType (#160762)
AmrDeveloper fcf79e5
[MLIR] Improve in-place folding to iterate until fixed-point (#160615)
joker-eph 08c1e9e
[LAA] Revert 56a1cbb and 1aded51, due to crash (#160993)
artagnon c6f22b4
[MLIR] Apply clang-tidy fixes for bugprone-argument-comment in Module…
joker-eph e25be77
[NFC] [docs] Fix typo in Programmer's Manual BinaryOperator descripti…
kdkasad 17bfec5
[flang][OpenMP] Use OmpDirectiveSpecification in ASSUMES (#160591)
kparzysz cdc3061
[X86] vector-fshl-256.ll - regenerate test checks (#161004)
RKSimon 80beefa
[flang][OpenMP] Use OmpDirectiveSpecification in REQUIRES (#160595)
kparzysz d1b5607
[libc++][ranges] Fix `ranges::join_view` segmented iterator trait (#1…
lbonn 371b3ca
[mlir] Fix typo in StandalonePasses.td doc string (#161009)
CRobeck 9bf51b2
[ARM] Generate build-attributes more correctly in the presence of int…
davemgreen 60912f9
[ADT] Use structured bindings in CoalescingBitVector.h (NFC) (#160976)
kazutakahirata 54beb58
[ADT] Add derived() to DenseMapBase (NFC) (#160977)
kazutakahirata 3163fcf
[ADT] Add [[nodiscard]] to set/map classes (NFC) (#160978)
kazutakahirata 798ccd2
[Support] Deprecate one form of support::endian::read (NFC) (#160979)
kazutakahirata d70490c
[llvm] Proofread BuildingADistribution.rst (#160980)
kazutakahirata 0df3651
[X86] matchVPMADD52 - only use 512-bit MADD52 on AVX512IFMA targets (…
RKSimon 3834c54
[MLIR][Python] add unchecked gettors (#160954)
makslevental 17a66ea
[clang-format][NFC] Rename a unit test
owenca 8460dbb
[VPlan] Mark VPInstruction::Broadcast as not reading/writing memory.
fhahn 08c057e
[GitHub][docker] Fix 'FromAsCasing' violation in CI dockerfile (#161017)
vbvictor 41a2dfc
[VPlan] Allow multiple users of (broadcast %evl).
fhahn 378b6d5
[AMDGPU] fcanonicalize.bf16.ll - regenerate test checks (#161026)
RKSimon 4a4573a
[clang] simplify placeholder type deduction for constant template par…
mizvekov 078e99e
[clang] fix transformation of subst constant template parameter nodes…
mizvekov ebfee32
[SDAG] Constant fold frexp in signed way (#161015)
XChy 9630b32
[MIPS][float] Fixed SingleFloat codegen on N32/N64 targets (#140575)
Tazdevil971 9a01561
[clang-format] Fix qualifier ordering for lines after PP directives (…
ZhongRuoyu 63f1c03
[Driver] Make -fvectorize and -fslp-vectorize override -O group optio…
MaskRay 4edda3d
[clang-format] Fix bugs in annotating arrows and square brackets (#16…
owenca c750487
[clang][bytecode] Diagnose volatile writes (#160350)
tbaederr 8ce3b8b
[ARM] Remove `UnsafeFPMath` uses (#151275)
paperchalice 5a13c85
[GitHub][docker] Add python3 venv package to CI container (#161024)
vbvictor f9e7f95
[clang-tidy] Fix `modernize-use-nullptr` crash on 32-bit Windows (#16…
localspook 1ab4113
[libc++] Remove a bunch of unused includes from <flat_*> (#160658)
philnik777 ddfbfd6
[NFC][clang] Move simplifyConstraint to TargetInfo.cpp (#154905)
el-ev 0fc6213
[LV] Clarify nature of legacy CSE (NFC) (#160855)
artagnon 0df525b
[LoongArch] Add patterns to support `[x]vadda.{b/h/w/d}` generation (…
zhaoqi5 2284ce0
[VPlan] Move using VPlanPatternMatch to top in VPlanUtils.cpp (NFC).
fhahn 58805dd
[SPIRV] Fix type mismatch assertion in insertvalue. (#143131)
maleadt 3407fed
[mlir][dataflow] Use skipRegions to print region op (NFC) (#161066)
linuxlonelyeagle 6167f0c
[MLIR] Apply clang-tidy fixes for llvm-qualified-auto in Mem2Reg.cpp …
joker-eph 062c0fc
[MLIR] Apply clang-tidy fixes for misc-use-internal-linkage in GPUOps…
joker-eph 60e41d2
[MLIR] Apply clang-tidy fixes for bugprone-argument-comment in Vector…
joker-eph c058ebd
[SPIRV] Porting tests to transcoding directory from translator (#151661)
EbinJose2002 4798162
[AMDGPU] Regenerate checks for test/CodeGen/AMDGPU/bf16.ll (#161069)
macurtis-amd 63d866e
[MLIR] Apply clang-tidy fixes for misc-use-internal-linkage in XeGPUO…
joker-eph aaf23f0
[mlir][mlir-tblgen] Emit correct error message if method is pruned (#…
JustinKim98 dcfb904
[SPIRV] Test file for memmove intrinsic (#152640)
EbinJose2002 047ddbf
[SPIRV] Added support for the constrained comparison intrinsics (#157…
SubashBoopathi 0c1acc9
[SPIRV] Added lowering for the debugtrap intrinsic (#157442)
SubashBoopathi 5d85d54
[SPIRV] Add support for the extension SPV_EXT_relaxed_printf_string_a…
EbinJose2002 0dbc1e2
[SPIRV] Added constraint for SPV_INTEL_bindless_image extension (#160…
EbinJose2002 2cf71fc
[SPIRV] Added opencl Pipe builtins (#135335)
EbinJose2002 9288b08
[MLIR] Apply clang-tidy fixes for bugprone-argument-comment in PadTil…
joker-eph a558d65
[CodeGen] Get rid of incorrect `std` template specializations (#160804)
frederick-vs-ja c05c909
[MLIR] Apply clang-tidy fixes for llvm-qualified-auto in MemRefUtils.…
joker-eph 41f3438
[VPlan] Remove dead code for scalar VFs in VPRegionBlock::cost (NFC).
fhahn d30fe62
ELF: Test .eh_frame relocation
MaskRay f7dd258
[ADT] Fix a bug in PackedVector::setValue for signed types (#159239)
kazutakahirata 0de265c
[ADT] Consolidate assertSafeToReferenceAfterClear with "if constexpr"…
kazutakahirata 372f786
[ADT] Add [[nodiscard]] to more classes (NFC) (#161044)
kazutakahirata 9a5671e
[Support] Deprecate one form of support::endian::byte_swap (NFC) (#16…
kazutakahirata 9c6d216
[llvm] Proofread FuzzingLLVM.rst (#161046)
kazutakahirata e930644
[ADT] clang-format PackedVector.h (NFC)
kazutakahirata 48a6f2f
[Object][Archive] Recompute headers and symbol map when switching fro…
cjacek 71be13a
[VPlan] Rewrite VPExpandSCEVExprs in replaceSymbolicStrides.
fhahn d297987
[InstCombine] Transform `vector.reduce.add` and `splat` into multipli…
spaits 2b67f5e
[SPIRV] Addition of image_store.ll and signed_arithmetic_overflow.ll …
aadeshps-mcw 12f42e5
[SPIRV] Frexp intrinsic implementation (#157436)
EbinJose2002 cac0635
[LoongArch] Add option for merge base offset pass
wangleiat abffc54
[X86][MemFold] Allow masked load folding if masks are equal (#161074)
phoebewang 23d3caf
[libc][math] Refactor exp10m1f implementation to header-only in src/_…
bassiounix eb420fd
[mlir][bzl] Fix missing dep (#161126)
jpienaar 250854d
[Github] Update GHA Dependencies (#161107)
renovate-bot 98563d8
[Github] Explicitly Annotate Versions
boomanaiden154 cd4c528
[Clang][OpenMP][LoopTransformations] Implement "#pragma omp fuse" loo…
eZWALT f27442b
[AArch64] Add missing bitcast patterns for bf16<->f16 converts. (#159…
davemgreen b0a755b
[TargetLowering] Remove NoSignedZerosFPMath uses (#160975)
paperchalice 85d48b8
[clang] treat deduced-as-dependent as undeduced for constant template…
mizvekov ab5bba5
[clang] fix code synthesis context depth limit logic (#161103)
mizvekov b3fe1b6
[C++20] [Modules] Set the feature testing macro to 1 (#161034)
ChuanqiXu9 52b59b5
[DropUnnecessaryAssumes] Make the ephemeral value check more precise …
nikic 0777849
[BOLT][DWARF] Fix debug info update issue with dwarf4 dwp (#155619)
Jinjie-Huang fd8adf3
[IR] Use immarg for preallocated intrinsics (NFC) (#155835)
nikic 3a3a4fb
[LoongArch][NFC] Pre-commit scalarize fp tests for #157824 (#160480)
zhaoqi5 f84b784
[X86] LowerShiftByScalarImmediate - move shl(x,1) -> add(freeze(x),fr…
RKSimon 483d73a
[libclc] Move myself to the list of inactive maintainers
frasercrmck 306ece0
[llvm][NFC] Simplify alignment calculations in `TrailingObjects` (#16…
localspook 99774ec
[LoongArch] Override cost hooks to expose more DAG combine opportunit…
zhaoqi5 f92c23d
[AArch64][SME][SDAG] Add basic support for exception handling (#159363)
MacDue b4be7ec
[VPlan] Compute cost of more replicating loads/stores in ::computeCos…
fhahn 600e97d
[MLIR] Apply clang-tidy fixes for modernize-use-emplace in LoopEmitte…
joker-eph a40918b
[MLIR] Apply clang-tidy fixes for misc-use-internal-linkage in JitRun…
joker-eph 8907adc
[MLIR] Apply clang-tidy fixes for bugprone-argument-comment in Subgro…
joker-eph 2e19666
[MLIR] Apply clang-tidy fixes for bugprone-argument-comment in PrintC…
joker-eph 631b89c
[MLIR][CF] Avoid collapsing blocks which participate in cycles (#160783)
benwu25 edc76e1
[ROCDL][LLVM] Added rocdl.fmed3 -> Intrinsic::amdgcn_fmed3 (#159332)
keshavvinayak01 8d57211
[LLVM][AArch64] Optimize sign bit tests with TST instruction for SIGN…
rez5427 97367d1
[libc++] Vectorize std::find (#156431)
philnik777 585fd4c
[libclc] Propose new libclc maintainer (#161141)
frasercrmck 2ab2ffe
[X86] createVPDPBUSD - only use 512-bit X86ISD::VPDPBUSD on AVX512VNN…
RKSimon f1b4a3b
[llvm-cov] Fix MSVC "not all control paths return a value" warning. N…
RKSimon ce70773
Fix some typos in machine verifier comments and trace output (#160049)
danstadelmann f628a54
[ConstantFold] Fold inttoptr, ptrtoaddr to bitcast (#161087)
XChy 9552e89
[X86] Remove X86ISD::VSHLDV/VSHRDV and use ISD::FSHL/FSHR opcodes dir…
TianYe717 3c98be4
[clang][bytecode] Pointer::isZero - fix MSVC "not all control paths r…
RKSimon c20ef94
[clang][x86] tbm-builtins.c - add i386 test coverage (#161169)
RKSimon 84e4c06
[DAGCombiner] Remove NoSignedZerosFPMath uses in visitFSUB (#160974)
paperchalice 7b25cef
[DOC][GlobalISel] Add more explanation to InstructionSelect (#160510)
kper 3253ec0
[clang][x86] bmi-builtins.c - add i386 test coverage (#161171)
RKSimon 2d30392
[clang][X86] bmi2-builtins.c - add -fexperimental-new-constant-interp…
RKSimon 9d33b99
[clang][X86] tbm-builtins.c - add -fexperimental-new-constant-interpr…
RKSimon 23d08af
[Offload][NFC] use unique ptrs for platforms (#160888)
pbalcer cd94035
[clang][X86] bmi-builtins.c - add -fexperimental-new-constant-interpr…
RKSimon 8df643f
[VectorCombine] Fix rotation in phi narrowing. (#160465)
PeddleSpam 5ff9f7b
[SimplifyCFG] Ensure selects have not been constant folded in `foldSw…
antoniofrighetto 2d1f9c9
Reland "[DebugInfo][DwarfDebug] Separate creation and population of a…
dzhidzhoev b555c99
[clang][modules] Ensure -nostdlib causes no manifest to be reported (…
naveen-seth 492bcff
[X86] ftrunc.ll - add nounwind to silence cfi noise (#161186)
RKSimon 99f296d
[CodeGen][test] Fix Buildbot failure due to uninitialized variables (…
frederick-vs-ja 4fe1a87
[X86][APX] Promote 8/16-bit LEA to 32-bit to avoid partial dependence…
phoebewang 31818fb
Reland "[clang][DebugInfo][NFC] Simplify CollectRecordLambdaFields"
Michael137 766c90f
[VectorCombine] foldShuffleOfCastops - handle unary shuffles (#160009)
ckoparkar d8a8d1f
[MLIR][MemRef] Change builders with `int` alignment params to `llvm::…
jiang1997 41bce81
[AMDGPU][Disassembler][NFC] Regenerate check lines of some tests usin…
kosarev 668f56d
[analyzer] CStringChecker: Fix crash in `CheckOverlap` when arguments…
guillem-bartrina-sonarsource 36d9e10
[flang][OpenMP] Fix scope checks for ALLOCATE directive (#160948)
kparzysz b285bac
[libc++][NFC] In documentation, fix path to benchmark that has now moved
ldionne a4348de
Merge branch 'main' of github.com:llvm/llvm-project into DefaultLambd…
jjmarr-amd 13b5049
rephrase
jjmarr-amd 043df7c
commit vibe coded work
jjmarr-amd 33af58b
attempt to fix to use something that isn't weird string manipulation
jjmarr-amd 51aa182
more vibe coding with human intervention
jjmarr-amd dd65b90
go back to the hacky string manipulation
jjmarr-amd a9509f3
remove AI comments
jjmarr-amd e9e0f9a
fix namespacing issues
jjmarr-amd b2c3cc2
remove anonymous namespace
jjmarr-amd 969558e
simplify per code review
jjmarr-amd 359fd6c
Use IIFE so ReplacementText can be const.
jjmarr-amd 4e10e78
simplify code even more
jjmarr-amd 9765c90
Turns out this check doesn't like templated lambdas
jjmarr-amd 33a79a0
ignore VLAs
jjmarr-amd 8f21201
move around doc paragraphs
jjmarr-amd e49dd93
Apply suggestions from code review
jjmarr-amd 840c043
Update clang-tools-extra/clang-tidy/readability/AvoidDefaultLambdaCap…
jjmarr-amd c4870ed
remove namespace qualifiers
jjmarr-amd 34ab8dd
add new test case
jjmarr-amd 48416d1
explicit types
jjmarr-amd 3ff1c7a
remove brackets around single statement ifs
jjmarr-amd 6cefb5f
add init capture test cases
jjmarr-amd 0eadc10
Apply suggestions from code review
jjmarr-amd 8f374ff
alphabetize
jjmarr-amd 31d0b93
alphabetize again since i missed one
jjmarr-amd File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
clang-tools-extra/clang-tidy/bugprone/DefaultLambdaCaptureCheck.cpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#include "DefaultLambdaCaptureCheck.h" | ||
#include "clang/AST/ASTContext.h" | ||
#include "clang/ASTMatchers/ASTMatchFinder.h" | ||
|
||
using namespace clang::ast_matchers; | ||
|
||
namespace clang::tidy::bugprone { | ||
|
||
void DefaultLambdaCaptureCheck::registerMatchers(MatchFinder *Finder) { | ||
// Match any lambda expression | ||
Finder->addMatcher(lambdaExpr().bind("lambda"), this); | ||
} | ||
|
||
void DefaultLambdaCaptureCheck::check(const MatchFinder::MatchResult &Result) { | ||
const auto *Lambda = Result.Nodes.getNodeAs<LambdaExpr>("lambda"); | ||
if (!Lambda) | ||
return; | ||
|
||
// Check if lambda has a default capture | ||
jjmarr-amd marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
if (Lambda->getCaptureDefault() == LCD_None) | ||
return; | ||
|
||
SourceLocation DefaultCaptureLoc = Lambda->getCaptureDefaultLoc(); | ||
if (DefaultCaptureLoc.isInvalid()) | ||
return; | ||
|
||
const char *CaptureKind = | ||
(Lambda->getCaptureDefault() == LCD_ByCopy) ? "by-copy" : "by-reference"; | ||
|
||
diag(DefaultCaptureLoc, "lambda %0 default capture is discouraged; " | ||
"prefer to capture specific variables explicitly") | ||
<< CaptureKind; | ||
} | ||
jjmarr-amd marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
||
} // namespace clang::tidy::bugprone |
26 changes: 26 additions & 0 deletions
26
clang-tools-extra/clang-tidy/bugprone/DefaultLambdaCaptureCheck.h
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_BUGPRONE_DEFAULT_LAMBDA_CAPTURE_H | ||
#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_BUGPRONE_DEFAULT_LAMBDA_CAPTURE_H | ||
|
||
#include "../ClangTidyCheck.h" | ||
|
||
namespace clang::tidy::bugprone { | ||
|
||
/** Flags lambdas that use default capture modes | ||
* | ||
* For the user-facing documentation see: | ||
* http://clang.llvm.org/extra/clang-tidy/checks/bugprone/default-lambda-capture.html | ||
*/ | ||
class DefaultLambdaCaptureCheck : public ClangTidyCheck { | ||
public: | ||
DefaultLambdaCaptureCheck(StringRef Name, ClangTidyContext *Context) | ||
: ClangTidyCheck(Name, Context) {} | ||
void registerMatchers(ast_matchers::MatchFinder *Finder) override; | ||
void check(const ast_matchers::MatchFinder::MatchResult &Result) override; | ||
std::optional<TraversalKind> getCheckTraversalKind() const override { | ||
return TK_IgnoreUnlessSpelledInSource; | ||
} | ||
}; | ||
|
||
} // namespace clang::tidy::bugprone | ||
|
||
#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_BUGPRONE_DEFAULT_LAMBDA_CAPTURE_H |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
clang-tools-extra/docs/clang-tidy/checks/bugprone/default-lambda-capture.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
.. title:: clang-tidy - bugprone-default-lambda-capture | ||
|
||
bugprone-default-lambda-capture | ||
=============================== | ||
|
||
Warns when lambda expressions use default capture modes (``[=]`` or ``[&]``) | ||
instead of explicitly capturing specific variables. Default captures can make | ||
code less readable and more error-prone by making it unclear which variables | ||
are being captured and how. | ||
|
||
Implements Item 31 of Effective Modern C++ by Scott Meyers. | ||
|
||
Example | ||
------- | ||
|
||
.. code-block:: c++ | ||
|
||
void example() { | ||
int x = 1; | ||
int y = 2; | ||
|
||
// Bad - default capture by copy | ||
auto lambda1 = [=]() { return x + y; }; | ||
|
||
// Bad - default capture by reference | ||
auto lambda2 = [&]() { return x + y; }; | ||
|
||
// Good - explicit captures | ||
auto lambda3 = [x, y]() { return x + y; }; | ||
auto lambda4 = [&x, &y]() { return x + y; }; | ||
} | ||
|
||
The check will warn on: | ||
|
||
- Default capture by copy: ``[=]`` | ||
- Default capture by reference: ``[&]`` | ||
- Mixed captures with defaults: ``[=, &x]`` or ``[&, x]`` | ||
|
||
The check will not warn on: | ||
|
||
- Explicit captures: ``[x]``, ``[&x]``, ``[x, y]``, ``[this]`` | ||
- Empty capture lists: ``[]`` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
98 changes: 98 additions & 0 deletions
98
clang-tools-extra/test/clang-tidy/checkers/bugprone/default-lambda-capture.cpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
// RUN: %check_clang_tidy %s bugprone-default-lambda-capture %t | ||
|
||
void test_default_captures() { | ||
int value = 42; | ||
int another = 10; | ||
|
||
auto lambda1 = [=](int x) { return value + x; }; | ||
// CHECK-MESSAGES: :[[@LINE-1]]:19: warning: lambda by-copy default capture is discouraged; prefer to capture specific variables explicitly [bugprone-default-lambda-capture] | ||
|
||
auto lambda2 = [&](int x) { return value + x; }; | ||
// CHECK-MESSAGES: :[[@LINE-1]]:19: warning: lambda by-reference default capture is discouraged; prefer to capture specific variables explicitly [bugprone-default-lambda-capture] | ||
|
||
auto lambda3 = [=, &another](int x) { return value + another + x; }; | ||
// CHECK-MESSAGES: :[[@LINE-1]]:19: warning: lambda by-copy default capture is discouraged; prefer to capture specific variables explicitly [bugprone-default-lambda-capture] | ||
|
||
auto lambda4 = [&, value](int x) { return value + another + x; }; | ||
// CHECK-MESSAGES: :[[@LINE-1]]:19: warning: lambda by-reference default capture is discouraged; prefer to capture specific variables explicitly [bugprone-default-lambda-capture] | ||
} | ||
|
||
void test_acceptable_captures() { | ||
int value = 42; | ||
int another = 10; | ||
|
||
auto lambda1 = [value](int x) { return value + x; }; | ||
auto lambda2 = [&value](int x) { return value + x; }; | ||
auto lambda3 = [value, another](int x) { return value + another + x; }; | ||
auto lambda4 = [&value, &another](int x) { return value + another + x; }; | ||
|
||
auto lambda5 = [](int x, int y) { return x + y; }; | ||
|
||
struct S { | ||
int member = 5; | ||
void foo() { | ||
auto lambda = [this]() { return member; }; | ||
} | ||
}; | ||
} | ||
|
||
void test_nested_lambdas() { | ||
int outer_var = 1; | ||
int middle_var = 2; | ||
int inner_var = 3; | ||
|
||
auto outer = [=]() { | ||
// CHECK-MESSAGES: :[[@LINE-1]]:17: warning: lambda by-copy default capture is discouraged; prefer to capture specific variables explicitly [bugprone-default-lambda-capture] | ||
|
||
auto inner = [&](int x) { return outer_var + middle_var + inner_var + x; }; | ||
// CHECK-MESSAGES: :[[@LINE-1]]:19: warning: lambda by-reference default capture is discouraged; prefer to capture specific variables explicitly [bugprone-default-lambda-capture] | ||
|
||
return inner(10); | ||
}; | ||
} | ||
|
||
void test_lambda_returns() { | ||
int a = 1, b = 2, c = 3; | ||
|
||
auto create_adder = [=](int x) { | ||
// CHECK-MESSAGES: :[[@LINE-1]]:24: warning: lambda by-copy default capture is discouraged; prefer to capture specific variables explicitly [bugprone-default-lambda-capture] | ||
return [x](int y) { return x + y; }; // Inner lambda is fine - explicit capture | ||
}; | ||
|
||
auto func1 = [&]() { return a; }; | ||
// CHECK-MESSAGES: :[[@LINE-1]]:17: warning: lambda by-reference default capture is discouraged; prefer to capture specific variables explicitly [bugprone-default-lambda-capture] | ||
|
||
auto func2 = [=]() { return b; }; | ||
// CHECK-MESSAGES: :[[@LINE-1]]:17: warning: lambda by-copy default capture is discouraged; prefer to capture specific variables explicitly [bugprone-default-lambda-capture] | ||
} | ||
|
||
class TestClass { | ||
int member = 42; | ||
|
||
public: | ||
void test_member_function_lambdas() { | ||
int local = 10; | ||
|
||
auto lambda1 = [=]() { return member + local; }; | ||
// CHECK-MESSAGES: :[[@LINE-1]]:21: warning: lambda by-copy default capture is discouraged; prefer to capture specific variables explicitly [bugprone-default-lambda-capture] | ||
|
||
auto lambda2 = [&]() { return member + local; }; | ||
// CHECK-MESSAGES: :[[@LINE-1]]:21: warning: lambda by-reference default capture is discouraged; prefer to capture specific variables explicitly [bugprone-default-lambda-capture] | ||
|
||
auto lambda3 = [this, local]() { return member + local; }; | ||
auto lambda4 = [this, &local]() { return member + local; }; | ||
} | ||
}; | ||
|
||
template<typename T> | ||
void test_template_lambdas() { | ||
T value{}; | ||
|
||
auto lambda = [=](T x) { return value + x; }; | ||
// CHECK-MESSAGES: :[[@LINE-1]]:18: warning: lambda by-copy default capture is discouraged; prefer to capture specific variables explicitly [bugprone-default-lambda-capture] | ||
} | ||
|
||
void instantiate_templates() { | ||
test_template_lambdas<int>(); | ||
test_template_lambdas<double>(); | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.