[cfe-commits] r135621 - in /cfe/trunk: include/clang/Basic/DiagnosticDriverKinds.td include/clang/Driver/ArgList.h include/clang/Driver/Compilation.h include/clang/Driver/Driver.h include/clang/Driver/Job.h lib/Driver/ArgList.cpp lib/Driver/Compilation.cpp lib/Driver/Driver.cpp lib/Driver/Job.cpp lib/Driver/Tools.cpp tools/driver/driver.cpp

Chad Rosier mcrosier at apple.com
Wed Jul 20 14:16:17 PDT 2011


Author: mcrosier
Date: Wed Jul 20 16:16:17 2011
New Revision: 135621

URL: http://llvm.org/viewvc/llvm-project?rev=135621&view=rev
Log:
Temporarily revert r135614 while I fix the cmake build.

Modified:
    cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td
    cfe/trunk/include/clang/Driver/ArgList.h
    cfe/trunk/include/clang/Driver/Compilation.h
    cfe/trunk/include/clang/Driver/Driver.h
    cfe/trunk/include/clang/Driver/Job.h
    cfe/trunk/lib/Driver/ArgList.cpp
    cfe/trunk/lib/Driver/Compilation.cpp
    cfe/trunk/lib/Driver/Driver.cpp
    cfe/trunk/lib/Driver/Job.cpp
    cfe/trunk/lib/Driver/Tools.cpp
    cfe/trunk/tools/driver/driver.cpp

Modified: cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td?rev=135621&r1=135620&r2=135621&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td Wed Jul 20 16:16:17 2011
@@ -123,7 +123,4 @@
 def warn_drv_pch_not_first_include : Warning<
   "precompiled header '%0' was ignored because '%1' is not first '-include'">;
 
-def note_drv_command_failed_diag_msg : Note<
-  "diagnostic msg: %0">;
-
 }

Modified: cfe/trunk/include/clang/Driver/ArgList.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/ArgList.h?rev=135621&r1=135620&r2=135621&view=diff
==============================================================================
--- cfe/trunk/include/clang/Driver/ArgList.h (original)
+++ cfe/trunk/include/clang/Driver/ArgList.h Wed Jul 20 16:16:17 2011
@@ -150,13 +150,6 @@
     }
 
     /// @}
-    /// @name Arg Removal
-    /// @{
-
-    /// eraseArg - Remove any option matching \arg Id.
-    void eraseArg(OptSpecifier Id);
-
-    /// @}
     /// @name Arg Access
     /// @{
 
@@ -249,10 +242,6 @@
     /// option id.
     void ClaimAllArgs(OptSpecifier Id0) const;
 
-    /// ClaimAllArgs - Claim all arguments.
-    ///
-    void ClaimAllArgs() const;
-
     /// @}
     /// @name Arg Synthesis
     /// @{

Modified: cfe/trunk/include/clang/Driver/Compilation.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Compilation.h?rev=135621&r1=135620&r2=135621&view=diff
==============================================================================
--- cfe/trunk/include/clang/Driver/Compilation.h (original)
+++ cfe/trunk/include/clang/Driver/Compilation.h Wed Jul 20 16:16:17 2011
@@ -13,7 +13,6 @@
 #include "clang/Driver/Job.h"
 #include "clang/Driver/Util.h"
 #include "llvm/ADT/DenseMap.h"
-#include "llvm/Support/Path.h"
 
 namespace clang {
 namespace driver {
@@ -56,9 +55,6 @@
   /// Result files which should be removed on failure.
   ArgStringList ResultFiles;
 
-  /// Redirection for stdout, stderr, etc.
-  const llvm::sys::Path **Redirects;
-
 public:
   Compilation(const Driver &D, const ToolChain &DefaultToolChain,
               InputArgList *Args, DerivedArgList *TranslatedArgs);
@@ -135,11 +131,6 @@
   /// Command which failed.
   /// \return The accumulated result code of the job.
   int ExecuteJob(const Job &J, const Command *&FailingCommand) const;
-
-  /// initCompilationForDiagnostics - Remove stale state and suppress output
-  /// so compilation can be reexecuted to generate additional diagnostic
-  /// information (e.g., preprocessed source(s)).
-  void initCompilationForDiagnostics();
 };
 
 } // end namespace driver

