Skip to content

[AutoBump] Merge with ff99af7e (Feb 20) (62) #606

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
wants to merge 123 commits into
base: bump_to_d57479cf
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
123 commits
Select commit Hold shift + click to select a range
1841bcd
[clangd] Update XRefs to support overridden ObjC methods (#127109)
DavidGoldman Feb 19, 2025
8337d01
[MLIR] Fix doc build (NFC)
joker-eph Feb 19, 2025
36eaf0d
AMDGPU: Don't canonicalize fminnum/fmaxnum if targets support IEEE fm…
changpeng Feb 19, 2025
85e23fe
[Modules] Add `clang/Lex/HLSLRootSignatureTokenKinds.def` to clang's …
qiongsiwu Feb 19, 2025
1c762c2
[HLSL] Implement the 'and' HLSL function (#127098)
Icohedron Feb 19, 2025
5caefe2
[MLIR][LLVMIR] Add support for asin acos atan intrinsics op (#127317)
FantasqueX Feb 19, 2025
c3ebbfd
[RISCV] Add a pass to remove ADDI by reassociating to fold into load/…
topperc Feb 19, 2025
b1f882f
[OpenMP][NFC] Remove unused clock function types and globals (#127684)
jpeyton52 Feb 19, 2025
851177c
[OpenMP][NFC] Remove unused __kmp_dispatch_lock global (#127686)
jpeyton52 Feb 19, 2025
dca7306
[clang][perf-training] Support excluding LLVM build from PGO training…
petrhosek Feb 19, 2025
4a411eb
[MLIR] Fix rewrite of ops with vector operands to LLVM on GPU (#127844)
bjacob Feb 19, 2025
1987f93
[SandboxIR] OpaqueValue (#127699)
vporpo Feb 19, 2025
37d0f20
Revert "[RISCV] Add a pass to remove ADDI by reassociating to fold in…
topperc Feb 19, 2025
c9ff839
[mlir][Linalg] Fix linalg.generic iteration domain collapse for dynam…
Groverkss Feb 19, 2025
26e3750
Recommit "[RISCV] Add a pass to remove ADDI by reassociating to fold …
topperc Feb 19, 2025
84eacd3
[gn build] Port 26e375046dbd
llvmgnsyncbot Feb 19, 2025
c833746
[DSE] Make iter order deterministic in removePartiallyOverlappedStore…
bjope Feb 19, 2025
1761066
[GlobalOpt] Remove Function* argument from tryWidenGlobalArrayAndDest…
topperc Feb 19, 2025
1a6ed4d
[mlir][Vector] Deprecate vector.extractelement/vector.insertelement (…
Groverkss Feb 19, 2025
92b0752
[MemProf] Support cloning through recursive cycles (#127429)
teresajohnson Feb 19, 2025
3836559
[InstCombine] Test for regession with trunc in foldSelectICmpAnd
andjo403 Feb 19, 2025
c0c42c8
[SandboxIR][NFC] Change order of ifs in Context::getOrCreateValueInte…
vporpo Feb 19, 2025
5f8b256
Check the type of Objective-C++ instance variables in WebKit member v…
rniwa Feb 19, 2025
8363b0a
[clang-tidy] add AllowedTypes option to misc-const-correctness (#122951)
vbvictor Feb 19, 2025
0fe0968
[AArch64][FEAT_CMPBR] Codegen for Armv9.6-a compare-and-branch (#116465)
dtellenbach Feb 19, 2025
ef49760
[libc][POSIX][unistd] implement getsid (#127341)
ZakyHermawan Feb 19, 2025
6342095
[memprof] Fix a warning
kazutakahirata Feb 19, 2025
0127f16
[CUDA] Add support for sm101 and sm120 target architectures (#127187)
jodelek Feb 19, 2025
6cc7ca0
[Clang] Fix cross-lane scan when given divergent lanes (#127703)
jhuber6 Feb 19, 2025
5622f22
Add back deleted test for llvm-dwarfdump JSON output (#127685)
youngd007 Feb 19, 2025
b0e24d1
[RISCV] Use opaque pointers in some tests. NFC (#127906)
topperc Feb 19, 2025
f62f13d
[lldb] Store the return SBValueList in the CommandReturnObject (#127566)
JDevlieghere Feb 19, 2025
9107ad4
Apply clang-format to bitset_test_cases.h to make PR#120807 cleaner
winner245 Feb 19, 2025
86f0e6d
[libc] Add --json mode for hdrgen (#127847)
frobtech Feb 20, 2025
131a3cf
[CIR] updates test for 75ea7aed (#127917)
cjdb Feb 20, 2025
19bad2a
[BOLT][NFC] Fix an incorrect address used in a BOLT-INFO message (#12…
yozhu Feb 20, 2025
75bd46e
[globals-aa] Improved isNonEscapingGlobalNoAlias. (#127707)
vzakhari Feb 20, 2025
007f601
[Clang][Docs] Document -Xarch_ better (#127890)
jhuber6 Feb 20, 2025
5d4998b
UpdateTestChecks: Don't check meta details in func definition w/--glo…
jsji Feb 20, 2025
f5b311e
[CMake][Release] Statically link clang with stage1 runtimes (#127268)
tstellar Feb 20, 2025
ab7664c
[mlir][integer-range-analysis] expose helpers in header and fix Const…
makslevental Feb 20, 2025
bf9b72e
[NFC][Clang] Precommit test for VTable codegen (#124983)
gandhi56 Feb 20, 2025
a16fa3a
Reland "[libclang] Always Dup in createRef(StringRef)" (#127078)
vitalybuka Feb 20, 2025
f178e51
[SDAG] Add missing ppc_fp128 ExpandFloatRes legalization for modf (#1…
MacDue Feb 20, 2025
3e5ae57
workflows/release-binaries: Disable Flang on x86_64 macOS (#127216)
tstellar Feb 20, 2025
37c341d
Revert "AMDGPU: Don't canonicalize fminnum/fmaxnum if targets support…
arsenm Feb 20, 2025
1fd280d
[MLIR][Affine] Add missing check in affine data copy nest generation …
bondhugula Feb 20, 2025
f8bdbed
[CIR] Upstream simple function bodies (#127674)
dkolsen-pgi Feb 20, 2025
c58011d
[RISCV][VLOPT] Peek through copies in checkUsers (#127656)
lukel97 Feb 20, 2025
557628d
[CodeGen][NewPM] Port RegAllocPriorityAdvisor analysis to NPM (#118462)
optimisan Feb 20, 2025
58279d1
[lldb] Synchronize the debuggers output & error streams
JDevlieghere Feb 20, 2025
df96b56
[RISCV] Move VMV0 elimination past machine SSA opts (#126850)
lukel97 Feb 20, 2025
95000fd
[CUDA] Increment VTable index for device thunks (#124989)
gandhi56 Feb 20, 2025
62e4436
[NVPTX] Use appropriate operands in ReplaceImageHandles (NFC) (#127898)
AlexMaclean Feb 20, 2025
57bac14
[lldb] Fix header include order in ScriptInterpreterPython.cpp
JDevlieghere Feb 20, 2025
92ddbbd
[CodeGen] Remove static member functions Register::stackSlot2Index/is…
topperc Feb 20, 2025
77a8338
[ARC] Update code after removal of Register::isStackSlot. NFC
topperc Feb 20, 2025
8b58cb8
[SelectionDAG][NFC] Refactor duplicate code into SDNode::bitcastToAPI…
pfusik Feb 20, 2025
a6eb7d6
[ARC] Remove unneeded isStackSlot
MaskRay Feb 20, 2025
2130b9c
[Coroutines] Avoid repeated hash lookups (NFC) (#127956)
kazutakahirata Feb 20, 2025
77183a4
[CodeGen] Remove static member function Register::virtReg2Index. NFC …
topperc Feb 20, 2025
7d03c8e
[mlir][Parser] Fix use-after-free when parsing invalid reference to n…
matthias-springer Feb 20, 2025
2d6330f
[LangRef] Fix indent for deref assume bundle note added in 65640c1d4c.
fhahn Feb 20, 2025
507e413
[libunwind][NFC] Remove the CET keyword in shadow stack-related stuff…
mylai-mtk Feb 20, 2025
44dc572
[gn build] Port 507e413a2d85
llvmgnsyncbot Feb 20, 2025
611a648
[AMDGPU] Add llvm.amdgcn.dead intrinsic (#123190)
rovka Feb 20, 2025
3df03db
[CodeGen] Refactor `warn()` to use StringRef (NFCI) (#127537)
vortex73 Feb 20, 2025
079115e
[libclc] Move modf to the CLC library (#127828)
frasercrmck Feb 20, 2025
684ad25
[libclc] Move frexp to CLC library; optimize half vecs (#127836)
frasercrmck Feb 20, 2025
0cd5a1f
[NFC][clang] Cleanup in APValue and SemaInit (#127790)
Fznamznon Feb 20, 2025
62d77fc
[X86] combineX86ShuffleChain - don't combine to VPERM2W/VPERM2B from …
RKSimon Feb 20, 2025
2c022e3
[lldb] Replace LineTable::upper_bound with GetLineEntryIndexRange (#1…
labath Feb 20, 2025
e264317
[lldb] Fix RangeDataVector::CombineConsecutiveEntriesWithEqualData (#…
labath Feb 20, 2025
55fa2fa
[SPIR-V] Add SPV_INTEL_bindless_images extension (#127737)
MrSidims Feb 20, 2025
44feae8
[RISCV][VLOPT] Mark some methods + arguments as const. NFC
lukel97 Feb 20, 2025
a60675d
[CodeGen][NFC] Move test builtin_signbit.cpp to CodeGen (#127814)
NagyDonat Feb 20, 2025
6e047a5
Add Wasm, RISC-V, BPF, and NVPTX targets back to Windows release pack…
zmodem Feb 20, 2025
e09fc39
[llvm] Make target triple in TLII const reference (#127718)
davidgmbb Feb 20, 2025
dc326d0
[Clang][doc] -ffp-contract options and standard compliance (#127621)
sjoerdmeijer Feb 20, 2025
d595fc9
Revert "[clang] Lower modf builtin using `llvm.modf` intrinsic" (#127…
MacDue Feb 20, 2025
747588d
[flang][Lower][OpenMP] Don't read moldarg for static sized array (#…
tblah Feb 20, 2025
9787240
[RISCV][test] Add tests for extending negated mask
pfusik Feb 17, 2025
544a161
[NFC][SPIR-V] Remove unused variable (#127985)
MrSidims Feb 20, 2025
367ecc6
[lldb] Renaissance LineTable sequences (#127800)
labath Feb 20, 2025
d7784a6
[flang][OpenMP] Catch threadprivate common block vars that appear in …
luporl Feb 20, 2025
0948fc8
[clang] print correct context for diagnostics suppressed by deduction…
mizvekov Feb 20, 2025
66cf2a8
[X86] sext-vsetcc.ll - regenerate VPTERNLOG comments
RKSimon Feb 20, 2025
92a3192
[X86] vector-shuffle-v192.ll - regenerate VPTERNLOG comments
RKSimon Feb 20, 2025
505d35a
[X86] getFauxShuffleMask - relax one use limit for insert_subvector c…
RKSimon Feb 20, 2025
9855d76
[AMDGPU][NewPM] Port SIOptimizeExecMaskingPreRA to NPM (#125351)
optimisan Feb 20, 2025
458b1e9
[TBAA] Refine pointer-tbaa for void pointers by pointer depth (#126047)
brunodf-snps Feb 20, 2025
54f14d9
[FunctionAttrs] Add test for incorrect predicate in capture analysis …
nikic Feb 20, 2025
6361a8a
[CaptureTracking] Check for equality predicate for null comparisons
nikic Feb 20, 2025
f4f7c71
[RISCV][VLOPT] Move mayReadPastVL check into getMinimumVLForUser. NFC…
lukel97 Feb 20, 2025
70ed381
[GlobalISel][AArch64] Fix fptoi.sat lowering. (#127901)
davemgreen Feb 20, 2025
58571c8
[lldb] Un-XFAIL TestDeadStrip.py on windows
labath Feb 20, 2025
0a8341f
[RISCV] Avoid VMNOT by swapping VMERGE operands for mask extensions (…
pfusik Feb 20, 2025
0c809ea
[Mips] Reserve hardware register HWR2 (#127775)
yingopq Feb 20, 2025
12f8ed5
[Clang] Mark P1061 (Structured Bindings can introduce a Pack) as impl…
cor3ntin Feb 20, 2025
8feb5ba
[libc++] Add benchmarks for copy algorithms (#127328)
ldionne Feb 20, 2025
f00b32e
[libc++] Reduce the dependency of the locale base API on the base sys…
ldionne Feb 20, 2025
a03f064
[X86] combineX86ShufflesRecursively - peek through one use bitcasts t…
RKSimon Feb 20, 2025
41cece8
[flang] Add -f[no-]vectorize flags (#119718)
DavidTruby Feb 20, 2025
1c4e986
[OpenMP][NFC] Remove unused debug lock (#127928)
jpeyton52 Feb 20, 2025
24cd933
[MemCpyOpt] Add test for call slot opt with ret-only capture (NFC)
nikic Feb 20, 2025
9ffab56
[SPIR-V] Initial implementation of SPV_INTEL_long_composites (#126545)
vmaksimo Feb 20, 2025
6eba277
[LAA] Scale strides using type-size (NFC) (#124529)
artagnon Feb 20, 2025
ae57854
[libclc] Define macros for users of gentype.inc (#128012)
frasercrmck Feb 20, 2025
3b9f964
[LV] Regen a couple of tests with UTC (#127785)
artagnon Feb 20, 2025
04b5c63
[LV] Add inbounds to interleave test.
fhahn Feb 20, 2025
43f2968
[RISCV] Recognize VLA shift pairs from shuffle masks (#127710)
preames Feb 20, 2025
1b78ff6
[InstCombine] Simplify the pointer operand of store if writing to nul…
dtcxzyw Feb 20, 2025
1b610e6
[MLIR][Math] Add floating point value folders (#127947)
wsmoses Feb 20, 2025
c2e5142
[MLIR][LLVM] Fold extract of constant (#127927)
wsmoses Feb 20, 2025
404af37
[VPlan] Remove stale assertion in HCFG builder.
fhahn Feb 20, 2025
60c6202
[ADT] Add set_intersects to check if there is any intersection (#127907)
teresajohnson Feb 20, 2025
a72616d
[mlir][python] fix linalg.pack/unpack (#127729)
makslevental Feb 20, 2025
81ed485
[CMake] Fix variable name (#127967)
petrhosek Feb 20, 2025
c48e0c1
[lldb][RISC-V] Extended if conditions to support alias names for regi…
kper Feb 20, 2025
81bc28d
[lldb] Update PlatformDarwin list of libraries with thread functions …
felipepiovezan Feb 20, 2025
609732c
[RISCV] Fix warnings
kazutakahirata Feb 20, 2025
ff99af7
[CodeGen] Remove static member function Register::isVirtualRegister. …
topperc Feb 20, 2025
526b929
[AutoBump] Merge with ff99af7e (Feb 20)
jorickert Jun 18, 2025
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
  •  
  •  
  •  
5 changes: 5 additions & 0 deletions .github/workflows/release-binaries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,11 @@ jobs:
arches=arm64
else
arches=x86_64
# Disable Flang builds on macOS x86_64. The FortranLower library takes
# 2-3 hours to build on macOS, much slower than on Linux.
# The long build time causes the release build to time out on x86_64,
# so we need to disable flang there.
target_cmake_flags="$target_cmake_flags -DLLVM_RELEASE_ENABLE_PROJECTS='clang;lld;lldb;clang-tools-extra;bolt;polly;mlir'"
fi
target_cmake_flags="$target_cmake_flags -DBOOTSTRAP_BOOTSTRAP_DARWIN_osx_ARCHS=$arches -DBOOTSTRAP_BOOTSTRAP_DARWIN_osx_BUILTIN_ARCHS=$arches"
fi
Expand Down
2 changes: 1 addition & 1 deletion bolt/lib/RuntimeLibs/InstrumentationRuntimeLibrary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ void InstrumentationRuntimeLibrary::link(
}
outs() << "BOLT-INFO: output linked against instrumentation runtime "
"library, lib entry point is 0x"
<< Twine::utohexstr(RuntimeFiniAddress) << "\n";
<< Twine::utohexstr(RuntimeStartAddress) << "\n";
outs() << "BOLT-INFO: clear procedure is 0x"
<< Twine::utohexstr(
Linker.lookupSymbol("__bolt_instr_clear_counters").value_or(0))
Expand Down
17 changes: 15 additions & 2 deletions clang-tools-extra/clang-tidy/misc/ConstCorrectnessCheck.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

#include "ConstCorrectnessCheck.h"
#include "../utils/FixItHintUtils.h"
#include "../utils/Matchers.h"
#include "../utils/OptionsUtils.h"
#include "clang/AST/ASTContext.h"
#include "clang/ASTMatchers/ASTMatchFinder.h"
#include "clang/ASTMatchers/ASTMatchers.h"
Expand Down Expand Up @@ -41,7 +43,9 @@ ConstCorrectnessCheck::ConstCorrectnessCheck(StringRef Name,
TransformValues(Options.get("TransformValues", true)),
TransformReferences(Options.get("TransformReferences", true)),
TransformPointersAsValues(
Options.get("TransformPointersAsValues", false)) {
Options.get("TransformPointersAsValues", false)),
AllowedTypes(
utils::options::parseStringList(Options.get("AllowedTypes", ""))) {
if (AnalyzeValues == false && AnalyzeReferences == false)
this->configurationDiag(
"The check 'misc-const-correctness' will not "
Expand All @@ -57,6 +61,8 @@ void ConstCorrectnessCheck::storeOptions(ClangTidyOptions::OptionMap &Opts) {
Options.store(Opts, "TransformValues", TransformValues);
Options.store(Opts, "TransformReferences", TransformReferences);
Options.store(Opts, "TransformPointersAsValues", TransformPointersAsValues);
Options.store(Opts, "AllowedTypes",
utils::options::serializeStringList(AllowedTypes));
}

void ConstCorrectnessCheck::registerMatchers(MatchFinder *Finder) {
Expand All @@ -73,6 +79,12 @@ void ConstCorrectnessCheck::registerMatchers(MatchFinder *Finder) {
hasType(referenceType(pointee(hasCanonicalType(templateTypeParmType())))),
hasType(referenceType(pointee(substTemplateTypeParmType()))));

const auto AllowedType = hasType(qualType(anyOf(
hasDeclaration(namedDecl(matchers::matchesAnyListedName(AllowedTypes))),
references(namedDecl(matchers::matchesAnyListedName(AllowedTypes))),
pointerType(pointee(hasDeclaration(
namedDecl(matchers::matchesAnyListedName(AllowedTypes))))))));

const auto AutoTemplateType = varDecl(
anyOf(hasType(autoType()), hasType(referenceType(pointee(autoType()))),
hasType(pointerType(pointee(autoType())))));
Expand All @@ -87,7 +99,8 @@ void ConstCorrectnessCheck::registerMatchers(MatchFinder *Finder) {
unless(anyOf(ConstType, ConstReference, TemplateType,
hasInitializer(isInstantiationDependent()), AutoTemplateType,
RValueReference, FunctionPointerRef,
hasType(cxxRecordDecl(isLambda())), isImplicit())));
hasType(cxxRecordDecl(isLambda())), isImplicit(),
AllowedType)));

// Match the function scope for which the analysis of all local variables
// shall be run.
Expand Down
1 change: 1 addition & 0 deletions clang-tools-extra/clang-tidy/misc/ConstCorrectnessCheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ class ConstCorrectnessCheck : public ClangTidyCheck {
const bool TransformValues;
const bool TransformReferences;
const bool TransformPointersAsValues;
const std::vector<StringRef> AllowedTypes;
};

} // namespace clang::tidy::misc
Expand Down
56 changes: 56 additions & 0 deletions clang-tools-extra/clangd/XRefs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,15 @@ void enhanceLocatedSymbolsFromIndex(llvm::MutableArrayRef<LocatedSymbol> Result,
});
}

bool objcMethodIsTouched(const SourceManager &SM, const ObjCMethodDecl *OMD,
SourceLocation Loc) {
unsigned NumSels = OMD->getNumSelectorLocs();
for (unsigned I = 0; I < NumSels; ++I)
if (SM.getSpellingLoc(OMD->getSelectorLoc(I)) == Loc)
return true;
return false;
}

// Decls are more complicated.
// The AST contains at least a declaration, maybe a definition.
// These are up-to-date, and so generally preferred over index results.
Expand Down Expand Up @@ -430,6 +439,26 @@ locateASTReferent(SourceLocation CurLoc, const syntax::Token *TouchedIdentifier,
continue;
}
}
// Special case: - (void)^method {} should jump to overrides, but the decl
// shouldn't, only the definition. Note that an Objective-C method can
// override a parent class or protocol.
//
// FIXME: Support jumping from a protocol decl to overrides on go-to
// definition.
if (const auto *OMD = llvm::dyn_cast<ObjCMethodDecl>(D)) {
if (OMD->isThisDeclarationADefinition() && TouchedIdentifier &&
objcMethodIsTouched(SM, OMD, TouchedIdentifier->location())) {
llvm::SmallVector<const ObjCMethodDecl *, 4> Overrides;
OMD->getOverriddenMethods(Overrides);
if (!Overrides.empty()) {
for (const auto *Override : Overrides)
AddResultDecl(Override);
LocateASTReferentMetric.record(1, "objc-overriden-method");
}
AddResultDecl(OMD);
continue;
}
}

// Special case: the cursor is on an alias, prefer other results.
// This targets "using ns::^Foo", where the target is more interesting.
Expand Down Expand Up @@ -1283,6 +1312,12 @@ std::vector<LocatedSymbol> findImplementations(ParsedAST &AST, Position Pos,
} else if (const auto *RD = dyn_cast<CXXRecordDecl>(ND)) {
IDs.insert(getSymbolID(RD));
QueryKind = RelationKind::BaseOf;
} else if (const auto *OMD = dyn_cast<ObjCMethodDecl>(ND)) {
IDs.insert(getSymbolID(OMD));
QueryKind = RelationKind::OverriddenBy;
} else if (const auto *ID = dyn_cast<ObjCInterfaceDecl>(ND)) {
IDs.insert(getSymbolID(ID));
QueryKind = RelationKind::BaseOf;
}
}
return findImplementors(std::move(IDs), QueryKind, Index, AST.tuPath());
Expand All @@ -1302,6 +1337,21 @@ void getOverriddenMethods(const CXXMethodDecl *CMD,
}
}

// Recursively finds all the overridden methods of `OMD` in complete type
// hierarchy.
void getOverriddenMethods(const ObjCMethodDecl *OMD,
llvm::DenseSet<SymbolID> &OverriddenMethods) {
if (!OMD)
return;
llvm::SmallVector<const ObjCMethodDecl *, 4> Overrides;
OMD->getOverriddenMethods(Overrides);
for (const ObjCMethodDecl *Base : Overrides) {
if (auto ID = getSymbolID(Base))
OverriddenMethods.insert(ID);
getOverriddenMethods(Base, OverriddenMethods);
}
}

std::optional<std::string>
stringifyContainerForMainFileRef(const Decl *Container) {
// FIXME We might also want to display the signature here
Expand Down Expand Up @@ -1438,6 +1488,12 @@ ReferencesResult findReferences(ParsedAST &AST, Position Pos, uint32_t Limit,
getOverriddenMethods(CMD, OverriddenMethods);
}
}
// Special case: Objective-C methods can override a parent class or
// protocol, we should be sure to report references to those.
if (const auto *OMD = llvm::dyn_cast<ObjCMethodDecl>(ND)) {
OverriddenBy.Subjects.insert(getSymbolID(OMD));
getOverriddenMethods(OMD, OverriddenMethods);
}
}
}

Expand Down
36 changes: 36 additions & 0 deletions clang-tools-extra/clangd/unittests/SymbolCollectorTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1335,6 +1335,42 @@ TEST_F(SymbolCollectorTest, OverrideRelationsMultipleInheritance) {
OverriddenBy(CBar, DBar), OverriddenBy(CBaz, DBaz)));
}

TEST_F(SymbolCollectorTest, ObjCOverrideRelationsSimpleInheritance) {
std::string Header = R"cpp(
@interface A
- (void)foo;
@end
@interface B : A
- (void)foo; // A::foo
- (void)bar;
@end
@interface C : B
- (void)bar; // B::bar
@end
@interface D : C
- (void)foo; // B::foo
- (void)bar; // C::bar
@end
)cpp";
runSymbolCollector(Header, /*Main=*/"",
{"-xobjective-c++", "-Wno-objc-root-class"});
const Symbol &AFoo = findSymbol(Symbols, "A::foo");
const Symbol &BFoo = findSymbol(Symbols, "B::foo");
const Symbol &DFoo = findSymbol(Symbols, "D::foo");

const Symbol &BBar = findSymbol(Symbols, "B::bar");
const Symbol &CBar = findSymbol(Symbols, "C::bar");
const Symbol &DBar = findSymbol(Symbols, "D::bar");

std::vector<Relation> Result;
for (const Relation &R : Relations)
if (R.Predicate == RelationKind::OverriddenBy)
Result.push_back(R);
EXPECT_THAT(Result, UnorderedElementsAre(
OverriddenBy(AFoo, BFoo), OverriddenBy(BBar, CBar),
OverriddenBy(BFoo, DFoo), OverriddenBy(CBar, DBar)));
}

TEST_F(SymbolCollectorTest, CountReferences) {
const std::string Header = R"(
class W;
Expand Down
Loading