本文整理汇总了C++中Multilib::flags方法的典型用法代码示例。如果您正苦于以下问题:C++ Multilib::flags方法的具体用法?C++ Multilib::flags怎么用?C++ Multilib::flags使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Multilib
的用法示例。
在下文中一共展示了Multilib::flags方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TEST
TEST(MultilibTest, Construction3) {
Multilib M = Multilib().flag("+f1").flag("+f2").flag("-f3");
for (Multilib::flags_list::const_iterator I = M.flags().begin(),
E = M.flags().end();
I != E; ++I) {
ASSERT_TRUE(llvm::StringSwitch<bool>(*I)
.Cases("+f1", "+f2", "-f3", true)
.Default(false));
}
}
示例2: hasFlag
static bool hasFlag(const Multilib &M, StringRef Flag) {
for (Multilib::flags_list::const_iterator I = M.flags().begin(),
E = M.flags().end();
I != E; ++I) {
if (*I == Flag)
return true;
else if (StringRef(*I).substr(1) == Flag.substr(1))
return false;
}
return false;
}
示例3: select
bool MultilibSet::select(const Multilib::flags_list &Flags, Multilib &M) const {
llvm::StringMap<bool> FlagSet;
// Stuff all of the flags into the FlagSet such that a true mappend indicates
// the flag was enabled, and a false mappend indicates the flag was disabled.
for (StringRef Flag : Flags)
FlagSet[Flag.substr(1)] = isFlagEnabled(Flag);
multilib_list Filtered = filterCopy([&FlagSet](const Multilib &M) {
for (StringRef Flag : M.flags()) {
llvm::StringMap<bool>::const_iterator SI = FlagSet.find(Flag.substr(1));
if (SI != FlagSet.end())
if (SI->getValue() != isFlagEnabled(Flag))
return true;
}
return false;
}, Multilibs);
if (Filtered.size() == 0) {
return false;
} else if (Filtered.size() == 1) {
M = Filtered[0];
return true;
}
// TODO: pick the "best" multlib when more than one is suitable
assert(false);
return false;
}
示例4: compose
static Multilib compose(const Multilib &Base, const Multilib &New) {
SmallString<128> GCCSuffix;
llvm::sys::path::append(GCCSuffix, "/", Base.gccSuffix(), New.gccSuffix());
SmallString<128> OSSuffix;
llvm::sys::path::append(OSSuffix, "/", Base.osSuffix(), New.osSuffix());
SmallString<128> IncludeSuffix;
llvm::sys::path::append(IncludeSuffix, "/", Base.includeSuffix(),
New.includeSuffix());
Multilib Composed(GCCSuffix, OSSuffix, IncludeSuffix);
Multilib::flags_list &Flags = Composed.flags();
Flags.insert(Flags.end(), Base.flags().begin(), Base.flags().end());
Flags.insert(Flags.end(), New.flags().begin(), New.flags().end());
return Composed;
}
示例5: Either
MultilibSet &MultilibSet::Maybe(const Multilib &M) {
Multilib Opposite;
// Negate any '+' flags
for (StringRef Flag : M.flags()) {
if (Flag.front() == '+')
Opposite.flags().push_back(("-" + Flag.substr(1)).str());
}
return Either(M, Opposite);
}
示例6: operator
bool operator()(const Multilib &M) const override {
for (StringRef Flag : M.flags()) {
llvm::StringMap<bool>::const_iterator SI = FlagSet.find(Flag.substr(1));
if (SI != FlagSet.end())
if (SI->getValue() != isFlagEnabled(Flag))
return true;
}
return false;
}