Modified: cfe/trunk/include/clang/Driver/Driver.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Driver.h?rev=135621&r1=135620&r2=135621&view=diff
==============================================================================
--- cfe/trunk/include/clang/Driver/Driver.h (original)
+++ cfe/trunk/include/clang/Driver/Driver.h Wed Jul 20 16:16:17 2011
@@ -30,7 +30,6 @@
 namespace driver {
   class Action;
   class ArgList;
-  class Command;
   class Compilation;
   class DerivedArgList;
   class HostInfo;
@@ -134,9 +133,6 @@
   /// format.
   unsigned CCLogDiagnostics : 1;
 
-  /// Whether the driver is generating diagnostics for debugging purposes.
-  unsigned CCGenDiagnostics : 1;
-
 private:
   /// Name to use when invoking gcc/g++.
   std::string CCCGenericGCCName;
@@ -266,14 +262,7 @@
   /// This routine handles additional processing that must be done in addition
   /// to just running the subprocesses, for example reporting errors, removing
   /// temporary files, etc.
-  int ExecuteCompilation(const Compilation &C,
-                         const Command *&FailingCommand) const;
-  
-  /// generateCompilationDiagnostics - Generate diagnostics information 
-  /// including preprocessed source file(s).
-  /// 
-  void generateCompilationDiagnostics(Compilation &C,
-                                      const Command *FailingCommand);
+  int ExecuteCompilation(const Compilation &C) const;
 
   /// @}
   /// @name Helper Methods

Modified: cfe/trunk/include/clang/Driver/Job.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Job.h?rev=135621&r1=135620&r2=135621&view=diff
==============================================================================
--- cfe/trunk/include/clang/Driver/Job.h (original)
+++ cfe/trunk/include/clang/Driver/Job.h Wed Jul 20 16:16:17 2011
@@ -97,9 +97,6 @@
   /// Add a job to the list (taking ownership).
   void addJob(Job *J) { Jobs.push_back(J); }
 
-  /// Clear the job list.
-  void clear();
-
   const list_type &getJobs() const { return Jobs; }
 
   size_type size() const { return Jobs.size(); }

Modified: cfe/trunk/lib/Driver/ArgList.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ArgList.cpp?rev=135621&r1=135620&r2=135621&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ArgList.cpp (original)
+++ cfe/trunk/lib/Driver/ArgList.cpp Wed Jul 20 16:16:17 2011
@@ -46,16 +46,6 @@
   Args.push_back(A);
 }
 
-void ArgList::eraseArg(OptSpecifier Id) {
-  for (iterator it = begin(), ie = end(); it != ie; ++it) {
-    if ((*it)->getOption().matches(Id)) {
-      Args.erase(it);
-      it = begin();
-      ie = end();
-    }
-  }
-}
-
 Arg *ArgList::getLastArgNoClaim(OptSpecifier Id) const {
   // FIXME: Make search efficient?
   for (const_reverse_iterator it = rbegin(), ie = rend(); it != ie; ++it)
@@ -202,12 +192,6 @@
     (*it)->claim();
 }
 
