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"
25using 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));
56inline 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;
71inline raw_ostream &
EmitInteger(raw_ostream &o, int64_t value) {
112 Indent(o, indent) <<
"<dict>\n";
113 Indent(o, indent) <<
" <key>line</key>";
115 Indent(o, indent) <<
" <key>col</key>";
117 Indent(o, indent) <<
" <key>file</key>";
119 Indent(o, indent) <<
"</dict>\n";
126 assert(R.
isCharRange() &&
"cannot handle a token range");
127 Indent(o, indent) <<
"<array>\n";
134 Indent(o, indent) <<
"</array>\n";
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified.
Defines the clang::SourceLocation class and associated facilities.
Defines the SourceManager interface.
__device__ __2f16 float __ockl_bool s
__device__ __2f16 float c
Represents a character-granular source range.
SourceLocation getEnd() const
SourceLocation getBegin() const
An opaque identifier used by SourceManager which refers to a source file (MemoryBuffer) along with it...
A SourceLocation and its associated SourceManager.
Encodes a location in the source.
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.
void EmitRange(raw_ostream &o, const SourceManager &SM, CharSourceRange R, const FIDMap &FM, unsigned indent)
raw_ostream & EmitString(raw_ostream &o, StringRef s)
unsigned GetFID(const FIDMap &FIDs, FileID FID)
unsigned AddFID(FIDMap &FIDs, SmallVectorImpl< FileID > &V, FileID FID)
raw_ostream & EmitInteger(raw_ostream &o, int64_t value)
llvm::DenseMap< FileID, unsigned > FIDMap
raw_ostream & EmitPlistHeader(raw_ostream &o)
void EmitLocation(raw_ostream &o, const SourceManager &SM, SourceLocation L, const FIDMap &FM, unsigned indent)
The JSON file list parser is used to communicate input to InstallAPI.