The main function of the LSP server needs to load the dialects and similar that the server should be able to understand. When extensions where introduced, the loading of the extensions was apparently not added to its main functions, so ops from extensions were previously not recognized by the server. This patch registers all extensions through the existing convenience function, and also registers the TestDynDialect, which `mlir-opt`s main function also registers. Reviewed By: springerm Differential Revision: https://reviews.llvm.org/D159091
37 lines
1.2 KiB
C++
37 lines
1.2 KiB
C++
//===- mlir-lsp-server.cpp - MLIR Language Server -------------------------===//
|
|
//
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include "mlir/IR/Dialect.h"
|
|
#include "mlir/IR/MLIRContext.h"
|
|
#include "mlir/InitAllDialects.h"
|
|
#include "mlir/InitAllExtensions.h"
|
|
#include "mlir/Tools/mlir-lsp-server/MlirLspServerMain.h"
|
|
|
|
using namespace mlir;
|
|
|
|
#ifdef MLIR_INCLUDE_TESTS
|
|
namespace test {
|
|
void registerTestDialect(DialectRegistry &);
|
|
void registerTestDynDialect(DialectRegistry &);
|
|
void registerTestTransformDialectExtension(DialectRegistry &);
|
|
} // namespace test
|
|
#endif
|
|
|
|
int main(int argc, char **argv) {
|
|
DialectRegistry registry;
|
|
registerAllDialects(registry);
|
|
registerAllExtensions(registry);
|
|
|
|
#ifdef MLIR_INCLUDE_TESTS
|
|
::test::registerTestDialect(registry);
|
|
::test::registerTestTransformDialectExtension(registry);
|
|
::test::registerTestDynDialect(registry);
|
|
#endif
|
|
return failed(MlirLspServerMain(argc, argv, registry));
|
|
}
|