-void ArgList::ClaimAllArgs() const {
-  for (const_iterator it = begin(), ie = end(); it != ie; ++it)
-    if (!(*it)->isClaimed())
-      (*it)->claim();
-}
-
 const char *ArgList::MakeArgString(const llvm::Twine &T) const {
   llvm::SmallString<256> Str;
   T.toVector(Str);

Modified: cfe/trunk/lib/Driver/Compilation.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Compilation.cpp?rev=135621&r1=135620&r2=135621&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Compilation.cpp (original)
+++ cfe/trunk/lib/Driver/Compilation.cpp Wed Jul 20 16:16:17 2011
@@ -25,7 +25,7 @@
 Compilation::Compilation(const Driver &D, const ToolChain &_DefaultToolChain,
                          InputArgList *_Args, DerivedArgList *_TranslatedArgs)
   : TheDriver(D), DefaultToolChain(_DefaultToolChain), Args(_Args),
-    TranslatedArgs(_TranslatedArgs), Redirects(0) {
+    TranslatedArgs(_TranslatedArgs) {
 }
 
 Compilation::~Compilation() {
@@ -43,13 +43,6 @@
   for (ActionList::iterator it = Actions.begin(), ie = Actions.end();
        it != ie; ++it)
     delete *it;
-
-  // Free redirections of stdout/stderr.
-  if (Redirects) {
-    delete Redirects[1];
-    delete Redirects[2];
-    delete Redirects;
-  }
 }
 
 const DerivedArgList &Compilation::getArgsForToolChain(const ToolChain *TC,
@@ -142,8 +135,8 @@
   std::copy(C.getArguments().begin(), C.getArguments().end(), Argv+1);
   Argv[C.getArguments().size() + 1] = 0;
 
-  if ((getDriver().CCCEcho || getDriver().CCPrintOptions ||
-       getArgs().hasArg(options::OPT_v)) && !getDriver().CCGenDiagnostics) {
+  if (getDriver().CCCEcho || getDriver().CCPrintOptions ||
+      getArgs().hasArg(options::OPT_v)) {
     llvm::raw_ostream *OS = &llvm::errs();
 
     // Follow gcc implementation of CC_PRINT_OPTIONS; we could also cache the
@@ -174,7 +167,7 @@
   std::string Error;
   int Res =
     llvm::sys::Program::ExecuteAndWait(Prog, Argv,
-                                       /*env*/0, Redirects,
+                                       /*env*/0, /*redirects*/0,
                                        /*secondsToWait*/0, /*memoryLimit*/0,
                                        &Error);
   if (!Error.empty()) {
@@ -202,27 +195,3 @@
     return 0;
   }
 }
-
-void Compilation::initCompilationForDiagnostics(void) {
-  // Free actions and jobs, if built.
-  for (ActionList::iterator it = Actions.begin(), ie = Actions.end();
-       it != ie; ++it)
-    delete *it;
-  Actions.clear();
-  Jobs.clear();
-
-  // Clear temporary and results file lists.
-  TempFiles.clear();
-  ResultFiles.clear();
-
-  // Remove any user specified output.  Claim any unclaimed arguments, so as
-  // to avoid emitting warnings about unused args.
-  if (TranslatedArgs->hasArg(options::OPT_o))
-    TranslatedArgs->eraseArg(options::OPT_o);
-  TranslatedArgs->ClaimAllArgs();
-
-  // Redirect stdout/stderr to /dev/null.
-  Redirects = new const llvm::sys::Path*[3]();
-  Redirects[1] = new const llvm::sys::Path();
-  Redirects[2] = new const llvm::sys::Path();
-}

Modified: cfe/trunk/lib/Driver/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=135621&r1=135620&r2=135621&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Driver.cpp (original)
+++ cfe/trunk/lib/Driver/Driver.cpp Wed Jul 20 16:16:17 2011
@@ -60,9 +60,9 @@
     CCLogDiagnosticsFilename(0), CCCIsCXX(false),
     CCCIsCPP(false),CCCEcho(false), CCCPrintBindings(false),
     CCPrintOptions(false), CCPrintHeaders(false), CCLogDiagnostics(false),
-    CCGenDiagnostics(false), CCCGenericGCCName(""), CheckInputsExist(true),
-    CCCUseClang(true), CCCUseClangCXX(true), CCCUseClangCPP(true),
-    CCCUsePCH(true), SuppressMissingInputWarning(false) {
+    CCCGenericGCCName(""), CheckInputsExist(true), CCCUseClang(true),
+    CCCUseClangCXX(true), CCCUseClangCPP(true), CCCUsePCH(true),
+    SuppressMissingInputWarning(false) {
   if (IsProduction) {
     // In a "production" build, only use clang on architectures we expect to
     // work, and don't use clang C++.
@@ -313,63 +313,7 @@
   return C;
 }
 
-// When clang crashes, produce diagnostic information including the fully 
-// preprocessed source file(s).  Request that the developer attach the 
-// diagnostic information to a bug report.
-void Driver::generateCompilationDiagnostics(Compilation &C,
-                                            const Command *FailingCommand) {
-  Diag(clang::diag::note_drv_command_failed_diag_msg)
-    << "Please submit a bug report to " BUG_REPORT_URL " and include command"
-    " line arguments and all diagnostic information.";
-
-  // Suppress driver output and emit preprocessor output to temp file.
-  CCCIsCPP = true;
-  CCGenDiagnostics = true;
-
-  // Clear stale state and suppress tool output.
-  C.initCompilationForDiagnostics();
-
-  // Construct the list of abstract actions to perform for this compilation.
-  Diags.Reset();
-  if (Host->useDriverDriver())
-    BuildUniversalActions(C.getDefaultToolChain(), C.getArgs(),
-                          C.getActions());
-  else
-    BuildActions(C.getDefaultToolChain(), C.getArgs(), C.getActions());
-
-  BuildJobs(C);
-
-  // If there were errors building the compilation, quit now.
-  if (Diags.hasErrorOccurred()) {
-    Diag(clang::diag::note_drv_command_failed_diag_msg)
-      << "Error generating preprocessed source(s).";
-    return;
-  }
-
-  // Generate preprocessed output.
-  FailingCommand = 0;
-  int Res = C.ExecuteJob(C.getJobs(), FailingCommand);
-
-  // If the command succeeded, we are done.
-  if (Res == 0) {
-    Diag(clang::diag::note_drv_command_failed_diag_msg)
-      << "Preprocessed source(s) are located at:";
-    ArgStringList Files = C.getTempFiles();
-    for (ArgStringList::const_iterator it = Files.begin(), ie = Files.end(); 
-         it != ie; ++it)
-      Diag(clang::diag::note_drv_command_failed_diag_msg) << *it;
-  } else {
-    // Failure, remove preprocessed files.
-    if (!C.getArgs().hasArg(options::OPT_save_temps))
-      C.CleanupFileList(C.getTempFiles(), true);
-
-    Diag(clang::diag::note_drv_command_failed_diag_msg)
-      << "Error generating preprocessed source(s).";
-  }
-}
-
-int Driver::ExecuteCompilation(const Compilation &C,
-                               const Command *&FailingCommand) const {
+int Driver::ExecuteCompilation(const Compilation &C) const {
   // Just print if -### was present.
   if (C.getArgs().hasArg(options::OPT__HASH_HASH_HASH)) {
     C.PrintJob(llvm::errs(), C.getJobs(), "\n", true);
@@ -377,9 +321,10 @@
   }
 
   // If there were errors building the compilation, quit now.
-  if (Diags.hasErrorOccurred())
+  if (getDiags().hasErrorOccurred())
     return 1;
 
+  const Command *FailingCommand = 0;
   int Res = C.ExecuteJob(C.getJobs(), FailingCommand);
 
   // Remove temp files.
@@ -1253,7 +1198,7 @@
                        A->getType(), BaseInput);
   }
 
-  if (CCCPrintBindings && !CCGenDiagnostics) {
+  if (CCCPrintBindings) {
     llvm::errs() << "# \"" << T.getToolChain().getTripleString() << '"'
                  << " - \"" << T.getName() << "\", inputs: [";
     for (unsigned i = 0, e = InputInfos.size(); i != e; ++i) {
@@ -1280,12 +1225,11 @@
   }
 
   // Default to writing to stdout?
-  if (AtTopLevel && isa<PreprocessJobAction>(JA) && !CCGenDiagnostics)
+  if (AtTopLevel && isa<PreprocessJobAction>(JA))
     return "-";
 
   // Output to a temporary file?
-  if ((!AtTopLevel && !C.getArgs().hasArg(options::OPT_save_temps)) ||
-      CCGenDiagnostics) {
+  if (!AtTopLevel && !C.getArgs().hasArg(options::OPT_save_temps)) {
     std::string TmpName =
       GetTemporaryPath(types::getTypeTempSuffix(JA.getType()));
     return C.addTempFile(C.getArgs().MakeArgString(TmpName.c_str()));

Modified: cfe/trunk/lib/Driver/Job.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Job.cpp?rev=135621&r1=135620&r2=135621&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Job.cpp (original)
+++ cfe/trunk/lib/Driver/Job.cpp Wed Jul 20 16:16:17 2011
@@ -28,12 +28,6 @@
     delete *it;
 }
 
-void JobList::clear() {
-  for (iterator it = begin(), ie = end(); it != ie; ++it)
-    delete *it;
-  Jobs.clear();
-}
-
 void Job::addCommand(Command *C) {
   cast<JobList>(this)->addJob(C);
 }

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=135621&r1=135620&r2=135621&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Wed Jul 20 16:16:17 2011
@@ -1376,7 +1376,7 @@
 
   Args.AddAllArgs(CmdArgs, options::OPT_v);
   Args.AddLastArg(CmdArgs, options::OPT_H);
-  if (D.CCPrintHeaders && !D.CCGenDiagnostics) {
+  if (D.CCPrintHeaders) {
     CmdArgs.push_back("-header-include-file");
     CmdArgs.push_back(D.CCPrintHeadersFilename ?
                       D.CCPrintHeadersFilename : "-");
@@ -1384,7 +1384,7 @@
   Args.AddLastArg(CmdArgs, options::OPT_P);
   Args.AddLastArg(CmdArgs, options::OPT_print_ivar_layout);
 
-  if (D.CCLogDiagnostics && !D.CCGenDiagnostics) {
+  if (D.CCLogDiagnostics) {
     CmdArgs.push_back("-diagnostic-log-file");
     CmdArgs.push_back(D.CCLogDiagnosticsFilename ?
                       D.CCLogDiagnosticsFilename : "-");

Modified: cfe/trunk/tools/driver/driver.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/driver/driver.cpp?rev=135621&r1=135620&r2=135621&view=diff
==============================================================================
--- cfe/trunk/tools/driver/driver.cpp (original)
+++ cfe/trunk/tools/driver/driver.cpp Wed Jul 20 16:16:17 2011
@@ -458,15 +458,9 @@
 
   llvm::OwningPtr<Compilation> C(TheDriver.BuildCompilation(argv));
   int Res = 0;
-  const Command *FailingCommand = 0;
   if (C.get())
-    Res = TheDriver.ExecuteCompilation(*C, FailingCommand);
-
-  // If result status is < 0, then the driver command signalled an error.
-  // In this case, generate additional diagnostic information if possible.
-  if (Res < 0)
-    TheDriver.generateCompilationDiagnostics(*C, FailingCommand);
-
+    Res = TheDriver.ExecuteCompilation(*C);
+  
   // If any timers were active but haven't been destroyed yet, print their
   // results now.  This happens in -disable-free mode.
   llvm::TimerGroup::printAll(llvm::errs());





More information about the cfe-commits mailing list