Skip to content

Commit 25e30d6

Browse files
committed
[llvm-readtapi] Make directory traversal more reslient to different path
styles
1 parent 9359df8 commit 25e30d6

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

llvm/tools/llvm-readtapi/llvm-readtapi.cpp

+11-3
Original file line numberDiff line numberDiff line change
@@ -258,9 +258,17 @@ static void stubifyDirectory(const StringRef InputPath, Context &Ctx) {
258258
// Skip header directories (include/Headers/PrivateHeaders) and module
259259
// files.
260260
StringRef Path = IT->path();
261-
if (Path.ends_with("/include") || Path.ends_with("/Headers") ||
262-
Path.ends_with("/PrivateHeaders") || Path.ends_with("/Modules") ||
263-
Path.ends_with(".map") || Path.ends_with(".modulemap")) {
261+
if (sys::fs::is_directory(Path)) {
262+
const StringRef Stem = sys::path::stem(Path);
263+
if (Stem == "include" || Stem == "Headers" || Stem == "PrivateHeaders" ||
264+
Stem == "Modules") {
265+
IT.no_push();
266+
continue;
267+
}
268+
}
269+
270+
// Skip module files too.
271+
if (Path.ends_with(".map") || Path.ends_with(".modulemap")) {
264272
IT.no_push();
265273
continue;
266274
}

0 commit comments

Comments
 (0)