aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorMikhail Glushenkov <foldr@codedgers.com>2010-07-27 11:19:36 +0000
committerMikhail Glushenkov <foldr@codedgers.com>2010-07-27 11:19:36 +0000
commitb613c396c944f7a0e9556c23c7e89ea76005dc29 (patch)
treec7414f5ee29f8837a3feffc91f156f30ece6a3a3 /include
parentb29734fab3a5a6ad7152506590fe00fb4cad7d23 (diff)
downloadexternal_llvm-b613c396c944f7a0e9556c23c7e89ea76005dc29.zip
external_llvm-b613c396c944f7a0e9556c23c7e89ea76005dc29.tar.gz
external_llvm-b613c396c944f7a0e9556c23c7e89ea76005dc29.tar.bz2
Return -1 only on failure to execute a program.
Also fix some comments. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@109499 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/CompilerDriver/Action.h2
-rw-r--r--include/llvm/CompilerDriver/CompilationGraph.h57
-rw-r--r--include/llvm/CompilerDriver/Tool.h4
3 files changed, 36 insertions, 27 deletions
diff --git a/include/llvm/CompilerDriver/Action.h b/include/llvm/CompilerDriver/Action.h
index 4ff6fd9..f2b7965 100644
--- a/include/llvm/CompilerDriver/Action.h
+++ b/include/llvm/CompilerDriver/Action.h
@@ -43,7 +43,7 @@ namespace llvmc {
}
bool IsConstructed () { return (Command_.size() != 0);}
- /// Execute - Executes the represented action.
+ /// Execute - Executes the command. Returns -1 on error.
int Execute () const;
bool StopCompilation () const { return StopCompilation_; }
const std::string& OutFile() { return OutFile_; }
diff --git a/include/llvm/CompilerDriver/CompilationGraph.h b/include/llvm/CompilerDriver/CompilationGraph.h
index 9f2e50e..e3b0cff 100644
--- a/include/llvm/CompilerDriver/CompilationGraph.h
+++ b/include/llvm/CompilerDriver/CompilationGraph.h
@@ -132,28 +132,28 @@ namespace llvmc {
void insertNode(Tool* T);
/// insertEdge - Insert a new edge into the graph. Takes ownership
- /// of the Edge object.
+ /// of the Edge object. Returns non-zero value on error.
int insertEdge(const std::string& A, Edge* E);
- /// Build - Build target(s) from the input file set. Command-line
- /// options are passed implicitly as global variables.
+ /// Build - Build target(s) from the input file set. Command-line options
+ /// are passed implicitly as global variables. Returns non-zero value on
+ /// error (usually the failed program's exit code).
int Build(llvm::sys::Path const& TempDir, const LanguageMap& LangMap);
- /// Check - Check the compilation graph for common errors like
- /// cycles, input/output language mismatch and multiple default
- /// edges. Prints error messages and in case it finds any errors.
+ /// Check - Check the compilation graph for common errors like cycles,
+ /// input/output language mismatch and multiple default edges. Prints error
+ /// messages and in case it finds any errors.
int Check();
- /// getNode - Return a reference to the node correponding to the
- /// given tool name. Throws std::runtime_error.
+ /// getNode - Return a reference to the node corresponding to the given tool
+ /// name. Returns 0 on error.
Node* getNode(const std::string& ToolName);
const Node* getNode(const std::string& ToolName) const;
- /// viewGraph - This function is meant for use from the debugger.
- /// You can just say 'call G->viewGraph()' and a ghostview window
- /// should pop up from the program, displaying the compilation
- /// graph. This depends on there being a 'dot' and 'gv' program
- /// in your path.
+ /// viewGraph - This function is meant for use from the debugger. You can
+ /// just say 'call G->viewGraph()' and a ghostview window should pop up from
+ /// the program, displaying the compilation graph. This depends on there
+ /// being a 'dot' and 'gv' program in your path.
void viewGraph();
/// writeGraph - Write Graphviz .dot source file to the current direcotry.
@@ -167,12 +167,11 @@ namespace llvmc {
// Helper functions.
/// getToolsVector - Return a reference to the list of tool names
- /// corresponding to the given language name. Throws
- /// std::runtime_error.
+ /// corresponding to the given language name. Returns 0 on error.
const tools_vector_type* getToolsVector(const std::string& LangName) const;
- /// PassThroughGraph - Pass the input file through the toolchain
- /// starting at StartNode.
+ /// PassThroughGraph - Pass the input file through the toolchain starting at
+ /// StartNode.
int PassThroughGraph (const llvm::sys::Path& In, const Node* StartNode,
const InputLanguagesSet& InLangs,
const llvm::sys::Path& TempDir,
@@ -185,26 +184,32 @@ namespace llvmc {
InputLanguagesSet& InLangs,
const LanguageMap& LangMap) const;
- /// BuildInitial - Traverse the initial parts of the toolchains.
+ /// BuildInitial - Traverse the initial parts of the toolchains. Returns
+ /// non-zero value on error.
int BuildInitial(InputLanguagesSet& InLangs,
const llvm::sys::Path& TempDir,
const LanguageMap& LangMap);
- /// TopologicalSort - Sort the nodes in topological order.
+ /// TopologicalSort - Sort the nodes in topological order. Returns non-zero
+ /// value on error.
int TopologicalSort(std::vector<const Node*>& Out);
- /// TopologicalSortFilterJoinNodes - Call TopologicalSort and
- /// filter the resulting list to include only Join nodes.
+ /// TopologicalSortFilterJoinNodes - Call TopologicalSort and filter the
+ /// resulting list to include only Join nodes. Returns non-zero value on
+ /// error.
int TopologicalSortFilterJoinNodes(std::vector<const Node*>& Out);
// Functions used to implement Check().
- /// CheckLanguageNames - Check that output/input language names
- /// match for all nodes.
+ /// CheckLanguageNames - Check that output/input language names match for
+ /// all nodes. Returns non-zero value on error (number of errors
+ /// encountered).
int CheckLanguageNames() const;
- /// CheckMultipleDefaultEdges - check that there are no multiple
- /// default default edges.
+ /// CheckMultipleDefaultEdges - check that there are no multiple default
+ /// default edges. Returns non-zero value on error (number of errors
+ /// encountered).
int CheckMultipleDefaultEdges() const;
- /// CheckCycles - Check that there are no cycles in the graph.
+ /// CheckCycles - Check that there are no cycles in the graph. Returns
+ /// non-zero value on error (number of errors encountered).
int CheckCycles();
};
diff --git a/include/llvm/CompilerDriver/Tool.h b/include/llvm/CompilerDriver/Tool.h
index d064a03..45ef50d 100644
--- a/include/llvm/CompilerDriver/Tool.h
+++ b/include/llvm/CompilerDriver/Tool.h
@@ -38,6 +38,8 @@ namespace llvmc {
virtual ~Tool() {}
+ /// GenerateAction - Generate an Action given particular command-line
+ /// options. Returns non-zero value on error.
virtual int GenerateAction (Action& Out,
const PathVector& inFiles,
const bool HasChildren,
@@ -45,6 +47,8 @@ namespace llvmc {
const InputLanguagesSet& InLangs,
const LanguageMap& LangMap) const = 0;
+ /// GenerateAction - Generate an Action given particular command-line
+ /// options. Returns non-zero value on error.
virtual int GenerateAction (Action& Out,
const llvm::sys::Path& inFile,
const bool HasChildren,