Lines Matching defs:record

105 /// Get the base definition of the given record value, or nullptr if one
108 getBaseValue(const Record *record, const RecordVal *value) {
112 // Find a base value for the field in the super classes of the given record.
113 // On success, `record` is updated to the new parent record.
115 auto findValueInSupers = [&](const Record *&record) -> const RecordVal * {
116 for (auto [parentRecord, loc] : record->getSuperClasses()) {
118 record = parentRecord;
125 // Try to find the lowest definition of the record value.
127 while (const RecordVal *newBase = findValueInSupers(record))
128 baseValue = {record, newBase};
146 TableGenIndexSymbol(const Record *record)
147 : definition(record),
148 defLoc(convertTokenLocToRange(record->getLoc().front())) {}
162 /// This class represents a single record symbol.
164 TableGenRecordSymbol(const Record *record) : TableGenIndexSymbol(record) {}
174 /// This class represents a single record value symbol.
176 TableGenRecordValSymbol(const Record *record, const RecordVal *value)
177 : TableGenIndexSymbol(value), record(record) {}
189 /// The parent record of this symbol.
190 const Record *record;
218 /// Get or insert a symbol for the given record.
219 TableGenIndexSymbol *getOrInsertDef(const Record *record) {
220 auto it = defToSymbol.try_emplace(record, nullptr);
222 it.first->second = std::make_unique<TableGenRecordSymbol>(record);
225 /// Get or insert a symbol for the given record value.
226 TableGenIndexSymbol *getOrInsertDef(const Record *record,
231 std::make_unique<TableGenRecordValSymbol>(record, value);
361 lsp::Hover buildHoverForRecord(const Record *record,
363 lsp::Hover buildHoverForTemplateArg(const Record *record,
366 lsp::Hover buildHoverForField(const Record *record, const RecordVal *value,
386 /// The record keeper containing the parsed tablegen constructs.
481 // If this symbol is a record value and the def position is already the def of
486 if (auto *val = getBaseValue(valSym->record, valSym->getValue()).second) {
538 if (auto *record = dyn_cast<TableGenRecordSymbol>(symbol))
539 return buildHoverForRecord(record->getValue(), hoverRange);
546 return buildHoverForTemplateArg(recordVal->record, value, hoverRange);
547 return buildHoverForField(recordVal->record, value, hoverRange);
550 lsp::Hover TableGenTextFile::buildHoverForRecord(const Record *record,
556 // Format the type of record this is.
557 if (record->isClass()) {
558 hoverOS << "**class** `" << record->getName() << "`";
559 } else if (record->isAnonymous()) {
562 hoverOS << "**def** `" << record->getName() << "`";
566 // Check if this record has summary/description fields. These are often used
567 // to hold documentation for the record.
569 // Check that the record actually has the given field, and that it's a
571 const RecordVal *value = record->getValue(fieldName);
587 lsp::extractSourceDocComment(sourceMgr, record->getLoc().front())) {
595 const Record *record, const RecordVal *value, const SMRange &hoverRange) {
608 lsp::Hover TableGenTextFile::buildHoverForField(const Record *record,
627 auto [baseRecord, baseValue] = getBaseValue(record, value);