indicate whether or not the range represents an absolute range or should be
extended by lexing to the end of the token.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69834
91177308-0d34-0410-b5e6-
96231b3b80d8
//===----------------------------------------------------------------------===//
// Path-sensitive diagnostics.
//===----------------------------------------------------------------------===//
+
+class PathDiagnosticRange : public SourceRange {
+public:
+ const bool isPoint;
+
+ PathDiagnosticRange(const SourceRange &R, bool isP = false)
+ : SourceRange(R), isPoint(isP) {}
+};
class PathDiagnosticLocation {
private:
const SourceManager& getSourceManager() const { assert(isValid());return *SM;}
FullSourceLoc asLocation() const;
- SourceRange asRange() const;
+ PathDiagnosticRange asRange() const;
const Stmt *asStmt() const { assert(isValid()); return S; }
const Decl *asDecl() const { assert(isValid()); return D; }
return FullSourceLoc(R.getBegin(), const_cast<SourceManager&>(*SM));
}
-SourceRange PathDiagnosticLocation::asRange() const {
+PathDiagnosticRange PathDiagnosticLocation::asRange() const {
assert(isValid());
// Note that we want a 'switch' here so that the compiler can warn us in
// case we add more cases.
switch (K) {
case SingleLocK:
+ return PathDiagnosticRange(R, true);
case RangeK:
break;
case StmtK: {
}
else {
SourceLocation L = D->getLocation();
- return SourceRange(L, L);
+ return PathDiagnosticRange(SourceRange(L, L), true);
}
}
static void EmitRange(llvm::raw_ostream& o, const SourceManager &SM,
const LangOptions &LangOpts,
- SourceRange R, const FIDMap &FM,
+ PathDiagnosticRange R, const FIDMap &FM,
unsigned indent) {
Indent(o, indent) << "<array>\n";
EmitLocation(o, SM, LangOpts, R.getBegin(), FM, indent+1);
- EmitLocation(o, SM, LangOpts, R.getEnd(), FM, indent+1, true);
+ EmitLocation(o, SM, LangOpts, R.getEnd(), FM, indent+1, !R.isPoint);
Indent(o, indent) << "</array>\n";
}