summaryrefslogtreecommitdiffstats
path: root/lldb
diff options
context:
space:
mode:
authorRaphael Isemann <teemperor@gmail.com>2020-01-10 20:16:41 +0100
committerRaphael Isemann <teemperor@gmail.com>2020-01-10 21:19:04 +0100
commit77da826edad0a7b906c734c6bee3489ef495c746 (patch)
treea51e0e108820eeea2bf726f842e2414ebed16bcb /lldb
parent0c29d3ff2233696f663ae34a8aeda23c750ac68f (diff)
downloadbcm5719-llvm-77da826edad0a7b906c734c6bee3489ef495c746.tar.gz
bcm5719-llvm-77da826edad0a7b906c734c6bee3489ef495c746.zip
[lldb] Make CompleteTagDeclsScope completion order deterministic
Summary: We iterate over `m_decls_to_complete` to complete declarations. As `m_decls_to_complete` is a set the iteration order can be non-deterministic. The order is currently only non-deterministic when we have a large set of decls that need to be completed (i.e. more than 32 decls, as otherwise the SmallPtrSet is just a linear-searched list). This doesn't really fix any specific bug or has any really observable change in behavior as the order in which we import should not influence any semantics. However the order we create decls/types is now always deterministic which should make debugging easier. Reviewers: labath, mib, shafik, davide Reviewed By: shafik, davide Subscribers: davide, abidh, JDevlieghere, lldb-commits, mgrang Tags: #lldb Differential Revision: https://reviews.llvm.org/D72495
Diffstat (limited to 'lldb')
-rw-r--r--lldb/source/Symbol/ClangASTImporter.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/lldb/source/Symbol/ClangASTImporter.cpp b/lldb/source/Symbol/ClangASTImporter.cpp
index a10ac8a4d88..8cb404231a8 100644
--- a/lldb/source/Symbol/ClangASTImporter.cpp
+++ b/lldb/source/Symbol/ClangASTImporter.cpp
@@ -214,7 +214,7 @@ namespace {
/// imported while completing the original Decls).
class CompleteTagDeclsScope : public ClangASTImporter::NewDeclListener {
ClangASTImporter::ImporterDelegateSP m_delegate;
- llvm::SmallPtrSet<NamedDecl *, 32> m_decls_to_complete;
+ llvm::SmallVector<NamedDecl *, 32> m_decls_to_complete;
llvm::SmallPtrSet<NamedDecl *, 32> m_decls_already_completed;
clang::ASTContext *m_dst_ctx;
clang::ASTContext *m_src_ctx;
@@ -239,10 +239,8 @@ public:
// Complete all decls we collected until now.
while (!m_decls_to_complete.empty()) {
- NamedDecl *decl = *m_decls_to_complete.begin();
-
+ NamedDecl *decl = m_decls_to_complete.pop_back_val();
m_decls_already_completed.insert(decl);
- m_decls_to_complete.erase(decl);
// We should only complete decls coming from the source context.
assert(to_context_md->m_origins[decl].ctx == m_src_ctx);
@@ -287,7 +285,7 @@ public:
// Check if we already completed this type.
if (m_decls_already_completed.count(to_named_decl) != 0)
return;
- m_decls_to_complete.insert(to_named_decl);
+ m_decls_to_complete.push_back(to_named_decl);
}
};
} // namespace
OpenPOWER on IntegriCloud