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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@363052
91177308-0d34-0410-b5e6-
96231b3b80d8
// REQUIRES: shell
-// RUN: %clangxx -S -ftime-trace -mllvm --time-trace-granularity=0 %s 2>&1 \
-// RUN: | grep "Time trace json-file dumped to" | awk '{print $NF}' | xargs cat \
+// RUN: %clangxx -S -ftime-trace -mllvm --time-trace-granularity=0 -o %T/check-time-trace %s
+// RUN: cat %T/check-time-trace.json \
// RUN: | %python -c 'import json, sys; json.dump(json.loads(sys.stdin.read()), sys.stdout, sort_keys=True, indent=2)' \
// RUN: | FileCheck %s
/*useTemporary=*/false);
llvm::timeTraceProfilerWrite(*profilerOutput);
+ // FIXME(ibiryukov): make profilerOutput flush in destructor instead.
+ profilerOutput->flush();
llvm::timeTraceProfilerCleanup();
llvm::errs() << "Time trace json-file dumped to " << Path.str() << "\n";