[Lldb-commits] [lldb] [lldb][ClangASTImporter][NFC] Emit a log message when we break MapImported invariant (PR #112748)
Pavel Labath via lldb-commits
lldb-commits at lists.llvm.org
Thu Oct 17 23:53:13 PDT 2024
================
@@ -1136,6 +1136,25 @@ ClangASTImporter::ASTImporterDelegate::ImportImpl(Decl *From) {
void ClangASTImporter::ASTImporterDelegate::ImportDefinitionTo(
clang::Decl *to, clang::Decl *from) {
+ Log *log = GetLog(LLDBLog::Expressions);
+
+ auto getDeclName = [](Decl const *decl) {
+ std::string name_string;
+ if (auto const *from_named_decl = dyn_cast<clang::NamedDecl>(decl)) {
+ llvm::raw_string_ostream name_stream(name_string);
+ from_named_decl->printName(name_stream);
+ }
+
+ return name_string;
+ };
+
+ if (auto *D = GetAlreadyImportedOrNull(from); D && D != to)
----------------
labath wrote:
If this is expensive (I honestly don't know), you may want to put this in a `if(log)` block.
https://github.com/llvm/llvm-project/pull/112748
More information about the lldb-commits
mailing list