forked from OSchip/llvm-project
Disallow multiple instances of PluginPriority.
Several instances of PluginPriority in a single file most probably signifies a programming error. llvm-svn: 84350
This commit is contained in:
parent
4500d416aa
commit
b2eba4904f
|
|
@ -0,0 +1,10 @@
|
|||
// Check that multiple plugin priorities are not allowed.
|
||||
// RUN: ignore tblgen -I %p/../../include --gen-llvmc %s |& grep "More than one 'PluginPriority' instance found"
|
||||
|
||||
include "llvm/CompilerDriver/Common.td"
|
||||
|
||||
def Graph : CompilationGraph<[]>;
|
||||
|
||||
def Priority1 : PluginPriority<1>;
|
||||
|
||||
def Priority2 : PluginPriority<2>;
|
||||
|
|
@ -775,11 +775,17 @@ void FillInEdgeVector(RecordVector::const_iterator B,
|
|||
/// CalculatePriority - Calculate the priority of this plugin.
|
||||
int CalculatePriority(RecordVector::const_iterator B,
|
||||
RecordVector::const_iterator E) {
|
||||
int total = 0;
|
||||
for (; B!=E; ++B) {
|
||||
total += static_cast<int>((*B)->getValueAsInt("priority"));
|
||||
int priority = 0;
|
||||
|
||||
if (B != E) {
|
||||
priority = static_cast<int>((*B)->getValueAsInt("priority"));
|
||||
|
||||
if (++B != E)
|
||||
throw std::string("More than one 'PluginPriority' instance found: "
|
||||
"most probably an error!");
|
||||
}
|
||||
return total;
|
||||
|
||||
return priority;
|
||||
}
|
||||
|
||||
/// NotInGraph - Helper function object for FilterNotInGraph.
|
||||
|
|
|
|||
Loading…
Reference in New Issue