diff options
Diffstat (limited to 'include/clang/Basic/PlistSupport.h')
-rw-r--r-- | include/clang/Basic/PlistSupport.h | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/include/clang/Basic/PlistSupport.h b/include/clang/Basic/PlistSupport.h index 081f22d..84dd291 100644 --- a/include/clang/Basic/PlistSupport.h +++ b/include/clang/Basic/PlistSupport.h @@ -12,7 +12,6 @@ #include "clang/Basic/FileManager.h" #include "clang/Basic/SourceManager.h" -#include "clang/Lex/Lexer.h" #include "llvm/Support/raw_ostream.h" namespace clang { @@ -89,31 +88,29 @@ inline raw_ostream &EmitString(raw_ostream &o, StringRef s) { } inline void EmitLocation(raw_ostream &o, const SourceManager &SM, - const LangOptions &LangOpts, SourceLocation L, - const FIDMap &FM, unsigned indent, - bool extend = false) { - FullSourceLoc Loc(SM.getExpansionLoc(L), const_cast<SourceManager &>(SM)); + SourceLocation L, const FIDMap &FM, unsigned indent) { + if (L.isInvalid()) return; - // Add in the length of the token, so that we cover multi-char tokens. - unsigned offset = - extend ? Lexer::MeasureTokenLength(Loc, SM, LangOpts) - 1 : 0; + FullSourceLoc Loc(SM.getExpansionLoc(L), const_cast<SourceManager &>(SM)); Indent(o, indent) << "<dict>\n"; Indent(o, indent) << " <key>line</key>"; EmitInteger(o, Loc.getExpansionLineNumber()) << '\n'; Indent(o, indent) << " <key>col</key>"; - EmitInteger(o, Loc.getExpansionColumnNumber() + offset) << '\n'; + EmitInteger(o, Loc.getExpansionColumnNumber()) << '\n'; Indent(o, indent) << " <key>file</key>"; EmitInteger(o, GetFID(FM, SM, Loc)) << '\n'; Indent(o, indent) << "</dict>\n"; } inline void EmitRange(raw_ostream &o, const SourceManager &SM, - const LangOptions &LangOpts, CharSourceRange R, - const FIDMap &FM, unsigned indent) { + CharSourceRange R, const FIDMap &FM, unsigned indent) { + if (R.isInvalid()) return; + + assert(R.isCharRange() && "cannot handle a token range"); Indent(o, indent) << "<array>\n"; - EmitLocation(o, SM, LangOpts, R.getBegin(), FM, indent + 1); - EmitLocation(o, SM, LangOpts, R.getEnd(), FM, indent + 1, R.isTokenRange()); + EmitLocation(o, SM, R.getBegin(), FM, indent + 1); + EmitLocation(o, SM, R.getEnd(), FM, indent + 1); Indent(o, indent) << "</array>\n"; } } |