Skip to content

Commit 4ed543d

Browse files
authored
[InstallAPI] Fix early return for scanning sub-directories (#100636)
1 parent 364ee4e commit 4ed543d

File tree

2 files changed

+63
-1
lines changed

2 files changed

+63
-1
lines changed

clang/lib/InstallAPI/DirectoryScanner.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,8 @@ Error DirectoryScanner::scanHeaders(StringRef Path, Library &Lib,
130130
if (ParentPath.empty())
131131
ParentPath = Path;
132132
for (const StringRef Dir : SubDirectories)
133-
return scanHeaders(Dir, Lib, Type, BasePath, ParentPath);
133+
if (Error Err = scanHeaders(Dir, Lib, Type, BasePath, ParentPath))
134+
return Err;
134135

135136
return Error::success();
136137
}
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
; RUN: rm -rf %t
2+
; RUN: split-file %s %t
3+
; RUN: mkdir -p %t/DstRoot/
4+
; RUN: cp -r %S/Inputs/LibFoo/* %t/DstRoot/
5+
6+
; RUN: clang-installapi \
7+
; RUN: -target arm64-apple-macos12 -install_name @rpath/libfoo.dylib \
8+
; RUN: -current_version 1 -compatibility_version 1 \
9+
; RUN: -I%t/DstRoot/usr/include -dynamiclib \
10+
; RUN: -exclude-public-header %t/DstRoot/usr/include/public.h \
11+
; RUN: %t/DstRoot -o %t/output.tbd 2>&1 | FileCheck %s --allow-empty \
12+
; RUN: --implicit-check-not=error --implicit-check-not=warning
13+
; RUN: llvm-readtapi --compare %t/output.tbd %t/expected.tbd
14+
15+
16+
;--- DstRoot/usr/include/extra/extra.h
17+
int extra(void);
18+
19+
;--- DstRoot/usr/include/extra/additional/additional.h
20+
int additional(void);
21+
22+
;--- DstRoot/usr/include/more/more.h
23+
int more(void);
24+
25+
;--- DstRoot/usr/include/another/another.h
26+
int another(void);
27+
28+
;--- expected.tbd
29+
{
30+
"main_library": {
31+
"exported_symbols": [
32+
{
33+
"text": {
34+
"global": [
35+
"_foo", "_additional", "_more",
36+
"_another", "_extra"
37+
]
38+
}
39+
}
40+
],
41+
"flags": [
42+
{
43+
"attributes": [
44+
"not_app_extension_safe"
45+
]
46+
}
47+
],
48+
"install_names": [
49+
{
50+
"name": "@rpath/libfoo.dylib"
51+
}
52+
],
53+
"target_info": [
54+
{
55+
"min_deployment": "12",
56+
"target": "arm64-macos"
57+
}
58+
]
59+
},
60+
"tapi_tbd_version": 5
61+
}

0 commit comments

Comments
 (0)