12#include "llvm/Support/Error.h"
13#include "llvm/Support/JSON.h"
14#include "llvm/Support/Registry.h"
22using Array = llvm::json::Array;
23using Object = llvm::json::Object;
24using Value = llvm::json::Value;
30 return EntitySourceLocationsSummary(std::move(Locs));
35 return S.DeclLocations;
41static constexpr llvm::StringLiteral
FilePathKey =
"file_path";
42static constexpr llvm::StringLiteral
LineKey =
"line";
43static constexpr llvm::StringLiteral
ColumnKey =
"column";
47 {
LineKey.data(),
static_cast<int64_t
>(R.Line)},
48 {
ColumnKey.data(),
static_cast<int64_t
>(R.Column)}};
53 const Object *Obj =
V.getAsObject();
75 R.FilePath = FilePath->str();
76 R.Line =
static_cast<unsigned>(*Line);
77 R.Column =
static_cast<unsigned>(*Column);
95 "an Object with an array field %s",
98 std::vector<SourceLocationRecord>
Records;
100 for (
const Value &
V : *Locs) {
103 return R.takeError();
104 Records.push_back(std::move(*R));
106 return std::make_unique<EntitySourceLocationsSummary>(
111struct SharedLexicalRepresentationJSONFormatInfo final
113 SharedLexicalRepresentationJSONFormatInfo()
114 : JSONFormat::FormatInfo(EntitySourceLocationsSummary::summaryName(),
119static llvm::Registry<JSONFormat::FormatInfo>::Add<
120 SharedLexicalRepresentationJSONFormatInfo>
123 "JSON Format info for EntitySourceLocationsSummary");
llvm::MachO::Records Records
Manages entity name interning and provides efficient EntityId handles.
An EntitySourceLocationsSummary contains one SourceLocationRecord per declaration site contributed by...
static constexpr llvm::StringLiteral Name
Base class for analysis-specific summary data.
EntitySourceLocationsSummary buildEntitySourceLocationsSummary(std::vector< SourceLocationRecord > Locs)
llvm::ArrayRef< SourceLocationRecord > getDeclLocations(const EntitySourceLocationsSummary &S)
llvm::Error makeSawButExpectedError(const JSONTy &Saw, llvm::StringRef Expected, const Ts &...ExpectedArgs)
volatile int SharedLexicalRepresentationJSONFormatAnchorSource
llvm::json::Object Object
The JSON file list parser is used to communicate input to InstallAPI.
A canonical (file, line, column) triple for one declaration site.