Go to the documentation of this file.
9 #ifndef LLVM_CLANG_BASIC_PLISTSUPPORT_H
10 #define LLVM_CLANG_BASIC_PLISTSUPPORT_H
15 #include "llvm/ADT/DenseMap.h"
16 #include "llvm/ADT/SmallVector.h"
17 #include "llvm/ADT/StringRef.h"
18 #include "llvm/Support/raw_ostream.h"
25 using FIDMap = llvm::DenseMap<FileID, unsigned>;
29 FIDMap::iterator I = FIDs.find(FID);
32 unsigned NewValue =
V.size();
40 FileID FID =
SM.getFileID(
SM.getExpansionLoc(L));
45 FIDMap::const_iterator I = FIDs.find(FID);
46 assert(I != FIDs.end());
52 FileID FID =
SM.getFileID(
SM.getExpansionLoc(L));
56 inline raw_ostream &
Indent(raw_ostream &o,
const unsigned indent) {
57 for (
unsigned i = 0; i < indent; ++i)
63 static const char *PlistHeader =
64 "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
65 "<!DOCTYPE plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\" "
66 "\"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n"
67 "<plist version=\"1.0\">\n";
68 return o << PlistHeader;
71 inline raw_ostream &
EmitInteger(raw_ostream &o, int64_t value) {
80 for (StringRef::const_iterator I =
s.begin(), E =
s.end(); I != E; ++I) {
113 Indent(o, indent) <<
"<dict>\n";
114 Indent(o, indent) <<
" <key>line</key>";
116 Indent(o, indent) <<
" <key>col</key>";
118 Indent(o, indent) <<
" <key>file</key>";
120 Indent(o, indent) <<
"</dict>\n";
127 assert(R.
isCharRange() &&
"cannot handle a token range");
128 Indent(o, indent) <<
"<array>\n";
135 Indent(o, indent) <<
"</array>\n";
141 #endif // LLVM_CLANG_BASIC_PLISTSUPPORT_H
SourceLocation getBegin() const
A SourceLocation and its associated SourceManager.
Encodes a location in the source.
raw_ostream & Indent(raw_ostream &o, const unsigned indent)
SourceLocation getLocWithOffset(IntTy Offset) const
Return a source location with the specified offset from this SourceLocation.
This class handles loading and caching of source files into memory.
unsigned getExpansionLineNumber(bool *Invalid=nullptr) const
raw_ostream & EmitPlistHeader(raw_ostream &o)
raw_ostream & EmitInteger(raw_ostream &o, int64_t value)
void EmitLocation(raw_ostream &o, const SourceManager &SM, SourceLocation L, const FIDMap &FM, unsigned indent)
llvm::DenseMap< FileID, unsigned > FIDMap
Represents a character-granular source range.
raw_ostream & EmitString(raw_ostream &o, StringRef s)
SourceLocation getEnd() const
An opaque identifier used by SourceManager which refers to a source file (MemoryBuffer) along with it...
__device__ __2f16 float bool s
unsigned AddFID(FIDMap &FIDs, SmallVectorImpl< FileID > &V, FileID FID)
__device__ __2f16 float c
unsigned GetFID(const FIDMap &FIDs, FileID FID)
void EmitRange(raw_ostream &o, const SourceManager &SM, CharSourceRange R, const FIDMap &FM, unsigned indent)
unsigned getExpansionColumnNumber(bool *Invalid=nullptr) const