Skip to content

Commit

Permalink
Revert "[clang][flang] Support -time in both clang and flang"
Browse files Browse the repository at this point in the history
Reverts #109165

This created a buildbot failure on
[Fuchsia](https://lab.llvm.org/buildbot/#/builders/11/builds/8080).
  • Loading branch information
tarunprabhu authored Nov 13, 2024
1 parent 7ba864b commit 01d233f
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 93 deletions.
1 change: 0 additions & 1 deletion clang/include/clang/Driver/Options.td
Original file line number Diff line number Diff line change
Expand Up @@ -5896,7 +5896,6 @@ def print_enabled_extensions : Flag<["-", "--"], "print-enabled-extensions">,
def : Flag<["-"], "mcpu=help">, Alias<print_supported_cpus>;
def : Flag<["-"], "mtune=help">, Alias<print_supported_cpus>;
def time : Flag<["-"], "time">,
Visibility<[ClangOption, CLOption, DXCOption, FlangOption]>,
HelpText<"Time individual commands">;
def traditional_cpp : Flag<["-", "--"], "traditional-cpp">,
Visibility<[ClangOption, CC1Option]>,
Expand Down
20 changes: 0 additions & 20 deletions clang/lib/Driver/Compilation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@
#include "llvm/Option/OptSpecifier.h"
#include "llvm/Option/Option.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/Format.h"
#include "llvm/Support/Path.h"
#include "llvm/Support/Timer.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/TargetParser/Triple.h"
#include <cassert>
Expand Down Expand Up @@ -197,28 +194,11 @@ int Compilation::ExecuteCommand(const Command &C,
if (LogOnly)
return 0;

// We don't use any timers or llvm::TimeGroup's because those are tied into
// the global static timer list which, in principle, could be cleared without
// us knowing about it.
llvm::TimeRecord StartTime;
if (getArgs().hasArg(options::OPT_time))
StartTime = llvm::TimeRecord::getCurrentTime(/*Start=*/true);

std::string Error;
bool ExecutionFailed;
int Res = C.Execute(Redirects, &Error, &ExecutionFailed);
if (PostCallback)
PostCallback(C, Res);

if (getArgs().hasArg(options::OPT_time)) {
llvm::TimeRecord Time = llvm::TimeRecord::getCurrentTime(/*Start=*/false);
Time -= StartTime;
llvm::StringRef Name = llvm::sys::path::filename(C.getExecutable());
llvm::errs() << "# " << Name << " "
<< llvm::format("%0.2f", Time.getUserTime()) << " "
<< llvm::format("%0.2f", Time.getSystemTime()) << "\n";
}

if (!Error.empty()) {
assert(Res && "Error string set with 0 result code!");
getDriver().Diag(diag::err_drv_command_failure) << Error;
Expand Down
3 changes: 0 additions & 3 deletions clang/lib/Driver/Driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1315,9 +1315,6 @@ Compilation *Driver::BuildCompilation(ArrayRef<const char *> ArgList) {
// Ignore -pipe.
Args.ClaimAllArgs(options::OPT_pipe);

// Ignore -time.
Args.ClaimAllArgs(options::OPT_time);

// Extract -ccc args.
//
// FIXME: We need to figure out where this behavior should live. Most of it
Expand Down
33 changes: 0 additions & 33 deletions clang/test/Driver/time.c

This file was deleted.

36 changes: 0 additions & 36 deletions flang/test/Driver/time.f90

This file was deleted.

0 comments on commit 01d233f

Please sign in to comment.