return dn_or_err.takeError();
DeclContext *dc = *dc_or_err;
DeclContext::lookup_result lr = dc->lookup(*dn_or_err);
- if (lr.size()) {
- clang::Decl *lookup_found = lr.front();
- RegisterImportedDecl(From, lookup_found);
- m_decls_to_ignore.insert(lookup_found);
- return lookup_found;
- } else
- LLDB_LOG(log, "[ClangASTImporter] Complete definition not found");
+ for (clang::Decl *candidate : lr) {
+ if (candidate->getKind() == From->getKind()) {
+ RegisterImportedDecl(From, candidate);
+ m_decls_to_ignore.insert(candidate);
+ return candidate;
+ }
+ }
+ LLDB_LOG(log, "[ClangASTImporter] Complete definition not found");
}
return ASTImporter::ImportImpl(From);
self.expect_expr("get_two().one().member", result_value="124")
self.expect_expr("get_two().member", result_value="224")
+ self.expect_expr("shadowed_one.member", result_value="47")
+ self.expect_expr("shadowed_one.one", result_value="142")
+
@skipIf(bugnumber="pr46284", debug_info="gmodules")
@skipIfWindows # Clang emits type info even with -flimit-debug-info
def test_two_debug(self):
#include "onetwo.h"
struct InheritsFromOne : One {
- constexpr InheritsFromOne() = default;
int member = 47;
} inherits_from_one;
struct InheritsFromTwo : Two {
- constexpr InheritsFromTwo() = default;
int member = 47;
} inherits_from_two;
struct OneAsMember {
- constexpr OneAsMember() = default;
member::One one;
int member = 47;
} one_as_member;
struct TwoAsMember {
- constexpr TwoAsMember() = default;
member::Two two;
int member = 47;
} two_as_member;
result::One get_one() { return result::One(124); }
result::Two get_two() { return result::Two(224); }
+// Note that there's also a function with the name func_shadow::One.
+struct ShadowedOne : func_shadow::One {
+ int member = 47;
+} shadowed_one;
+
int main() { return get_one().member; }
result::One::One(int member) : member(member) {}
result::One::~One() = default;
+
+void func_shadow::One(int) {}
+func_shadow::One::~One() = default;
+void func_shadow::One(float) {}
virtual ~Two();
};
} // namespace result
+
+namespace func_shadow {
+void One(int);
+struct One {
+ int one = 142;
+ constexpr One() = default;
+ virtual ~One();
+};
+void One(float);
+} // namespace func_shadow