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 auto [I, Inserted] = FIDs.try_emplace(FID,
V.size());
37 FileID FID =
SM.getFileID(
SM.getExpansionLoc(L));
42 FIDMap::const_iterator I = FIDs.find(FID);
43 assert(I != FIDs.end());
49 FileID FID =
SM.getFileID(
SM.getExpansionLoc(L));
53inline raw_ostream &Indent(raw_ostream &o,
const unsigned indent) {
54 for (
unsigned i = 0; i < indent; ++i)
60 static const char *PlistHeader =
61 "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
62 "<!DOCTYPE plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\" "
63 "\"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n"
64 "<plist version=\"1.0\">\n";
65 return o << PlistHeader;
68inline raw_ostream &
EmitInteger(raw_ostream &o, int64_t value) {
109 Indent(o, indent) <<
"<dict>\n";
110 Indent(o, indent) <<
" <key>line</key>";
112 Indent(o, indent) <<
" <key>col</key>";
114 Indent(o, indent) <<
" <key>file</key>";
116 Indent(o, indent) <<
"</dict>\n";
123 assert(R.
isCharRange() &&
"cannot handle a token range");
124 Indent(o, indent) <<
"<array>\n";
131 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.