Skip to content

Commit 1f6c602

Browse files
committed
Make sure a test from r363036 does not write into a working directory
It breaks if build directory is not writable. This change is required to fix our integrate. Also add a flush() call, otherwise time trace option does not produce the full output. llvm-svn: 363052
1 parent 7bd5c55 commit 1f6c602

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

clang/test/Driver/check-time-trace.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// REQUIRES: shell
2-
// RUN: %clangxx -S -ftime-trace -mllvm --time-trace-granularity=0 %s 2>&1 \
3-
// RUN: | grep "Time trace json-file dumped to" | awk '{print $NF}' | xargs cat \
2+
// RUN: %clangxx -S -ftime-trace -mllvm --time-trace-granularity=0 -o %T/check-time-trace %s
3+
// RUN: cat %T/check-time-trace.json \
44
// RUN: | %python -c 'import json, sys; json.dump(json.loads(sys.stdin.read()), sys.stdout, sort_keys=True, indent=2)' \
55
// RUN: | FileCheck %s
66

clang/tools/driver/cc1_main.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,8 @@ int cc1_main(ArrayRef<const char *> Argv, const char *Argv0, void *MainAddr) {
240240
/*useTemporary=*/false);
241241

242242
llvm::timeTraceProfilerWrite(*profilerOutput);
243+
// FIXME(ibiryukov): make profilerOutput flush in destructor instead.
244+
profilerOutput->flush();
243245
llvm::timeTraceProfilerCleanup();
244246

245247
llvm::errs() << "Time trace json-file dumped to " << Path.str() << "\n";

0 commit comments

Comments
 (0)