[Mlir-commits] [mlir] e00dc16 - [tblgen-lsp-server] Fix various ASAN issues
River Riddle
llvmlistbot at llvm.org
Thu Oct 20 10:49:19 PDT 2022
Author: River Riddle
Date: 2022-10-20T10:49:09-07:00
New Revision: e00dc16dbe35dc2ce9c9c915b3a0d9fc699a8e24
URL: https://github.com/llvm/llvm-project/commit/e00dc16dbe35dc2ce9c9c915b3a0d9fc699a8e24
DIFF: https://github.com/llvm/llvm-project/commit/e00dc16dbe35dc2ce9c9c915b3a0d9fc699a8e24.diff
LOG: [tblgen-lsp-server] Fix various ASAN issues
* Properly use virtual destructors for index symbols
* Clear the index before initializing it
Added:
Modified:
mlir/lib/Tools/tblgen-lsp-server/TableGenServer.cpp
Removed:
################################################################################
diff --git a/mlir/lib/Tools/tblgen-lsp-server/TableGenServer.cpp b/mlir/lib/Tools/tblgen-lsp-server/TableGenServer.cpp
index 42e321faa9541..5a4d3b29d4bb9 100644
--- a/mlir/lib/Tools/tblgen-lsp-server/TableGenServer.cpp
+++ b/mlir/lib/Tools/tblgen-lsp-server/TableGenServer.cpp
@@ -142,6 +142,7 @@ struct TableGenIndexSymbol {
TableGenIndexSymbol(const llvm::RecordVal *value)
: definition(value),
defLoc(lsp::convertTokenLocToRange(value->getLoc())) {}
+ virtual ~TableGenIndexSymbol() = default;
// The main definition of the symbol.
PointerUnion<const llvm::Record *, const llvm::RecordVal *> definition;
@@ -156,6 +157,7 @@ struct TableGenIndexSymbol {
struct TableGenRecordSymbol : public TableGenIndexSymbol {
TableGenRecordSymbol(const llvm::Record *record)
: TableGenIndexSymbol(record) {}
+ ~TableGenRecordSymbol() override = default;
static bool classof(const TableGenIndexSymbol *symbol) {
return symbol->definition.is<const llvm::Record *>();
@@ -171,6 +173,7 @@ struct TableGenRecordValSymbol : public TableGenIndexSymbol {
TableGenRecordValSymbol(const llvm::Record *record,
const llvm::RecordVal *value)
: TableGenIndexSymbol(value), record(record) {}
+ ~TableGenRecordValSymbol() override = default;
static bool classof(const TableGenIndexSymbol *symbol) {
return symbol->definition.is<const llvm::RecordVal *>();
@@ -241,6 +244,9 @@ class TableGenIndex {
} // namespace
void TableGenIndex::initialize(const llvm::RecordKeeper &records) {
+ intervalMap.clear();
+ defToSymbol.clear();
+
auto insertRef = [&](TableGenIndexSymbol *sym, SMRange refLoc,
bool isDef = false) {
const char *startLoc = refLoc.Start.getPointer();
More information about the Mlir-commits
mailing list