[clang] [flang] [clang][flang] Support -time in both clang and flang (PR #109165)
    Tom Eccles via cfe-commits 
    cfe-commits at lists.llvm.org
       
    Mon Oct 14 13:03:30 PDT 2024
    
    
  
================
@@ -194,11 +197,29 @@ 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(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(false);
----------------
tblah wrote:
nit
```suggestion
    llvm::TimeRecord Time = llvm::TimeRecord::getCurrentTime(/*Start=*/false);
```
https://github.com/llvm/llvm-project/pull/109165
    
    
More information about the cfe-commits
mailing list