[PATCH] D113668: [ASTImporter][NFC] Dump decl name at assertion violation
Balázs Benics via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Nov 19 02:31:42 PST 2021
This revision was automatically updated to reflect the committed changes.
Closed by commit rGf3753ad77450: [ASTImporter][NFC] Dump decl name at assertion violation (authored by steakhal).
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D113668/new/
https://reviews.llvm.org/D113668
Files:
clang/lib/AST/ASTImporterLookupTable.cpp
Index: clang/lib/AST/ASTImporterLookupTable.cpp
===================================================================
--- clang/lib/AST/ASTImporterLookupTable.cpp
+++ clang/lib/AST/ASTImporterLookupTable.cpp
@@ -14,6 +14,7 @@
#include "clang/AST/ASTImporterLookupTable.h"
#include "clang/AST/Decl.h"
#include "clang/AST/RecursiveASTVisitor.h"
+#include "llvm/Support/FormatVariadic.h"
namespace clang {
@@ -93,10 +94,19 @@
}
void ASTImporterLookupTable::remove(DeclContext *DC, NamedDecl *ND) {
- DeclList &Decls = LookupTable[DC][ND->getDeclName()];
+ const DeclarationName Name = ND->getDeclName();
+ DeclList &Decls = LookupTable[DC][Name];
bool EraseResult = Decls.remove(ND);
(void)EraseResult;
- assert(EraseResult == true && "Trying to remove not contained Decl");
+#ifndef NDEBUG
+ if (!EraseResult) {
+ std::string Message =
+ llvm::formatv("Trying to remove not contained Decl '{0}' of type {1}",
+ Name.getAsString(), DC->getDeclKindName())
+ .str();
+ llvm_unreachable(Message.c_str());
+ }
+#endif
}
void ASTImporterLookupTable::add(NamedDecl *ND) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D113668.388441.patch
Type: text/x-patch
Size: 1134 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20211119/be8512c6/attachment.bin>
More information about the cfe-commits
mailing list