summaryrefslogtreecommitdiffstats
path: root/test/Import
Commit message (Collapse)AuthorAgeFilesLines
* [ASTImporter] Add support for import of CXXInheritedCtorInitExpr.Balazs Keri2018-07-252-0/+17
| | | | | | | | | | | | Reviewers: a.sidorin, martong Reviewed By: martong Subscribers: rnkovacs, a_sidorin, martong, cfe-commits Differential Revision: https://reviews.llvm.org/D49293 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337898 91177308-0d34-0410-b5e6-96231b3b80d8
* [ASTImporter] fix test failure corrected by fixed func end locsRafael Stahl2018-07-091-1/+1
| | | | | | | | fix to rC336523 / D48941 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@336527 91177308-0d34-0410-b5e6-96231b3b80d8
* [ASTImporter] Properly import SourceLocations of AttrsAleksei Sidorin2018-05-082-0/+39
| | | | | | | | | | Patch by Rafael Stahl! Differential Revision: https://reviews.llvm.org/D46115 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@331762 91177308-0d34-0410-b5e6-96231b3b80d8
* [ASTImporter] Support LambdaExprs and improve template supportAleksei Sidorin2018-01-262-1/+8
| | | | | | | | | | | | | | | | Also, a number of style and bug fixes was done: * ASTImporterTest: added sanity check for source node * ExternalASTMerger: better lookup for template specializations * ASTImporter: don't add templated declarations into DeclContext * ASTImporter: introduce a helper, ImportTemplateArgumentListInfo getting SourceLocations * ASTImporter: proper set ParmVarDecls for imported FunctionProtoTypeLoc Differential Revision: https://reviews.llvm.org/D42301 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@323519 91177308-0d34-0410-b5e6-96231b3b80d8
* Add support for remembering origins to ExternalASTMergerSean Callanan2017-09-2718-3/+86
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@314336 91177308-0d34-0410-b5e6-96231b3b80d8
* This adds the argument --dump-ir to clang-import-test, which allows Sean Callanan2017-08-074-0/+35
| | | | | | | | | | | | | | | | | | | | | | viewing of the final IR. This is useful for confirming that structure layout was correct. I've added two tests: - A test that checks that structs in top-level code are completed correctly during struct layout (they are) - A test that checks that structs defined in function bodies are cpmpleted correctly during struct layout (currently they are not, so this is XFAIL). The second test fails because LookupSameContext() (ExternalASTMerger.cpp) can't find the struct. This is an issue I intend to resolve separately. Differential Revision: https://reviews.llvm.org/D36429 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@310318 91177308-0d34-0410-b5e6-96231b3b80d8
* [ExternalASTMerger] Import Objective-C classesSean Callanan2017-07-252-0/+9
| | | | | | | | | | | | | | 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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@309014 91177308-0d34-0410-b5e6-96231b3b80d8
* [clang-import-test] Test that enumerators and their values are found.Sean Callanan2017-07-112-0/+8
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@307603 91177308-0d34-0410-b5e6-96231b3b80d8
* clang-import-test had some dead code. I did the following to eliminate it:Sean Callanan2017-07-102-0/+8
| | | | | | | | | | | | | | | - 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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@307600 91177308-0d34-0410-b5e6-96231b3b80d8
* Add testcase for r305850.Lang Hames2017-07-072-0/+16
| | | | | | | Accidentally left this out of the original commit. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@307444 91177308-0d34-0410-b5e6-96231b3b80d8
* Call setMustBuildLookupTable on TagDecls in ExternalASTMergerLang Hames2017-06-172-0/+7
| | | | | | | | | | | | | | | | | | | | 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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@305619 91177308-0d34-0410-b5e6-96231b3b80d8
* [ASTImporter] Improve handling of incomplete typesSean Callanan2017-05-133-0/+20
| | | | | | | | | | | | | | | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@302975 91177308-0d34-0410-b5e6-96231b3b80d8
* Added an Importer test for in-class member initializers.Sean Callanan2017-04-272-0/+8
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@301573 91177308-0d34-0410-b5e6-96231b3b80d8
* [clang-import-test] Lookup inside contextsSean Callanan2017-04-1117-0/+84
| | | | | | | | | | | | | | | | | | | | 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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@299976 91177308-0d34-0410-b5e6-96231b3b80d8
* Testbed and skeleton of a new expression parserSean Callanan2016-12-229-0/+36
| | | | | | | | | | | | | | | | | | | | | Recommitted after formal approval. LLVM's JIT is now the foundation of dynamic-compilation features for many languages. Clang also has low-level support for dynamic compilation (ASTImporter and ExternalASTSource, notably). How the compiler is set up for dynamic parsing is generally left up to individual clients, for example LLDB's C/C++/Objective-C expression parser and the ROOT project. Although this arrangement offers external clients the flexibility to implement dynamic features as they see fit, the lack of an in-tree client means that subtle bugs can be introduced that cause regressions in the external clients but aren't caught by tests (or users) until much later. LLDB for example regularly encounters complicated ODR violation scenarios where it is not immediately clear who is at fault. Other external clients (notably, Cling) rely on similar functionality, and another goal is to break this functionality up into composable parts so that any client can be built easily on top of Clang without requiring extensive additional code. I propose that the parts required to build a simple expression parser be added to Clang. Initially, I aim to have the following features: A piece that looks up external declarations from a variety of sources (e.g., from previous dynamic compilations, from modules, or from DWARF) and uses clear conflict resolution rules to reconcile differences, with easily understood errors. This functionality will be supported by in-tree tests. A piece that works hand in hand with the LLVM JIT to resolve the locations of external declarations so that e.g. variables can be redeclared and (for high-performance applications like DTrace) external variables can be accessed directly from the registers where they reside. This commit adds a tester that parses a sequence of source files and then uses them as source data for an expression. External references are resolved using an ExternalASTSource that responds to name queries using an ASTImporter. This is the setup that LLDB uses, and the motivating reason for MinimalImport in ASTImporter. When complete, this tester will implement the first of the above goals. Differential Revision: https://reviews.llvm.org/D27180 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@290367 91177308-0d34-0410-b5e6-96231b3b80d8
* Reverting r290004, r290006, r290010 pending review.Sean Callanan2016-12-199-36/+0
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@290130 91177308-0d34-0410-b5e6-96231b3b80d8
* Testbed and skeleton of a new expression parserSean Callanan2016-12-169-0/+36
LLVM's JIT is now the foundation of dynamic-compilation features for many languages. Clang also has low-level support for dynamic compilation (ASTImporter and ExternalASTSource, notably). How the compiler is set up for dynamic parsing is generally left up to individual clients, for example LLDB's C/C++/Objective-C expression parser and the ROOT project. Although this arrangement offers external clients the flexibility to implement dynamic features as they see fit, the lack of an in-tree client means that subtle bugs can be introduced that cause regressions in the external clients but aren't caught by tests (or users) until much later. LLDB for example regularly encounters complicated ODR violation scenarios where it is not immediately clear who is at fault. Other external clients (notably, Cling) rely on similar functionality, and another goal is to break this functionality up into composable parts so that any client can be built easily on top of Clang without requiring extensive additional code. I propose that the parts required to build a simple expression parser be added to Clang. Initially, I aim to have the following features: - A piece that looks up external declarations from a variety of sources (e.g., from previous dynamic compilations, from modules, or from DWARF) and uses clear conflict resolution rules to reconcile differences, with easily understood errors. This functionality will be supported by in-tree tests. - A piece that works hand in hand with the LLVM JIT to resolve the locations of external declarations so that e.g. variables can be redeclared and (for high-performance applications like DTrace) external variables can be accessed directly from the registers where they reside. This commit adds a tester that parses a sequence of source files and then uses them as source data for an expression. External references are resolved using an ExternalASTSource that responds to name queries using an ASTImporter. This is the setup that LLDB uses, and the motivating reason for MinimalImport in ASTImporter. When complete, this tester will implement the first of the above goals. Differential Revision: https://reviews.llvm.org/D27180 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@290004 91177308-0d34-0410-b5e6-96231b3b80d8