10 #ifndef LLVM_CLANG_BASIC_PLISTSUPPORT_H 11 #define LLVM_CLANG_BASIC_PLISTSUPPORT_H 14 #include "llvm/Support/raw_ostream.h" 18 typedef llvm::DenseMap<FileID, unsigned>
FIDMap;
23 FIDMap::iterator I = FIDs.find(FID);
33 FIDMap::const_iterator I = FIDs.find(FID);
34 assert(I != FIDs.end());
38 inline raw_ostream &
Indent(raw_ostream &o,
const unsigned indent) {
39 for (
unsigned i = 0; i < indent; ++i)
45 static const char *PlistHeader =
46 "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" 47 "<!DOCTYPE plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\" " 48 "\"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n" 49 "<plist version=\"1.0\">\n";
50 return o << PlistHeader;
53 inline raw_ostream &
EmitInteger(raw_ostream &o, int64_t value) {
60 inline raw_ostream &
EmitString(raw_ostream &o, StringRef s) {
62 for (StringRef::const_iterator I = s.begin(), E = s.end(); I != E; ++I) {
95 Indent(o, indent) <<
"<dict>\n";
96 Indent(o, indent) <<
" <key>line</key>";
98 Indent(o, indent) <<
" <key>col</key>";
100 Indent(o, indent) <<
" <key>file</key>";
102 Indent(o, indent) <<
"</dict>\n";
109 assert(R.
isCharRange() &&
"cannot handle a token range");
110 Indent(o, indent) <<
"<array>\n";
113 Indent(o, indent) <<
"</array>\n";
void AddFID(FIDMap &FIDs, SmallVectorImpl< FileID > &V, const SourceManager &SM, SourceLocation L)
void EmitLocation(raw_ostream &o, const SourceManager &SM, SourceLocation L, const FIDMap &FM, unsigned indent)
Defines the SourceManager interface.
raw_ostream & EmitInteger(raw_ostream &o, int64_t value)
SourceLocation getBegin() const
SourceLocation getExpansionLoc(SourceLocation Loc) const
Given a SourceLocation object Loc, return the expansion location referenced by the ID...
unsigned getExpansionColumnNumber(bool *Invalid=nullptr) const
unsigned GetFID(const FIDMap &FIDs, const SourceManager &SM, SourceLocation L)
Represents a character-granular source range.
Encodes a location in the source.
llvm::DenseMap< FileID, unsigned > FIDMap
raw_ostream & EmitPlistHeader(raw_ostream &o)
An opaque identifier used by SourceManager which refers to a source file (MemoryBuffer) along with it...
Dataflow Directional Tag Classes.
raw_ostream & Indent(raw_ostream &o, const unsigned indent)
void EmitRange(raw_ostream &o, const SourceManager &SM, CharSourceRange R, const FIDMap &FM, unsigned indent)
unsigned getExpansionLineNumber(bool *Invalid=nullptr) const
FileID getFileID(SourceLocation SpellingLoc) const
Return the FileID for a SourceLocation.
SourceLocation getEnd() const
raw_ostream & EmitString(raw_ostream &o, StringRef s)
A SourceLocation and its associated SourceManager.
This class handles loading and caching of source files into memory.