Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
194 commits
Select commit Hold shift + click to select a range
97169bf
Update contact email address
MaskRay Sep 27, 2024
6fd870b
[clang][bytecode] Implement zero-init for fixed point types (#110257)
tbaederr Sep 27, 2024
a4197e4
Add docs describing how the thread plan stack affects stepping (#110167)
jimingham Sep 27, 2024
b65930c
[gn build] Port 491375cc4eb2
llvmgnsyncbot Sep 27, 2024
e42cc3f
[clang][test] add testing for the AST matcher reference (#110258)
5chmidti Sep 27, 2024
51259de
[libc++] LWG4025: Move assignment operator of `std::expected<cv void,…
xiaoyang-sde Sep 27, 2024
ea568a9
[libclang/python] Improve test coverage (#109846)
DeinAlptraum Sep 27, 2024
68f529d
[rtsan] Fix comment in fcntl, fix va_args type (#108440)
cjappl Sep 27, 2024
787a6d5
[nvlink-wrapper] Remove use of symlinks
jhuber6 Sep 27, 2024
cd5f5b7
[AMDGPU][MC] Implement fft and rotate modes for ds_swizzle_b32 (#108064)
jwanggit86 Sep 27, 2024
50afafb
[RISCV][TTI] Adjust constant materialization cost for (z/s)ext from i…
preames Sep 27, 2024
eba106d
[SandboxIR][NFC] Move Instruction classes into a separate file (#110294)
Sep 27, 2024
cce52c7
[gn build] Port eba106d461f7
llvmgnsyncbot Sep 27, 2024
1832d60
InstCombine/Demanded: simplify srem case (NFC) (#110260)
artagnon Sep 27, 2024
2804775
VPlan/PatternMatch: mark match functions const (NFC) (#108191)
artagnon Sep 27, 2024
68ddd6c
Revert "Fix LLVM_ENABLE_ABI_BREAKING_CHECKS macro check: use #if inst…
joker-eph Sep 27, 2024
c616f19
[MemProf] Refactor context node creation into a new helper (NFC) (#10…
teresajohnson Sep 27, 2024
a4b27e7
[LV] Remove noalias intrinsics handling from scalarizeInstruction (NFC).
fhahn Sep 27, 2024
ca47f48
[SandboxIR][NFC] Delete SandboxIR.h (#110309)
Sep 27, 2024
8dfeb4e
Revert "[SandboxIR][NFC] Delete SandboxIR.h (#110309)"
Sep 27, 2024
f49344e
[SLP]Check if number of elements forms a full register
alexey-bataev Sep 27, 2024
ac946e6
[SCEV] Re-organize tests requiring remainder predicates.
fhahn Sep 27, 2024
48dc4d3
[libc++][Apple] Add missing availabilty mappings for Apple platforms …
ldionne Sep 27, 2024
6389974
[libc++] Don't use aligned_alloc on iOS versions before 13 (#110315)
Un1q32 Sep 27, 2024
f11775f
[libclang/python] Do not rely on `ctypes`' `errcheck` (#105490)
DeinAlptraum Sep 27, 2024
2018f4c
Reapply "[SandboxIR][NFC] Delete SandboxIR.h (#110309)"
Sep 27, 2024
1fb3fe0
[mlir] Avoid Type::getPointerTo() (NFC)
JOE1994 Sep 27, 2024
4407cf9
[HLSL] Vector Usual Arithmetic Conversions (#110195)
llvm-beanz Sep 27, 2024
8ed18ed
[RISCV] Add correct MachinePointerInfo when putting arguments on the …
topperc Sep 27, 2024
c650067
[NVPTX] Add a clang builtin for the `warpsize` intrinsic (#110316)
jhuber6 Sep 27, 2024
023f691
[SandboxIR] Fix MSVC warning caused by 2018f4ccf28b
Sep 27, 2024
e9700d0
[HLSL] Implement `asint` casting using `bit_cast` (#110027)
inbelic Sep 27, 2024
3723946
[SandboxIR][NFC] Create Use.cpp and delete SandboxIR.cpp (#110323)
Sep 27, 2024
5d08f32
[HLSL] Implementation of the elementwise fmod builtin (#108849)
lizhengxing Sep 27, 2024
218ac5b
[gn build] Port 3723946146db
llvmgnsyncbot Sep 27, 2024
ae74e14
[LLVM][TableGen] Adopt `indent` in CallingConvEmitter (#110113)
jurahul Sep 27, 2024
3d715e1
Revert "[Bazel] Port 5e9813667958688f5ab0e0b776b509b2b909d1e4"
hanhanW Sep 27, 2024
f0083c6
[AIX][PGO] Enable PGO continuous mode support on AIX (#110196)
Sep 26, 2024
0b7a18b
[Attributor] Use more appropriate approach to check flat address spac…
shiltian Sep 27, 2024
c2af9af
[SandboxIR][NFC] Remove some unnecessary friend declarations
Sep 27, 2024
84fdfb9
[lldb] Store expression evaluator diagnostics in an llvm::Error (NFC)…
adrian-prantl Sep 27, 2024
49372d1
[lldb] Inline expression evaluator error visualization (#106470)
adrian-prantl Sep 27, 2024
8536d48
Add missing dependency to unit test
adrian-prantl Sep 27, 2024
159470d
[mlir] [tblgen-to-irdl] Add attributes to tblgen-to-irdl script (#109…
alexarice Sep 27, 2024
2ddcc4e
Revert "Add missing dependency to unit test"
adrian-prantl Sep 28, 2024
41dca01
Revert "[lldb] Inline expression evaluator error visualization (#1064…
adrian-prantl Sep 28, 2024
df4d7d3
[SandboxIR] Add pointer-diff utility function (#110343)
Sterling-Augustine Sep 28, 2024
d33fa70
[lldb] Inline expression evaluator error visualization (#106470)
adrian-prantl Sep 27, 2024
cca3217
[mlir][SCF] Use Affine ops for indexing math. (#108450)
MaheshRavishankar Sep 28, 2024
2a005bf
[Flang][OpenMP] Fix for error in atomic read for different elements o…
chandankds Sep 28, 2024
a94060c
[ELF] Pass Ctx & to Relocations
MaskRay Sep 28, 2024
f597ce0
[ORC][Runtime] Enhancing ELF Platform with Push-Request Model for Ini…
SahilPatidar Sep 28, 2024
969abfe
[compiler-rt] Fix a warning
kazutakahirata Sep 28, 2024
ef390b3
[libc] Use RAII based alloc in gpu rpc_server instead of manual new/d…
Hardcode84 Sep 28, 2024
75e08a5
[mlir][linalg] Add tests for PadOp (#110271)
banach-space Sep 28, 2024
a800764
Revert "[clang][test] add testing for the AST matcher reference" (#11…
5chmidti Sep 28, 2024
44478ba
Fix MSVC signed/unsigned mismatch warning. NFC.
RKSimon Sep 28, 2024
641b4d5
[clang][bytecode] Implement integral-to-fixed-point casts (#110350)
tbaederr Sep 28, 2024
bbe79a8
[libc] Use RAII alloc in gpu rpc printf impl (#110352)
Hardcode84 Sep 28, 2024
2f7ccaf
[SCEV] Add predicate in SolveLinEq to ensure B is a multiple of A. (#…
fhahn Sep 28, 2024
6b62e04
[clang][bytecode] Implement (N)EQ between fixed point and integral (#…
tbaederr Sep 28, 2024
29d0a84
[clang][CGOpenMPRuntimeGPU] Avoid llvm::Type::getPointerTo() (NFC) (#…
JOE1994 Sep 28, 2024
6cbd8a3
[clang][bytecode] Implement floating-to-fixed-point casts (#110361)
tbaederr Sep 28, 2024
d48777e
[mlir][polynomial] remove incorrect canonicalization rule (#110318)
ZenithalHourlyRate Sep 28, 2024
5d734fa
[llvm][SPIRV] Expose fast `popcnt` support for SPIR-V targets (#109845)
AlexVlx Sep 28, 2024
795c24c
[InstCombine] foldVecExtTruncToExtElt - extend to handle trunc(lshr(e…
RKSimon Sep 28, 2024
1c2ed36
[clang][x86] Add constexpr support for BMI/TBM BEXTR intrinsics (#109…
RKSimon Sep 28, 2024
60a6e6f
[Object] Avoid repeated map lookups (NFC) (#110201)
kazutakahirata Sep 28, 2024
30089b1
[DWARF] Avoid repeated hash lookups (NFC) (#110202)
kazutakahirata Sep 28, 2024
312c1cf
[CodeGen] Avoid repeated hash lookups (NFC) (#110203)
kazutakahirata Sep 28, 2024
5bc673d
[MCParser] Avoid repeated hash lookups (NFC) (#110204)
kazutakahirata Sep 28, 2024
3a5b9da
[clang][bytecode] Implement fixed-point-to-float casts (#110369)
tbaederr Sep 28, 2024
fcde4f6
[mlir][Transforms][NFC] Dialect Conversion: Remove redundant `lookupO…
matthias-springer Sep 28, 2024
fd50cdf
[AMDGPU] Use MCRegister. NFC
topperc Sep 28, 2024
af629ec
[AVR] Use MCRegister. NFC
topperc Sep 28, 2024
6b81357
[Hexagon] Use MCRegister. NFC
topperc Sep 28, 2024
deda2f0
[LV] Remove redundant InnerLoopUnroller class (NFCI).
fhahn Sep 28, 2024
871e32b
[AsmPrinter] Avoid repeated hash lookups (NFC) (#110376)
kazutakahirata Sep 28, 2024
8cfc99b
[DWARFLinker] Avoid repeated hash lookups (NFC) (#110377)
kazutakahirata Sep 28, 2024
f8bd98b
[Analysis] Avoid repeated hash lookups (NFC) (#110378)
kazutakahirata Sep 28, 2024
d3ca484
[LiveDebugValues] Avoid repeated hash lookups (NFC) (#110379)
kazutakahirata Sep 28, 2024
6022a3a
[SCEV] Store predicates for EL/ENT in SmallVector.
fhahn Sep 28, 2024
e9c0c66
[libc++] Add [[nodiscard]] to std::prev and std::next (#109550)
marcauberer Sep 28, 2024
e7621f4
Reland "[NVVM] Upgrade nvvm.ptr.* intrinics to addrspace cast" (#110262)
AlexMaclean Sep 28, 2024
6558e56
[libc] Update HSA queues to use the maximum size and set the barrier …
jhuber6 Sep 28, 2024
e203a67
[cuda][HIP] `__constant__` should imply constant (#110182)
AlexVlx Sep 29, 2024
8773bd0
[mlir] Print aliases for recursive types (#110346)
smeenai Sep 29, 2024
8cd2f75
[bazel] Port df4d7d3b29b073e24a5ebb8302e7a1ac873a5cde (#110395)
keith Sep 29, 2024
d30d251
[bazel] Port f597ce03a6b2b7268e6a5c11cf7478c87b65b2bc (#110396)
keith Sep 29, 2024
29783f7
[ELF] Pass Ctx & to Relocations
MaskRay Sep 29, 2024
a522516
[ELF] Pass Ctx & to Target.cpp
MaskRay Sep 29, 2024
bf9ab0b
[C++20] [Modules] Emit implicit Deduction Guide for implicit class sp…
ChuanqiXu9 Sep 27, 2024
f11abac
Revert "[libc++][modules] Rewrite the modulemap to have fewer top-lev…
llvm-beanz Sep 29, 2024
2575c39
[gn build] Port f11abac6524f
llvmgnsyncbot Sep 29, 2024
b0fc36d
[ELF] Remove unneeded getTargetInfo. NFC
MaskRay Sep 29, 2024
7883b02
[ItaniumMangle] Add substitutions for record types when mangling vtab…
tcwzxx Sep 29, 2024
75ad8b2
workflows/release-binaries-all: trigger for Release.cmake (#110394)
keith Sep 29, 2024
c3e4998
[ELF] Pass Ctx & to TargetInfo. NFC
MaskRay Sep 29, 2024
31dd29c
[X86,lld] Handle relocation R_X86_64_REX2_GOTPCRELX (#109783)
KanRobert Sep 29, 2024
defead4
[clang][bytecode] Implement fixed-point add (#110405)
tbaederr Sep 29, 2024
d705bd2
[compiler-rt] freadlink fix 2 for #83679. (#110372)
devnexen Sep 29, 2024
26df43f
[BPF] fix print_btf.py test script on bigendian machines (#110332)
eddyz87 Sep 29, 2024
c2a37e4
[clang][bytecode] Implement fixed point casts (#110409)
tbaederr Sep 29, 2024
1714b11
[clang][bytcode] Convert Fixed Point values to target semantics... (#…
tbaederr Sep 29, 2024
1edd220
[LV] Retrieve reduction resume values directly for epilogue vec. (NFC)
fhahn Sep 29, 2024
95ce78b
[clang][bytecode] Implement fixed-point-to-int casts (#110417)
tbaederr Sep 29, 2024
5c811cc
[clang][bytecode] Implement more binary operators for fixed point typ…
tbaederr Sep 29, 2024
8a9e9a8
[Analysis] Avoid repeated hash lookups (NFC) (#110397)
kazutakahirata Sep 29, 2024
a341820
[LiveDebugValues] Simplify code with MapVector::insert_or_assign (NFC…
kazutakahirata Sep 29, 2024
19e5a52
[GlobalISel] Avoid repeated hash lookups (NFC) (#110399)
kazutakahirata Sep 29, 2024
76f2fa8
[Transforms] Avoid repeated hash lookups (NFC) (#110400)
kazutakahirata Sep 29, 2024
6f04e65
[clang][bytecode] Implement fixed-point shifts (#110429)
tbaederr Sep 29, 2024
51e0a99
[test-release.sh] Fix sed encoding issues on macOS (#105989)
keith Sep 29, 2024
2c8836c
[LV] Don't consider predicated insts as invariant unconditionally in CM.
fhahn Sep 29, 2024
886b2b2
[BPF] Use MCRegister. NFC
topperc Sep 29, 2024
65c41da
[Lanai] Use MCRegister. NFC
topperc Sep 29, 2024
c38b5c8
[LoongArch] Use MCRegister. NFC
topperc Sep 29, 2024
2ab9233
[MSP430] Use MCRegister. NFC
topperc Sep 29, 2024
bab5d5b
[ELF] Pass Ctx & to ICF and SymbolTable
MaskRay Sep 29, 2024
877e49f
[CSKY] Use MCRegister. NFC
MaskRay Sep 29, 2024
cf30e8e
[ELF] Pass Ctx & to Thunk
MaskRay Sep 29, 2024
04e69ad
[ELF] Pass Ctx & to Thunk
MaskRay Sep 29, 2024
5c33424
[ELF] Pass Ctx & to MarkLive
MaskRay Sep 29, 2024
1747318
[ELF] Pass Ctx & to MapFile
MaskRay Sep 29, 2024
cc6c059
[ELF] Pass Ctx & to Writer
MaskRay Sep 29, 2024
079b832
[ELF] Pass Ctx & to InputFiles and SyntheticSections
MaskRay Sep 29, 2024
c490d34
[ELF] Pass Ctx & to Relocations
MaskRay Sep 29, 2024
129ade2
[mlir][sparse] Replace `getSparseTensorType` with `tryGetSparseTensor…
CoTinker Sep 30, 2024
dbad963
[SPARC] Align i128 to 16 bytes in SPARC datalayouts (#106951)
koachan Sep 30, 2024
1efd122
[InstCombine] Fold `icmp eq/ne (X *nw Z), (Y *nw Z) -> icmp eq/ne Z, …
dtcxzyw Sep 30, 2024
64f2bff
[ReachingDefAnalysis] Turn MBBReachingDefsInfo into a proper class (N…
kazutakahirata Sep 30, 2024
4ef77d6
[include-cleaner] Attach Header to AnalysisResults for misisng header…
kadircet Sep 30, 2024
6292f11
[ORC-RT] Rename sections_tracker.h to record_section_tracker.h.
lhames Sep 30, 2024
e20bf28
[HLSL] Replace `element_type*` handles in HLSLExternalSemaSource with…
hekota Sep 30, 2024
6f3c151
[SPIR-V] Fix of OpString separator in DI test (#110249)
bwlodarcz Sep 30, 2024
0bc9834
[LICM] Use DomTreeUpdater version of SplitBlockPredecessors, nfc (#10…
caojoshua Sep 30, 2024
af47038
[clangd] [C++20] [Modules] Support code complete for C++20 modules (#…
ChuanqiXu9 Sep 30, 2024
a87640c
AMDGPU: Fix assertion on load of vector of pointers (#110436)
arsenm Sep 30, 2024
0d384fe
[clang][analyzer] Move 'alpha.core.PointerSub' checker into 'security…
balazske Sep 30, 2024
147558e
[clang][ItaniumMangle] Mangle friend function templates with a constr…
VitaNuo Sep 30, 2024
f8373cb
[LV] Reuse VPReplicateRecipe to handle scalar stores in exit block. (…
Mel-Chen Sep 30, 2024
f5c02dd
[MemCpyOpt] Use EarliestEscapeInfo (#110280)
nikic Sep 30, 2024
a548ede
[AArch64][SME]Check streaming mode when using SME2 instruction in fra…
CarolineConcatto Sep 30, 2024
dd2792a
[bazel] Fix build past 6292f117c39b9fc72da4e40328eeeda2aa94a5f2 (#110…
dklimkin Sep 30, 2024
f445e39
[SimplifyCFG] Use isWritableObject() API (#110127)
nikic Sep 30, 2024
f627c45
Fix test for PR#109680
CarolineConcatto Sep 30, 2024
e9d12a6
AMDGPU: Add test for 16 bit unsigned scratch offsets (#110255)
petar-avramovic Sep 30, 2024
93eaa99
[abi] [ItaniumMangle] Remove a test case that fails due to expected r…
VitaNuo Sep 30, 2024
83fe851
AMDGPU: Fix inst-selection of large scratch offsets with sgpr base (#…
petar-avramovic Sep 30, 2024
8e0daab
AMDGPU: Make a frame index test more realistic
arsenm Sep 30, 2024
b8c974f
[MLIR][TilingInterface] Extend consumer fusion for multi-use of produ…
Abhishek-Varma Sep 30, 2024
6f956e3
[AMDGPU] Rename LocalMemorySize features to AddressableLocalMemorySiz…
jayfoad Sep 30, 2024
d556e38
[flang][debug] Support derived type components with box types. (#109424)
abidh Sep 30, 2024
5883ad3
DAG: Handle vector legalization of minimumnum/maximumnum (#109779)
arsenm Sep 30, 2024
81ba95c
FastISel: Fix incorrectly using getPointerTy (#110465)
arsenm Sep 30, 2024
9f3728d
[libclc] Fix installation w/ ENABLE_RUNTIME_SUBNORMAL (#109926)
frasercrmck Sep 30, 2024
dc6e480
[clang][bytecode] Cast fixed-point cmp result to int if necessary (#1…
tbaederr Sep 30, 2024
79382eb
[clang][bytecode] Remove superfluous check from fixed-point div (#110…
tbaederr Sep 30, 2024
3c85102
[clang][bytecode] Handle DiscardResult for fixed-point literals (#110…
tbaederr Sep 30, 2024
c897c13
[AMDGPU] Convert AMDGPUResourceUsageAnalysis pass from Module to MF p…
JanekvO Sep 30, 2024
8f50dbd
[gn build] Port c897c13dde3b
llvmgnsyncbot Sep 30, 2024
82e594a
[AMDGPU] Remove unused lambda capture in AMDGPUMCResourceInfo.cpp (NFC)
DamonFool Sep 30, 2024
bdd3559
[X86] pmulh.ll - add extra test coverage from #109790
RKSimon Sep 30, 2024
412d59f
[DAG] combineShiftToMULH - handle zext nneg as sext
RKSimon Sep 30, 2024
587eaef
[sanitizer_common] Handle ptrace on Linux/sparc64 (#109310)
rorth Sep 30, 2024
c0e97c4
[Clang][LLVM][AArch64] Add intrinsic for LUTI4 SME2 instruction (#977…
CarolineConcatto Sep 30, 2024
735a5f6
[AMDGPU] When allocating VGPRs, VGPR spills are not part of the prolo…
jayfoad Sep 30, 2024
8e6bba2
[libc++][NFC] Rename fold.h to ranges_fold.h (#109696)
ldionne Sep 27, 2024
18df9d2
[libc++] Add an ABI setting to harden unique_ptr<T[]>::operator[] (#9…
ldionne Sep 27, 2024
3d9cf8b
[clangd] Improve filtering logic for undesired proto symbols (#110091)
kadircet Sep 30, 2024
7061d38
[gn build] Port 18df9d23ea39
llvmgnsyncbot Sep 30, 2024
5df7d88
[gn build] Port 8e6bba230e1c
llvmgnsyncbot Sep 30, 2024
282fc93
[clang-tidy][NFC] optimize unused using decls performance (#110200)
HerrCai0907 Sep 30, 2024
ec08c11
[mlir][doc][SPIR-V] Add missing `>` (#110464)
trdthg Sep 30, 2024
054eadc
[flang] Implement GETUID and GETGID intrinsics (#108017)
DavidTruby Sep 30, 2024
bfa8519
[LLVM][TableGen] Change GlobalISelEmitter to use const RecordKeeper (…
jurahul Sep 30, 2024
619688f
[IR] Avoid repeated hash lookups (NFC) (#110450)
kazutakahirata Sep 30, 2024
47b2230
[ExecutionEngine] Avoid repeated hash lookups (NFC) (#110451)
kazutakahirata Sep 30, 2024
db9e1fb
[MachineLICM] Avoid repeated hash lookups (NFC) (#110452)
kazutakahirata Sep 30, 2024
be6a5dc
[Analysis] Avoid repeated hash lookups (NFC) (#110453)
kazutakahirata Sep 30, 2024
0617629
[SLP][REVEC] Fix cost model for getBuildVectorCost with FixedVectorTy…
HanKuanChen Sep 30, 2024
bfde178
[mlir] Update the return type of `getNum{Dynamic|Scalable}Dims` (#110…
banach-space Sep 30, 2024
ac0f64f
[AMDGPU] Split vgpr regalloc pipeline (#93526)
cdevadas Sep 30, 2024
9f6cd56
[HLSL] Use HLSLToolChain for Vulkan (#110306)
s-perron Sep 30, 2024
38450df
[gn build] Port ac0f64f06d67
llvmgnsyncbot Sep 30, 2024
1b7b3b8
[NFC] Move intrinsic related functions to Intrinsic namespace (#110125)
jurahul Sep 30, 2024
1e0d3c6
LV: reuse getSmallBestKnownTC in a TC estimation (NFC) (#105834)
artagnon Sep 30, 2024
7eea55f
LoopLoadElim: re-org tests after invalid #96656 (#97598)
artagnon Sep 30, 2024
f2ad39b
LV/test: improve a couple of tests, regen with UTC (#107225)
artagnon Sep 30, 2024
9177e81
X86: Fix asserting on bfloat argument/return without sse2 (#93146)
arsenm Sep 30, 2024
93af9d6
[clang][x86] Add constexpr support for LZCNT/TZCNT intrinsics (#110499)
RKSimon Sep 30, 2024
f9fbfc5
[SystemZ] Dump function signature on missing arg extension. (#109699)
JonPsson1 Sep 30, 2024
4ae0c50
[clang] Fix static analyzer concerns (#110243)
Fznamznon Sep 30, 2024
874dd36
Add address space modifier to barrier
FMarno Sep 10, 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 .github/workflows/release-binaries-all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ on:
- '.github/workflows/release-binaries.yml'
- '.github/workflows/release-binaries-setup-stage/*'
- '.github/workflows/release-binaries-save-stage/*'
- 'clang/cmake/caches/Release.cmake'

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || 'dispatch' }}
Expand Down
16 changes: 9 additions & 7 deletions clang-tools-extra/clang-tidy/misc/UnusedUsingDeclsCheck.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@ AST_MATCHER_P(DeducedTemplateSpecializationType, refsToTemplatedDecl,
return false;
}

AST_MATCHER_P(Type, asTagDecl, clang::ast_matchers::internal::Matcher<TagDecl>,
DeclMatcher) {
if (const TagDecl *ND = Node.getAsTagDecl())
return DeclMatcher.matches(*ND, Finder, Builder);
return false;
}

} // namespace

// A function that helps to tell whether a TargetDecl in a UsingDecl will be
Expand Down Expand Up @@ -61,7 +68,8 @@ void UnusedUsingDeclsCheck::registerMatchers(MatchFinder *Finder) {
Finder->addMatcher(userDefinedLiteral().bind("used"), this);
Finder->addMatcher(
loc(elaboratedType(unless(hasQualifier(nestedNameSpecifier())),
hasUnqualifiedDesugaredType(type().bind("usedType")))),
hasUnqualifiedDesugaredType(
type(asTagDecl(tagDecl().bind("used")))))),
this);
// Cases where we can identify the UsingShadowDecl directly, rather than
// just its target.
Expand Down Expand Up @@ -139,12 +147,6 @@ void UnusedUsingDeclsCheck::check(const MatchFinder::MatchResult &Result) {
return;
}

if (const auto *T = Result.Nodes.getNodeAs<Type>("usedType")) {
if (const auto *ND = T->getAsTagDecl())
RemoveNamedDecl(ND);
return;
}

if (const auto *UsedShadow =
Result.Nodes.getNodeAs<UsingShadowDecl>("usedShadow")) {
removeFromFoundDecls(UsedShadow->getTargetDecl());
Expand Down
5 changes: 4 additions & 1 deletion clang-tools-extra/clangd/CodeComplete.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1409,6 +1409,9 @@ bool semaCodeComplete(std::unique_ptr<CodeCompleteConsumer> Consumer,
Clang->getPreprocessorOpts().SingleFileParseMode = CompletingInPreamble;
Clang->setCodeCompletionConsumer(Consumer.release());

if (Input.Preamble.RequiredModules)
Input.Preamble.RequiredModules->adjustHeaderSearchOptions(Clang->getHeaderSearchOpts());

SyntaxOnlyAction Action;
if (!Action.BeginSourceFile(*Clang, Clang->getFrontendOpts().Inputs[0])) {
log("BeginSourceFile() failed when running codeComplete for {0}",
Expand Down Expand Up @@ -2122,7 +2125,7 @@ clang::CodeCompleteOptions CodeCompleteOptions::getClangCompleteOpts() const {
// When an is used, Sema is responsible for completing the main file,
// the index can provide results from the preamble.
// Tell Sema not to deserialize the preamble to look for results.
Result.LoadExternal = !Index;
Result.LoadExternal = ForceLoadPreamble || !Index;
Result.IncludeFixIts = IncludeFixIts;

return Result;
Expand Down
5 changes: 5 additions & 0 deletions clang-tools-extra/clangd/CodeComplete.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ struct CodeCompleteOptions {
/// For example, private members are usually inaccessible.
bool IncludeIneligibleResults = false;

/// Force sema to load decls from preamble even if an index is provided.
/// This is helpful for cases the index can't provide symbols, e.g. with
/// experimental c++20 modules
bool ForceLoadPreamble = false;

/// Combine overloads into a single completion item where possible.
/// If none, the implementation may choose an appropriate behavior.
/// (In practice, ClangdLSPServer enables bundling if the client claims
Expand Down
69 changes: 57 additions & 12 deletions clang-tools-extra/clangd/index/SymbolCollector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/Path.h"
Expand Down Expand Up @@ -75,18 +76,62 @@ bool isPrivateProtoDecl(const NamedDecl &ND) {
if (ND.getIdentifier() == nullptr)
return false;
auto Name = ND.getIdentifier()->getName();
if (!Name.contains('_'))
return false;
// Nested proto entities (e.g. Message::Nested) have top-level decls
// that shouldn't be used (Message_Nested). Ignore them completely.
// The nested entities are dangling type aliases, we may want to reconsider
// including them in the future.
// For enum constants, SOME_ENUM_CONSTANT is not private and should be
// indexed. Outer_INNER is private. This heuristic relies on naming style, it
// will include OUTER_INNER and exclude some_enum_constant.
// FIXME: the heuristic relies on naming style (i.e. no underscore in
// user-defined names) and can be improved.
return (ND.getKind() != Decl::EnumConstant) || llvm::any_of(Name, islower);
// There are some internal helpers like _internal_set_foo();
if (Name.contains("_internal_"))
return true;

// https://protobuf.dev/reference/cpp/cpp-generated/#nested-types
// Nested entities (messages/enums) has two names, one at the top-level scope,
// with a mangled name created by prepending all the outer types. These names
// are almost never preferred by the developers, so exclude them from index.
// e.g.
// message Foo {
// message Bar {}
// enum E { A }
// }
//
// yields:
// class Foo_Bar {};
// enum Foo_E { Foo_E_A };
// class Foo {
// using Bar = Foo_Bar;
// static constexpr Foo_E A = Foo_E_A;
// };

// We get rid of Foo_Bar and Foo_E by discarding any top-level entries with
// `_` in the name. This relies on original message/enum not having `_` in the
// name. Hence might go wrong in certain cases.
if (ND.getDeclContext()->isNamespace()) {
// Strip off some known public suffix helpers for enums, rest of the helpers
// are generated inside record decls so we don't care.
// https://protobuf.dev/reference/cpp/cpp-generated/#enum
Name.consume_back("_descriptor");
Name.consume_back("_IsValid");
Name.consume_back("_Name");
Name.consume_back("_Parse");
Name.consume_back("_MIN");
Name.consume_back("_MAX");
Name.consume_back("_ARRAYSIZE");
return Name.contains('_');
}

// EnumConstantDecls need some special attention, despite being nested in a
// TagDecl, they might still have mangled names. We filter those by checking
// if it has parent's name as a prefix.
// This might go wrong if a nested entity has a name that starts with parent's
// name, e.g: enum Foo { Foo_X }.
if (llvm::isa<EnumConstantDecl>(&ND)) {
auto *DC = llvm::cast<EnumDecl>(ND.getDeclContext());
if (!DC || !DC->getIdentifier())
return false;
auto CtxName = DC->getIdentifier()->getName();
return !CtxName.empty() && Name.consume_front(CtxName) &&
Name.consume_front("_");
}

// Now we're only left with fields/methods without an `_internal_` in the
// name, they're intended for public use.
return false;
}

// We only collect #include paths for symbols that are suitable for global code
Expand Down
3 changes: 3 additions & 0 deletions clang-tools-extra/clangd/tool/ClangdMain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -919,6 +919,9 @@ clangd accepts flags on the commandline, and in the CLANGD_FLAGS environment var
Opts.CodeComplete.EnableFunctionArgSnippets = EnableFunctionArgSnippets;
Opts.CodeComplete.RunParser = CodeCompletionParse;
Opts.CodeComplete.RankingModel = RankingModel;
// FIXME: If we're using C++20 modules, force the lookup process to load
// external decls, since currently the index doesn't support C++20 modules.
Opts.CodeComplete.ForceLoadPreamble = ExperimentalModulesSupport;

RealThreadsafeFS TFS;
std::vector<std::unique_ptr<config::Provider>> ProviderStack;
Expand Down
80 changes: 80 additions & 0 deletions clang-tools-extra/clangd/unittests/PrerequisiteModulesTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,86 @@ import A;
EXPECT_TRUE(D.isFromASTFile());
}

// An end to end test for code complete in modules
TEST_F(PrerequisiteModulesTests, CodeCompleteTest) {
MockDirectoryCompilationDatabase CDB(TestDir, FS);

CDB.addFile("A.cppm", R"cpp(
export module A;
export void printA();
)cpp");

llvm::StringLiteral UserContents = R"cpp(
import A;
void func() {
print^
}
)cpp";

CDB.addFile("Use.cpp", UserContents);
Annotations Test(UserContents);

ModulesBuilder Builder(CDB);

ParseInputs Use = getInputs("Use.cpp", CDB);
Use.ModulesManager = &Builder;

std::unique_ptr<CompilerInvocation> CI =
buildCompilerInvocation(Use, DiagConsumer);
EXPECT_TRUE(CI);

auto Preamble =
buildPreamble(getFullPath("Use.cpp"), *CI, Use, /*InMemory=*/true,
/*Callback=*/nullptr);
EXPECT_TRUE(Preamble);
EXPECT_TRUE(Preamble->RequiredModules);

auto Result = codeComplete(getFullPath("Use.cpp"), Test.point(),
Preamble.get(), Use, {});
EXPECT_FALSE(Result.Completions.empty());
EXPECT_EQ(Result.Completions[0].Name, "printA");
}

TEST_F(PrerequisiteModulesTests, SignatureHelpTest) {
MockDirectoryCompilationDatabase CDB(TestDir, FS);

CDB.addFile("A.cppm", R"cpp(
export module A;
export void printA(int a);
)cpp");

llvm::StringLiteral UserContents = R"cpp(
import A;
void func() {
printA(^);
}
)cpp";

CDB.addFile("Use.cpp", UserContents);
Annotations Test(UserContents);

ModulesBuilder Builder(CDB);

ParseInputs Use = getInputs("Use.cpp", CDB);
Use.ModulesManager = &Builder;

std::unique_ptr<CompilerInvocation> CI =
buildCompilerInvocation(Use, DiagConsumer);
EXPECT_TRUE(CI);

auto Preamble =
buildPreamble(getFullPath("Use.cpp"), *CI, Use, /*InMemory=*/true,
/*Callback=*/nullptr);
EXPECT_TRUE(Preamble);
EXPECT_TRUE(Preamble->RequiredModules);

auto Result = signatureHelp(getFullPath("Use.cpp"), Test.point(),
*Preamble.get(), Use, MarkupKind::PlainText);
EXPECT_FALSE(Result.signatures.empty());
EXPECT_EQ(Result.signatures[0].label, "printA(int a) -> void");
EXPECT_EQ(Result.signatures[0].parameters[0].labelString, "int a");
}

} // namespace
} // namespace clang::clangd

Expand Down
64 changes: 54 additions & 10 deletions clang-tools-extra/clangd/unittests/SymbolCollectorTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -201,19 +201,63 @@ TEST_F(ShouldCollectSymbolTest, NoPrivateProtoSymbol) {
build(
R"(// Generated by the protocol buffer compiler. DO NOT EDIT!
namespace nx {
class Top_Level {};
class TopLevel {};
enum Kind {
KIND_OK,
Kind_Not_Ok,
enum Outer_Enum : int {
Outer_Enum_KIND1,
Outer_Enum_Kind_2,
};
bool Outer_Enum_IsValid(int);

class Outer_Inner {};
class Outer {
using Inner = Outer_Inner;
using Enum = Outer_Enum;
static constexpr Enum KIND1 = Outer_Enum_KIND1;
static constexpr Enum Kind_2 = Outer_Enum_Kind_2;
static bool Enum_IsValid(int);
int &x();
void set_x();
void _internal_set_x();

int &Outer_y();
};
enum Foo {
FOO_VAL1,
Foo_VAL2,
};
bool Foo_IsValid(int);
})");
EXPECT_TRUE(shouldCollect("nx::TopLevel"));
EXPECT_TRUE(shouldCollect("nx::Kind::KIND_OK"));
EXPECT_TRUE(shouldCollect("nx::Kind"));

EXPECT_FALSE(shouldCollect("nx::Top_Level"));
EXPECT_FALSE(shouldCollect("nx::Kind::Kind_Not_Ok"));
// Make sure all the mangled names for Outer::Enum is discarded.
EXPECT_FALSE(shouldCollect("nx::Outer_Enum"));
EXPECT_FALSE(shouldCollect("nx::Outer_Enum_KIND1"));
EXPECT_FALSE(shouldCollect("nx::Outer_Enum_Kind_2"));
EXPECT_FALSE(shouldCollect("nx::Outer_Enum_IsValid"));
// But nested aliases are preserved.
EXPECT_TRUE(shouldCollect("nx::Outer::Enum"));
EXPECT_TRUE(shouldCollect("nx::Outer::KIND1"));
EXPECT_TRUE(shouldCollect("nx::Outer::Kind_2"));
EXPECT_TRUE(shouldCollect("nx::Outer::Enum_IsValid"));

// Check for Outer::Inner.
EXPECT_FALSE(shouldCollect("nx::Outer_Inner"));
EXPECT_TRUE(shouldCollect("nx::Outer"));
EXPECT_TRUE(shouldCollect("nx::Outer::Inner"));

// Make sure field related information is preserved, unless it's explicitly
// marked with `_internal_`.
EXPECT_TRUE(shouldCollect("nx::Outer::x"));
EXPECT_TRUE(shouldCollect("nx::Outer::set_x"));
EXPECT_FALSE(shouldCollect("nx::Outer::_internal_set_x"));
EXPECT_TRUE(shouldCollect("nx::Outer::Outer_y"));

// Handling of a top-level enum
EXPECT_TRUE(shouldCollect("nx::Foo::FOO_VAL1"));
EXPECT_TRUE(shouldCollect("nx::FOO_VAL1"));
EXPECT_TRUE(shouldCollect("nx::Foo_IsValid"));
// Our heuristic goes wrong here, if the user has a nested name that starts
// with parent's name.
EXPECT_FALSE(shouldCollect("nx::Foo::Foo_VAL2"));
EXPECT_FALSE(shouldCollect("nx::Foo_VAL2"));
}

TEST_F(ShouldCollectSymbolTest, DoubleCheckProtoHeaderComment) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h"
#include <string>
#include <utility>

namespace clang {
class SourceLocation;
Expand Down Expand Up @@ -62,7 +63,8 @@ void walkUsed(llvm::ArrayRef<Decl *> ASTRoots,

struct AnalysisResults {
std::vector<const Include *> Unused;
std::vector<std::string> Missing; // Spellings, like "<vector>"
// Spellings, like "<vector>" paired with the Header that generated it.
std::vector<std::pair<std::string, Header>> Missing;
};

/// Determine which headers should be inserted or removed from the main file.
Expand Down
16 changes: 8 additions & 8 deletions clang-tools-extra/include-cleaner/lib/Analysis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/STLFunctionalExtras.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/StringSet.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/ErrorHandling.h"
#include <cassert>
Expand Down Expand Up @@ -84,7 +84,7 @@ analyze(llvm::ArrayRef<Decl *> ASTRoots,
auto &SM = PP.getSourceManager();
const auto MainFile = *SM.getFileEntryRefForID(SM.getMainFileID());
llvm::DenseSet<const Include *> Used;
llvm::StringSet<> Missing;
llvm::StringMap<Header> Missing;
if (!HeaderFilter)
HeaderFilter = [](llvm::StringRef) { return false; };
OptionalDirectoryEntryRef ResourceDir =
Expand Down Expand Up @@ -119,7 +119,7 @@ analyze(llvm::ArrayRef<Decl *> ASTRoots,
Satisfied = true;
}
if (!Satisfied)
Missing.insert(std::move(Spelling));
Missing.try_emplace(std::move(Spelling), Providers.front());
});

AnalysisResults Results;
Expand All @@ -144,8 +144,8 @@ analyze(llvm::ArrayRef<Decl *> ASTRoots,
}
Results.Unused.push_back(&I);
}
for (llvm::StringRef S : Missing.keys())
Results.Missing.push_back(S.str());
for (auto &E : Missing)
Results.Missing.emplace_back(E.first().str(), E.second);
llvm::sort(Results.Missing);
return Results;
}
Expand All @@ -158,9 +158,9 @@ std::string fixIncludes(const AnalysisResults &Results,
// Encode insertions/deletions in the magic way clang-format understands.
for (const Include *I : Results.Unused)
cantFail(R.add(tooling::Replacement(FileName, UINT_MAX, 1, I->quote())));
for (llvm::StringRef Spelled : Results.Missing)
cantFail(R.add(tooling::Replacement(FileName, UINT_MAX, 0,
("#include " + Spelled).str())));
for (auto &[Spelled, _] : Results.Missing)
cantFail(R.add(
tooling::Replacement(FileName, UINT_MAX, 0, "#include " + Spelled)));
// "cleanup" actually turns the UINT_MAX replacements into concrete edits.
auto Positioned = cantFail(format::cleanupAroundReplacements(Code, R, Style));
return cantFail(tooling::applyAllReplacements(Code, Positioned));
Expand Down
Loading