summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/ExternalASTMerger.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Fix -Wcast-qual warning after r314336.Nico Weber2017-09-281-1/+1
| | | | llvm-svn: 314424
* Add support for remembering origins to ExternalASTMergerSean Callanan2017-09-271-93/+309
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ExternalASTMerger has hitherto relied on being able to look up any Decl through its named DeclContext chain. This works for many cases, but causes problems for function-local structs, which cannot be looked up in their containing FunctionDecl. An example case is void f() { { struct S { int a; }; } { struct S { bool b; }; } } It is not possible to lookup either of the two Ses individually (or even to provide enough information to disambiguate) after parsing is over; and there is typically no need to, since they are invisible to the outside world. However, ExternalASTMerger needs to be able to complete either S on demand. This led to an XFAIL on test/Import/local-struct, which this patch removes. The way the patch works is: It defines a new data structure, ExternalASTMerger::OriginMap, which clients are expected to maintain (default-constructing if the origin does not have an ExternalASTMerger servicing it) As DeclContexts are imported, if they cannot be looked up by name they are placed in the OriginMap. This allows ExternalASTMerger to complete them later if necessary. As DeclContexts are imported from an origin that already has its own OriginMap, the origins are forwarded – but only for those DeclContexts that are actually used. This keeps the amount of stored data minimal. The patch also applies several improvements from review: - Thoroughly documents the interface to ExternalASTMerger; - Adds optional logging to help track what's going on; and - Cleans up a bunch of braces and dangling elses. Differential Revision: https://reviews.llvm.org/D38208 llvm-svn: 314336
* [ExternalASTMerger] Import Objective-C classesSean Callanan2017-07-251-1/+5
| | | | | | | | | | | | | This patch adds functionality and a test for importing Objective-C classes and their methods. It also adds a flag to clang-import-test to set the language used for parsing. This takes the same argument format as the -x option to the driver. Differential Revision: https://reviews.llvm.org/D35274 llvm-svn: 309014
* clang-import-test had some dead code. I did the following to eliminate it:Sean Callanan2017-07-101-5/+0
| | | | | | | | | | | | | | - eliminated error handling for the indirect CompilerInstance, which should never generate an error as it is created; - added a new test for direct importation; and - removed an unused implementation of the CompleteType() API. This brings clang-import-test.cpp and ExternalASTMerge.cpp back to 100% coverage on all metrics measured by DLLVM_BUILD_INSTRUMENTED_COVERAGE. Differential Revision: https://reviews.llvm.org/D35220 llvm-svn: 307600
* Call setMustBuildLookupTable on TagDecls in ExternalASTMergerLang Hames2017-06-171-0/+1
| | | | | | | | | | | | | | | | | | | | Summary: setMustBuildLookupTable should be called on imported TagDecls otherwise we may fail to import their member decls (if they have any). Not calling the setMustBuildLookupTable method results in a failure in the attached test case when lookup for the 'x' member fails on struct S, which hasn't had its decls imported elsewhere. (By contrast the member-in-struct testcase hasn't run into this issue because the import of its decls is triggered when the struct instance is defined, and the member access follows this). Reviewers: spyffe, rsmith Reviewed By: spyffe, rsmith Differential Revision: https://reviews.llvm.org/D34253 llvm-svn: 305619
* [ASTImporter] Improve handling of incomplete typesSean Callanan2017-05-131-0/+6
| | | | | | | | | | | | | | | | | | | | | ASTImporter has some bugs when it's importing types that themselves come from an ExternalASTSource. This is exposed particularly in the behavior when comparing complete TagDecls with forward declarations. This patch does several things: - Adds a test case making sure that conflicting forward-declarations are resolved correctly; - Extends the clang-import-test harness to test two-level importing, so that we make sure we complete types when necessary; and - Fixes a few bugs I found this way. Failure to complete types was one; however, I also discovered that complete RecordDecls aren't properly added to the redecls chain for existing forward declarations. llvm-svn: 302975
* Use default ref capture to simplify local lambdas, use a template to avoid ↵David Blaikie2017-04-171-22/+17
| | | | | | std::function overhead, other cleanup llvm-svn: 300461
* ExternalASTMerger.cpp: Silence another warning. [-Wunused-lambda-capture]NAKAMURA Takumi2017-04-131-0/+1
| | | | llvm-svn: 300145
* Silence unused variable warning in release builds.Benjamin Kramer2017-04-111-0/+1
| | | | llvm-svn: 300006
* [ExternalASTMerger] Removed a move constructor to address MSVC build failureSean Callanan2017-04-111-1/+1
| | | | llvm-svn: 299983
* [ExternalASTMerger] Fix the MSVC buildSean Callanan2017-04-111-3/+3
| | | | llvm-svn: 299977
* [clang-import-test] Lookup inside contextsSean Callanan2017-04-111-0/+183
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
OpenPOWER on IntegriCloud