[clang-import-test] Lookup inside contexts
authorSean Callanan <scallanan@apple.com>
Tue, 11 Apr 2017 19:33:35 +0000 (19:33 +0000)
committerSean Callanan <scallanan@apple.com>
Tue, 11 Apr 2017 19:33:35 +0000 (19:33 +0000)
commitb7160ca466175d21a01de50894df47f7c4612e67
tree28603dd87d598ec66586831ac76790f3dd082f2f
parent20dd36a48a76bb4227e19ad5da26066db5a466fa
[clang-import-test] Lookup inside contexts

clang-import-test has until now been only able to report top-level Decls.
This is clearly insufficient; we should be able to look inside structs
and namespaces also.  This patch adds new test cases for a variety of
lookups inside existing ASTContexts, and adds the functionality necessar
to make most of these testcases work.  (One testcase is known to fail
because of ASTImporter limitations when importing templates; I'll look
into that separately.)

This patch also separates the core functionality out into
ExternalASTMerger, an interface that allows clients like LLDB to make
use of it.  clang-import-test now only has the machinery necessary to
set up the tests.

Differential revision: https://reviews.llvm.org/D30435

llvm-svn: 299976
21 files changed:
clang/include/clang/AST/ExternalASTMerger.h [new file with mode: 0644]
clang/lib/AST/CMakeLists.txt
clang/lib/AST/ExternalASTMerger.cpp [new file with mode: 0644]
clang/test/Import/forward-declared-struct/Inputs/S1.c [new file with mode: 0644]
clang/test/Import/forward-declared-struct/Inputs/S2.c [new file with mode: 0644]
clang/test/Import/forward-declared-struct/test.c [new file with mode: 0644]
clang/test/Import/member-in-struct/Inputs/S.c [new file with mode: 0644]
clang/test/Import/member-in-struct/test.c [new file with mode: 0644]
clang/test/Import/multiple-forward-declarations/Inputs/S1.c [new file with mode: 0644]
clang/test/Import/multiple-forward-declarations/Inputs/S2.c [new file with mode: 0644]
clang/test/Import/multiple-forward-declarations/test.c [new file with mode: 0644]
clang/test/Import/overloaded-function/Inputs/F1.c [new file with mode: 0644]
clang/test/Import/overloaded-function/Inputs/F2.c [new file with mode: 0644]
clang/test/Import/overloaded-function/test.c [new file with mode: 0644]
clang/test/Import/struct-in-namespace/Inputs/N1.cpp [new file with mode: 0644]
clang/test/Import/struct-in-namespace/Inputs/N2.cpp [new file with mode: 0644]
clang/test/Import/struct-in-namespace/Inputs/N3.cpp [new file with mode: 0644]
clang/test/Import/struct-in-namespace/test.cpp [new file with mode: 0644]
clang/test/Import/template-specialization/Inputs/T.cpp [new file with mode: 0644]
clang/test/Import/template-specialization/test.cpp [new file with mode: 0644]
clang/tools/clang-import-test/clang-import-test.cpp