hanchenye-llvm-project/clang
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
..
INPUTS
bindings bindings: expose Linkage to the python bindings 2017-09-22 18:35:09 +00:00
cmake [Fuchsia] Set ENABLE_X86_RELAX_RELOCATIONS for Fuchsia builds 2017-09-13 19:17:41 +00:00
docs [analyzer] Keep track of design discusions as part of analyzer documentation. 2017-09-26 15:49:53 +00:00
examples
include Add support for remembering origins to ExternalASTMerger 2017-09-27 19:57:58 +00:00
lib Add support for remembering origins to ExternalASTMerger 2017-09-27 19:57:58 +00:00
runtime Resubmit "[lit] Force site configs to run before source-tree configs" 2017-09-15 22:10:46 +00:00
test Add support for remembering origins to ExternalASTMerger 2017-09-27 19:57:58 +00:00
tools Add support for remembering origins to ExternalASTMerger 2017-09-27 19:57:58 +00:00
unittests clang-format/java: Unbreak genenrics formatting after r299952. 2017-09-27 17:57:50 +00:00
utils [Analyzer] Fix minor errors in python scripts. 2017-09-22 22:58:46 +00:00
www set the svn:executable property, seems that it is necessary for apache (discussed with Tanya by email) 2017-09-10 08:00:03 +00:00
.arcconfig
.clang-format
.clang-tidy
.gitignore
CMakeLists.txt Don't search libxml2 if using msan. LLVM already has similar check. 2017-09-02 03:53:42 +00:00
CODE_OWNERS.TXT
INSTALL.txt
LICENSE.TXT
ModuleInfo.txt
NOTES.txt
README.txt Test commit access in clang. 2017-09-03 15:29:38 +00:00

README.txt

//===----------------------------------------------------------------------===//
// C Language Family Front-end
//===----------------------------------------------------------------------===//

Welcome to Clang.  This is a compiler front-end for the C family of languages
(C, C++, Objective-C, and Objective-C++) which is built as part of the LLVM
compiler infrastructure project.

Unlike many other compiler frontends, Clang is useful for a number of things
beyond just compiling code: we intend for Clang to be host to a number of
different source-level tools.  One example of this is the Clang Static Analyzer.

If you're interested in more (including how to build Clang) it is best to read
the relevant web sites.  Here are some pointers:

Information on Clang:              http://clang.llvm.org/
Building and using Clang:          http://clang.llvm.org/get_started.html
Clang Static Analyzer:             http://clang-analyzer.llvm.org/
Information on the LLVM project:   http://llvm.org/

If you have questions or comments about Clang, a great place to discuss them is
on the Clang development mailing list:
  http://lists.llvm.org/mailman/listinfo/cfe-dev

If you find a bug in Clang, please file it in the LLVM bug tracker:
  http://llvm.org/bugs/