Go to file
Gabor Marton 2cd0afaeb3 [ASTImporter] Refactor Decl creation
Summary:
Generalize the creation of Decl nodes during Import.  With this patch we do the
same things after and before a new AST node is created (::Create) The import
logic should be really simple, we create the node, then we mark that as
imported, then we recursively import the parts for that node and then set them
on that node.  However, the AST is actually a graph, so we have to handle
circles.  If we mark something as imported (`MapImported()`) then we return with
the corresponding `To` decl whenever we want to import that node again, this way
circles are handled.  In order to make this algorithm work we must ensure
things, which are handled in the generic CreateDecl<> template:
* There are no `Import()` calls in between any node creation (::Create)
and the `MapImported()` call.
* Before actually creating an AST node (::Create), we must check if
the Node had been imported already, if yes then return with that one.
One very important case for this is connected to templates: we may
start an import both from the templated decl of a template and from
the template itself.

Now, the virtual `Imported` function is called in `ASTImporter::Impor(Decl *)`,
but only once, when the `Decl` is imported.  One point of this refactor is to
separate responsibilities. The original `Imported()` had 3 responsibilities:
- notify subclasses when an import happened
- register the decl into `ImportedDecls`
- initialise the Decl (set attributes, etc)
Now all of these are in separate functions:
- `Imported`
- `MapImported`
- `InitializeImportedDecl`
I tried to check all the clients, I executed tests for `ExternalASTMerger.cpp`
and some unittests for lldb.

Reviewers: a.sidorin, balazske, xazax.hun, r.stahl

Subscribers: rnkovacs, dkrupp, cfe-commits

Differential Revision: https://reviews.llvm.org/D47632

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@336896 91177308-0d34-0410-b5e6-96231b3b80d8
2018-07-12 09:42:05 +00:00
INPUTS Revert 'Fix a typo 'iff' => 'if''. iff is an abreviation of if and only if. See: http://en.wikipedia.org/wiki/If_and_only_if Commit 164766 2012-09-27 10:16:10 +00:00
bindings [bindings] Fix most Python binding unittests on Windows 2018-06-21 20:07:03 +00:00
cmake [CMake] Don't build Linux targets on Darwin in Fuchsia toolchain 2018-06-28 20:33:18 +00:00
docs [docs] List correct default for -ftemplate-depth; also add missing 2018-07-11 00:34:54 +00:00
examples clang-interpreter: Add missing LLVM component Object 2018-06-03 08:12:15 +00:00
include [ASTImporter] Refactor Decl creation 2018-07-12 09:42:05 +00:00
lib [ASTImporter] Refactor Decl creation 2018-07-12 09:42:05 +00:00
runtime [CMake] Make bootstrap and compiler-rt depend on cxx-headers. 2018-06-28 18:35:25 +00:00
test Fix deduction for conversion function templates converting to reference 2018-07-11 23:19:41 +00:00
tools Revert -r336726, which included more files than intended. 2018-07-10 20:51:41 +00:00
unittests [ASTImporter] Refactor Decl creation 2018-07-12 09:42:05 +00:00
utils [analyzer] [tests] Pass clang executable path to prefix-less executor scripts. 2018-07-02 17:10:40 +00:00
www DR330: look through array types when forming the cv-decomposition of a type. 2018-07-11 00:19:19 +00:00
.arcconfig [clang] Set up .arcconfig to point to new Diffusion C repository 2017-11-27 17:21:24 +00:00
.clang-format Switch the default mode for clang-format to '-file'. Make 'LLVM' the 2013-09-02 07:42:02 +00:00
.clang-tidy Backport changes from llvm/.clang_tidy to clang/.clang_tidy configs 2018-03-20 14:39:12 +00:00
.gitignore Add the clang debug info test directory to .gitignore as it's managed separately. 2016-01-29 01:35:55 +00:00
CMakeLists.txt [CMake] Make bootstrap and compiler-rt depend on cxx-headers. 2018-06-28 18:35:25 +00:00
CODE_OWNERS.TXT Change code owner for Clang Static Analyzer to Devin Coughlin. 2017-11-17 23:19:04 +00:00
INSTALL.txt Honor system specific paths of MAN pages 2015-11-20 18:49:02 +00:00
LICENSE.TXT Update copyright year to 2018. 2018-06-18 12:22:17 +00:00
ModuleInfo.txt Move the ModuleInfo.txt file. 2007-07-11 17:03:27 +00:00
NOTES.txt Remove trailing spaces 2014-07-13 17:11:45 +00:00
README.txt Test commit 2017-10-21 16:03:17 +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/