本文整理汇总了C++中PathDiagnosticControlFlowPiece::begin方法的典型用法代码示例。如果您正苦于以下问题:C++ PathDiagnosticControlFlowPiece::begin方法的具体用法?C++ PathDiagnosticControlFlowPiece::begin怎么用?C++ PathDiagnosticControlFlowPiece::begin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PathDiagnosticControlFlowPiece
的用法示例。
在下文中一共展示了PathDiagnosticControlFlowPiece::begin方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ReportControlFlow
static void ReportControlFlow(raw_ostream &o,
const PathDiagnosticControlFlowPiece& P,
const FIDMap& FM,
const SourceManager &SM,
const LangOptions &LangOpts,
unsigned indent) {
Indent(o, indent) << "<dict>\n";
++indent;
Indent(o, indent) << "<key>kind</key><string>control</string>\n";
// Emit edges.
Indent(o, indent) << "<key>edges</key>\n";
++indent;
Indent(o, indent) << "<array>\n";
++indent;
for (PathDiagnosticControlFlowPiece::const_iterator I=P.begin(), E=P.end();
I!=E; ++I) {
Indent(o, indent) << "<dict>\n";
++indent;
// Make the ranges of the start and end point self-consistent with adjacent edges
// by forcing to use only the beginning of the range. This simplifies the layout
// logic for clients.
Indent(o, indent) << "<key>start</key>\n";
SourceRange StartEdge(
SM.getExpansionLoc(I->getStart().asRange().getBegin()));
EmitRange(o, SM, Lexer::getAsCharRange(StartEdge, SM, LangOpts), FM,
indent + 1);
Indent(o, indent) << "<key>end</key>\n";
SourceRange EndEdge(SM.getExpansionLoc(I->getEnd().asRange().getBegin()));
EmitRange(o, SM, Lexer::getAsCharRange(EndEdge, SM, LangOpts), FM,
indent + 1);
--indent;
Indent(o, indent) << "</dict>\n";
}
--indent;
Indent(o, indent) << "</array>\n";
--indent;
// Output any helper text.
const std::string& s = P.getString();
if (!s.empty()) {
Indent(o, indent) << "<key>alternate</key>";
EmitString(o, s) << '\n';
}
--indent;
Indent(o, indent) << "</dict>\n";
}
示例2: ReportControlFlow
static void ReportControlFlow(llvm::raw_ostream& o,
const PathDiagnosticControlFlowPiece& P,
const FIDMap& FM,
const SourceManager &SM,
const LangOptions &LangOpts,
unsigned indent) {
Indent(o, indent) << "<dict>\n";
++indent;
Indent(o, indent) << "<key>kind</key><string>control</string>\n";
// Emit edges.
Indent(o, indent) << "<key>edges</key>\n";
++indent;
Indent(o, indent) << "<array>\n";
++indent;
for (PathDiagnosticControlFlowPiece::const_iterator I=P.begin(), E=P.end();
I!=E; ++I) {
Indent(o, indent) << "<dict>\n";
++indent;
Indent(o, indent) << "<key>start</key>\n";
EmitRange(o, SM, LangOpts, I->getStart().asRange(), FM, indent+1);
Indent(o, indent) << "<key>end</key>\n";
EmitRange(o, SM, LangOpts, I->getEnd().asRange(), FM, indent+1);
--indent;
Indent(o, indent) << "</dict>\n";
}
--indent;
Indent(o, indent) << "</array>\n";
--indent;
// Output any helper text.
const std::string& s = P.getString();
if (!s.empty()) {
Indent(o, indent) << "<key>alternate</key>";
EmitString(o, s) << '\n';
}
--indent;
Indent(o, indent) << "</dict>\n";
}