forked from OSchip/llvm-project
967d438439
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 |
||
---|---|---|
.. | ||
ARCMT | ||
ASTMerge | ||
Analysis | ||
CXX | ||
CodeCompletion | ||
CodeGen | ||
CodeGenCUDA | ||
CodeGenCXX | ||
CodeGenCoroutines | ||
CodeGenObjC | ||
CodeGenObjCXX | ||
CodeGenOpenCL | ||
Coverage | ||
CoverageMapping | ||
Driver | ||
FixIt | ||
Format | ||
Frontend | ||
Headers | ||
Import | ||
Index | ||
Integration | ||
Layout | ||
Lexer | ||
Misc | ||
Modules | ||
OpenMP | ||
PCH | ||
Parser | ||
Preprocessor | ||
Profile | ||
Refactor | ||
Rewriter | ||
Sema | ||
SemaCUDA | ||
SemaCXX | ||
SemaObjC | ||
SemaObjCXX | ||
SemaOpenCL | ||
SemaTemplate | ||
TableGen | ||
Tooling | ||
Unit | ||
VFS | ||
clang-rename | ||
.clang-format | ||
CMakeLists.txt | ||
TestRunner.sh | ||
cxx-sections.data | ||
lit.cfg.py | ||
lit.site.cfg.py.in | ||
make_test_dirs.pl |