本文整理汇总了C++中llvm::raw_ostream::write_escaped方法的典型用法代码示例。如果您正苦于以下问题:C++ raw_ostream::write_escaped方法的具体用法?C++ raw_ostream::write_escaped怎么用?C++ raw_ostream::write_escaped使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类llvm::raw_ostream
的用法示例。
在下文中一共展示了raw_ostream::write_escaped方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: dump
void RawSyntax::dump(llvm::raw_ostream &OS, unsigned Indent) const {
auto indent = [&](unsigned Amount) {
for (decltype(Amount) i = 0; i < Amount; ++i) {
OS << ' ';
}
};
indent(Indent);
OS << '(';
dumpSyntaxKind(OS, getKind());
if (isMissing())
OS << " [missing] ";
if (isToken()) {
OS << " ";
dumpTokenKind(OS, getTokenKind());
for (auto &Leader : getLeadingTrivia()) {
OS << "\n";
Leader.dump(OS, Indent + 1);
}
OS << "\n";
indent(Indent + 1);
OS << "(text=\"";
OS.write_escaped(getTokenText(), /*UseHexEscapes=*/true);
OS << "\")";
for (auto &Trailer : getTrailingTrivia()) {
OS << "\n";
Trailer.dump(OS, Indent + 1);
}
} else {
for (auto &Child : getLayout()) {
if (!Child)
continue;
OS << "\n";
Child->dump(OS, Indent + 1);
}
}
OS << ')';
}
示例2: 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";
}