hanchenye-llvm-project/clang
Douglas Gregor 935bc7a214 Make the loading of information attached to an IdentifierInfo from an
AST file more lazy, so that we don't eagerly load that information for
all known identifiers each time a new AST file is loaded. The eager
reloading made some sense in the context of precompiled headers, since
very few identifiers were defined before PCH load time. With modules,
however, a huge amount of code can get parsed before we see an
@import, so laziness becomes important here.

The approach taken to make this information lazy is fairly simple:
when we load a new AST file, we mark all of the existing identifiers
as being out-of-date. Whenever we want to access information that may
come from an AST (e.g., whether the identifier has a macro definition,
or what top-level declarations have that name), we check the
out-of-date bit and, if it's set, ask the AST reader to update the
IdentifierInfo from the AST files. The update is a merge, and we now
take care to merge declarations before/after imports with declarations
from multiple imports.

The results of this optimization are fairly dramatic. On a small
application that brings in 14 non-trivial modules, this takes modules
from being > 3x slower than a "perfect" PCH file down to 30% slower
for a full rebuild. A partial rebuild (where the PCH file or modules
can be re-used) is down to 7% slower. Making the PCH file just a
little imperfect (e.g., adding two smallish modules used by a bunch of
.m files that aren't in the PCH file) tips the scales in favor of the
modules approach, with 24% faster partial rebuilds.

This is just a first step; the lazy scheme could possibly be improved
by adding versioning, so we don't search into modules we already
searched. Moreover, we'll need similar lazy schemes for all of the
other lookup data structures, such as DeclContexts.

llvm-svn: 143100
2011-10-27 09:33:13 +00:00
..
INPUTS Enhance the CFG construction to detect no-return destructors for 2011-09-13 06:09:01 +00:00
bindings/python Add support for constant arrays, from Anders Waldenborg!. 2011-10-19 05:51:43 +00:00
docs Update documentation to use "C++11" instead of "C++0x" 2011-10-18 05:49:30 +00:00
examples Add missing include to clang-interpreter example, to make it work on Windows. Patch by Dean Pavlekovic. 2011-10-06 22:24:13 +00:00
include Make the loading of information attached to an IdentifierInfo from an 2011-10-27 09:33:13 +00:00
lib Make the loading of information attached to an IdentifierInfo from an 2011-10-27 09:33:13 +00:00
runtime Install a copy of the libc++ headers with clang. <rdar://problem/10096516> 2011-09-30 20:24:28 +00:00
test Make the loading of information attached to an IdentifierInfo from an 2011-10-27 09:33:13 +00:00
tools Implement support for dependent Microsoft __if_exists/__if_not_exists 2011-10-25 01:33:02 +00:00
unittests Attempt to fix unit tests 2011-09-29 00:53:49 +00:00
utils Remove the Blackfin backend. 2011-10-25 00:06:12 +00:00
www Tweak the C++11 status prose a bit. We still need better user guidance on the standard library issue 2011-10-14 23:35:48 +00:00
.gitignore Revert "Test commit" 2011-10-24 10:03:25 +00:00
CMakeLists.txt Add the Clang tblgen backends to Clang, and flip the switch to cause 2011-10-06 13:03:08 +00:00
INSTALL.txt
LICENSE.TXT
Makefile Add the Clang tblgen backends to Clang, and flip the switch to cause 2011-10-06 13:03:08 +00:00
ModuleInfo.txt
NOTES.txt Make a note about a missing optimization. 2011-07-28 07:41:22 +00:00
README.txt

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.cs.uiuc.edu/mailman/listinfo/cfe-dev

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