14 #ifndef LLVM_CLANG_FRONTEND_COMMANDLINESOURCELOC_H 15 #define LLVM_CLANG_FRONTEND_COMMANDLINESOURCELOC_H 18 #include "llvm/Support/CommandLine.h" 19 #include "llvm/Support/raw_ostream.h" 34 std::pair<StringRef, StringRef> ColSplit = Str.rsplit(
':');
35 std::pair<StringRef, StringRef> LineSplit =
36 ColSplit.first.rsplit(
':');
39 if (!ColSplit.second.getAsInteger(10, PSL.
Column) &&
40 !LineSplit.second.getAsInteger(10, PSL.
Line)) {
58 std::pair<unsigned, unsigned>
Begin;
61 std::pair<unsigned, unsigned>
End;
73 std::pair<StringRef, StringRef> RangeSplit = Str.rsplit(
'-');
74 unsigned EndLine, EndColumn;
75 bool HasEndLoc =
false;
76 if (!RangeSplit.second.empty()) {
77 std::pair<StringRef, StringRef>
Split = RangeSplit.second.rsplit(
':');
78 if (Split.first.getAsInteger(10, EndLine) ||
79 Split.second.getAsInteger(10, EndColumn)) {
83 RangeSplit.first = Str;
88 if (Begin.FileName.empty())
92 EndColumn = Begin.Column;
95 {Begin.Line, Begin.Column},
96 {EndLine, EndColumn}};
107 class parser<
clang::ParsedSourceLocation> final
110 inline bool parse(Option &O, StringRef ArgName, StringRef ArgValue,
115 parser<clang::ParsedSourceLocation>::
116 parse(Option &O, StringRef ArgName, StringRef ArgValue,
118 using namespace clang;
123 <<
"source location must be of the form filename:line:column\n";
Specialize PointerLikeTypeTraits to allow LazyGenerationalUpdatePtr to be placed into a PointerUnion...
static Optional< ParsedSourceRange > fromString(StringRef Str)
Returns a parsed source range from a string or None if the string is invalid.
A source range that has been parsed on the command line.
std::pair< unsigned, unsigned > End
The ending location of the range.
A source location that has been parsed on the command line.
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified...
std::pair< unsigned, unsigned > Begin
The starting location of the range.
Dataflow Directional Tag Classes.
static ParsedSourceLocation FromString(StringRef Str)
Construct a parsed source location from a string; the Filename is empty on error. ...