From 67a71b3184ce20a901e874d0ee25e01397dd87ef Mon Sep 17 00:00:00 2001 From: Roman Divacky Date: Wed, 3 Mar 2010 17:27:15 +0000 Subject: Update LLVM to 97654. --- lib/CompilerDriver/CompilationGraph.cpp | 5 +++-- lib/CompilerDriver/Main.cpp | 7 ++----- lib/CompilerDriver/Tool.cpp | 21 +++++++++++++++++++++ 3 files changed, 26 insertions(+), 7 deletions(-) (limited to 'lib/CompilerDriver') diff --git a/lib/CompilerDriver/CompilationGraph.cpp b/lib/CompilerDriver/CompilationGraph.cpp index 524607bee779..7d1c7fe4a62b 100644 --- a/lib/CompilerDriver/CompilationGraph.cpp +++ b/lib/CompilerDriver/CompilationGraph.cpp @@ -34,7 +34,8 @@ namespace llvmc { const std::string& LanguageMap::GetLanguage(const sys::Path& File) const { StringRef suf = File.getSuffix(); - LanguageMap::const_iterator Lang = this->find(suf); + LanguageMap::const_iterator Lang = + this->find(suf.empty() ? "*empty*" : suf); if (Lang == this->end()) throw std::runtime_error("File '" + File.str() + "' has unknown suffix '" + suf.str() + '\''); @@ -313,7 +314,7 @@ int CompilationGraph::Build (const sys::Path& TempDir, JoinTool* JT = &dynamic_cast(*CurNode->ToolPtr.getPtr()); // Are there any files in the join list? - if (JT->JoinListEmpty()) + if (JT->JoinListEmpty() && !(JT->WorksOnEmpty() && InputFilenames.empty())) continue; Action CurAction = JT->GenerateAction(CurNode->HasChildren(), diff --git a/lib/CompilerDriver/Main.cpp b/lib/CompilerDriver/Main.cpp index 3a3487a0a9c0..b5e507dfc3a3 100644 --- a/lib/CompilerDriver/Main.cpp +++ b/lib/CompilerDriver/Main.cpp @@ -100,7 +100,8 @@ int Main(int argc, char** argv) { ProgramName = argv[0]; cl::ParseCommandLineOptions - (argc, argv, "LLVM Compiler Driver (Work In Progress)", true); + (argc, argv, "LLVM Compiler Driver (Work In Progress)", + /* ReadResponseFiles = */ false); PluginLoader Plugins; Plugins.RunInitialization(langMap, graph); @@ -126,10 +127,6 @@ int Main(int argc, char** argv) { return 0; } - if (InputFilenames.empty()) { - throw std::runtime_error("no input files"); - } - if (Time) { GlobalTimeLog = new std::stringstream; GlobalTimeLog->precision(2); diff --git a/lib/CompilerDriver/Tool.cpp b/lib/CompilerDriver/Tool.cpp index 9f4ab4956627..5e558ca43c8d 100644 --- a/lib/CompilerDriver/Tool.cpp +++ b/lib/CompilerDriver/Tool.cpp @@ -17,6 +17,8 @@ #include "llvm/ADT/StringExtras.h" #include "llvm/System/Path.h" +#include + using namespace llvm; using namespace llvmc; @@ -71,3 +73,22 @@ sys::Path Tool::OutFilename(const sys::Path& In, } return Out; } + +namespace { + template + bool CompareFirst (std::pair p1, std::pair p2) { + return std::less()(p1.first, p2.first); + } +} + +StrVector Tool::SortArgs(ArgsVector& Args) const { + StrVector Out; + + // HACK: this won't be needed when we'll migrate away from CommandLine. + std::stable_sort(Args.begin(), Args.end(), &CompareFirst); + for (ArgsVector::iterator B = Args.begin(), E = Args.end(); B != E; ++B) { + Out.push_back(B->second); + } + + return Out; +} -- cgit v1.3