llvm-project/clang/test
Sean Callanan 967d438439 Add support for remembering origins to ExternalASTMerger
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
2017-09-27 19:57:58 +00:00
..
ARCMT clang/test/ARCMT/remap-applying.c: Use %/s on the command line of echo(1). 2017-04-28 05:02:52 +00:00
ASTMerge Revert r299355 "[ASTImporter] Fix for importing unnamed structs" 2017-04-03 21:06:45 +00:00
Analysis [analyzer] Fix an outdated comment in a test. NFC. 2017-09-27 10:59:06 +00:00
CXX Don't warn about runtime behavior problems in variable initializers that we 2017-09-23 18:27:11 +00:00
CodeCompletion Fixed a crash in code completion. 2017-09-08 13:36:38 +00:00
CodeGen revert rL314300 2017-09-27 13:02:44 +00:00
CodeGenCUDA CodeGenModule: Always output wchar_size, check LLVM assumptions. 2017-05-20 01:29:55 +00:00
CodeGenCXX Add test forgotten in r314262. 2017-09-27 03:23:02 +00:00
CodeGenCoroutines [coroutines] Support coroutine-handle returning await-suspend (i.e symmetric control transfer) 2017-08-25 04:46:54 +00:00
CodeGenObjC [CodeGen][ObjC] Build the global block structure before emitting the 2017-09-22 21:32:06 +00:00
CodeGenObjCXX Fix off-by-one error in block mangling. 2017-09-07 05:41:24 +00:00
CodeGenOpenCL [OpenCL] Fixed CL version in failing test. 2017-09-27 17:03:35 +00:00
Coverage [Analyzer] Add support for displaying cross-file diagnostic paths in HTML output 2017-08-03 18:12:22 +00:00
CoverageMapping [Coverage] Add an option to emit limited coverage info 2017-09-22 18:23:04 +00:00
Driver [OpenMP] Fix passing of -m arguments to device toolchain 2017-09-27 18:12:34 +00:00
FixIt [clang] Fix printf fixit for objc specific types 2017-09-22 18:36:06 +00:00
Format [clang] Get rid of "%T" expansions 2017-08-15 19:47:06 +00:00
Frontend Extend -ast-dump for CXXRecordDecl to dump the flags from the DefinitionData. 2017-09-22 00:11:15 +00:00
Headers This adds the _Float16 preprocessor macro definitions. 2017-09-13 15:23:19 +00:00
Import Add support for remembering origins to ExternalASTMerger 2017-09-27 19:57:58 +00:00
Index Set completion priority of destructors and operators to CCP_Unlikely. 2017-09-22 19:07:37 +00:00
Integration Fix the test fix from r312181 2017-08-30 23:26:38 +00:00
Layout
Lexer Recommit "Add _Float16 as a C/C++ source language type" 2017-09-08 15:15:00 +00:00
Misc Add support for attribute 'noescape'. 2017-09-22 00:41:05 +00:00
Modules Extend -ast-dump for CXXRecordDecl to dump the flags from the DefinitionData. 2017-09-22 00:11:15 +00:00
OpenMP [OpenMP] Add an additional test for D34888 2017-09-27 14:31:08 +00:00
PCH Implement C++ [basic.link]p8. 2017-09-20 07:22:00 +00:00
Parser [c++2a] P0683R1: Permit default member initializers for bit-fields. 2017-08-28 00:28:14 +00:00
Preprocessor [Clang] Adding missing feature to goldmont 2017-09-25 13:49:32 +00:00
Profile [Profile] Do not assign counters to functions without bodies 2017-06-30 21:02:14 +00:00
Refactor Fix Refactor/tool-test-support.c test on Windows by avoiding 2017-09-14 15:10:39 +00:00
Rewriter [clang] Remove unit test which uses reverse-iterate flag 2017-08-24 22:40:32 +00:00
Sema Emit section information for extern variables. 2017-09-26 23:42:34 +00:00
SemaCUDA [CUDA] When compilation fails, print the compilation mode. 2017-09-07 18:37:16 +00:00
SemaCXX Allow IUnknown/IInterface types to come from extern C++ 2017-09-26 18:55:16 +00:00
SemaObjC [Sema][ObjC] Warn about mismatches in attributes between overriding and 2017-09-20 05:39:18 +00:00
SemaObjCXX Add test cases that weren't committed in r313945. 2017-09-22 01:54:36 +00:00
SemaOpenCL [OpenCL] Handle taking an address of block captures. 2017-09-07 17:00:33 +00:00
SemaTemplate Don't warn about runtime behavior problems in variable initializers that we 2017-09-23 18:27:11 +00:00
TableGen
Tooling [clang-diff] Treat CXXCtorInitializer as a node 2017-08-27 22:52:20 +00:00
Unit [lit] Rename lld and clang lit configs to end in .py 2017-09-21 17:38:13 +00:00
VFS
clang-rename [refactor] add clang-refactor tool with initial testing support and 2017-09-14 10:06:52 +00:00
.clang-format
CMakeLists.txt [test] Enable clang-func-mapping as a test dep with the analyzer 2017-09-22 22:17:10 +00:00
TestRunner.sh
cxx-sections.data
lit.cfg.py [lit.cfg] Avoid concatenating which(clang-func-mapping) if it's missing 2017-09-22 18:42:28 +00:00
lit.site.cfg.py.in [lit] Rename lld and clang lit configs to end in .py 2017-09-21 17:38:13 +00:00
make_test_dirs.pl