[llvm] 7a6ae49 - [JITLink] Add an assertion that block removal leaves no dangling symbols.
Lang Hames via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 11 12:56:59 PST 2020
Author: Lang Hames
Date: 2020-02-11T12:56:41-08:00
New Revision: 7a6ae494c522e91f56c91a27045ebfdcbd7327fc
URL: https://github.com/llvm/llvm-project/commit/7a6ae494c522e91f56c91a27045ebfdcbd7327fc
DIFF: https://github.com/llvm/llvm-project/commit/7a6ae494c522e91f56c91a27045ebfdcbd7327fc.diff
LOG: [JITLink] Add an assertion that block removal leaves no dangling symbols.
Added:
Modified:
llvm/include/llvm/ExecutionEngine/JITLink/JITLink.h
Removed:
################################################################################
diff --git a/llvm/include/llvm/ExecutionEngine/JITLink/JITLink.h b/llvm/include/llvm/ExecutionEngine/JITLink/JITLink.h
index fa04653fa7bd..1a8f5cacbcd4 100644
--- a/llvm/include/llvm/ExecutionEngine/JITLink/JITLink.h
+++ b/llvm/include/llvm/ExecutionEngine/JITLink/JITLink.h
@@ -17,6 +17,7 @@
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/DenseSet.h"
#include "llvm/ADT/Optional.h"
+#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/Triple.h"
#include "llvm/ExecutionEngine/JITSymbol.h"
#include "llvm/Support/Allocator.h"
@@ -990,6 +991,11 @@ class LinkGraph {
/// Remove a block.
void removeBlock(Block &B) {
+ assert(llvm::none_of(B.getSection().symbols(),
+ [&](const Symbol *Sym) {
+ return &Sym->getBlock() == &B;
+ }) &&
+ "Block still has symbols attached");
B.getSection().removeBlock(B);
destroyBlock(B);
}
More information about the llvm-commits
mailing list