Lines Matching refs:ast
75 getLspDiagnoticFromDiag(llvm::SourceMgr &sourceMgr, const ast::Diagnostic &diag, in getLspDiagnoticFromDiag()
94 case ast::Diagnostic::Severity::DK_Note: in getLspDiagnoticFromDiag()
96 case ast::Diagnostic::Severity::DK_Warning: in getLspDiagnoticFromDiag()
99 case ast::Diagnostic::Severity::DK_Error: in getLspDiagnoticFromDiag()
102 case ast::Diagnostic::Severity::DK_Remark: in getLspDiagnoticFromDiag()
110 for (const ast::Diagnostic ¬e : diag.getNotes()) { in getLspDiagnoticFromDiag()
123 const ast::Decl *decl) { in getDocumentationFor()
178 explicit PDLIndexSymbol(const ast::Decl *definition) in PDLIndexSymbol()
185 if (const ast::Decl *decl = definition.dyn_cast<const ast::Decl *>()) { in getDefLoc()
186 const ast::Name *declName = decl->getName(); in getDefLoc()
193 PointerUnion<const ast::Decl *, const ods::Operation *> definition;
205 void initialize(const ast::Module &module, const ods::Context &odsContext);
234 void PDLIndex::initialize(const ast::Module &module, in initialize()
262 module.walk([&](const ast::Node *node) { in initialize()
264 if (const auto *decl = dyn_cast<ast::OpNameDecl>(node)) { in initialize()
267 } else if (const ast::Decl *decl = dyn_cast<ast::Decl>(node)) { in initialize()
268 const ast::Name *name = decl->getName(); in initialize()
274 if (const auto *varDecl = dyn_cast<ast::VariableDecl>(decl)) { in initialize()
279 } else if (const auto *expr = dyn_cast<ast::DeclRefExpr>(node)) { in initialize()
334 Optional<lsp::Hover> findHover(const ast::Decl *decl,
338 lsp::Hover buildHoverForVariable(const ast::VariableDecl *varDecl,
340 lsp::Hover buildHoverForPattern(const ast::PatternDecl *decl,
342 lsp::Hover buildHoverForCoreConstraint(const ast::CoreConstraintDecl *decl,
375 void getInlayHintsFor(const ast::VariableDecl *decl,
378 void getInlayHintsFor(const ast::CallExpr *expr, const lsp::URIForFile &uri,
380 void getInlayHintsFor(const ast::OperationExpr *expr,
386 const ast::Expr *expr, StringRef label);
406 ast::Context astContext;
409 FailureOr<ast::Module *> astModule;
438 astContext.getDiagEngine().setHandlerFn([&](const ast::Diagnostic &diag) { in PDLDocument()
515 const auto *decl = symbol->definition.get<const ast::Decl *>(); in findHover()
519 Optional<lsp::Hover> PDLDocument::findHover(const ast::Decl *decl, in findHover()
522 if (const auto *varDecl = dyn_cast<ast::VariableDecl>(decl)) in findHover()
526 if (const auto *patternDecl = dyn_cast<ast::PatternDecl>(decl)) in findHover()
530 if (const auto *cst = dyn_cast<ast::CoreConstraintDecl>(decl)) in findHover()
534 if (const auto *cst = dyn_cast<ast::UserConstraintDecl>(decl)) in findHover()
538 if (const auto *rewrite = dyn_cast<ast::UserRewriteDecl>(decl)) in findHover()
556 lsp::Hover PDLDocument::buildHoverForVariable(const ast::VariableDecl *varDecl, in buildHoverForVariable()
567 lsp::Hover PDLDocument::buildHoverForPattern(const ast::PatternDecl *decl, in buildHoverForPattern()
573 if (const ast::Name *name = decl->getName()) in buildHoverForPattern()
591 PDLDocument::buildHoverForCoreConstraint(const ast::CoreConstraintDecl *decl, in buildHoverForCoreConstraint()
597 TypeSwitch<const ast::Decl *>(decl) in buildHoverForCoreConstraint()
598 .Case([&](const ast::AttrConstraintDecl *) { hoverOS << "Attr"; }) in buildHoverForCoreConstraint()
599 .Case([&](const ast::OpConstraintDecl *opCst) { in buildHoverForCoreConstraint()
604 .Case([&](const ast::TypeConstraintDecl *) { hoverOS << "Type"; }) in buildHoverForCoreConstraint()
605 .Case([&](const ast::TypeRangeConstraintDecl *) { in buildHoverForCoreConstraint()
608 .Case([&](const ast::ValueConstraintDecl *) { hoverOS << "Value"; }) in buildHoverForCoreConstraint()
609 .Case([&](const ast::ValueRangeConstraintDecl *) { in buildHoverForCoreConstraint()
625 ArrayRef<ast::VariableDecl *> inputs = decl->getInputs(); in buildHoverForUserConstraintOrRewrite()
628 for (const ast::VariableDecl *input : inputs) in buildHoverForUserConstraintOrRewrite()
633 ast::Type resultType = decl->getResultType(); in buildHoverForUserConstraintOrRewrite()
634 if (auto resultTupleTy = resultType.dyn_cast<ast::TupleType>()) { in buildHoverForUserConstraintOrRewrite()
666 for (const ast::Decl *decl : (*astModule)->getChildren()) { in findDocumentSymbols()
670 if (const auto *patternDecl = dyn_cast<ast::PatternDecl>(decl)) { in findDocumentSymbols()
671 const ast::Name *name = patternDecl->getName(); in findDocumentSymbols()
679 } else if (const auto *cDecl = dyn_cast<ast::UserConstraintDecl>(decl)) { in findDocumentSymbols()
687 } else if (const auto *cDecl = dyn_cast<ast::UserRewriteDecl>(decl)) { in findDocumentSymbols()
714 void codeCompleteTupleMemberAccess(ast::TupleType tupleType) final { in codeCompleteTupleMemberAccess()
715 ArrayRef<ast::Type> elementTypes = tupleType.getElementTypes(); in codeCompleteTupleMemberAccess()
739 void codeCompleteOperationMemberAccess(ast::OperationType opType) final { in codeCompleteOperationMemberAccess()
809 void codeCompleteConstraintName(ast::Type currentType, in codeCompleteConstraintName()
812 const ast::DeclScope *scope) final { in codeCompleteConstraintName()
843 if (!currentType || currentType.isa<ast::AttributeType>()) in codeCompleteConstraintName()
846 if (!currentType || currentType.isa<ast::ValueType>()) in codeCompleteConstraintName()
849 if (!currentType || currentType.isa<ast::ValueRangeType>()) in codeCompleteConstraintName()
856 for (const ast::Decl *decl : scope->getDecls()) { in codeCompleteConstraintName()
857 if (const auto *cst = dyn_cast<ast::UserConstraintDecl>(decl)) { in codeCompleteConstraintName()
872 ast::Type constraintType = cst->getInputs()[0]->getType(); in codeCompleteConstraintName()
881 cst->getInputs(), strOS, [&](const ast::VariableDecl *var) { in codeCompleteConstraintName()
1038 ast::Context tmpContext(tmpODSContext); in getCodeCompletion()
1058 void codeCompleteCallSignature(const ast::CallableDecl *callable, in codeCompleteCallSignature()
1066 auto formatParamFn = [&](const ast::VariableDecl *var) { in codeCompleteCallSignature()
1192 ast::Context tmpContext(tmpODSContext); in getSignatureHelp()
1204 static bool shouldAddHintFor(const ast::Expr *expr, StringRef name) { in shouldAddHintFor()
1209 if (auto *ref = dyn_cast<ast::DeclRefExpr>(expr)) { in shouldAddHintFor()
1210 const ast::Name *declName = ref->getDecl()->getName(); in shouldAddHintFor()
1226 (*astModule)->walk([&](const ast::Node *node) { in getInlayHints()
1234 llvm::TypeSwitch<const ast::Node *>(node) in getInlayHints()
1235 .Case<ast::VariableDecl, ast::CallExpr, ast::OperationExpr>( in getInlayHints()
1242 void PDLDocument::getInlayHintsFor(const ast::VariableDecl *decl, in getInlayHintsFor()
1251 if (const ast::Expr *expr = decl->getInitExpr()) { in getInlayHintsFor()
1255 if (isa<ast::OperationExpr>(expr)) in getInlayHintsFor()
1269 void PDLDocument::getInlayHintsFor(const ast::CallExpr *expr, in getInlayHintsFor()
1273 const auto *callableRef = dyn_cast<ast::DeclRefExpr>(expr->getCallableExpr()); in getInlayHintsFor()
1275 callableRef ? dyn_cast<ast::CallableDecl>(callableRef->getDecl()) in getInlayHintsFor()
1286 void PDLDocument::getInlayHintsFor(const ast::OperationExpr *expr, in getInlayHintsFor()
1290 ast::OperationType opType = expr->getType().dyn_cast<ast::OperationType>(); in getInlayHintsFor()
1293 auto addOpHint = [&](const ast::Expr *valueExpr, StringRef label) { in getInlayHintsFor()
1304 auto addOperandOrResultHints = [&](ArrayRef<ast::Expr *> values, in getInlayHintsFor()
1335 const ast::Expr *expr, StringRef label) { in addParameterHintFor()