本文整理汇总了C++中PathDiagnosticControlFlowPiece类的典型用法代码示例。如果您正苦于以下问题:C++ PathDiagnosticControlFlowPiece类的具体用法?C++ PathDiagnosticControlFlowPiece怎么用?C++ PathDiagnosticControlFlowPiece使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PathDiagnosticControlFlowPiece类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: compareControlFlow
static llvm::Optional<bool>
compareControlFlow(const PathDiagnosticControlFlowPiece &X,
const PathDiagnosticControlFlowPiece &Y) {
FullSourceLoc XSL = X.getStartLocation().asLocation();
FullSourceLoc YSL = Y.getStartLocation().asLocation();
if (XSL != YSL)
return XSL.isBeforeInTranslationUnitThan(YSL);
FullSourceLoc XEL = X.getEndLocation().asLocation();
FullSourceLoc YEL = Y.getEndLocation().asLocation();
if (XEL != YEL)
return XEL.isBeforeInTranslationUnitThan(YEL);
return llvm::Optional<bool>();
}
示例3: 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";
}