Skip to content

Commit 84b5616

Browse files
authored
Merge pull request #12282 from graydon/rdar-34818636-backport-PR-12257-stats-output-dir-filename-issues-to-swift-4.0-branch
Rdar 34818636 backport pr 12257 stats output dir filename issues to swift 4.0 branch
2 parents 7efb2d1 + c13ec89 commit 84b5616

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

lib/Basic/Statistic.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,10 @@ auxName(StringRef ModuleName,
8787
if (InputName.empty()) {
8888
InputName = "all";
8989
}
90+
// Dispose of path prefix, which might make composite name too long.
91+
InputName = path::filename(InputName);
9092
if (OptType.empty()) {
91-
InputName = "Onone";
93+
OptType = "Onone";
9294
}
9395
if (!OutputType.empty() && OutputType.front() == '.') {
9496
OutputType = OutputType.substr(1);
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// REQUIRES: OS=macosx
2+
// RUN: rm -rf %t && mkdir -p %t
3+
// RUN: mkdir -p %t/very-long-directory-name-that-contains-over-128-characters-which-is-not-enough-to-be-illegal-on-its-own-but-presents
4+
// RUN: cp %s %t/very-long-directory-name-that-contains-over-128-characters-which-is-not-enough-to-be-illegal-on-its-own-but-presents/a-problem-when-combined-with-other-long-path-elements-and-filenames-to-exceed-256-characters-combined-because-yay-arbitrary-limits-amirite.swift
5+
// RUN: touch %t/main.swift
6+
// RUN: %target-swiftc_driver -o %t/main -module-name main -stats-output-dir %t %t/main.swift %t/very-long-directory-name-that-contains-over-128-characters-which-is-not-enough-to-be-illegal-on-its-own-but-presents/a-problem-when-combined-with-other-long-path-elements-and-filenames-to-exceed-256-characters-combined-because-yay-arbitrary-limits-amirite.swift
7+
// RUN: %utils/process-stats-dir.py --set-csv-baseline %t/frontend.csv %t
8+
// RUN: %FileCheck -input-file %t/frontend.csv %s
9+
10+
// CHECK: {{"AST.NumSourceLines" [1-9][0-9]*$}}
11+
// CHECK: {{"IRModule.NumIRFunctions" [1-9][0-9]*$}}
12+
// CHECK: {{"LLVM.NumLLVMBytesOutput" [1-9][0-9]*$}}
13+
14+
public func foo() {
15+
print("hello")
16+
}

0 commit comments

Comments
 (0)