本文整理汇总了C++中llvm::raw_ostream::indent方法的典型用法代码示例。如果您正苦于以下问题:C++ raw_ostream::indent方法的具体用法?C++ raw_ostream::indent怎么用?C++ raw_ostream::indent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类llvm::raw_ostream
的用法示例。
在下文中一共展示了raw_ostream::indent方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: printGroup
static void printGroup(llvm::raw_ostream &out, const GroupRecord &Group,
bool FlagsOnly, unsigned Indent = 0) {
out.indent(Indent * 2);
bool ShowColors = showColors(out);
setColor(ShowColors, out, llvm::raw_ostream::YELLOW);
out << "-W" << Group.getName() << "\n";
resetColor(ShowColors, out);
++Indent;
for (GroupRecord::subgroup_iterator I = Group.subgroup_begin(),
E = Group.subgroup_end();
I != E; ++I) {
printGroup(out, *I, FlagsOnly, Indent);
}
if (!FlagsOnly) {
for (GroupRecord::diagnostics_iterator I = Group.diagnostics_begin(),
E = Group.diagnostics_end();
I != E; ++I) {
if (ShowColors) {
if (getLevel(I->DiagID) != DiagnosticsEngine::Ignored) {
setColor(ShowColors, out, llvm::raw_ostream::GREEN);
}
}
out.indent(Indent * 2);
out << I->getName();
resetColor(ShowColors, out);
out << "\n";
}
}
}
示例2: print
void CGBitFieldInfo::print(llvm::raw_ostream &OS) const {
OS << "<CGBitFieldInfo";
OS << " Size:" << Size;
OS << " IsSigned:" << IsSigned << "\n";
OS.indent(4 + strlen("<CGBitFieldInfo"));
OS << " NumComponents:" << getNumComponents();
OS << " Components: [";
if (getNumComponents()) {
OS << "\n";
for (unsigned i = 0, e = getNumComponents(); i != e; ++i) {
const AccessInfo &AI = getComponent(i);
OS.indent(8);
OS << "<AccessInfo"
<< " FieldIndex:" << AI.FieldIndex
<< " FieldByteOffset:" << AI.FieldByteOffset
<< " FieldBitStart:" << AI.FieldBitStart
<< " AccessWidth:" << AI.AccessWidth << "\n";
OS.indent(8 + strlen("<AccessInfo"));
OS << " AccessAlignment:" << AI.AccessAlignment
<< " TargetBitOffset:" << AI.TargetBitOffset
<< " TargetBitWidth:" << AI.TargetBitWidth
<< ">\n";
}
OS.indent(4);
}
OS << "]>";
}
示例3: PrintHelpOptionList
static void PrintHelpOptionList(llvm::raw_ostream &OS, llvm::StringRef Title,
std::vector<std::pair<std::string,
const char*> > &OptionHelp) {
OS << Title << ":\n";
// Find the maximum option length.
unsigned OptionFieldWidth = 0;
for (unsigned i = 0, e = OptionHelp.size(); i != e; ++i) {
// Skip titles.
if (!OptionHelp[i].second)
continue;
// Limit the amount of padding we are willing to give up for alignment.
unsigned Length = OptionHelp[i].first.size();
if (Length <= 23)
OptionFieldWidth = std::max(OptionFieldWidth, Length);
}
const unsigned InitialPad = 2;
for (unsigned i = 0, e = OptionHelp.size(); i != e; ++i) {
const std::string &Option = OptionHelp[i].first;
int Pad = OptionFieldWidth - int(Option.size());
OS.indent(InitialPad) << Option;
// Break on long option names.
if (Pad < 0) {
OS << "\n";
Pad = OptionFieldWidth + InitialPad;
}
OS.indent(Pad + 1) << OptionHelp[i].second << '\n';
}
}
示例4: printAccesses
/// Print the current state of all MemoryAccesses to @p OS.
void printAccesses(llvm::raw_ostream &OS, int Indent = 0) const {
OS.indent(Indent) << "After accesses {\n";
for (auto &Stmt : *S) {
OS.indent(Indent + 4) << Stmt.getBaseName() << "\n";
for (auto *MA : Stmt)
MA->print(OS);
}
OS.indent(Indent) << "}\n";
}
示例5: printDetail
void TempScop::printDetail(llvm::raw_ostream &OS, ScalarEvolution *SE,
LoopInfo *LI, const Region *CurR,
unsigned ind) const {
// Print the loop bounds, if the current region is a loop.
LoopBoundMapType::const_iterator at = LoopBounds.find(castToLoop(*CurR, *LI));
if (at != LoopBounds.end()) {
OS.indent(ind) << "Bounds of Loop: " << at->first->getHeader()->getName()
<< ":\t{ ";
at->second.print(OS, false);
OS << " }\n";
ind += 2;
}
// Iterate over the region nodes of this Scop to print the access functions
// and loop bounds.
for (Region::const_element_iterator I = CurR->element_begin(),
E = CurR->element_end(); I != E; ++I) {
if (I->isSubRegion()) {
Region *subR = I->getNodeAs<Region>();
printDetail(OS, SE, LI, subR, ind + 2);
} else {
BasicBlock *BB = I->getNodeAs<BasicBlock>();
if (const AccFuncSetType *AccFunc = getAccessFunctions(BB)) {
OS.indent(ind) << "BB: " << BB->getName() << "{\n";
for (AccFuncSetType::const_iterator FI = AccFunc->begin(),
FE = AccFunc->end(); FI != FE; ++FI) {
const SCEVAffFunc &AF = FI->first;
const Value *Ptr = AF.getBaseAddr();
OS.indent(ind + 2) << AF << " Refs: ";
for (MayAliasSetInfo::const_alias_iterator
MI = MayASInfo->alias_begin(Ptr), ME = MayASInfo->alias_end(Ptr);
MI != ME; ++MI) {
MI->second->print(OS);
OS << ", ";
}
OS << '\n';
}
if (Reductions.count(BB))
OS.indent(ind + 2) << "Reduction\n";
OS.indent(ind) << "}\n";
}
}
}
}
示例6: print
void SymbolicValue::print(llvm::raw_ostream &os, unsigned indent) const {
os.indent(indent);
switch (representationKind) {
case RK_Unknown: {
os << "unknown(" << (int)getUnknownReason() << "): ";
getUnknownNode()->dump();
return;
}
case RK_Metatype:
os << "metatype: ";
getMetatypeValue()->print(os);
os << "\n";
return;
case RK_Function: {
auto fn = getFunctionValue();
os << "fn: " << fn->getName() << ": ";
os << Demangle::demangleSymbolAsString(fn->getName());
os << "\n";
return;
}
case RK_Integer:
case RK_IntegerInline:
os << "int: " << getIntegerValue() << "\n";
return;
case RK_Aggregate: {
ArrayRef<SymbolicValue> elements = getAggregateValue();
switch (elements.size()) {
case 0:
os << "agg: 0 elements []\n";
return;
case 1:
os << "agg: 1 elt: ";
elements[0].print(os, indent + 2);
return;
default:
os << "agg: " << elements.size() << " elements [\n";
for (auto elt : elements)
elt.print(os, indent + 2);
os.indent(indent) << "]\n";
return;
}
}
}
}
示例7: dump
void SubstitutionMap::dump(llvm::raw_ostream &out) const {
out << "Substitutions:\n";
for (const auto &sub : subMap) {
out.indent(2);
sub.first->print(out);
out << " -> ";
sub.second->print(out);
out << "\n";
}
out << "\nConformance map:\n";
for (const auto &conformances : conformanceMap) {
out.indent(2);
conformances.first->print(out);
out << " -> [";
interleave(conformances.second.begin(), conformances.second.end(),
[&](ProtocolConformanceRef conf) {
conf.dump(out);
},
[&] {
out << ", ";
});
out << "]\n";
}
out << "\nParent map:\n";
for (const auto &parent : parentMap) {
out.indent(2);
parent.first->print(out);
out << " -> [";
interleave(parent.second.begin(), parent.second.end(),
[&](SubstitutionMap::ParentType parentType) {
parentType.first->print(out);
out << " @ ";
out << parentType.second->getProtocol()->getName().str()
<< "." << parentType.second->getName().str();
},
[&] {
out << ", ";
});
out << "]\n";
}
}
示例8: printStatistics
/// Print simplification statistics to @p OS.
void printStatistics(llvm::raw_ostream &OS, int Indent = 0) const {
OS.indent(Indent) << "Statistics {\n";
OS.indent(Indent + 4) << "Overwrites removed: " << OverwritesRemoved
<< '\n';
OS.indent(Indent + 4) << "Partial writes coalesced: " << WritesCoalesced
<< "\n";
OS.indent(Indent + 4) << "Redundant writes removed: "
<< RedundantWritesRemoved << "\n";
OS.indent(Indent + 4) << "Accesses with empty domains removed: "
<< EmptyPartialAccessesRemoved << "\n";
OS.indent(Indent + 4) << "Dead accesses removed: " << DeadAccessesRemoved
<< '\n';
OS.indent(Indent + 4) << "Dead instructions removed: "
<< DeadInstructionsRemoved << '\n';
OS.indent(Indent + 4) << "Stmts removed: " << StmtsRemoved << "\n";
OS.indent(Indent) << "}\n";
}
示例9: printHelp
void CheckerRegistry::printHelp(llvm::raw_ostream &out,
size_t maxNameChars) const {
// FIXME: Alphabetical sort puts 'experimental' in the middle.
// Would it be better to name it '~experimental' or something else
// that's ASCIIbetically last?
std::sort(Checkers.begin(), Checkers.end(), checkerNameLT);
// FIXME: Print available packages.
out << "CHECKERS:\n";
// Find the maximum option length.
size_t optionFieldWidth = 0;
for (CheckerInfoList::const_iterator i = Checkers.begin(), e = Checkers.end();
i != e; ++i) {
// Limit the amount of padding we are willing to give up for alignment.
// Package.Name Description [Hidden]
size_t nameLength = i->FullName.size();
if (nameLength <= maxNameChars)
optionFieldWidth = std::max(optionFieldWidth, nameLength);
}
const size_t initialPad = 2;
for (CheckerInfoList::const_iterator i = Checkers.begin(), e = Checkers.end();
i != e; ++i) {
out.indent(initialPad) << i->FullName;
int pad = optionFieldWidth - i->FullName.size();
// Break on long option names.
if (pad < 0) {
out << '\n';
pad = optionFieldWidth + initialPad;
}
out.indent(pad + 2) << i->Desc;
out << '\n';
}
}
示例10: Dump
void Table::Dump(llvm::raw_ostream &OS, llvm::StringRef Prefix) const {
for(unsigned I = 0, E = RowsCount(); I < E; ++I) {
if(!Prefix.empty()) {
OS.changeColor(llvm::raw_ostream::GREEN) << Prefix << ": ";
OS.resetColor();
}
for(unsigned J = 0, K = ColsCount(); J < K; ++J) {
llvm::StringRef Cell = Columns[J][I];
OS.indent(Columns[J].GetWidth() - Cell.size()) << Cell;
if(J != K - 1)
OS << " ";
}
OS << "\n";
}
}
示例11: printConnectedComponents
void ConstraintGraph::printConnectedComponents(llvm::raw_ostream &out) {
SmallVector<TypeVariableType *, 16> typeVars;
SmallVector<unsigned, 16> components;
unsigned numComponents = computeConnectedComponents(typeVars, components);
for (unsigned component = 0; component != numComponents; ++component) {
out.indent(2);
out << component << ":";
for (unsigned i = 0, n = typeVars.size(); i != n; ++i) {
if (components[i] == component) {
out << ' ';
typeVars[i]->print(out);
}
}
out << '\n';
}
}
示例12: print
void PabloPrinter::print(const Statement * stmt, llvm::raw_ostream & out, const bool expandNested, const unsigned indent) {
out.indent(indent);
if (stmt == nullptr) {
out << "<null-stmt>";
} else if (const Assign * an = dyn_cast<const Assign>(stmt)) {
out << an->getName() << " = ";
print(an->getExpression(), out);
} else if (const Next * next = dyn_cast<const Next>(stmt)) {
out << "Next(" << next->getName() << ") = ";
print(next->getExpr(), out);
} else if (const If * ifNode = dyn_cast<const If>(stmt)) {
out << "If ";
print(ifNode->getCondition(), out);
if (expandNested) {
out << ":\n";
print(ifNode->getBody(), out, true, indent + BlockIndenting);
if (ifNode->getDefined().size() > 0) {
out.indent(indent);
out << "Else:\n";
print_vars(ifNode->getDefined(), out, indent + BlockIndenting);
}
}
} else if (const While * whileNode = dyn_cast<const While>(stmt)) {
out << "While ";
print(whileNode->getCondition(), out);
if (expandNested) {
out << ":\n";
print(whileNode->getBody(), out, true, indent + BlockIndenting);
}
} else if (const Call * call = dyn_cast<const Call>(stmt)) {
if (call->getPrototype()->getNumOfResults() > 0) {
out << " = ";
}
out << call->getCallee() << "(";
for (unsigned i = 0; i != call->getNumOperands(); ++i) {
print(call->getOperand(i), out);
}
out << ")";
} else if (const And * andNode = dyn_cast<const And>(stmt)) {
out << andNode->getName() << " = (";
for (unsigned i = 0; i != andNode->getNumOperands(); ++i) {
if (i) out << " & ";
print(andNode->getOperand(i), out);
}
out << ")";
} else if (const Or * orNode = dyn_cast<const Or>(stmt)) {
out << orNode->getName() << " = (";
for (unsigned i = 0; i != orNode->getNumOperands(); ++i) {
if (i) out << " | ";
print(orNode->getOperand(i), out);
}
out << ")";
} else if (const Xor * xorNode = dyn_cast<const Xor>(stmt)) {
out << xorNode->getName() << " = (";
for (unsigned i = 0; i != xorNode->getNumOperands(); ++i) {
if (i) out << " ^ ";
print(xorNode->getOperand(i), out);
}
out << ")";
} else if (const Sel * selNode = dyn_cast<const Sel>(stmt)) {
out << selNode->getName() << " = (";
print(selNode->getCondition(), out);
out << " ? ";
print(selNode->getTrueExpr(), out);
out << " : ";
print(selNode->getFalseExpr(), out);
out << ")";
} else if (const Not * notNode = dyn_cast<const Not>(stmt)) {
out << notNode->getName() << " = (~";
print(notNode->getExpr(), out);
out << ")";
} else if (const Advance * adv = dyn_cast<const Advance>(stmt)) {
out << adv->getName() << " = pablo.Advance(";
print(adv->getExpr(), out);
out << ", " << std::to_string(adv->getAmount()) << ")";
} else if (const Lookahead * adv = dyn_cast<const Lookahead>(stmt)) {
out << adv->getName() << " = pablo.Lookahead(";
print(adv->getExpr(), out);
out << ", " << std::to_string(adv->getAmount()) << ")";
} else if (const MatchStar * mstar = dyn_cast<const MatchStar>(stmt)) {
out << mstar->getName() << " = pablo.MatchStar(";
print(mstar->getMarker(), out);
out << ", ";
print(mstar->getCharClass(), out);
out << ")";
} else if (const ScanThru * sthru = dyn_cast<const ScanThru>(stmt)) {
out << sthru->getName() << " = pablo.ScanThru(";
print(sthru->getScanFrom(), out);
out << ", ";
print(sthru->getScanThru(), out);
out << ")";
} else if (const Count * count = dyn_cast<const Count>(stmt)) {
out << count->getName() << " = pablo.Count(";
print(count->getExpr(), out);
out << ")";
} else {
out << "???";
}
}
示例13: print_vars
inline void print_vars(const pablo::If::DefinedVars & vars, llvm::raw_ostream & out, const unsigned indent) {
for (const Assign * def : vars) {
out.indent(indent);
out << def->getName() << " = 0\n";
}
}
示例14: print
void ConstraintGraphNode::print(llvm::raw_ostream &out, unsigned indent) {
out.indent(indent);
TypeVar->print(out);
out << ":\n";
// Print constraints.
if (!Constraints.empty()) {
out.indent(indent + 2);
out << "Constraints:\n";
SmallVector<Constraint *, 4> sortedConstraints(Constraints.begin(),
Constraints.end());
std::sort(sortedConstraints.begin(), sortedConstraints.end());
for (auto constraint : sortedConstraints) {
out.indent(indent + 4);
constraint->print(out, &TypeVar->getASTContext().SourceMgr);
out << "\n";
}
}
// Print adjacencies.
if (!Adjacencies.empty()) {
out.indent(indent + 2);
out << "Adjacencies:";
SmallVector<TypeVariableType *, 4> sortedAdjacencies(Adjacencies.begin(),
Adjacencies.end());
std::sort(sortedAdjacencies.begin(), sortedAdjacencies.end(),
[&](TypeVariableType *typeVar1, TypeVariableType *typeVar2) {
return typeVar1->getID() < typeVar2->getID();
});
for (auto adj : sortedAdjacencies) {
out << ' ';
adj->print(out);
auto &info = AdjacencyInfo[adj];
auto degree = info.NumConstraints;
if (degree > 1 || info.FixedBinding) {
out << " (";
if (degree > 1) {
out << degree;
if (info.FixedBinding)
out << ", fixed";
} else {
out << "fixed";
}
out << ")";
}
}
out << "\n";
}
// Print equivalence class.
if (TypeVar->getImpl().getRepresentative(nullptr) == TypeVar &&
EquivalenceClass.size() > 1) {
out.indent(indent + 2);
out << "Equivalence class:";
for (unsigned i = 1, n = EquivalenceClass.size(); i != n; ++i) {
out << ' ';
EquivalenceClass[i]->print(out);
}
out << "\n";
}
// Print member types.
if (!MemberTypes.empty()) {
out.indent(indent + 2);
out << "Member types:\n";
for (auto memberType : MemberTypes) {
out.indent(indent + 4);
out << memberType.first.str() << " -> ";
memberType.second->print(out);
out << "\n";
}
out << "\n";
}
}
示例15: print
void Module::print(llvm::raw_ostream &OS, unsigned Indent) const {
OS.indent(Indent);
if (IsFramework)
OS << "framework ";
if (IsExplicit)
OS << "explicit ";
OS << "module " << Name << " {\n";
if (!Requires.empty()) {
OS.indent(Indent + 2);
OS << "requires ";
for (unsigned I = 0, N = Requires.size(); I != N; ++I) {
if (I)
OS << ", ";
OS << Requires[I];
}
OS << "\n";
}
if (const FileEntry *UmbrellaHeader = getUmbrellaHeader()) {
OS.indent(Indent + 2);
OS << "umbrella header \"";
OS.write_escaped(UmbrellaHeader->getName());
OS << "\"\n";
} else if (const DirectoryEntry *UmbrellaDir = getUmbrellaDir()) {
OS.indent(Indent + 2);
OS << "umbrella \"";
OS.write_escaped(UmbrellaDir->getName());
OS << "\"\n";
}
for (unsigned I = 0, N = Headers.size(); I != N; ++I) {
OS.indent(Indent + 2);
OS << "header \"";
OS.write_escaped(Headers[I]->getName());
OS << "\"\n";
}
for (submodule_const_iterator MI = submodule_begin(), MIEnd = submodule_end();
MI != MIEnd; ++MI)
(*MI)->print(OS, Indent + 2);
for (unsigned I = 0, N = Exports.size(); I != N; ++I) {
OS.indent(Indent + 2);
OS << "export ";
if (Module *Restriction = Exports[I].getPointer()) {
OS << Restriction->getFullModuleName();
if (Exports[I].getInt())
OS << ".*";
} else {
OS << "*";
}
OS << "\n";
}
for (unsigned I = 0, N = UnresolvedExports.size(); I != N; ++I) {
OS.indent(Indent + 2);
OS << "export ";
printModuleId(OS, UnresolvedExports[I].Id);
if (UnresolvedExports[I].Wildcard) {
if (UnresolvedExports[I].Id.empty())
OS << "*";
else
OS << ".*";
}
OS << "\n";
}
if (InferSubmodules) {
OS.indent(Indent + 2);
if (InferExplicitSubmodules)
OS << "explicit ";
OS << "module * {\n";
if (InferExportWildcard) {
OS.indent(Indent + 4);
OS << "export *\n";
}
OS.indent(Indent + 2);
OS << "}\n";
}
OS.indent(Indent);
OS << "}\n";
}