本文整理汇总了C++中llvm::SmallVector::size方法的典型用法代码示例。如果您正苦于以下问题:C++ SmallVector::size方法的具体用法?C++ SmallVector::size怎么用?C++ SmallVector::size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类llvm::SmallVector
的用法示例。
在下文中一共展示了SmallVector::size方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
CGFunctionInfo::CGFunctionInfo(QualType ResTy,
const llvm::SmallVector<QualType, 16> &ArgTys) {
NumArgs = ArgTys.size();
Args = new ArgInfo[1 + NumArgs];
Args[0].type = ResTy;
for (unsigned i = 0; i < NumArgs; ++i)
Args[1 + i].type = ArgTys[i];
}
示例2: parse_float
std::string clang_c_convertert::parse_float(
llvm::SmallVector<char, 32> &src,
mp_integer &significand,
mp_integer &exponent)
{
// {digit}{dot}{31 digits}[+-]{exponent}
unsigned p = 0;
// get whole number
std::string str_whole_number = "";
str_whole_number += src[p++];
// skip dot
assert(src[p] == '.');
p++;
// get fraction part
std::string str_fraction_part = "";
while (src[p] != 'E')
str_fraction_part += src[p++];
// skip E
assert(src[p] == 'E');
p++;
// get exponent
assert(src[p] == '+' || src[p] == '-');
// skip +
if(src[p] == '+')
p++;
std::string str_exponent = "";
str_exponent += src[p++];
while (p < src.size())
str_exponent += src[p++];
std::string str_number = str_whole_number + str_fraction_part;
if (str_number.empty())
significand = 0;
else
significand = string2integer(str_number);
if (str_exponent.empty())
exponent = 0;
else
exponent = string2integer(str_exponent);
exponent -= str_fraction_part.size();
return str_whole_number;
}
示例3: rankArgsMatch
/**
* Check if rank arguments of send, recv pair match.
*
* @return is matching
*/
bool MPICheckerAST::rankArgsMatch(const MPICall &sendCall,
const MPICall &recvCall,
const MPIRankCase &sendCase,
const MPIRankCase &recvCase) const {
// match special case
if (isFirstLastPair(sendCall, recvCall, sendCase, recvCase)) return true;
// compare ranks
const auto &rankArgSend = sendCall.arg(MPIPointToPoint::kRank);
const auto &rankArgRecv = recvCall.arg(MPIPointToPoint::kRank);
if (rankArgSend.valueSequence().size() !=
rankArgRecv.valueSequence().size())
return false;
// build sequences without last operator(skip first element)
const llvm::SmallVector<std::string, 4> sendValSeq{
rankArgSend.valueSequence().begin() + 1,
rankArgSend.valueSequence().end()},
recvValSeq{rankArgRecv.valueSequence().begin() + 1,
rankArgRecv.valueSequence().end()};
bool containsSubtraction{false};
for (size_t i = 0; i < sendValSeq.size(); ++i) {
if (sendValSeq[i] == "-" || recvValSeq[i] == "-") {
containsSubtraction = true;
break;
}
}
// check ordered
if (containsSubtraction && (sendValSeq != recvValSeq)) return false;
// check permutation
if (!containsSubtraction &&
(!cont::isPermutation(sendValSeq, recvValSeq))) {
return false;
}
// last (value|var|function) must be identical
if (sendValSeq.back() != recvValSeq.back()) return false;
// last operator must be inverse
if (!rankArgSend.isLastOperatorInverse(rankArgRecv)) return false;
return true;
}
示例4: CheckForClashingNames
///\brief Checks for clashing names when trying to extract a declaration.
///
///\returns true if there is another declaration with the same name
bool DeclExtractor::CheckForClashingNames(
const llvm::SmallVector<NamedDecl*, 4>& Decls,
DeclContext* DC, Scope* S) {
for (size_t i = 0; i < Decls.size(); ++i) {
NamedDecl* ND = Decls[i];
if (TagDecl* TD = dyn_cast<TagDecl>(ND)) {
LookupResult Previous(*m_Sema, ND->getDeclName(), ND->getLocation(),
Sema::LookupTagName, Sema::ForRedeclaration
);
m_Sema->LookupName(Previous, S);
// There is no function diagnosing the redeclaration of tags (eg. enums).
// So either we have to do it by hand or we can call the top-most
// function that does the check. Currently the top-most clang function
// doing the checks creates an AST node, which we don't want.
if (!CheckTagDeclaration(TD, Previous))
return true;
}
else if (VarDecl* VD = dyn_cast<VarDecl>(ND)) {
LookupResult Previous(*m_Sema, ND->getDeclName(), ND->getLocation(),
Sema::LookupOrdinaryName, Sema::ForRedeclaration
);
m_Sema->LookupName(Previous, S);
m_Sema->CheckVariableDeclaration(VD, Previous);
if (VD->isInvalidDecl())
return true;
// This var decl will likely get referenced later; claim that it's used.
VD->setIsUsed();
}
}
return false;
}