diff options
author | Mikhail Glushenkov <foldr@codedgers.com> | 2008-11-17 17:30:25 +0000 |
---|---|---|
committer | Mikhail Glushenkov <foldr@codedgers.com> | 2008-11-17 17:30:25 +0000 |
commit | 35fde150591d7c5f032a5e7c9643315e5f2bedde (patch) | |
tree | 0fe26a6f8a9013fba98fe980595413fce6e3b405 /tools | |
parent | fa2707709d8edb493e33fdeca5710011ec309728 (diff) | |
download | external_llvm-35fde150591d7c5f032a5e7c9643315e5f2bedde.zip external_llvm-35fde150591d7c5f032a5e7c9643315e5f2bedde.tar.gz external_llvm-35fde150591d7c5f032a5e7c9643315e5f2bedde.tar.bz2 |
Support dependencies between plugins by priority-sorting.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59449 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools')
-rw-r--r-- | tools/llvmc2/driver/Plugin.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/tools/llvmc2/driver/Plugin.cpp b/tools/llvmc2/driver/Plugin.cpp index c9b3960..17c7086 100644 --- a/tools/llvmc2/driver/Plugin.cpp +++ b/tools/llvmc2/driver/Plugin.cpp @@ -13,6 +13,7 @@ #include "llvm/CompilerDriver/Plugin.h" +#include <algorithm> #include <vector> namespace { @@ -27,6 +28,13 @@ namespace { static bool pluginListInitialized = false; typedef std::vector<const llvmc::BasePlugin*> PluginList; static PluginList Plugins; + + struct ByPriority { + bool operator()(const llvmc::BasePlugin* lhs, + const llvmc::BasePlugin* rhs) { + return lhs->Priority() < rhs->Priority(); + } + }; } namespace llvmc { @@ -36,6 +44,7 @@ namespace llvmc { for (PluginRegistry::iterator B = PluginRegistry::begin(), E = PluginRegistry::end(); B != E; ++B) Plugins.push_back(B->instantiate()); + std::sort(Plugins.begin(), Plugins.end(), ByPriority()); } pluginListInitialized = true; } |