diff options
author | Mikhail Glushenkov <foldr@codedgers.com> | 2008-05-30 06:24:49 +0000 |
---|---|---|
committer | Mikhail Glushenkov <foldr@codedgers.com> | 2008-05-30 06:24:49 +0000 |
commit | 5fe8475e3ab521444193c469cdeaa3a2edf01abb (patch) | |
tree | cb6e8b9d031b8ac05997e82757f3e8473239a36a /tools | |
parent | 92b8da75a1bed2f70079e970883b4e69e99d2330 (diff) | |
download | external_llvm-5fe8475e3ab521444193c469cdeaa3a2edf01abb.zip external_llvm-5fe8475e3ab521444193c469cdeaa3a2edf01abb.tar.gz external_llvm-5fe8475e3ab521444193c469cdeaa3a2edf01abb.tar.bz2 |
A small optimization: use static char* array instead of StrVector.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51752 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools')
-rw-r--r-- | tools/llvmc2/CompilationGraph.cpp | 23 | ||||
-rw-r--r-- | tools/llvmc2/Tool.h | 8 |
2 files changed, 16 insertions, 15 deletions
diff --git a/tools/llvmc2/CompilationGraph.cpp b/tools/llvmc2/CompilationGraph.cpp index cf174dd..df1f239 100644 --- a/tools/llvmc2/CompilationGraph.cpp +++ b/tools/llvmc2/CompilationGraph.cpp @@ -123,10 +123,9 @@ void CompilationGraph::insertNode(Tool* V) { void CompilationGraph::insertEdge(const std::string& A, Edge* Edg) { Node& B = getNode(Edg->ToolName()); if (A == "root") { - const StrVector& InputLanguages = B.ToolPtr->InputLanguages(); - for (StrVector::const_iterator B = InputLanguages.begin(), - E = InputLanguages.end(); B != E; ++B) - ToolsMap[*B].push_back(IntrusiveRefCntPtr<Edge>(Edg)); + const char** InLangs = B.ToolPtr->InputLanguages(); + for (;*InLangs; ++InLangs) + ToolsMap[*InLangs].push_back(IntrusiveRefCntPtr<Edge>(Edg)); NodesMap["root"].AddEdge(Edg); } else { @@ -392,15 +391,17 @@ namespace llvm { return N->ToolPtr->OutputLanguage(); } else { - const StrVector& InputLanguages = I->ToolPtr->InputLanguages(); + const char** InLangs = I->ToolPtr->InputLanguages(); std::string ret; - for (StrVector::const_iterator B = InputLanguages.begin(), - E = InputLanguages.end(); B != E; ++B) { - if (llvm::next(B) != E) - ret += *B + ", "; - else - ret += *B; + for (; *InLangs; ++InLangs) { + if (*(InLangs + 1)) { + ret += *InLangs; + ret += ", "; + } + else { + ret += *InLangs; + } } return ret; diff --git a/tools/llvmc2/Tool.h b/tools/llvmc2/Tool.h index 4762b1e..93fa5df 100644 --- a/tools/llvmc2/Tool.h +++ b/tools/llvmc2/Tool.h @@ -42,10 +42,10 @@ namespace llvmc { const llvm::sys::Path& outFile, const InputLanguagesSet& InLangs) const = 0; - virtual const char* Name() const = 0; - virtual StrVector InputLanguages() const = 0; - virtual const char* OutputLanguage() const = 0; - virtual const char* OutputSuffix() const = 0; + virtual const char* Name() const = 0; + virtual const char** InputLanguages() const = 0; + virtual const char* OutputLanguage() const = 0; + virtual const char* OutputSuffix() const = 0; virtual bool IsLast() const = 0; virtual bool IsJoin() const = 0; |