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>";
115 EmitInteger(o, Loc.getExpansionLineNumber()) <<
'\n';
116 Indent(o, indent) <<
" <key>col</key>";
117 EmitInteger(o, Loc.getExpansionColumnNumber()) <<
'\n';
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 getLocWithOffset(int Offset) const
Return a source location with the specified offset from this SourceLocation.
void EmitLocation(raw_ostream &o, const SourceManager &SM, SourceLocation L, const FIDMap &FM, unsigned indent)
unsigned GetFID(const FIDMap &FIDs, FileID FID)
Defines the SourceManager interface.
raw_ostream & EmitInteger(raw_ostream &o, int64_t value)
SourceLocation getBegin() const
unsigned AddFID(FIDMap &FIDs, SmallVectorImpl< FileID > &V, FileID FID)
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified.
__device__ __2f16 float bool s
Represents a character-granular source range.
llvm::DenseMap< FileID, unsigned > FIDMap
Encodes a location in the source.
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)
SourceLocation getEnd() const
raw_ostream & EmitString(raw_ostream &o, StringRef s)
Defines the clang::SourceLocation class and associated facilities.
A SourceLocation and its associated SourceManager.
This class handles loading and caching of source files into memory.
__device__ __2f16 float c