• Home
  • History
  • Annotate
  • only in /external/clang/test/Modules/
History log of /external/clang/test/Modules/
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
ef8225444452a1486bd721f3285301fe84643b00 21-Jul-2014 Stephen Hines <srhines@google.com> Update Clang for rebase to r212749.

This also fixes a small issue with arm_neon.h not being generated always.

Includes a cherry-pick of:
r213450 - fixes mac-specific header issue
r213126 - removes a default -Bsymbolic on Android

Change-Id: I2a790a0f5d3b2aab11de596fc3a74e7cbc99081d
nputs/cxx-decls-imported.h
nputs/cxx-decls-merged.h
nputs/module.map
nputs/templates-left.h
nputs/templates-right.h
nputs/templates-top.h
utolink.m
ompiler_builtins_arm.m
xx-decls.cpp
xx-irgen.cpp
ependency-dump-dependent-module.m
ependency-dump.m
emplates.mm
6bcf27bb9a4b5c3f79cb44c0e4654a6d7619ad89 29-May-2014 Stephen Hines <srhines@google.com> Update Clang for 3.5 rebase (r209713).

Change-Id: I8c9133b0f8f776dc915f270b60f94962e771bc83
nputs/cxx-decls-imported.h
nputs/cxx-irgen-left.h
nputs/cxx-irgen-top.h
nputs/cxx-templates-a.h
nputs/cxx-templates-b-impl.h
nputs/cxx-templates-common.h
nputs/exclude-header/module.map
nputs/exclude-header/x/a.h
nputs/exclude-header/x/bad.h
nputs/exclude-header/y/b.h
nputs/module.map
nputs/modules-with-same-name/DependsOnA/DependsOnA.h
nputs/modules-with-same-name/DependsOnA/module.modulemap
nputs/modules-with-same-name/path1/A/a.h
nputs/modules-with-same-name/path1/A/module.modulemap
nputs/modules-with-same-name/path2/A/a.h
nputs/modules-with-same-name/path2/A/module.modulemap
nputs/redecl-add-after-load-decls.h
nputs/redecl-add-after-load-top.h
nputs/redecl-add-after-load.h
nputs/require-modular-includes/A.framework/Headers/A.h
nputs/require-modular-includes/AnotherModule.h
nputs/require-modular-includes/AnotherModuleExcluded.h
nputs/require-modular-includes/B.framework/Headers/B.h
nputs/require-modular-includes/C.h
nputs/require-modular-includes/ExcludedFromAnotherModule.framework/Headers/ExcludedFromAnotherModule.h
nputs/require-modular-includes/FromAnotherModule.framework/Headers/FromAnotherModule.h
nputs/require-modular-includes/FromImportedModuleFail.framework/Headers/FromImportedModuleFail.h
nputs/require-modular-includes/FromImportedModuleOK.framework/Headers/FromImportedModuleOK.h
nputs/require-modular-includes/FromImportedModuleOK.framework/Headers/FromImportedModuleOK2.h
nputs/require-modular-includes/FromImportedModuleOK.framework/Modules/module.modulemap
nputs/require-modular-includes/FromImportedSubModule.framework/Headers/Header.h
nputs/require-modular-includes/FromImportedSubModule.framework/Modules/module.modulemap
nputs/require-modular-includes/FromNonModularSubframework.framework/Frameworks/Subframework.framework/Headers/Subframework.h
nputs/require-modular-includes/FromNonModularSubframework.framework/Headers/FromNonModularSubframework.h
nputs/require-modular-includes/FromNonModularSubframework.framework/Modules/module.modulemap
nputs/require-modular-includes/FromSubframework.framework/Frameworks/Subframework.framework/Headers/Subframework.h
nputs/require-modular-includes/FromSubframework.framework/Headers/FromSubframework.h
nputs/require-modular-includes/FromSubframework.framework/Modules/module.modulemap
nputs/require-modular-includes/FromUmbrella.framework/Headers/FromUmbrella.h
nputs/require-modular-includes/IncludeExcluded.framework/Headers/Excluded.h
nputs/require-modular-includes/IncludeExcluded.framework/Headers/IncludeExcluded.h
nputs/require-modular-includes/IncludeExcluded.framework/Modules/module.modulemap
nputs/require-modular-includes/NotFramework.h
nputs/require-modular-includes/NotInModule.h
nputs/require-modular-includes/module.modulemap
nputs/require-modular-includes/umbrella/bar/bar.h
nputs/require-modular-includes/umbrella/foo.h
nputs/submodules/module.map
nputs/templates-left.h
nputs/templates-right.h
nputs/templates-top.h
nputs/undefined-type-fixit/module.map
nputs/undefined-type-fixit/public1.h
nputs/undefined-type-fixit/public2.h
nputs/undefined-type-fixit/public2sub.h
module-build.m
error-Wsystem-headers.m
error.m
xx-decls.cpp
xx-irgen.cpp
xx-templates.cpp
ecldef.mm
ependency-gen-pch.m
iamond-pch.c
xclude-header.c
mport-self.m
oad-after-failure.m
acro-undef-through-pch.m
issing-header.m
issing-submodule.m
odule_file_info.m
odules-with-same-name.m
o-stale-modtime.m
rune.m
edecl-add-after-load.cpp
edecls/main.m
equire-modular-includes.m
esolution-change.m
trict-decluse.cpp
ubmodules.cpp
ystem_version.m
emplate-specialization-visibility.cpp
emplates.mm
ndefined-type-fixit1.cpp
alidate-system-headers.m
651f13cea278ec967336033dd032faef0e9fc2ec 24-Apr-2014 Stephen Hines <srhines@google.com> Updated to Clang 3.5a.

Change-Id: I8127eb568f674c2e72635b639a3295381fe8af82
nputs/ModuleMapLocations/Both/a.h
nputs/ModuleMapLocations/Both/b.h
nputs/ModuleMapLocations/Both/module.map
nputs/ModuleMapLocations/Both/module.modulemap
nputs/ModuleMapLocations/Both_F.framework/Headers/a.h
nputs/ModuleMapLocations/Both_F.framework/Headers/b.h
nputs/ModuleMapLocations/Both_F.framework/Modules/module.modulemap
nputs/ModuleMapLocations/Both_F.framework/module.map
nputs/ModuleMapLocations/Inferred.framework/Headers/Inferred.h
nputs/ModuleMapLocations/Module_ModuleMap/a.h
nputs/ModuleMapLocations/Module_ModuleMap/module.modulemap
nputs/ModuleMapLocations/Module_ModuleMap_F.framework/Headers/a.h
nputs/ModuleMapLocations/Module_ModuleMap_F.framework/Modules/module.modulemap
nputs/ModuleMapLocations/Module_ModuleMap_F.framework/Modules/module.private.modulemap
nputs/ModuleMapLocations/Module_ModuleMap_F.framework/PrivateHeaders/private.h
nputs/ModuleMapLocations/module.modulemap
nputs/autolink-sub3.h
nputs/autolink-sub3.pch
nputs/c-header-bad.h
nputs/c-header.h
nputs/cxx-header.h
nputs/cxx-inline-namespace-b.h
nputs/cxx-inline-namespace.h
nputs/cxx-irgen-left.h
nputs/cxx-irgen-right.h
nputs/cxx-irgen-top.h
nputs/cxx-templates-a.h
nputs/cxx-templates-b.h
nputs/cxx-templates-common.h
nputs/declare-use/e.h
nputs/declare-use/h.h
nputs/declare-use/i.h
nputs/declare-use/j.h
nputs/declare-use/module.map
nputs/declare-use/s.h
nputs/elsewhere/c-header-indirect.h
nputs/elsewhere/module.map
nputs/include-relative/a.h
nputs/include-relative/module.map
nputs/macro-undef-through-pch/A.h
nputs/macro-undef-through-pch/foo.h
nputs/macro-undef-through-pch/module.map
nputs/macros_other.h
nputs/macros_right.h
nputs/macros_right_undef.h
nputs/macros_top.h
nputs/macros_top_b.h
nputs/macros_top_c.h
nputs/malformed/a1.h
nputs/malformed/a2.h
nputs/malformed/b1.h
nputs/malformed/b2.h
nputs/malformed/module.map
nputs/module.map
nputs/namespaces-left.h
nputs/namespaces-top.h
nputs/recursive1.h
nputs/recursive2.h
nputs/string_names/a.h
nputs/string_names/b.h
nputs/string_names/c.h
nputs/string_names/module.map
nputs/string_names/sub.h
nputs/submodules/import-self-b.h
nputs/submodules/module.map
nputs/submodules/not_missing.h
nputs/template-specialization-visibility/a.h
nputs/template-specialization-visibility/b.h
nputs/template-specialization-visibility/c.h
nputs/template-specialization-visibility/d.h
nputs/template-specialization-visibility/e.h
nputs/template-specialization-visibility/module.map
nputs/unnecessary-module-map-parsing/a1.h
nputs/unnecessary-module-map-parsing/module.map
nputs/update-after-load/a.h
nputs/update-after-load/b.h
nputs/update-after-load/module.map
nputs/update-after-load/modules.timestamp
uto-module-import.m
utolink.m
onfig_macros.m
xx-inline-namespace.cpp
xx-irgen.cpp
xx-templates.cpp
eclare-use.S
eclare-use1.cpp
eclare-use2.cpp
eclare-use3.cpp
eclare-use4.cpp
ependency-gen-inferred-map.m
ependency-gen-pch.m
ependency-gen.m
iag-pragma.c
iamond-pch.c
iamond.c
xtern_c.cpp
xtern_c_bad.cpp
atal-module-loader-error.m
modules-validate-once-per-build-session.c
nclude-relative.c
rgen.c
inkage-merge.cpp
inkage-merge.m
oad_failure.c
ookup.cpp
ookup.m
acro-undef-through-pch.m
acros.c
acros2.c
alformed.cpp
odule-private.cpp
odule_file_info.m
odulemap-locations.m
amespaces.cpp
bjc-categories.m
bjc_redef.m
ecursive.c
edecl-namespaces.mm
edeclarations.m
edecls/main.m
enamed.m
tring_names.cpp
ubframework-from-intermediate-path.m
ubmodules.cpp
emplate-specialization-visibility.cpp
nnecessary-module-map-parsing.c
pdate-after-load.cpp
alidate-system-headers.m
26297f57634994b4ae47a0774c372d6944265bb2 15-Nov-2013 Richard Smith <richard-llvm@metafoo.co.uk> When we hit a #include directive that maps to a module import, emit a token
representing the module import rather than making the module immediately
visible. This serves two goals:
* It avoids making declarations in the module visible prematurely, if we
walk past the #include during a tentative parse, for instance, and
* It gives a diagnostic (although, admittedly, not a very nice one) if
a header with a corresponding module is included anywhere other than
at the top level.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@194782 91177308-0d34-0410-b5e6-96231b3b80d8
uto-module-import.m
a5ba7b405dff48a5a0a63fff32c99eedb044842b 07-Nov-2013 Douglas Gregor <dgregor@apple.com> Modules: Teach the preprocessor to recognize 'import' only after an '@'.

The preprocessor currently recognizes module declarations to load a
module based on seeing the 'import' keyword followed by an
identifier. This sequence is fairly unlikely in C (one would need a
type named 'import'), but is more common in Objective-C (where a
variable named 'import' can cause problems). Since import declarations
currently require a leading '@', recognize that in the preprocessor as
well. Fixes <rdar://problem/15084587>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@194225 91177308-0d34-0410-b5e6-96231b3b80d8
mport-decl.cpp
86250895597e288c86ef08c2e824956ea9835fed 04-Nov-2013 Dmitri Gribenko <gribozavr@gmail.com> Include non-explicit submodules in exported module list

This change fixes Richard's testcase for r193815. Now we include non-explicit
submodules into the list of exports.

The test failed previously because:
- recursive_visibility_a1.inner is not imported (only recursive_visibility_a1 is),
- thus the 'inner' submodule is not showing up in any of the import lists,
- and because of this getExportedModules() is not returning the
correct module set -- it only considers modules that are imported.

The fix is to make Module::getExportedModules() include non-explicit submodules
into the list of exports.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@194018 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/module.map
nputs/recursive_visibility_a1_inner.h
nputs/recursive_visibility_a2_more_inner.h
nputs/recursive_visibility_b.h
nputs/recursive_visibility_c.h
ecursive_visibility.mm
5794b53ad5b38b53c9eaf3a172354e63081ceb2f 28-Oct-2013 Richard Smith <richard-llvm@metafoo.co.uk> Allow a new syntax in a module requires-declaration:

requires ! feature

The purpose of this is to allow (for instance) the module map for /usr/include
to exclude <tgmath.h> and <complex.h> when building in C++ (these headers are
instead provided by the C++ standard library in this case, and the glibc C
<tgmath.h> header would otherwise try to include <complex.h>, resulting in a
module cycle).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@193549 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/DependsOnModule.framework/Headers/not_cxx.h
nputs/DependsOnModule.framework/Headers/not_objc.h
nputs/DependsOnModule.framework/module.map
equires.m
equires.mm
ee0cd37fe4a9f4e2ee73ae34cf93c410cb299a82 24-Oct-2013 Manuel Klimek <klimek@google.com> Use the same SourceManager for ModuleMaps and compilations.

This allows using virtual file mappings on the original SourceManager to
map in virtual module.map files. Without this patch, the ModuleMap
search will find a module.map file (as the FileEntry exists in the
FileManager), but will be unable to get the content from the
SourceManager (as ModuleMap previously created its own SourceManager).

Two problems needed to be fixed which this patch exposed:

1. Storing the inferred module map
When writing out a module, the ASTWriter stores the names of the files
in the main source manager; when loading the AST again, the ASTReader
errs out if such a file is found missing, unless it is overridden.
Previously CompilerInstance's compileModule method would store the
inferred module map to a temporary file; the problem with this approach
is that now that the module map is handled by the main source manager,
the ASTWriter stores the name of the temporary module map as source to
the compilation; later, when the module is loaded, the temporary file
has already been deleted, which leads to a compilation error. This patch
changes the inferred module map to instead inject a virtual file into
the source manager. This both saves some disk IO, and works with how the
ASTWriter/ASTReader handle overridden source files.

2. Changing test input in test/Modules/Inputs/*
Now that the module map file is handled by the main source manager, the
VerifyDiagnosticConsumer will not ignore diagnostics created while
parsing the module map file. The module test test/Modules/renamed.m uses
-I test/Modules/Inputs and triggers recursive loading of all module maps
in test/Modules/Inputs, some of which had conflicting names, thus
leading errors while parsing the module maps. Those diagnostics already
occur on trunk, but before this patch they would not break the test, as
they were ignored by the VerifyDiagnosticConsumer. This patch thus
changes the module maps that have been recently introduced which broke
the invariant of compatible modules maps in test/Modules/Inputs.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@193314 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/declare-use/module.map
nputs/private1/module.map
nputs/private2/module.map
eclare-use1.cpp
eclare-use2.cpp
rivate1.cpp
f06a2893bc9778857295c64ee32b4a899a338480 23-Oct-2013 Richard Smith <richard-llvm@metafoo.co.uk> Make UsingShadowDecls redeclarable. This fixes some visibility problems with
modules.

With this fixed, I no longer see any test regressions in the libc++ test suite
when enabling a single-module module.map for libc++ (other than issues with my
system headers).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@193219 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/module.map
nputs/using-decl-a.h
nputs/using-decl-b.h
sing-decl.cpp
c641709607d45bf97772e925647db6c94866c50a 22-Oct-2013 Daniel Jasper <djasper@google.com> Allow a header to be part of multiple modules.

This patch changes two things:

a) Allow a header to be part of multiple modules. The reasoning is that
in existing codebases that have a module-like build system, the same
headers might be used in several build targets. Simple reasons might be
that they defined different classes that are declared in the same
header. Supporting a header as a part of multiple modules will make the
transistion easier for those cases. A later step in clang can then
determine whether the two modules are actually compatible and can be
merged and error out appropriately. The later check is similar to what
needs to be done for template specializations anyway.

b) Allow modules to be stored in a directory tree separate from the
headers they describe.

Review: http://llvm-reviews.chandlerc.com/D1951

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@193151 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/modular_maps/common.h
nputs/modular_maps/modulea.map
nputs/modular_maps/moduleb.map
nputs/separate_map_tree/maps/modulea.map
nputs/separate_map_tree/maps/moduleb.map
nputs/separate_map_tree/maps/modulec.map
nputs/separate_map_tree/src/common.h
nputs/separate_map_tree/src/private-in-c.h
nputs/separate_map_tree/src/public-in-b.h
nputs/separate_map_tree/src/public-in-c.h
odular_maps.cpp
eparate_map_tree.cpp
b934d248d001d1536e074e3e8da8f47db63d719f 19-Oct-2013 Richard Smith <richard-llvm@metafoo.co.uk> Fix crash if a submodule @imports another submodule from the same module. The
test also adds FIXMEs for a number of places where imports and includes of
submodules don't work very well.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@193005 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/submodules/import-self-a.h
nputs/submodules/import-self-b.h
nputs/submodules/import-self-c.h
nputs/submodules/import-self-d.h
nputs/submodules/module.map
ubmodules.cpp
9b6711873cbba149dd50cedcfdf31f9dd254df50 18-Oct-2013 Richard Smith <richard-llvm@metafoo.co.uk> C++ modules: don't lose track of a 'namespace std' that is imported from a module.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@192951 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/initializer_list
nputs/module.map
nitializer_list.cpp
3c40a28aa3dde7c5f7e1520c32e7515eda830fef 18-Oct-2013 Richard Smith <richard-llvm@metafoo.co.uk> Basic ODR checking for C++ modules:

If we have multiple definitions of the same entity from different modules, we
nominate the first definition which we see as being the canonical definition.
If we load a declaration from a different definition and we can't find a
corresponding declaration in the canonical definition, issue a diagnostic.

This is insufficient to prevent things from going horribly wrong in all cases
-- we might be in the middle of emitting IR for a function when we trigger some
deserialization and discover that it refers to an incoherent piece of the AST,
by which point it's probably too late to bail out -- but we'll at least produce
a diagnostic.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@192950 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/odr/a.h
nputs/odr/b.h
nputs/odr/module.map
dr.cpp
7a3dfcdfb32c08f2f6f4a90a097bb240fdc1a94c 16-Oct-2013 Richard Smith <richard-llvm@metafoo.co.uk> Test that we can merge together explicit and partial specializations from
merged declarations of a class template.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@192746 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/cxx-templates-a.h
nputs/cxx-templates-b.h
nputs/cxx-templates-c.h
nputs/module.map
xx-templates.cpp
d692a84e18fb48e6442bee83364f1d301f5b8404 16-Oct-2013 Richard Smith <richard-llvm@metafoo.co.uk> C++ modules: merging for enumerations and enumerators with multiple definitions
(eg through template instantiations in multiple modules).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@192740 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/cxx-templates-a.h
nputs/cxx-templates-b.h
nputs/cxx-templates-common.h
xx-templates.cpp
8bfc1e118169229960b90a4ef8761ee0eb296755 14-Oct-2013 Richard Smith <richard-llvm@metafoo.co.uk> Merge common pointers for redeclarations of the same template across modules.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@192560 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/cxx-templates-a.h
nputs/cxx-templates-b.h
xx-templates.cpp
4ed0122c1b795379cc4e11dfd62312358dcbf506 07-Oct-2013 Richard Smith <richard-llvm@metafoo.co.uk> When merging class definitions across modules in C++, merge together fields.
This change doesn't go all the way to making fields redeclarable; instead, it
makes them 'mergeable', which means we can find the canonical declaration, but
not much else (and for a declaration that's not from a module, the canonical
declaration is always that declaration).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@192092 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/templates-left.h
nputs/templates-right.h
nputs/templates-top.h
emplates.mm
1b8840ce0d7a3383915b29dc3779dfadec817458 24-Sep-2013 Daniel Jasper <djasper@google.com> Add -fmodule-map-file option.

With this option, arbitrarily named module map files can be specified
to be loaded as required for headers in the respective (sub)directories.

This, together with the extern module declaration allows for specifying
module maps in a modular fashion without the need for files called
"module.map".

Among other things, this allows a directory to contain two modules that
are completely independent of one another.

Review: http://llvm-reviews.chandlerc.com/D1697.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@191284 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/modular_maps/module.map
nputs/modular_maps/modulea.map
odular_maps.cpp
ddd2dfc1d3f4a36cbe8cd775c588623a17049f9f 24-Sep-2013 Daniel Jasper <djasper@google.com> Module use declarations (II)

Review: http://llvm-reviews.chandlerc.com/D1546.

I have picked up this patch form Lawrence
(http://llvm-reviews.chandlerc.com/D1063) and did a few changes.

From the original change description (updated as appropriate):
This patch adds a check that ensures that modules only use modules they
have so declared. To this end, it adds a statement on intended module
use to the module.map grammar:

use module-id

A module can then only use headers from other modules if it 'uses' them.
This enforcement is off by default, but may be turned on with the new
option -fmodules-decluse.

When enforcing the module semantics, we also need to consider a source
file part of a module. This is achieved with a compiler option

-fmodule-name=<module-id>.

The compiler at present only applies restrictions to the module directly
being built.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@191283 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/declare-use/a.h
nputs/declare-use/b.h
nputs/declare-use/c.h
nputs/declare-use/d.h
nputs/declare-use/e.h
nputs/declare-use/f.h
nputs/declare-use/g.h
nputs/declare-use/g1.h
nputs/declare-use/h.h
nputs/declare-use/h1.h
nputs/declare-use/module.map
eclare-use1.cpp
eclare-use2.cpp
5f0a3524d184f7fcda856aaa17686064e45cacd3 11-Sep-2013 Daniel Jasper <djasper@google.com> Support for modular module-map-files

This patch is the first step to make module-map-files modular (instead
of requiring a single "module.map"-file per include directory). This
step adds a new "extern module" declaration that enables
module-map-files to reference one another along with a very basic
implementation.

The next steps are:

* Combine this with the use-declaration (from
http://llvm-reviews.chandlerc.com/D1546) in order to only load module
map files required for a specific compilation.
* Add an additional flag to start with a specific module-map-file (instead
of requiring there to be at least one "module.map").

Review: http://llvm-reviews.chandlerc.com/D1637

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@190497 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/modular_maps/a.h
nputs/modular_maps/b.h
nputs/modular_maps/module.map
nputs/modular_maps/moduleb.map
odular_maps.cpp
b60fae50d38a0291e1c5731b2fb22849d26ca342 09-Sep-2013 Richard Smith <richard-llvm@metafoo.co.uk> C++ modules: if a class is defined in multiple modules (for instance, because
it is an implicit instantiation of a class template specialization), pick the
first-loaded definition to be the canonical definition, and merge all other
definitions into it.

This is still rather incomplete -- we need to extend every form of declaration
that can appear within a CXXRecordDecl to be redeclarable if it came from an
AST file (this includes fields, enumerators, ...).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@190315 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/cxx-templates-a.h
nputs/cxx-templates-b.h
nputs/templates-left.h
nputs/templates-right.h
nputs/templates-top.h
xx-templates.cpp
emplates.mm
b7165589b2eafc4b48d09a5914e21604ae580256 09-Sep-2013 Richard Smith <richard-llvm@metafoo.co.uk> C++ modules: fix a bug where loading a declaration with some name would prevent
name lookup from lazily deserializing the other declarations with the same
name, by tracking a bit to indicate whether a name in a DeclContext might have
additional external results. This also allows lazier reconciling of the lookup
table if a module import adds decls to a pre-existing DC.

However, this exposes a pre-existing bug, which causes a regression in
test/Modules/decldef.mm: if we have a reference to a declaration, and a
later-imported module adds a redeclaration, nothing causes us to load that
redeclaration when we use or emit the reference (which can manifest as a
reference to an undefined inline function, a use of an incomplete type, and so
on). decldef.mm has been extended with an additional testcase which fails with
or without this change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@190293 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/def.h
nputs/namespaces-top.h
xx-templates.cpp
ecldef.mm
amespaces.cpp
86164e8f51fa89a3ec904607c3848dc4a21b12cf 05-Sep-2013 Eli Friedman <eli.friedman@gmail.com> Note when a decl is used in AST files.

When an AST file is built based on another AST file, it can use a decl from
the fist file, and therefore mark the "isUsed" bit. We need to note this in
the AST file so that the bit is set correctly when the second AST file is
loaded.

This patch introduces the distinction between setIsUsed() and markUsed() so
that we don't call into the ASTMutationListener callback when it wouldn't
be appropriate.

Fixes PR16635.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@190016 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/System/usr/include/stdio.h
nputs/pch-used.h
ch-used.m
868edfa49df6f745751c82c514718fd30e2b2977 30-Aug-2013 Richard Smith <richard-llvm@metafoo.co.uk> Map from local decl IDs to global decl IDs when lazily deserializing friend decl chains.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@189629 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/cxx-decls-imported.h
nputs/dummy.h
nputs/module.map
xx-decls.cpp
d67679d7439bd17b06574781b908630f4640c662 20-Aug-2013 Richard Smith <richard-llvm@metafoo.co.uk> During typo correction, check for an exact match in an unimported module. If we
find one, then report the error as a missing import instead of as a typo.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@188821 91177308-0d34-0410-b5e6-96231b3b80d8
uto-module-import.m
ecldef.m
ecldef.mm
ormal-module-map.cpp
ubframeworks.m
ubmodules.cpp
931a4feb64f18190d189c222d61b2abf52f18ab8 12-Aug-2013 Tim Northover <tnorthover@apple.com> Fix FileCheck --check-prefix lines.

Various tests had sprung up over the years which had --check-prefix=ABC on the
RUN line, but "CHECK-ABC:" later on. This happened to work before, but was
strictly incorrect. FileCheck is getting stricter soon though.

Patch by Ron Ofir.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@188174 91177308-0d34-0410-b5e6-96231b3b80d8
river.c
1888b910a5512262228e785cc9caf90296c06a45 02-Aug-2013 Richard Smith <richard-llvm@metafoo.co.uk> When merging redeclaration chains across modules, if a declaration is visible
in one module but is only declared as a friend in another module, keep it
visible in the result of the merge.

This is incomplete on two axes:

1) Our handling of local extern declarations is basically broken (we put them
in the wrong decl context, and don't find them in redeclaration lookup, unless
they've previously been declared), and this results in them making friends
visible after a merge.

2) Eventually we'll need to mark that this has happened, and more carefully
check whether a declaration should be visible if it was only visible in some
of the modules in which it was declared. Fortunately it's rare for the
identifier namespace of a declaration to change along its redeclaration chain.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@187639 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/cxx-templates-a.h
nputs/cxx-templates-b.h
xx-templates.cpp
3f32210598ff678fbaa462422770bdbace895ac8 01-Aug-2013 Richard Smith <richard-llvm@metafoo.co.uk> Fix assert when instantiating a default argument of a template defined in a
module.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@187556 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/cxx-templates-a.h
xx-templates.cpp
b775100fea6d8955149897dae1adca50ca471d17 26-Jul-2013 Richard Smith <richard-llvm@metafoo.co.uk> When we perform dependent name lookup during template instantiation, it's not
sufficient to only consider names visible at the point of instantiation,
because that may not include names that were visible when the template was
defined. More generally, if the instantiation backtrace goes through a module
M, then every declaration visible within M should be available to the
instantiation. Any of those declarations might be part of the interface that M
intended to export to a template that it instantiates.

The fix here has two parts:

1) If we find a non-visible declaration during name lookup during template
instantiation, check whether the declaration was visible from the defining
module of all entities on the active template instantiation stack. The defining
module is not the owning module in all cases: we look at the module in which a
template was defined, not the module in which it was first instantiated.

2) Perform pending instantiations at the end of a module, not at the end of the
translation unit. This is general goodness, since it significantly cuts down
the amount of redundant work that is performed in every TU importing a module,
and also implicitly adds the module containing the point of instantiation to
the set of modules checked for declarations in a lookup within a template
instantiation.

There's a known issue here with template instantiations performed while
building a module, if additional imports are added later on. I'll fix that
in a subsequent commit.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@187167 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/cxx-templates-a.h
nputs/cxx-templates-b-impl.h
nputs/cxx-templates-b.h
nputs/cxx-templates-common.h
nputs/module.map
xx-templates.cpp
ace21ba7ba8a834a711154d8d1f29c12568dbc54 14-Jul-2013 Richard Smith <richard-llvm@metafoo.co.uk> If an unimported submodule of an imported module contains a declaration of a
global allocation or deallocation function, that should not cause that global
allocation or deallocation function to become unavailable.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186270 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/cxx-decls-imported.h
nputs/cxx-decls-unimported.h
nputs/module.map
xx-decls.cpp
96e7813f08c6adf1d8657b0da86741b54e850fd7 04-Jul-2013 Rafael Espindola <rafael.espindola@gmail.com> Add 'not' to commands that are expected to fail.

This is at least good documentation, but also opens the possibility of
using pipefail.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@185652 91177308-0d34-0410-b5e6-96231b3b80d8
uild-fail-notes.m
xx-templates.cpp
ycles.c
pic-fail.m
atal-module-loader-error.m
oad_failure.c
acros.c
9db7f57c1e3db8a2d06a833a4e0341f0fe310640 25-Jun-2013 Richard Smith <richard-llvm@metafoo.co.uk> Fix deserializing of class template partial specializations. Assign sequence
numbers as we deserialize class template partial specializations. We can't
assume that the old sequence numbers will work.

The sequence numbers are still deterministic, but are now a lot less
predictable for class template partial specializations in modules/PCH.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184811 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/cxx-templates-a.h
nputs/cxx-templates-b.h
nputs/cxx-templates-common.h
nputs/module.map
xx-templates.cpp
98f0723ca24c604d72a10047b10b60743ac71f27 25-Jun-2013 Richard Smith <richard-llvm@metafoo.co.uk> Check for matching template-parameter-lists when merging template declarations.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184791 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/cxx-templates-a.h
nputs/cxx-templates-b.h
xx-templates.cpp
096a394f3d5b4938640e1ac92d9b439a2bad0a23 24-Jun-2013 Richard Smith <richard-llvm@metafoo.co.uk> Avoid adding entries to the DeclContext lookup table multiple times when lazily
constructing a lookup table.

Previously, buildLookup would add lookup table entries for each item lexically
within the DC, and adding the first entry with a given name would trigger the
external source to add all its entries with that name. Then buildLookup would
carry on and re-add those entries all over again.

Instead, follow a simple rule: a declaration from an external source is only
ever made visible by the external source. One exception to this: since we don't
usually build a lookup table for the TU in C, and we never serialize one, we
don't expect the external source to provide lookups in the TU in C, so we build
those ones ourselves.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184696 91177308-0d34-0410-b5e6-96231b3b80d8
xx-templates.cpp
acd954bd8f28383e7538c4d0fd989763744f5e99 24-Jun-2013 Richard Smith <richard-llvm@metafoo.co.uk> Slightly improve cross-module merging for function templates.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184689 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/cxx-templates-a.h
nputs/cxx-templates-b.h
nputs/module.map
xx-templates.cpp
8f5d7d1d1f990f174c7f2682271a83acf64dd93d 21-Jun-2013 Douglas Gregor <dgregor@apple.com> [Modules] If a module map resides in a system header directory, treat it as a system module.

This prevents -pedantic from causing warnings in the system headers
used to create modules. Fixes <rdar://problem/14201171>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184560 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/module.map
nputs/warning.h
ystem_headers.m
74f05cc06310e091781a375b3ac7e07357608806 21-Jun-2013 Douglas Gregor <dgregor@apple.com> Add test header missing from r184504.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184505 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/MethodPoolBSub2.h
fc46be997f8219e11900473c373b639525396064 21-Jun-2013 Douglas Gregor <dgregor@apple.com> When building a module, keep *all* declared methods in the global method pool.

As an optimization, we only kept declared methods with distinct
signatures in the global method pool, to keep the method lists
small. Under modules, however, one could have two different methods
with the same signature that occur in different (sub)modules. If only
the later submodule is important, message sends to 'id' with that
selector would fail because the first method (the only one that got
into the method pool) was hidden. When building a module, keep *all*
of the declared methods.

I did a quick check of both module build time and uses of modules, and
found no performance regression despite this causing us to keep more
methods in the global method pool. Fixes <rdar://problem/14148896>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184504 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/MethodPoolBSub.h
nputs/module.map
ethod_pool.m
f3a0d0f3249898d89d6d0c6d2a927c5a77a01652 20-Jun-2013 Lawrence Crowl <crowl@google.com> Test files for private header patch.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184472 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/private/common.h
nputs/private/module.map
nputs/private/private1.h
nputs/private/private2.h
nputs/private/public1.h
nputs/private/public2.h
nputs/private0/common.h
nputs/private1/module.map
nputs/private1/private1.h
nputs/private1/public1.h
nputs/private2/module.map
nputs/private2/private2.h
nputs/private2/public2.h
rivate.cpp
rivate1.cpp
89735b9516b1a378c6d33620a6c3a0d5705f9d04 24-May-2013 Aaron Ballman <aaron@aaronballman.com> Suffixing #pragma comment(lib) library names with .lib if necessary. This matches MSVC behavior, as well as allows us to properly link libraries such as the ones provided by the MSDN examples.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182647 91177308-0d34-0410-b5e6-96231b3b80d8
utolink.m
1783b07ea8cce51ed9a3014e89fd2a800ba05653 24-May-2013 Argyrios Kyrtzidis <akyrtzi@gmail.com> User correct case for 'FileCheck'.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182632 91177308-0d34-0410-b5e6-96231b3b80d8
atal-module-loader-error.m
3b7deda7137e62810a810ce25b062927a9fc7c71 24-May-2013 Argyrios Kyrtzidis <akyrtzi@gmail.com> [modules] If we hit a failure while loading a PCH/module, abort parsing instead of trying to continue in an invalid state.

Also don't let libclang create a PCH with such an error.

Fixes rdar://13953768

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182629 91177308-0d34-0410-b5e6-96231b3b80d8
atal-module-loader-error.m
44b6fa39206ca47ee534a4db4fe5168617546dba 20-May-2013 Douglas Gregor <dgregor@apple.com> Add arm_neon.h to the builtin intrinsics module map.

Fixes <rdar://problem/13933913>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182268 91177308-0d34-0410-b5e6-96231b3b80d8
ompiler_builtins_arm.m
7baff64eb362ab8c3e0b821dd066ea80fdef4946 20-May-2013 Douglas Gregor <dgregor@apple.com> Fix broken test

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182264 91177308-0d34-0410-b5e6-96231b3b80d8
uild-fail-notes.m
58ea48dc1dd970f131207e00ae7ece159d1a08ed 20-May-2013 Douglas Gregor <dgregor@apple.com> Add -Wincomplete-module, which detects when a header is included from a module but isn't itself part of a module.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182263 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/incomplete_mod.h
nputs/incomplete_mod_missing.h
nputs/module.map
ncomplete-module.m
8b56788202e49747cc82ef87e5ef0d8d92c11b5b 16-May-2013 NAKAMURA Takumi <geek4civic@gmail.com> clang/test/Modules/self-import-header/test.m: Add explicit -target.

Clang has an issue between mingw/include/float.h and clang/Headers/float.h with cyclic include_next.
For now, it should work to suppress #include_next in clang/float.h with an explicit target.
(It may work with -U__MINGW32__, though.)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181988 91177308-0d34-0410-b5e6-96231b3b80d8
elf-import-header/test.m
14040142a3b3c1029092bc1f7c51e347c3fa8f89 15-May-2013 Fariborz Jahanian <fjahanian@apple.com> improve of note message and minor refactoring of my last
patch (r181847).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181896 91177308-0d34-0410-b5e6-96231b3b80d8
bjc-categories.m
9f00b1d3962147a2fe049b8b45f70680bc12fbc1 15-May-2013 Fariborz Jahanian <fjahanian@apple.com> Objective-C [diagnostics] [QOI], when method is not
found for a receiver, note where receiver class
is declaraed (this is most common when receiver is a forward
class). // rdar://3258331


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181847 91177308-0d34-0410-b5e6-96231b3b80d8
bjc-categories.m
d3220dbeeadc4ac54ceecea8cf63f8d8be291d2a 09-May-2013 Argyrios Kyrtzidis <akyrtzi@gmail.com> [modules] When building a module, make sure we don't serialize out HeaderFileInfo for headers not belonging to the module.

After r180934 we may initiate module map parsing for modules not related to the module what we are building,
make sure we ignore the header file info of headers from such modules.

First part of rdar://13840148

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181489 91177308-0d34-0410-b5e6-96231b3b80d8
elf-import-header/af.framework/Headers/a1.h
elf-import-header/af.framework/Headers/a2.h
elf-import-header/af.framework/module.map
elf-import-header/depend_builtin/h1.h
elf-import-header/depend_builtin/module.map
elf-import-header/test.m
3190ca922d3743137e15fe0c525c04b177b9983b 08-May-2013 Reid Kleckner <reid@kleckner.net> Forward #pragma comment(lib/linker) through as flags metadata

Summary:
Most of this change is wiring the pragma all the way through from the
lexer, parser, and sema to codegen. I considered adding a Decl AST node
for this, but it seemed too heavyweight.

Mach-O already uses a metadata flag called "Linker Options" to do this
kind of auto-linking. This change follows that pattern.

LLVM knows how to forward the "Linker Options" metadata into the COFF
.drectve section where these flags belong. ELF support is not
implemented, but possible.

This is related to auto-linking, which is http://llvm.org/PR13016.

CC: cfe-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D723

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181426 91177308-0d34-0410-b5e6-96231b3b80d8
utolink.m
745dacfcd1c9747a443b40683393aeb5f14d6f7b 06-May-2013 Douglas Gregor <dgregor@apple.com> Remove forward slashes from check; should unbreak Windows buildbots.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181199 91177308-0d34-0410-b5e6-96231b3b80d8
erialized-diags.m
a4a90cabfa15c900016a7cfaea51a6d4e8ebf4db 04-May-2013 Douglas Gregor <dgregor@apple.com> When building a module, forward diagnostics to the outer diagnostic consumer.

Previously, we would clone the current diagnostic consumer to produce
a new diagnostic consumer to use when building a module. The problem
here is that we end up losing diagnostics for important diagnostic
consumers, such as serialized diagnostics (where we'd end up with two
diagnostic consumers writing the same output file). With forwarding,
the diagnostics from all of the different modules being built get
forwarded to the one serialized-diagnostic consumer and are emitted in
a sane way.

Fixes <rdar://problem/13663996>.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181067 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/ModuleDiags/has_errors.h
nputs/ModuleDiags/has_warnings.h
nputs/ModuleDiags/module.map
ycles.c
erialized-diags.m
db3910be2e30b3fa00474f0e1c0780f544469dee 02-May-2013 Douglas Gregor <dgregor@apple.com> When looking for the module associated with one of our magical builtin headers, speculatively load module maps.

The "magical" builtin headers are the headers we provide as part of
the C standard library, which typically comes from /usr/include. We
essentially merge our headers into that location (due to cyclic
dependencies). This change makes sure that, when header search finds
one of our builtin headers, we figure out which module it actually
lives in. This case is fairly rare; one ends up having to include one
of the few built-in C headers we provide before including anything
from /usr/include to trigger it. Fixes <rdar://problem/13787184>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180934 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/System/usr/include/dbl_max.h
nputs/System/usr/include/module.map
nputs/System/usr/include/uses_other_constants.h
std.m
0532df02a72a32a6042e961b71989db73d0d0a22 26-Apr-2013 Argyrios Kyrtzidis <akyrtzi@gmail.com> [Modules] Fix an issue where the reconstructed redeclaration chain was incomplete, missing the definition from a module.

-Make sure that a deserialized external decl gets added to the TU scope.
-When associating an identifier with a set of decls, use the most recent local ones,
if they exist, otherwise associating decls from modules (that came after a local one)
will lead to an incomplete reconstructed re-declaration chain.

rdar://13712705

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180634 91177308-0d34-0410-b5e6-96231b3b80d8
edecls/a.h
edecls/b.h
edecls/main.m
edecls/module.map
f0cdc84298103e57919674bd1781624c74ab76d3 19-Apr-2013 Reid Kleckner <reid@kleckner.net> Avoid names like __in that conflict with SAL in builtin headers

Microsoft's Source Annotation Language (SAL) defines a bunch of keywords
for annotating the inputs and outputs of functions. Empty definitions
for the keywords are provided by <stdlib.h> -> <crtdefs.h> -> <sal.h>.
This makes it basically impossible to include MSVC's stdlib.h and
Clang's *mmintrin.h headers at the same time if they have variables
named __in. As a workaround, I've renamed those variables.

This fixes the Modules/compiler_builtins.m test which was XFAILed,
presumably due to this conflict.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179860 91177308-0d34-0410-b5e6-96231b3b80d8
ompiler_builtins.m
b42f200777a66b98989160bf3987ce431540a584 17-Apr-2013 Andy Gibbs <andyg1001@hotmail.co.uk> Extended VerifyDiagnosticConsumer to also verify source file for diagnostic.

VerifyDiagnosticConsumer previously would not check that the diagnostic and
its matching directive referenced the same source file. Common practice was
to create directives that referenced other files but only by line number,
and this led to problems such as when the file containing the directive
didn't have enough lines to match the location of the diagnostic in the
other file, leading to bizarre file formatting and other oddities.

This patch causes VerifyDiagnosticConsumer to match source files as well as
line numbers. Therefore, a new syntax is made available for directives, for
example:

// expected-error@file:line {{diagnostic message}}

This extends the @line feature where "file" is the file where the diagnostic
is generated. The @line syntax is still available and uses the current file
for the diagnostic. "file" can be specified either as a relative or absolute
path - although the latter has less usefulness, I think! The #include search
paths will be used to locate the file and if it is not found an error will be
generated.

The new check is not optional: if the directive is in a different file to the
diagnostic, the file must be specified. Therefore, a number of test-cases
have been updated with regard to this.

This closes out PR15613.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179677 91177308-0d34-0410-b5e6-96231b3b80d8
uto-module-import.m
ecldef.m
ecldef.mm
iamond-pch.c
iamond.c
inkage-merge.cpp
inkage-merge.m
ookup.cpp
ookup.m
acros.c
ethod_pool.m
odule-private.cpp
amespaces.cpp
ormal-module-map.cpp
bjc-categories.m
n-demand-build.m
edecl-merge.m
ubframeworks.m
f4910132078b4b8852fc46657f3150ed472f4654 16-Apr-2013 Daniel Dunbar <daniel@zuster.org> [Modules] Convert module specific -fno-modules-autolink into -fno-autolink.

- There is no reason to have a modules specific flag for disabling
autolinking. Instead, convert the existing flag into -fno-autolink (which
should cover other autolinking code generation paths like #pragmas if and
when we support them).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179612 91177308-0d34-0410-b5e6-96231b3b80d8
utolink.m
d7fed8e6905798e8a6a465489fe24df72f2f9aff 12-Apr-2013 Douglas Gregor <dgregor@apple.com> Make sure we have the include paths we need

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179347 91177308-0d34-0410-b5e6-96231b3b80d8
ystem_version.m
31230e6fb3331192b5559cab539344235c715836 12-Apr-2013 Douglas Gregor <dgregor@apple.com> <rdar://problem/13615607> Include SDK version information in the module hash.

This is a Darwin-SDK-specific hash criteria used to identify a
particular SDK without having to hash the contents of all of its
headers. If other platforms have such versioned files, we should add
those checks here.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179346 91177308-0d34-0410-b5e6-96231b3b80d8
ystem_version.m
5a15b9dc8386766592eec833dce1839ca7f56dbf 05-Apr-2013 Rafael Espindola <rafael.espindola@gmail.com> Add a module testcase with a using declaration.

Thanks a lot to Richard Smith for the suggestion.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178825 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/linkage-merge-bar.h
nputs/linkage-merge-foo.h
inkage-merge.cpp
c855ce7ab97aa25c609a5f83e19b27289fede21a 04-Apr-2013 Rafael Espindola <rafael.espindola@gmail.com> Add hasExternalLinkageUncached back with the test that Richard provided, but
keep the call at the current location.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178741 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/linkage-merge-bar.h
nputs/linkage-merge-foo.h
nputs/module.map
inkage-merge.cpp
96df3562752e13237df051469271f8999ad60fe6 04-Apr-2013 Douglas Gregor <dgregor@apple.com> <rdar://problem/13560075> Teach name lookup for builtin names to find hidden declarations.

Normal name lookup ignores any hidden declarations. When name lookup
for builtin declarations fails, we just synthesize a new
declaration at the point of use. With modules, this could lead to
multiple declarations of the same builtin, if one came from a (hidden)
submodule that was later made visible. Teach name lookup to always
find builtin names, so we don't create these redundant declarations in
the first place.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178711 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/builtin.h
nputs/builtin_sub.h
nputs/module.map
uiltins.m
bd25ff8632e18bb3af761369fd3b0f1b48fdf061 03-Apr-2013 Argyrios Kyrtzidis <akyrtzi@gmail.com> [preprocessor] Allow comparing two macro definitions syntactically instead of only lexically.

Syntactically means the function macro parameter names do not need to use the same
identifiers in order for the definitions to be considered identical.

Syntactic equivalence is a microsoft extension for macro redefinitions and we'll also
use this kind of comparison to check for ambiguous macros coming from modules.

rdar://13562254

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178671 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/macros_left.h
nputs/macros_right.h
acros.c
b2dbfd8669282915c9466ba88c66f9791b946efa 03-Apr-2013 Argyrios Kyrtzidis <akyrtzi@gmail.com> [modules] If a submodule has re-definitions of the same macro, only the last definition will be used as the "exported" one.

Fixes rdar://13562262

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178622 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/macros_top.h
ea744ab5f39b8f45f802301841b77398166bce8f 27-Mar-2013 Argyrios Kyrtzidis <akyrtzi@gmail.com> [modules] Make sure enabled diagnostic pragmas inside the module don't affect the translation unit that
imports the module.

Getting diagnostic sections from modules properly working is a fixme.

rdar://13516663

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178151 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/diag_pragma.h
nputs/module.map
iag-pragma.c
c544ba09695e300f31355af342258bd57619e737 27-Mar-2013 Douglas Gregor <dgregor@apple.com> <rdar://problem/13509689> Introduce -module-file-info option that provides information about a particular module file.

This option can be useful for end users who want to know why they
ended up with a ton of different variants of the "std" module in their
module cache. This problem should go away over time, as we reduce the
need for module variants, but it will never go away entirely.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178148 91177308-0d34-0410-b5e6-96231b3b80d8
odule_file_info.m
35803282ef0282467fe1c09aa8284d734030dc3f 27-Mar-2013 Argyrios Kyrtzidis <akyrtzi@gmail.com> [modules] Re-enable the "ambiguous expansion of macro" warning.

Also update "test/Modules/macros.c" to test modified semantics:
-When there is an ambiguous macro, expand using the latest introduced version, not the first one.
-#undefs in submodules cause the macro to not be exported by that submodule, it doesn't cause
undefining of macros in the translation unit that imported that submodule.
This reduces macro namespace interference across modules.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178105 91177308-0d34-0410-b5e6-96231b3b80d8
acros.c
e91544210a59c53ad8e49d0008a969682579814e 25-Mar-2013 Douglas Gregor <dgregor@apple.com> Remove local path from test.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177925 91177308-0d34-0410-b5e6-96231b3b80d8
rune.m
5d835266d5f147b7a2d4cff2e6909f1a837bb951 25-Mar-2013 Douglas Gregor <dgregor@apple.com> Use xargs rather than

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177923 91177308-0d34-0410-b5e6-96231b3b80d8
rune.m
5dca66c3d0fc588b2b67f941e0c512ccca907039 25-Mar-2013 Douglas Gregor <dgregor@apple.com> Use 'touch -t', which both BSD and Linux support.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177921 91177308-0d34-0410-b5e6-96231b3b80d8
rune.m
d44d2872b2ebe58237de4dbc350b82cab944ccc5 25-Mar-2013 Douglas Gregor <dgregor@apple.com> <rdar://problem/13434605> Periodically prune the module cache so that it does not grow forever.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177918 91177308-0d34-0410-b5e6-96231b3b80d8
rune.m
daf2e1c636799535a7eb058ffab93cdf52f466cb 22-Mar-2013 Douglas Gregor <dgregor@apple.com> <rdar://problem/13479214> Make Clang's <stddef.h> robust against system headers defining size_t/ptrdiff_t/wchar_t.

Clang's <stddef.h> provides definitions for the C standard library
types size_t, ptrdiff_t, and wchar_t. However, the system's C standard
library headers tend to provide the same typedefs, and the two
generally avoid each other using the macros
_SIZE_T/_PTRDIFF_T/_WCHAR_T. With modules, however, we need to see
*all* of the places where these types are defined, so provide the
typedefs (ignoring the macros) when modules are enabled.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177686 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/StdDef/module.map
nputs/StdDef/other.h
nputs/StdDef/size_t.h
tddef.m
892b6fb1ae818acc594ea54aaee084a4c48458ff 21-Mar-2013 Douglas Gregor <dgregor@apple.com> <rdar://problem/13477190> Give the Clang module cache directory some structure, so it's easier to find.

We now put the Clang module cache in
<system-temp-directory>/org.llvm.clang/ModuleCache. Perhaps some day
there will be other caches under <system-temp-directory>/org.llvm.clang>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177671 91177308-0d34-0410-b5e6-96231b3b80d8
river.c
cdf2808c4e735a717599751dcd2b434f239e1c68 21-Mar-2013 Douglas Gregor <dgregor@apple.com> <rdar://problem/13037793> Allow the names of modules to differ from the name of their subdirectory in the include path.




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177621 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/Modified/B.h
nputs/Modified/module.map
nputs/oldname/module.map
nputs/oldname/new_name.h
odify-module.m
enamed.m
906d66acc5cf2679453e10a4f0a67feedd765b21 20-Mar-2013 Douglas Gregor <dgregor@apple.com> <rdar://problem/12368093> Extend module maps with a 'conflict' declaration, and warn when a newly-imported module conflicts with an already-imported module.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177577 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/Conflicts/conflict_a.h
nputs/Conflicts/conflict_b.h
nputs/Conflicts/module.map
onflicts.m
63a726870b486e0470c3a4b11cf62bab8be00b73 20-Mar-2013 Douglas Gregor <dgregor@apple.com> <rdar://problem/10796651> Introduce configuration macros into module maps.

Configuration macros are macros that are intended to alter how a
module works, such that we need to build different module variants
for different values of these macros. A module can declare its
configuration macros, in which case we will complain if the definition
of a configation macro on the command line (or lack thereof) differs
from the current preprocessor state at the point where the module is
imported. This should eliminate some surprises when enabling modules,
because "#define CONFIG_MACRO ..." followed by "#include
<module/header.h>" would silently ignore the CONFIG_MACRO setting. At
least it will no longer be silent about it.

Configuration macros are eventually intended to help reduce the number
of module variants that need to be built. When the list of
configuration macros for a module is exhaustive, we only need to
consider the settings for those macros when building/finding the
module, which can help isolate modules for various project-specific -D
flags that should never affect how modules are build (but currently do).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177466 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/config.h
nputs/module.map
onfig_macros.m
677e15ffee2ecc9c1c8f46fd77cab4b5afb59640 19-Mar-2013 Douglas Gregor <dgregor@apple.com> <rdar://problem/13363214> Eliminate race condition between module rebuild and the global module index.

The global module index was querying the file manager for each of the
module files it knows about at load time, to prune out any out-of-date
information. The file manager would then cache the results of the
stat() falls used to find that module file.

Later, the same translation unit could end up trying to import one of the
module files that had previously been ignored by the module cache, but
after some other Clang instance rebuilt the module file to bring it
up-to-date. The stale stat() results in the file manager would
trigger a second rebuild of the already-up-to-date module, causing
failures down the line.

The global module index now lazily resolves its module file references
to actual AST reader module files only after the module file has been
loaded, eliminating the stat-caching race. Moreover, the AST reader
can communicate to its caller that a module file is missing (rather
than simply being out-of-date), allowing us to simplify the
module-loading logic and allowing the compiler to recover if a
dependent module file ends up getting deleted.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177367 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/Modified/B.h
nputs/Modified/module.map
odify-module.m
aa945900d5438984bdcaac85c4f54868292231f4 18-Feb-2013 Douglas Gregor <dgregor@apple.com> Ensure that the identifier chains have the most recent declaration after module deserialization.

This commit introduces a set of related changes to ensure that the
declaration that shows up in the identifier chain after deserializing
declarations with a given identifier is, in fact, the most recent
declaration. The primary change involves waiting until after we
deserialize and wire up redeclaration chains before updating the
identifier chains. There is a minor optimization in here to avoid
recursively deserializing names as part of looking to see whether
top-level declarations for a given name exist.

A related change that became suddenly more urgent is to property
record a merged declaration when an entity first declared in the
current translation unit is later deserialized from a module (that had
not been loaded at the time of the original declaration). Since we key
off the canonical declaration (which is parsed, not from an AST file)
for emitted redeclarations, we simply record this as a merged
declaration during AST writing and let the readers merge them.

Re-fixes <rdar://problem/13189985>, presumably for good this time.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175447 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/redecl-merge-left.h
nputs/redecl-merge-right.h
nputs/redecl-merge-top.h
edecl-merge.m
a46961b8dfe0a112097299e053c3d0cc5af13ab8 13-Feb-2013 Nick Lewycky <nicholas@mxc.ca> Change this comment to helpfully explain why it's there.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175027 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/HasSubModules.framework/Frameworks/Sub.framework/PrivateHeaders/SubPriv.h
2cbd427ec533f022f612fed0dd93ef5fa214478a 13-Feb-2013 Douglas Gregor <dgregor@apple.com> Order the methods in the global method pool based on when they become visible, not when they become deserialized <rdar://problem/13203033>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175018 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/MethodPoolA.h
nputs/MethodPoolASub.h
ethod_pool.m
ad0e27b18b0cefab049121d4bfd7b12216e7de6e 12-Feb-2013 Richard Smith <richard-llvm@metafoo.co.uk> Fix a bug reduced from a crash when trying to use modules with libc++. We check
the linkage of functions and variables while merging declarations from modules,
and we don't necessarily have enough of the rest of the AST loaded at that
point to allow us to compute linkage, so serialize it instead.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174943 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/cxx-linkage-cache.h
nputs/module.map
xx-linkage-cache.cpp
63a9514a2330b144575a136e38875193760126f7 12-Feb-2013 Richard Smith <richard-llvm@metafoo.co.uk> Remove an assert which triggers when a decl context in a module hits the 'has
lexical storage but not visible storage' case in C++. It's unclear whether we
even need the special-case handling for C++, since it seems to be working
around our not serializing a lookup table for the TU in C. But in any case,
the assertion is incorrect.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174931 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/cxx-inline-namespace.h
nputs/module.map
xx-inline-namespace.cpp
f4e955b694be22926f5ceb41e55d319ce9ff4aab 11-Feb-2013 Douglas Gregor <dgregor@apple.com> [Modules] Cope better with top-level declarations loaded after being declared in the current translation unit <rdar://problem/13189985>.

These two related tweaks to keep the information associated with a
given identifier correct when the identifier has been given some
top-level information (say, a top-level declaration) and more
information is then loaded from a module. The first ensures that an
identifier that was "interesting" before being loaded from an AST is
considered to be different from its on-disk counterpart. Otherwise, we
lose such changes when writing the current translation unit as a
module.

Second, teach the code that injects AST-loaded names into the
identifier chain for name lookup to keep the most recent declaration,
so that we don't end up confusing our declaration chains by having a
different declaration in there.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174895 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/module.map
nputs/redecl-merge-bottom-prefix.h
nputs/redecl-merge-bottom.h
nputs/redecl-merge-left.h
edecl-merge2.m
6bd992946bda92193fadce7e4890d4465d2702f4 09-Feb-2013 Douglas Gregor <dgregor@apple.com> Ensure that type definitions present in just-loaded modules are
visible.

The basic problem here is that a given translation unit can use
forward declarations to form pointers to a given type, say,

class X;
X *x;

and then import a module that includes a definition of X:

import XDef;

We will then fail when attempting to access a member of X, e.g.,

x->method()

because the AST reader did not know to look for a default of a class
named X within the new module.

This implementation is a bit of a C-centric hack, because the only
definitions that can have this property are enums, structs, unions,
Objective-C classes, and Objective-C protocols, and all of those are
either visible at the top-level or can't be defined later. Hence, we
can use the out-of-date-ness of the name and the identifier-update
mechanism to force the update.

In C++, we will not be so lucky, and will need a more advanced
solution, because the definitions could be in namespaces defined in
two different modules, e.g.,

// module 1
namespace N { struct X; }

// module 2
namespace N { struct X { /* ... */ }; }

One possible implementation here is for C++ to extend the information
associated with each identifier table to include the declaration IDs
of any definitions associated with that name, regardless of
context. We would have to eagerly load those definitions.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174794 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/def.h
ecldef.m
ecldef.mm
63eb156f663a869af8f7360165f85ff31dc95d1f 08-Feb-2013 Nick Lewycky <nicholas@mxc.ca> Fix test failure by making sure this file isn't identical to any other file
included in the same test. Clang gets confused about whether it's already built
a module for this file, when running on a content-addressible filesystem.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174694 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/HasSubModules.framework/Frameworks/Sub.framework/PrivateHeaders/SubPriv.h
a69a58991fdf67d6d26aff9028ced102142bfcc6 08-Feb-2013 Richard Smith <richard-llvm@metafoo.co.uk> Fix conflict between r174685 and r174645 (rename -fmodule-cache-path <foo> to -fmodules-cache-path=<foo>).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174690 91177308-0d34-0410-b5e6-96231b3b80d8
xx-many-overloads.cpp
2bb07c1dfeda50d7edcee512932b86a1a65c6e69 08-Feb-2013 Richard Smith <richard-llvm@metafoo.co.uk> Fix stack overflow and improve performance when a module contains many
overloads of a name by claiming that there are no lookup results for that name
in modules while loading the names from the module. Lookups in deserialization
really don't want to find names which they themselves are in the process of
introducing. This also has the pleasant side-effect of automatically caching
PCH lookups which found no names.

The runtime here is still quadratic in the number of overloads, but the
constant is lower.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174685 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/cxx-many-overloads.h
nputs/module.map
xx-many-overloads.cpp
1b58c74af272a1d8228b8161c93a8a018456098e 08-Feb-2013 Douglas Gregor <dgregor@apple.com> Teach subframework header lookup to suggest modules <rdar://problem/13176200>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174683 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/HasSubModules.framework/Frameworks/Sub.framework/Headers/Sub.h
nputs/HasSubModules.framework/Frameworks/Sub.framework/Headers/Types.h
nputs/HasSubModules.framework/Frameworks/Sub.framework/PrivateHeaders/SubPriv.h
nputs/HasSubModules.framework/Headers/HasSubModules.h
nputs/HasSubModules.framework/PrivateHeaders/HasSubModulesPriv.h
ubframeworks.m
250172a851a886c0763b5fd61c20bf21791c21e9 07-Feb-2013 Douglas Gregor <dgregor@apple.com> Form the default -fmodules-cache-path= properly.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174674 91177308-0d34-0410-b5e6-96231b3b80d8
river.c
882090e76a48337ce55fdc913a7e8a19ff35f4fc 07-Feb-2013 Douglas Gregor <dgregor@apple.com> Add missing header from r174648

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174649 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/MethodPoolASub2.h
7666b03d499819214752ae392efe666ca856d0e7 07-Feb-2013 Douglas Gregor <dgregor@apple.com> Retain all hidden methods in the global method pool, because they may become visible <rdar://problem/13172858>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174648 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/MethodPoolASub.h
nputs/MethodPoolBSub.h
nputs/module.map
ethod_pool.m
953a61f26bf79932b9699b09add4c388764de170 07-Feb-2013 Douglas Gregor <dgregor@apple.com> Rename -fmodule-cache-path <blah> to -fmodules-cache-path=<blah> for consistency.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174645 91177308-0d34-0410-b5e6-96231b3b80d8
uto-module-import.m
utolink.m
uild-fail-notes.m
ompiler_builtins.m
std.m
ycles.c
ecldef.mm
iamond-pch.c
iamond.c
irect-module-import.m
river.c
pic-fail.m
lobal_index.m
eader-import.m
gnored_macros.m
mport-decl.cpp
nferred-frameworks.m
nferred-submodules.m
rgen.c
inkage-merge.m
oad_failure.c
ookup.cpp
ookup.m
acros.c
ethod_pool.m
odify-module.m
odule-private.cpp
amespaces.cpp
ormal-module-map.cpp
bjc-categories.m
bjc_redef.m
n-demand-build.m
n-demand-macros.m
edecl-merge.m
edecl-namespaces.mm
edeclarations.m
equires.m
ubframeworks.m
ubmodules-preprocess.cpp
ubmodules.cpp
ubmodules.m
emplates.mm
ildcard-submodule-exports.cpp
bbcd0f3ba215d5a8857b224e32b0330586a00dc6 07-Feb-2013 Richard Smith <richard-llvm@metafoo.co.uk> Fix handling of module imports adding names to a DeclContext after qualified
name lookup has been performed in that context (this probably only happens in
C++).

1) Whenever we add names to a context, set a flag on it, and if we perform
lookup and discover that the context has had a lookup table built but has the
flag set, update all entries in the lookup table with additional names from
the external source.

2) When marking a DeclContext as having external visible decls, mark the
context in which lookup is performed, not the one we are adding. These won't
be the same if we're adding another copy of a pre-existing namespace.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174577 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/namespaces-left.h
nputs/namespaces-right.h
amespaces.cpp
005d51bc4f16a7b330e13082d186b72953bde581 07-Feb-2013 Douglas Gregor <dgregor@apple.com> Be a little more permissive with -fmodules-ignore-macro= by removing everything after the second '=' if it is there.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174567 91177308-0d34-0410-b5e6-96231b3b80d8
gnored_macros.m
2a06085281d1b6aee628f85e8676eec04542cbc9 07-Feb-2013 Douglas Gregor <dgregor@apple.com> Introduce -fmodules-ignore-macro=NNN to ignore a macro when building/loading modules.

The use of this flag enables a modules optimization where a given set
of macros can be labeled as "ignored" by the modules
system. Definitions of those macros will be completely ignored when
building the module hash and will be stripped when actually building
modules. The overall effect is that this flag can be used to
drastically reduce the number of

Eventually, we'll want modules to tell us what set of macros they
respond to (the "configuration macros"), and anything not in that set
will be excluded. However, that requires a lot of per-module
information that must be accurate, whereas this option can be used
more readily.

Fixes the rest of <rdar://problem/13165109>.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174560 91177308-0d34-0410-b5e6-96231b3b80d8
gnored_macros.m
8bf778eb9c0afb0a4c63a97ce504f50759c08d5f 06-Feb-2013 Douglas Gregor <dgregor@apple.com> Detect when we end up trying to load conflicting module files.

This can happen when one abuses precompiled headers by passing more -D
options when using a precompiled hedaer than when it was built. This
is intentionally permitted by precompiled headers (and is exploited by
some build environments), but causes problems for modules.

First part of <rdar://problem/13165109>, detecting when something when
horribly wrong.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174554 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/ignored_macros.h
nputs/module.map
gnored_macros.m
f5cfc89ea46cf20b4d5b5c42568e9ba6a4bbdd80 02-Feb-2013 Douglas Gregor <dgregor@apple.com> Merge "special" types from different modules in the AST reader.

Different modules may have different views of the various "special"
types in the AST, such as the redefinition type for "id". Merge those
types rather than only considering the redefinition types for the
first AST file loaded.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174234 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/module.map
nputs/weird_objc.h
bjc_redef.m
20c6f2eae500242d3aef5daaa55d440a0786a1fd 28-Jan-2013 Douglas Gregor <dgregor@apple.com> Enable the global module index by default. Introduce the
-fno-modules-global-index -cc1 option to allow one to disable the
index for performance testing purposes, but with a 10% win in
-fsyntax-only time, there is no reason a user would do this.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173707 91177308-0d34-0410-b5e6-96231b3b80d8
lobal_index.m
a6cd5cd98b45298ed6a13ff14551a43d1a210a32 25-Jan-2013 NAKAMURA Takumi <geek4civic@gmail.com> clang/test: Drop "REQUIRES:shell" in three tests. They can run on win32.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173419 91177308-0d34-0410-b5e6-96231b3b80d8
lobal_index.m
1a49d97d762570027863e9209af81d445e4f1502 25-Jan-2013 Douglas Gregor <dgregor@apple.com> Implement the reader of the global module index and wire it into the
AST reader.

The global module index tracks all of the identifiers known to a set
of module files. Lookup of those identifiers looks first in the global
module index, which returns the set of module files in which that
identifier can be found. The AST reader only needs to look into those
module files and any module files not known to the global index (e.g.,
because they were (re)built after the global index), reducing the
number of on-disk hash tables to visit. For an example source I'm
looking at, we go from 237844 total identifier lookups into on-disk
hash tables down to 126817.

Unfortunately, this does not translate into a performance advantage.
At best, it's a wash once the global module index has been built, but
that's ignore the cost of building the global module index (which
is itself fairly large). Profiles show that the global module index
code is far less efficient than it should be; optimizing it might give
enough of an advantage to justify its continued inclusion.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173405 91177308-0d34-0410-b5e6-96231b3b80d8
lobal_index.m
f575d6e7c3b887ea4c5394d2c7e322c7a929a57e 25-Jan-2013 Douglas Gregor <dgregor@apple.com> Rename the -cc1 option "-generate-module-index" to
"-fmodules-global-index" and expand its behavior to include both the
use and generation of the global module index.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173404 91177308-0d34-0410-b5e6-96231b3b80d8
lobal_index.m
d2db16f59601bc028f4f973990cc6d4abe95b91a 24-Jan-2013 NAKAMURA Takumi <geek4civic@gmail.com> clang/GlobalModuleIndex: Don't open the same file twice. Use raw_fd_ostream(fd, ...) instead.

FIXME: PathV2::unique_file() is assumed to open the file with binary mode on win32.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173330 91177308-0d34-0410-b5e6-96231b3b80d8
lobal_index.m
35ae83278d04d7d7ab5bb2c82d4323a4a05f52de 24-Jan-2013 NAKAMURA Takumi <geek4civic@gmail.com> clang/test/Modules/global_index.m: XFAILing on win32 when investigating for now.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173326 91177308-0d34-0410-b5e6-96231b3b80d8
lobal_index.m
a6b00fc97669aa25d89ae9f202b05dfadfd0e324 23-Jan-2013 Douglas Gregor <dgregor@apple.com> Implement the writer side of the global module index.

The global module index is a "global" index for all of the module
files within a particular subdirectory in the module cache, which
keeps track of all of the "interesting" identifiers and selectors
known in each of the module files. One can perform a fast lookup in
the index to determine which module files will have more information
about entities with a particular name/selector. This information can
help eliminate redundant lookups into module files (a serious
performance problem) and help with creating auto-import/auto-include
Fix-Its.

The global module index is created or updated at the end of a
translation unit that has triggered a (re)build of a module by
scraping all of the .pcm files out of the module cache subdirectory,
so it catches everything. As with module rebuilds, we use the file
system's atomicity to synchronize.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173301 91177308-0d34-0410-b5e6-96231b3b80d8
lobal_index.m
0c06cbc51c581ea31dac14134bd184e491fe5caf 23-Jan-2013 Argyrios Kyrtzidis <akyrtzi@gmail.com> [PCH] Temporarily disable the "ambiguous macro" warning that is currently bogus with a PCH
that redefined a macro without undef'ing it first.

Proper reconstruction of the macro info history from modules will properly fix this in subsequent commits.

rdar://13016031

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173281 91177308-0d34-0410-b5e6-96231b3b80d8
acros.c
6987e8d59ca1bde58e90f2df9486679c1943b862 17-Jan-2013 Douglas Gregor <dgregor@apple.com> Add a comment for Daniel

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172695 91177308-0d34-0410-b5e6-96231b3b80d8
utolink.m
f9d03c15e8642d4bd3686b8c8e8269242a0f37c6 17-Jan-2013 Daniel Dunbar <daniel@zuster.org> [IRgen] Update modules autolink metadata to use module flags (as now specified
in the LangRef).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172692 91177308-0d34-0410-b5e6-96231b3b80d8
utolink.m
4637d18deb6a9789e9ab1717c9ddde53dff9aead 17-Jan-2013 NAKAMURA Takumi <geek4civic@gmail.com> clang/test/Modules/compiler_builtins.m: Mark this as XFAIL:win32 for now. Investigating.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172689 91177308-0d34-0410-b5e6-96231b3b80d8
ompiler_builtins.m
0f9b9f37941ea709104f02d7dbe4ea18ab457605 17-Jan-2013 Douglas Gregor <dgregor@apple.com> Treat hidden Objective-C protocol definitions as if they were
undefined, and don't find methods or protocols within those protocol
definitions. This completes <rdar://problem/10634711>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172686 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/category_left_sub.h
nputs/category_right_sub.h
nputs/category_top.h
bjc-categories.m
d329724745b49f894b768d47275b7c2713106e89 17-Jan-2013 Douglas Gregor <dgregor@apple.com> Rework the traversal of Objective-C categories and extensions to
consider (sub)module visibility.

The bulk of this change replaces myriad hand-rolled loops over the
linked list of Objective-C categories/extensions attached to an
interface declaration with loops using one of the four new category
iterator kinds:

visible_categories_iterator: Iterates over all visible categories
and extensions, hiding any that have their "hidden" bit set. This is
by far the most commonly used iterator.

known_categories_iterator: Iterates over all categories and
extensions, ignoring the "hidden" bit. This tends to be used for
redeclaration-like traversals.

visible_extensions_iterator: Iterates over all visible extensions,
hiding any that have their "hidden" bit set.

known_extensions_iterator: Iterates over all extensions, whether
they are visible to normal name lookup or not.

The effect of this change is that any uses of the visible_ iterators
will respect module-import visibility. See the new tests for examples.

Note that the old accessors for categories and extensions are gone;
there are *Raw() forms for some of them, for those (few) areas of the
compiler that have to manipulate the linked list of categories
directly. This is generally discouraged.

Part two of <rdar://problem/10634711>.




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172665 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/category_left_sub.h
nputs/category_right_sub.h
nputs/category_top.h
nputs/module.map
bjc-categories.m
f0e00046711280d494f3ef2d85ae67a442b97406 16-Jan-2013 Douglas Gregor <dgregor@apple.com> Teach global selector lookup to ignore hidden methods, which occur
when the methods are declared in a submodule that has not yet been
imported. Part of <rdar://problem/10634711>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172635 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/MethodPoolASub.h
nputs/MethodPoolBSub.h
nputs/module.map
ethod_pool.m
f43b7214e812ddca74a6213608c69c960e067956 16-Jan-2013 Douglas Gregor <dgregor@apple.com> Add -fmodules-autolink/-fno-modules-autolink (defaults to on) so that
users can explicitly enable/disable modules autolinking.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172592 91177308-0d34-0410-b5e6-96231b3b80d8
utolink.m
858afb3c22144027bcd8ba75e27262eede093a60 14-Jan-2013 Douglas Gregor <dgregor@apple.com> Topologically sort the link options generated for modules based on
module-import dependencies, so we'll get the link order correct for
those silly linkers that need it.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172459 91177308-0d34-0410-b5e6-96231b3b80d8
utolink.m
3baad29d4413e1409fc69a472d374cf5de1d78ec 14-Jan-2013 Douglas Gregor <dgregor@apple.com> When forming the link options for an imported module, also include the
link options for the modules it imports.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172448 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/DependsOnModule.framework/DependsOnModule
utolink.m
5d75ea72d6eee3df0c6acdb282145dc4cc3a9a1b 14-Jan-2013 Douglas Gregor <dgregor@apple.com> Switch autolinking metadata format over to actual linker options, e.g.,

!0 = metadata !{metadata !"-lautolink"}
!1 = metadata !{metadata !"-framework", metadata !"autolink_framework"}

referenced from llvm.module.linkoptions, e.g.,

!llvm.module.linkoptions = !{!0, !1, !2, !3}

This conceptually moves the logic for figuring out the syntax the
linker will accept from LLVM into Clang. Moreover, it makes it easier
to support MSVC's

#pragma comment(linker, "some option")

in the future, should anyone care to do so.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172441 91177308-0d34-0410-b5e6-96231b3b80d8
utolink.m
8767dc29ec23f96e71658f760333bdf5d87283d5 14-Jan-2013 Douglas Gregor <dgregor@apple.com> Infer "link" lines for top-level frameworks. Essentially, a framework
will have a shared library with the same name as its framework (and no
suffix!) within its .framework directory. Detect this both when
inferring the whole top-level framework and when parsing a module map.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172439 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/Module.framework/Module
nputs/NoUmbrella.framework/NoUmbrella
utolink.m
b6cbe517237c3c223beb064d60d5b49e56d65c06 14-Jan-2013 Douglas Gregor <dgregor@apple.com> Implement parsing, AST, (de-)serialization, and placeholder global
metadata for linking against the libraries/frameworks for imported
modules.

The module map language is extended with a new "link" directive that
specifies what library or framework to link against when a module is
imported, e.g.,

link "clangAST"

or

link framework "MyFramework"

Importing the corresponding module (or any of its submodules) will
eventually link against the named library/framework.

For now, I've added some placeholder global metadata that encodes the
imported libraries/frameworks, so that we can test that this
information gets through to the IR. The format of the data is still
under discussion.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172437 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/autolink-sub.h
nputs/autolink-sub2.h
nputs/autolink.h
nputs/module.map
utolink.m
ca2ab45341c448284cf93770018c717810575f86 12-Jan-2013 Douglas Gregor <dgregor@apple.com> Provide Decl::getOwningModule(), which determines the (sub)module in
which a particular declaration resides. Use this information to
customize the "definition of 'blah' must be imported from another
module" diagnostic with the module the user actually has to
import. Additionally, recover by importing that module, so we don't
complain about other names in that module.

Still TODO: coming up with decent Fix-Its for these cases, and expand
this recovery approach for other name lookup failures.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172290 91177308-0d34-0410-b5e6-96231b3b80d8
ecldef.mm
7dc80e1c4dd44ce2b2da0fc3daff786c3d02348b 09-Jan-2013 Douglas Gregor <dgregor@apple.com> When name lookup for a redeclaration finds declarations that are known
(because they are part of some module) but have not been made visible
(because they are in a submodule that wasn't imported), filter out
those declarations unless both the old declaration and the new
declaration have external linkage. When one or both has internal
linkage, there should be no conflict unless both are imported.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171925 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/linkage-merge-sub.h
nputs/module.map
inkage-merge.m
c9c3907e66659e4457593fdec4a27c671c12e041 04-Jan-2013 Douglas Gregor <dgregor@apple.com> Add the module name to the 'incomplete umbrella header' warning.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171497 91177308-0d34-0410-b5e6-96231b3b80d8
uild-fail-notes.m
86ebd03380dd5d1b5744fe48405445ea27faf1d6 04-Jan-2013 Douglas Gregor <dgregor@apple.com> Remove -Wmodule-build; it was a dumb idea anyway. <rdar://problem/12957525>


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171478 91177308-0d34-0410-b5e6-96231b3b80d8
n-demand-build-warnings.m
0faaa164282406f07328dad27d02f5d04334c829 12-Dec-2012 NAKAMURA Takumi <geek4civic@gmail.com> clang/test: Suppress two tests on win32 for now, since, not sure, in r169829 to r169831.

"ansi-escape-sequences" is easy convenient to exclude win32. Please be patient.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169945 91177308-0d34-0410-b5e6-96231b3b80d8
odify-module.m
299c22f806d0127b58f5cc53ce4ac14ccb21b209 11-Dec-2012 Douglas Gregor <dgregor@apple.com> Don't use 'touch' in this test; it may be the cause of Windows-related failures.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169922 91177308-0d34-0410-b5e6-96231b3b80d8
odify-module.m
1b257afbae854c6817f26b7d61c4fed8ff7aebad 11-Dec-2012 Douglas Gregor <dgregor@apple.com> Use @import rather than @__experimental_modules_import, since the
latter is rather a mess to type.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169919 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/MutuallyRecursive1.framework/Headers/MutuallyRecursive1.h
nputs/MutuallyRecursive2.framework/Headers/MutuallyRecursive2.h
nputs/category_bottom.h
nputs/category_left.h
nputs/category_other.h
nputs/category_right.h
nputs/diamond.h
nputs/diamond_bottom.h
nputs/diamond_left.h
nputs/diamond_right.h
nputs/macros_left.h
nputs/macros_right.h
nputs/namespaces-left.h
nputs/namespaces-right.h
nputs/redecl-merge-bottom.h
nputs/redecl-merge-left-left.h
nputs/redecl-merge-left.h
nputs/redecl-merge-right.h
nputs/templates-left.h
nputs/templates-right.h
nputs/wildcard-submodule-exports/C_one.h
nputs/wildcard-submodule-exports/C_two.h
uild-fail-notes.m
ompiler_builtins.m
std.m
ycles.c
ecldef.mm
iamond.c
pic-fail.m
eader-import.m
mport-decl.cpp
nferred-frameworks.m
nferred-submodules.m
rgen.c
oad_failure.c
ookup.cpp
ookup.m
acros.c
ethod_pool.m
odify-module.m
odule-private.cpp
amespaces.cpp
ormal-module-map.cpp
bjc-categories.m
n-demand-build-warnings.m
n-demand-build.m
n-demand-macros.m
edecl-merge.m
edecl-namespaces.mm
edeclarations.m
equires.m
ubframeworks.m
ubmodules-preprocess.cpp
ubmodules.cpp
ubmodules.m
emplates.mm
ildcard-submodule-exports.cpp
ca952281611205fbc36d0516a595f9751e071d36 05-Dec-2012 Richard Smith <richard-llvm@metafoo.co.uk> Fix an egregiously broken test. This pattern doesn't work:

RUN: a
RUN: b || true

lit expands it to a && b || true, and the || true applies to both commands (thus ignoring failures in 'a')! This is PR10867 again.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169434 91177308-0d34-0410-b5e6-96231b3b80d8
uild-fail-notes.m
9ec98f26633ccbae8a8865f6fc6f08302f9eb518 05-Dec-2012 NAKAMURA Takumi <geek4civic@gmail.com> test/Modules/build-fail-notes.m: Tweak to unbreak Win32 hosts to relax expressions, for now.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169375 91177308-0d34-0410-b5e6-96231b3b80d8
uild-fail-notes.m
5b10af7aa9e254a38d0a9f4d86caaccd61972124 05-Dec-2012 Richard Smith <richard-llvm@metafoo.co.uk> PR14049: Don't say "expanded from macro 'foo'" when 'foo' just happens to be
the LHS of a token paste. Use "expanded from here" instead when we're not sure
it's actually a macro.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169373 91177308-0d34-0410-b5e6-96231b3b80d8
pic-fail.m
5a98f1da0e6eb5c4776f513eacc7756eaf15dff3 01-Dec-2012 Douglas Gregor <dgregor@apple.com> Fix test for Windows path separators

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169058 91177308-0d34-0410-b5e6-96231b3b80d8
uild-fail-notes.m
14afab36c73c32a831838ba80f36136a80d9e6db 01-Dec-2012 Douglas Gregor <dgregor@apple.com> Teach the serialized diagnostic writer to clone() itself, sharing
state so that all of the various clones end up rendering their
diagnostics into the same serialized-diagnostics file. This is
important when we actually want failures during module build to be
reported back to the translation unit that tried to import the
not-yet-built or out-of-date module. <rdar://problem/12565727>


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169057 91177308-0d34-0410-b5e6-96231b3b80d8
uild-fail-notes.m
6c3254316de2d0d554b19702f4b10117ae46b77b 30-Nov-2012 Douglas Gregor <dgregor@apple.com> When we're emitting a diagnostic with a source location in an imported
module, provide a module import stack similar to what we would get for
an include stack, e.g.,

In module 'DependsOnModule' imported from build-fail-notes.m:4:
In module 'Module' imported from DependsOnModule.framework/Headers/DependsOnModule.h:1:
Inputs/Module.framework/Headers/Module.h:15:12: note: previous definition is here
@interface Module

<rdar://problem/12696425>


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169042 91177308-0d34-0410-b5e6-96231b3b80d8
uild-fail-notes.m
830ea5b7c75413526c19531f0180fa6e45b98919 30-Nov-2012 Douglas Gregor <dgregor@apple.com> When an error occurs while building a module on demand, provide "While
building module 'Foo' imported from..." notes (the same we we provide
"In file included from..." notes) in the diagnostic, so that we know
how this module got included in the first place. This is part of
<rdar://problem/12696425>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169021 91177308-0d34-0410-b5e6-96231b3b80d8
uild-fail-notes.m
ycles.c
pic-fail.m
463d90986ec54c62bf8fe31193ef5db701db48a5 30-Nov-2012 Douglas Gregor <dgregor@apple.com> Keep track of modules that have failed to build. If we encounter an
import of that module elsewhere, don't try to build the module again:
it won't work, and the experience is quite dreadful. We track this
information somewhat globally, shared among all of the related
CompilerInvocations used to build modules on-the-fly, so that a
particular Clang instance will only try to build a given module once.

Fixes <rdar://problem/12552849>.




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168961 91177308-0d34-0410-b5e6-96231b3b80d8
pic-fail.m
71f49f5d8fc3c4980bed4bb7790c8d0e50586d3b 15-Nov-2012 Douglas Gregor <dgregor@apple.com> If an excluded header does not exist, just ignore it

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168077 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/module.map
7cdd28162dc7ade4b14bf237e87b4bbc17b2f023 07-Nov-2012 Douglas Gregor <dgregor@apple.com> When loading a module fails because it is out of date, rebuild that
module in place. <rdar://problem/10138913>


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167539 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/Modified/A.h
nputs/Modified/B.h
nputs/Modified/module.map
odify-module.m
82e52377bd76ed71e8c09edc5f2f452e388b16ad 06-Nov-2012 Douglas Gregor <dgregor@apple.com> Introduce inferred framework modules into the module map file,
allowing a module map to be placed one level above the '.framework'
directories to specify that all .frameworks within that directory can
be inferred as framework modules. One can also specifically exclude
frameworks known not to work.

This makes explicit (and more restricted) behavior modules have had
"forever", where *any* .framework was assumed to be able to be built
as a module. That's not necessarily true, so we white-list directories
(with exclusions) when those directories have been audited.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167482 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/NotAModule.framework/Headers/NotAModule.h
nputs/module.map
nferred-frameworks.m
c7be10245e78bf38694b26f289880edefb9f16e9 06-Nov-2012 Douglas Gregor <dgregor@apple.com> Have the parser initialize Sema before it consumes the first
token. This is important because the first token could actually be
after an #include that triggers a module import, which might use
either Sema or the AST consumer before it would have been initialized.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167423 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/Module.framework/Headers/Module.h
irect-module-import.m
a65c5a39b93c47ba8aed879a60ebcd431e071ec9 05-Nov-2012 Douglas Gregor <dgregor@apple.com> Make cpuid.h actually work with -std=c99 <rdar://problem/12552716>.

While we're here, extend the module map to cover most of the
newly-added instrinsic headers. Only wmmintrin.h is missing, because
it needs to be split into AES/PCLMUL subheaders (as a separate commit).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167398 91177308-0d34-0410-b5e6-96231b3b80d8
ompiler_builtins.m
a0d5878b7e1c54551c0445354788e4259900c03c 25-Oct-2012 David Tweed <david.tweed@arm.com> Correct test inovocations to use %clang_cc1 rather than direct invocation (so that it can have additional options set when trying to debug issues causing regressions).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166681 91177308-0d34-0410-b5e6-96231b3b80d8
mport-decl.cpp
8e8fb3be5bd78f0564444eca02b404566a5f3b5d 19-Oct-2012 Andy Gibbs <andyg1001@hotmail.co.uk> Prior to adding the new "expected-no-diagnostics" directive to VerifyDiagnosticConsumer, make the necessary adjustment to 580 test-cases which will henceforth require this new directive.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166280 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/lookup_right.hpp
ompiler_builtins.m
eader-import.m
nferred-submodules.m
n-demand-macros.m
edeclarations.m
ubmodules.m
emplates.mm
2b49d1f0ad790a8a5d514af1be211591a746cb73 15-Oct-2012 Douglas Gregor <dgregor@apple.com> Introduce the notion of excluded headers into the module map
description. Previously, one could emulate this behavior by placing
the header in an always-unavailable submodule, but Argyrios guilted me
into expressing this idea properly.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165921 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/NoUmbrella.framework/module.map
c8b2a863bda198c4be02056929143fed54e68e68 12-Oct-2012 Douglas Gregor <dgregor@apple.com> Add missing header from 165821

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165822 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/normal-module-map/nested_umbrella/decltype.h
8b48e087bc0e022703d235fa6382551cfaa57ae6 12-Oct-2012 Douglas Gregor <dgregor@apple.com> Sanitize the names of modules determined based on the names of headers
or directories, to make sure that they are identifiers that are not
keywords in any dialect. Fixes <rdar://problem/12489495>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165821 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/normal-module-map/nested_umbrella/1.h
nputs/normal-module-map/nested_umbrella/a-extras.h
ormal-module-map.cpp
54c8a40ed658676b1f3f983728feae488c501477 12-Oct-2012 Douglas Gregor <dgregor@apple.com> Track which particular submodule #undef's a macro, so that the actual
#undef only occurs if that submodule is imported.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165773 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/macros_left.h
nputs/macros_right.h
nputs/macros_right_undef.h
nputs/macros_top.h
nputs/module.map
acros.c
e8219a655128b98d0573658a139de5d848451fda 11-Oct-2012 Douglas Gregor <dgregor@apple.com> Diagnose the expansion of ambiguous macro definitions. This can happen
only with modules, when two disjoint modules #define the same
identifier to different token sequences.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165746 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/macros_left.h
nputs/macros_right.h
nputs/macros_top.h
acros.c
6c6c54a59a6e7dbe63ff6a9bbab76f6e0c7c8462 11-Oct-2012 Douglas Gregor <dgregor@apple.com> Deserialize macro history when we deserialize an identifier that has
macro history.

When deserializing macro history, we arrange history such that the
macros that have definitions (that haven't been #undef'd) and are
visible come at the beginning of the list, which is what the
preprocessor and other clients of Preprocessor::getMacroInfo()
expect. If additional macro definitions become visible later, they'll
be moved toward the front of the list. Note that it's possible to have
ambiguities, but we don't diagnose them yet.

There is a partially-implemented design decision here that, if a
particular identifier has been defined or #undef'd within the
translation unit, that definition (or #undef) hides any macro
definitions that come from imported modules. There's still a little
work to do to ensure that the right #undef'ing happens.

Additionally, we'll need to scope the update records for #undefs, so
they only kick in when the submodule containing that update record
becomes visible.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165682 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/macros_left.h
nputs/macros_right.h
nputs/module.map
acros.c
a8235d6c4093cd38dcf742909651f867de62e55b 10-Oct-2012 Douglas Gregor <dgregor@apple.com> Rework the (de-)serialization of macros, as stored in
MacroInfo*. Instead of simply dumping an offset into the current file,
give each macro definition a proper ID with all of the standard
modules-remapping facilities. Additionally, when a macro is modified
in a subsequent AST file (e.g., #undef'ing a macro loaded from another
module or from a precompiled header), provide a macro update record
rather than rewriting the entire macro definition. This gives us
greater consistency with the way we handle declarations, and ties
together macro definitions much more cleanly.

Note that we're still not actually deserializing macro history (we
never were), but it's far easy to do properly now.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165560 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/macros_left.h
nputs/macros_other.h
nputs/macros_right.h
nputs/macros_top.h
5456b0fe40714a78cd0ba7c1a5b7dc34eda385af 09-Oct-2012 Douglas Gregor <dgregor@apple.com> When we load a function or method body from an AST file, we check
whether that function/method already has a body (loaded from some
other AST file), as introduced in r165137. Delay this check until
after the redeclaration chains have been wired up.

While I'm here, make the loading of method bodies lazy.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165513 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/redecl-merge-left.h
nputs/redecl-merge-right.h
nputs/redecl-merge-top.h
bb2011db250de41f69fdbaaa35ff78310a7499f1 02-Oct-2012 Axel Naumann <Axel.Naumann@cern.ch> Add redecls into their lexical DeclContext: this is what they assert on, and the merging should have set it correctly.
This is especially relevant for templatedDecls that might be injected (and thus have their DeclContext set to) somewhere completely different.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165005 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/templates-top.h
38c3bb40c2cef630c236f3f455ea98999990b8ee 02-Oct-2012 Axel Naumann <Axel.Naumann@cern.ch> Only those InterestingDecls that got added to the AST should be passed to the ASTConsumer.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165001 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/templates-left.h
nputs/templates-right.h
emplates.mm
39d26c3e499470cd80a3e6f26f11ac681cd9712c 02-Oct-2012 Axel Naumann <Axel.Naumann@cern.ch> Merge pending instantiations instead of overwriting existing ones.
Check whether a pending instantiation needs to be instantiated (or whether an instantiation already exists).
Verify the size of the PendingInstantiations record (was only checking size of existing PendingInstantiations).

Migrate Obj-C++ part of redecl-merge into separate test, now that this is growing.
templates.mm: test that CodeGen has seen exactly one definition of template instantiations.
redecl-merge.m: use "@" specifier for expected-diagnostics.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164993 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/module.map
nputs/redecl-merge-bottom.h
nputs/redecl-merge-left.h
nputs/redecl-merge-right.h
nputs/redecl-merge-top.h
nputs/templates-left.h
nputs/templates-right.h
nputs/templates-top.h
edecl-merge.m
emplates.mm
3dd82f7f01a9ba995bea3027a934df85850cab58 01-Oct-2012 Axel Naumann <Axel.Naumann@cern.ch> The Redeclarable part of named decls is read before their name.
Lookup can nevertheless find them due to the serialized lookup table.
For instance when reading a template decl's templatedDecl, it will search for existing decls that it could be a redeclaration of, and find the half-read template decl.
Thus there is no point in asserting the names of decls.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164932 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/redecl-merge-left.h
b0e33d499d97b69f795cb53f8934bcd134a56b5a 01-Oct-2012 Axel Naumann <Axel.Naumann@cern.ch> Also merge template redeclarations.
Don't require specializations (of existing and read template) to be unique.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164931 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/redecl-merge-left.h
nputs/redecl-merge-right.h
edecl-merge.m
7b3b95a9485059b196896accc0144fd0bc31ff2c 01-Oct-2012 Axel Naumann <Axel.Naumann@cern.ch> Bring ASTReader and Writer into sync for the case where a canonical template specialization was written, which is non-canonical at the time of reading: force the reading of the ClassTemplateDecl if it was written.
The easiest way out is to store whether the decl was canonical at the time of writing.
Add test.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164927 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/redecl-merge-left.h
nputs/redecl-merge-right.h
nputs/redecl-merge-top.h
edecl-merge.m
b09de5177ee8101818a59dcd0038c75b190a2509 25-Sep-2012 Douglas Gregor <dgregor@apple.com> Introduce builtin macros to determine whether we're building a
specific module (__building_module(modulename)) and to get the name of
the current module as an identifier (__MODULE__).

Used to help headers behave differently when they're being included as
part of building a module. Oh, the irony.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164605 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/macros.h
acros.c
40b2e19cae6ab85407856c70f76278f9efbeeb7c 23-Aug-2012 Richard Smith <richard-llvm@metafoo.co.uk> When disambiguating an expression-statement from a declaraton-statement, if the
statement starts with an identifier for which name lookup will fail either way,
look at later tokens to disambiguate in order to improve error recovery.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162464 91177308-0d34-0410-b5e6-96231b3b80d8
odule-private.cpp
7c304f56eecbd03db7d222a05dfcd593750d50d3 10-Aug-2012 Jordan Rose <jordan_rose@apple.com> Update VerifyDiagnosticConsumer to only get directives during parsing.

The old behavior was to re-scan any files (like modules) where we may have
directives but won't actually be parsing during the -verify invocation.
Now, we keep the old behavior in Debug builds as a sanity check (though
modules are a known entity), and expect all legitimate directives to come
from comments seen by the preprocessor.

This also affects the ARC migration tool, which captures diagnostics in
order to filter some out. This change adds an explicit cleanup to
CaptureDiagnosticsConsumer in order to let its sub-consumer handle the
real end of diagnostics.

This was originally split into four patches, but the tests do not run
cleanly without all four, so I've combined them into one commit.

Patches by Andy Gibbs, with slight modifications from me.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161650 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/category_right.h
ookup.cpp
bjc-categories.m
bed28ac1d1463adca3ecf24fca5c30646fa9dbb2 23-Jul-2012 Sylvestre Ledru <sylvestre@debian.org> Fix a typo (the the => the)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160622 91177308-0d34-0410-b5e6-96231b3b80d8
std.m
78541c433049322b27b4f437973076ba29cff709 11-Jul-2012 Jordan Rose <jordan_rose@apple.com> Allow -verify directives to be filtered by preprocessing.

This is accomplished by making VerifyDiagnosticsConsumer a CommentHandler,
which then only reads the -verify directives that are actually in live
blocks of code. It also makes it simpler to handle -verify directives that
appear in header files, though we still have to manually reparse some files
depending on how they are generated.

This requires some test changes. In particular, all PCH tests now have their
-verify directives outside the "header" portion of the file, using the @line
syntax added in r159978. Other tests have been modified mostly to make it
clear what is being tested, and to prevent polluting the expected output with
the directives themselves.

Patch by Andy Gibbs! (with slight modifications)

The new Frontend/verify-* tests exercise the functionality of this commit,
as well as r159978, r159979, and r160053 (Andy's other -verify enhancements).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160068 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/Module.framework/Headers/Module.h
n-demand-build.m
d0792de17387e949c27f97a5fa4a0b3e82db9b1e 16-May-2012 Douglas Gregor <dgregor@apple.com> Fix ASTReader handling of ImportDecls, from Meador Inge!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156923 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/import-decl.h
nputs/module.map
mport-decl.cpp
f33d549b16a4d2f7325a099eee0ab7ee50c9528f 12-Apr-2012 Nick Lewycky <nicholas@mxc.ca> There's some code in the PCH reader that looks like it's needlessly complex, but
turns out that it's actually needed for C++ modules support. Since simplifying
it didn't cause any test failures, I'll add a test for it.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154582 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/module.map
nputs/redecl_namespaces_left.h
nputs/redecl_namespaces_right.h
edecl-namespaces.mm
b2f6820773aabff3c5c9e0dbb1cbbbda0d80c41f 06-Apr-2012 Patrick Beard <pcbeard@mac.com> Added a new attribute, objc_root_class, which informs the compiler when a root class is intentionally declared.
The warning this inhibits, -Wobjc-root-class, is opt-in for now. However, all clang unit tests that would trigger
the warning have been updated to use -Wno-objc-root-class. <rdar://problem/7446698>


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154187 91177308-0d34-0410-b5e6-96231b3b80d8
edecl-merge.m
1b7f9cbed1b96b58a6e5f7808ebc9345a76a0936 13-Mar-2012 Richard Smith <richard-llvm@metafoo.co.uk> Fix PR10447: lazily building name lookup tables for DeclContexts was broken.
The deferred lookup table building step couldn't accurately tell which Decls
should be included in the lookup table, and consequently built different tables
in some cases.

Fix this by removing lazy building of DeclContext name lookup tables. In
practice, the laziness was frequently not worthwhile in C++, because we
performed lookup into most DeclContexts. In C, it had a bit more value,
since there is no qualified lookup.

In the place of lazy lookup table building, we simply don't build lookup tables
for function DeclContexts at all. Such name lookup tables are not useful, since
they don't capture the scoping information required to correctly perform name
lookup in a function scope.

The resulting performance delta is within the noise on my testing, but appears
to be a very slight win for C++ and a very slight loss for C. The C performance
can probably be recovered (if it is a measurable problem) by avoiding building
the lookup table for the translation unit.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152608 91177308-0d34-0410-b5e6-96231b3b80d8
amespaces.cpp
32ad2ee2618745ce3da51c2ae066ed5f21157c07 01-Mar-2012 Ted Kremenek <kremenek@apple.com> Change @import to @__experimental_modules_import. We are not ready to commit to a particular syntax for modules,
and don't have time to push it forward in the near future.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151841 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/MutuallyRecursive1.framework/Headers/MutuallyRecursive1.h
nputs/MutuallyRecursive2.framework/Headers/MutuallyRecursive2.h
nputs/category_bottom.h
nputs/category_left.h
nputs/category_other.h
nputs/category_right.h
nputs/diamond.h
nputs/diamond_bottom.h
nputs/diamond_left.h
nputs/diamond_right.h
nputs/namespaces-left.h
nputs/namespaces-right.h
nputs/redecl-merge-bottom.h
nputs/redecl-merge-left-left.h
nputs/redecl-merge-left.h
nputs/redecl-merge-right.h
nputs/wildcard-submodule-exports/C_one.h
nputs/wildcard-submodule-exports/C_two.h
ompiler_builtins.m
std.m
ycles.c
ecldef.mm
iamond.c
eader-import.m
nferred-submodules.m
rgen.c
oad_failure.c
ookup.cpp
ookup.m
acros.c
ethod_pool.m
odule-private.cpp
amespaces.cpp
ormal-module-map.cpp
bjc-categories.m
n-demand-build-warnings.m
n-demand-build.m
n-demand-macros.m
edecl-merge.m
edeclarations.m
equires.m
ubframeworks.m
ubmodules-preprocess.cpp
ubmodules.cpp
ubmodules.m
ildcard-submodule-exports.cpp
59c9c72ba10dc778d326a7715a8f8c39ffa0a3a4 02-Feb-2012 Douglas Gregor <dgregor@apple.com> Use -isystem rather than relying on -isysroot to work consistently

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149626 91177308-0d34-0410-b5e6-96231b3b80d8
std.m
0d3b87cd3a644a71e2e7bb28f32bfc6d5cdb9747 02-Feb-2012 Douglas Gregor <dgregor@apple.com> Yet more data from failing buildbots...

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149624 91177308-0d34-0410-b5e6-96231b3b80d8
std.m
ee2127733af888638f830de5d5c4057cd98d7c77 02-Feb-2012 Douglas Gregor <dgregor@apple.com> Drop -verify to get better diagnostics from failing buildbots. Plus, we don't need it here

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149613 91177308-0d34-0410-b5e6-96231b3b80d8
std.m
2f04f1843ca0ffca13b8b0d4dadd1f50dffb38b8 02-Feb-2012 Douglas Gregor <dgregor@apple.com> Back out my heinous hack that tricked the module generation mechanism
into using non-absolute system includes (<foo>)...

... and introduce another hack that is simultaneously more heineous
and more effective. We whitelist Clang-supplied headers that augment
or override system headers (such as float.h, stdarg.h, and
tgmath.h). For these headers, Clang does not provide a module
mapping. Instead, a system-supplied module map can refer to these
headers in a system module, and Clang will look both in its own
include directory and wherever the system-supplied module map
suggests, then adds either or both headers. The end result is that
Clang-supplied headers get merged into the system-supplied module for
the C standard library.

As a drive-by, fix up a few dependencies in the _Builtin_instrinsics
module.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149611 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/System/usr/include/module.map
nputs/System/usr/include/stdbool.h
nputs/System/usr/include/stdint.h
nputs/System/usr/include/stdio.h
ompiler_builtins.m
std.m
9dc01f5f9ca379d378dfd6a225391497ef2447e3 01-Feb-2012 NAKAMURA Takumi <geek4civic@gmail.com> test/Modules/compiler_builtins.m: Appease Cygwin to add -D__need_wint_t.

On Cygwin, at first, <stddef.h> is included without __need_wint_t.
Next, <stddef.h> is included with __need_wint_t, though Modules feature would not process <stddef.h> twice.
Then, wint_t is not found in system headers.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149500 91177308-0d34-0410-b5e6-96231b3b80d8
ompiler_builtins.m
8c8840d0499964418fd3d83a03687b0f4fc13090 01-Feb-2012 NAKAMURA Takumi <geek4civic@gmail.com> test/Modules/compiler_builtins.m: Mark this as XFAIL:win32. MS limits.h provides size_t.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149499 91177308-0d34-0410-b5e6-96231b3b80d8
ompiler_builtins.m
eb7b9eb18b59c28d41d4dcddd55a3ec98c23d437 31-Jan-2012 Douglas Gregor <dgregor@apple.com> Split compiler builtin module into "stdlib" builtins and "intrinsic"
builds, and bring mm_alloc.h into the fold. Start playing some tricks
with these builtin modules to mirror the include_next tricks that the
headers already perform.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149434 91177308-0d34-0410-b5e6-96231b3b80d8
ompiler_builtins.m
8f7d64b6d4f9392ce783613458f3eb7a6cc78a9f 30-Jan-2012 Douglas Gregor <dgregor@apple.com> Remove tgmath.h from the module map for now, because it currently causes a
cyclic module dependency due to its inclusion of math.h and
complex.h. I'll take another shot at it later.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149283 91177308-0d34-0410-b5e6-96231b3b80d8
ompiler_builtins.m
e727d21d3fd5f6f68d9e7a260bbf84dc2fc8ae3a 30-Jan-2012 Douglas Gregor <dgregor@apple.com> Introduce TargetInfo::hasFeature() to query various feature names in
each of the targets. Use this for module requirements, so that we can
pin the availability of certain modules to certain target features,
e.g., provide a module for xmmintrin.h only when SSE support is
available.

Use these feature names to provide a nearly-complete module map for
Clang's built-in headers. Only mm_alloc.h and unwind.h are missing,
and those two are fairly specialized at the moment. Finishes
<rdar://problem/10710060>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149227 91177308-0d34-0410-b5e6-96231b3b80d8
ompiler_builtins.m
ebb1004d09968f51ec22bde2225112709dc0f386 30-Jan-2012 Douglas Gregor <dgregor@apple.com> Just disable the compiler-builtins module test on MSVC for now

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149214 91177308-0d34-0410-b5e6-96231b3b80d8
ompiler_builtins.m
8101c7f8a9b9494014db5da9f88b50e69f90acf4 30-Jan-2012 Douglas Gregor <dgregor@apple.com> Teach tgmath.h to only include <complex.h> if it's available.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149213 91177308-0d34-0410-b5e6-96231b3b80d8
ompiler_builtins.m
0fcba567b93b4af6045d51ef28b22b029a03a010 30-Jan-2012 Douglas Gregor <dgregor@apple.com> Try to get useful diagnostics out of the failing MSVC builders

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149212 91177308-0d34-0410-b5e6-96231b3b80d8
ompiler_builtins.m
e5c9e096a9e7171e8e97ab77610a71610e966f98 29-Jan-2012 Douglas Gregor <dgregor@apple.com> Alternate fix to the modules failures that doesn't require us to tweak tgmath.h

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149210 91177308-0d34-0410-b5e6-96231b3b80d8
ompiler_builtins.m
5ad2649083d75f2d3cfac7b56e0dc391d6e29541 29-Jan-2012 Douglas Gregor <dgregor@apple.com> If there's no math.h, then tgmath.h should just be empty

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149209 91177308-0d34-0410-b5e6-96231b3b80d8
ompiler_builtins.m
fe225e4aa34e37f26ea45270a18c986bd23a1b7f 29-Jan-2012 Douglas Gregor <dgregor@apple.com> Temporary disable the -verify on this test in the hope of getting some useful output from the buildbots

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149208 91177308-0d34-0410-b5e6-96231b3b80d8
ompiler_builtins.m
3e80d8ac921825436bd11d9b4017a0691584056b 29-Jan-2012 Douglas Gregor <dgregor@apple.com> Introduce a module map for (some of) the compiler-supplied
headers. The remaining headers require more sophisticated
requirements; they'll be handled separately. Part of
<rdar://problem/10710060>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149206 91177308-0d34-0410-b5e6-96231b3b80d8
ompiler_builtins.m
8f95cb328a5f4b5bf6d903b36861b1acc94b0505 29-Jan-2012 Douglas Gregor <dgregor@apple.com> Test module lookup within a subdirectory of a normal include directory.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149196 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/subdir/module.map
nputs/subdir/subdir.h
n-demand-build.m
a1f1fad8b60e1cb9d21a40a37f2e03150bcbeb6f 27-Jan-2012 Douglas Gregor <dgregor@apple.com> Introduce module attributes into the module map grammar, along with a
single attribute ("system") that allows us to mark a module as being a
"system" module. Each of the headers that makes up a system module is
considered to be a system header, so that we (for example) suppress
warnings there.

If a module is being inferred for a framework, and that framework
directory is within a system frameworks directory, infer it as a
system framework.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149143 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/NoUmbrella.framework/Headers/A.h
nputs/NoUmbrella.framework/module.map
cff9f26ce0ed76d555cd33b3dca84dd5cdf376af 27-Jan-2012 Douglas Gregor <dgregor@apple.com> Reimplement (de-)serialization of Objective-C categories to eliminate
the direct serialization of the linked-list structure. Instead, use a
scheme similar to how we handle redeclarations, with redeclaration
lists on the side. This addresses several issues:
- In cases involving mixing and matching of many categories across
many modules, the linked-list structure would not be consistent
across different modules, and categories would get lost.
- If a module is loaded after the class definition and its other
categories have already been loaded, we wouldn't see any categories
in the newly-loaded module.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149112 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/category_other.h
nputs/category_top.h
nputs/module.map
bjc-categories.m
0d266d623452f09d06973528217390d762a8f3fa 25-Jan-2012 Douglas Gregor <dgregor@apple.com> Whenever Sema attempts to look in the global method pool, try to load
additional data from the external Sema source. This properly copes
with modules that are imported after we have already searched in the
global method pool for a given selector. For PCH, it's a slight
pessimization to be fixed soon.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148891 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/MethodPoolA.h
nputs/MethodPoolB.h
nputs/module.map
ethod_pool.m
cc32b44ea4b3c702bf84eae0af27ca160bd90831 15-Jan-2012 Douglas Gregor <dgregor@apple.com> When deserializing the definition of a C++ class/ObjC class/ObjC
protocol, record the definition pointer in the canonical declaration
for that entity, and then propagate that definition pointer from the
canonical declaration to all other deserialized declarations. This
approach works well even when deserializing declarations that didn't
know about the original definition, which can occur with modules.

A nice bonus from this definition-deserialization approach is that we
no longer need update records when a definition is added, because the
redeclaration chains ensure that the if any declaration is loaded, the
definition will also get loaded.




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148223 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/redecl-merge-left-left.h
nputs/redecl-merge-right.h
edecl-merge.m
91534a357695fbdf3c136fb04218e37706da73a9 14-Jan-2012 Douglas Gregor <dgregor@apple.com> (Implicit) parameters deserialized as part of a function type must not
get added to the identifier chains as part of deserialization, because
they should not be visible to name lookup.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148159 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/redecl-merge-left.h
edecl-merge.m
a8c6fea0234bc23de6106a84646dc049cf45e8c8 13-Jan-2012 Douglas Gregor <dgregor@apple.com> When inferring a module for a framework, first determine whether that
framework is actually a subframework within a top-level framework. If
so, only infer a module for the top-level framework and then dig out
the appropriate submodule.

This helps us cope with an amusing subframeworks anti-pattern, where
one uses -F <framework>/Frameworks to get direct include access to the
subframeworks of a framework (which otherwise would not be
permitted).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148148 91177308-0d34-0410-b5e6-96231b3b80d8
ubframeworks.m
3a110f75acafc992cb664200cebec90520986715 13-Jan-2012 Douglas Gregor <dgregor@apple.com> Don't infer a submodule for a framework's private header, at least for now.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148117 91177308-0d34-0410-b5e6-96231b3b80d8
uto-module-import.m
1c3875dab92f3b0a25212c80863e452cb269d3f1 09-Jan-2012 Douglas Gregor <dgregor@apple.com> When deserializing an anonymous namespace from a module, do not attach
the anonymous namespace to its parent. Semantically, this means that
the anonymous namespaces defined in one module are distinct from the
anonymous namespaces defined in another module.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147782 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/namespaces-left.h
nputs/namespaces-right.h
nputs/namespaces-top.h
amespaces.cpp
0fdc09fe680787b855cf20183c4bd3b83f2c907f 09-Jan-2012 Douglas Gregor <dgregor@apple.com> Implement merging of namespace-scope declarations across modules, so
that we can merge, for example, two occurrences of

namespace N { void f(); }

in two disjoint modules.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147780 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/namespaces-left.h
nputs/namespaces-right.h
amespaces.cpp
c6c8e0ec96bb64f1b9f543d7c8317c6090f80a30 09-Jan-2012 Douglas Gregor <dgregor@apple.com> Implement redeclaration merging for namespaces defined in distinct
modules. Teach name lookup into namespaces to search in each of the
merged DeclContexts as well as the (now-primary) DeclContext. This
supports the common case where two different modules put something
into the same namespace.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147778 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/namespaces-left.h
nputs/namespaces-right.h
amespaces.cpp
c02d62f0b82c144f7db2a71c3b4565de8c6163e5 09-Jan-2012 Douglas Gregor <dgregor@apple.com> Always allow redefinition of typedefs when modules are enabled. This
is important because it's fairly common for headers (especially system
headers) to want to provide only those typedefs needed for that
particular header, based on some guard macro, e.g.,

#ifndef _SIZE_T
#define _SIZE_T
typedef long size_t;
#endif

which is repeated in a number of headers. The guard macro protects
against duplicate definitions. However, this means that only the first
occurrence of this pattern actually defines size_t, so the submodule
corresponding to this header has the only visible definition. If a
user then imports a different submodule from the same module, size_t
will be known but not visible, and therefore cannot be used.

By allowing redefinition of typedefs, each header that wants to define
size_t can do so independently, so it will be available in the
corresponding submodules.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147775 91177308-0d34-0410-b5e6-96231b3b80d8
edecl-merge.m
f5c9f9fd6f5e2850b9b0f19283430245b696c6e5 07-Jan-2012 Douglas Gregor <dgregor@apple.com> Switch NamespaceDecl from its own hand-rolled redeclaration chain over
to Redeclarable<NamespaceDecl>, so that we benefit from the improveed
redeclaration deserialization and merging logic provided by
Redeclarable<T>. Otherwise, no functionality change.

As a drive-by fix, collapse the "inline" bit into the low bit of the
original namespace/anonymous namespace, saving 8 bytes per
NamespaceDecl on x86_64.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147729 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/module.map
nputs/namespaces-left.h
nputs/namespaces-right.h
nputs/namespaces-top.h
amespaces.cpp
303aae98a5a27f2595d023c0b4e1484bf2c0ee57 06-Jan-2012 Douglas Gregor <dgregor@apple.com> When inferring a submodule ID during module creation, look up the
include stack to find the first file that is known to be part of the
module. This copes with situations where the module map doesn't
completely specify all of the headers that are involved in the module,
which can come up when there are very strange #include_next chains
(e.g., with weird compiler/stdlib headers like stdarg.h or float.h).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147662 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/def-include.h
nputs/def.h
447af24a003aa8d0dc7317a56f06f5b8361f8808 05-Jan-2012 Douglas Gregor <dgregor@apple.com> When we're performing name lookup for a tag, we still allow ourselves
to see hidden declarations because every tag lookup is effectively a
redeclaration lookup. For example, image that

struct foo;

is declared in a submodule that is known but hasn't been imported. If
someone later writes

struct foo *foo_p;

then "struct foo" is either a reference or a redeclaration. To keep
the redeclaration chains sound, we treat it like a redeclaration for
name-lookup purposes.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147588 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/redecl-merge-top-explicit.h
edecl-merge.m
752769f080e217747f7756d3db2b4ee405bf3767 05-Jan-2012 Douglas Gregor <dgregor@apple.com> When generating includes for all of the headers we found in an
umbrella directory, skip includes for any headers that are part of an
unavailable module.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147572 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/NoUmbrella.framework/Headers/Boom.h
nputs/NoUmbrella.framework/module.map
4791fa2c3c16c51c8435706682ec0fec8647335a 04-Jan-2012 Douglas Gregor <dgregor@apple.com> Implement declaration merging for variables in disjoint modules.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147535 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/redecl-merge-left.h
nputs/redecl-merge-right.h
edecl-merge.m
7076281fcaab2a01e6226b05c822dd3142167636 04-Jan-2012 Douglas Gregor <dgregor@apple.com> Implement declaration merging for non-template functions from
different modules. This implementation is a first approximation of
what we want, using only the function type to determine
equivalence. Later, we'll want to deal with some of the more subtle
issues, including:

- C allows a prototyped declaration and a non-prototyped declaration
to be merged, which we should support
- We may want to ignore the return type when merging, then
complain if the return types differ. Or, we may want to leave it
as it us, so that we only complain if overload resolution
eventually fails.
- C++ non-static member functions need to consider cv-qualifiers
and ref-qualifiers.
- Function templates need to consider the template parameters and
return type.
- Function template specializations will have special rules.
- We can now (accidentally!) end up overloading in C, even without
the "overloadable" attribute, and will need to detect this at some
point.

The actual detection of "is this an overload?" is implemented by
Sema::IsOverload(), which will need to be moved into the AST library
for re-use here. That will be a future refactor.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147534 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/redecl-merge-left.h
nputs/redecl-merge-right.h
edecl-merge.m
d6aba06861c41ccbc4926e5fe3cecd97b20410c0 04-Jan-2012 Douglas Gregor <dgregor@apple.com> Don't treat 'import' as a contextual keyword when we're in a caching lexer, or when modules are disabled.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147524 91177308-0d34-0410-b5e6-96231b3b80d8
ookup.cpp
7a537404f039d4b7d063bbdc3c8c924be977dff2 04-Jan-2012 Douglas Gregor <dgregor@apple.com> Test "merging" of typedef types across distinct modules. At present,
the AST reader doesn't actually perform a merge, because name lookup
knows how to merge identical typedefs together.

As part of this, teach C/Objective-C name lookup to return multiple
results in all cases, rather than first digging through the attributes
to see if the value is overloadable. This way, we'll catch ambiguous
lookups in C/Objective-C.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147498 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/redecl-merge-left.h
nputs/redecl-merge-right.h
edecl-merge.m
1ca4a5c41b8707b5fafcd1af1c9824b1bb19a399 03-Jan-2012 Douglas Gregor <dgregor@apple.com> Implement cross-module declaration merging for tag declarations, so
that if two modules A and B both contain a declaration of a tag such
as

struct X;

and those two modules are unrelated, the two declarations of X will be
merged into a single redeclaration chain.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147488 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/redecl-merge-bottom.h
nputs/redecl-merge-left.h
nputs/redecl-merge-right.h
nputs/redecl-merge-top.h
edecl-merge.m
1ac13c37d8af0145b7e03fea70b7b1476b8828c9 03-Jan-2012 Douglas Gregor <dgregor@apple.com> Re-uglify #public and #private to #__public_macro and #__private_macro.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147469 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/DependsOnModule.framework/Headers/DependsOnModule.h
nputs/Module.framework/Frameworks/SubFramework.framework/Headers/SubFramework.h
nputs/Module.framework/Headers/Module.h
nputs/macros.h
acros.c
c13a34b690d2dc2a03c2fea75a0a1438636c19ce 03-Jan-2012 Douglas Gregor <dgregor@apple.com> Eliminate the uglified keyword __import_module__ for importing
modules. This leaves us without an explicit syntax for importing
modules in C/C++, because such a syntax needs to be discussed
first. In Objective-C/Objective-C++, the @import syntax is used to
import modules.

Note that, under -fmodules, C/C++ programs can import modules via the
#include mechanism when a module map is in place for that header. This
allows us to work with modules in C/C++ without committing to a syntax.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147467 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/MutuallyRecursive1.framework/Headers/MutuallyRecursive1.h
nputs/MutuallyRecursive2.framework/Headers/MutuallyRecursive2.h
nputs/diamond.h
nputs/diamond_bottom.h
nputs/diamond_left.h
nputs/diamond_right.h
nputs/wildcard-submodule-exports/C_one.h
nputs/wildcard-submodule-exports/C_two.h
ycles.c
iamond-pch.c
iamond.c
rgen.c
oad_failure.c
ookup.cpp
acros.c
odule-private.cpp
ormal-module-map.cpp
ubmodules-preprocess.cpp
ubmodules.cpp
ildcard-submodule-exports.cpp
94ad28b31433058445a27db722f60402ee820bea 03-Jan-2012 Douglas Gregor <dgregor@apple.com> Under -fmodules, accept #public <macroname> and #private <macroname>
to make a macro public (the default for headers) or private,
respectively.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147455 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/DependsOnModule.framework/Headers/DependsOnModule.h
nputs/Module.framework/Frameworks/SubFramework.framework/Headers/SubFramework.h
nputs/Module.framework/Headers/Module.h
nputs/macros.h
ecldef.mm
eader-import.m
ookup.m
acros.c
bjc-categories.m
n-demand-build-warnings.m
n-demand-build.m
n-demand-macros.m
edeclarations.m
5948ae1021122164b22f74353bb7fe325a64f616 03-Jan-2012 Douglas Gregor <dgregor@apple.com> Introduce a non-uglified syntax for module imports in Objective-C:

@import identifier [. identifier]* ;



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147452 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/category_bottom.h
nputs/category_left.h
nputs/category_right.h
nputs/redecl-merge-bottom.h
nputs/redecl-merge-left-left.h
nputs/redecl-merge-left.h
nputs/redecl-merge-right.h
ecldef.mm
eader-import.m
nferred-submodules.m
ookup.m
bjc-categories.m
n-demand-build-warnings.m
n-demand-build.m
n-demand-macros.m
edecl-merge.m
edeclarations.m
equires.m
ubframeworks.m
ubmodules.m
674949fe3fdd796fc643f0e7660cb973da1dd383 03-Jan-2012 Douglas Gregor <dgregor@apple.com> Don't attempt to merge a deserialized declaration with existing
declarations in the AST unless modules are enabled. This case doesn't
come up with precompiled headers, and it isn't cheap.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147451 91177308-0d34-0410-b5e6-96231b3b80d8
edecl-merge.m
c514a8a0eaa575cf46b038cc27fa1e4e8c22f89a 03-Jan-2012 Douglas Gregor <dgregor@apple.com> Rename the command-line option for mapping #include/#import over to
module imports from -fauto-module-import to -fmodules. The new name
will eventually be used to enable modules, and the #include/#import
mapping is a crucial part of the feature.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147447 91177308-0d34-0410-b5e6-96231b3b80d8
uto-module-import.m
nferred-submodules.m
ormal-module-map.cpp
equires.m
ubframeworks.m
ubmodules-preprocess.cpp
ubmodules.cpp
ubmodules.m
ildcard-submodule-exports.cpp
d07cc36c71558b62889691184dd04655a33fd12a 02-Jan-2012 Douglas Gregor <dgregor@apple.com> Diagnose cases where the definition of a particular type is required,
is known (to Clang), but is not visible because the module has not yet
been imported.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147436 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/def.h
ecldef.mm
dba9361891ab147b6ea658c1834bc1d660f5226b 01-Jan-2012 Douglas Gregor <dgregor@apple.com> Implement declaration merging for Objective-C protocols across
multiple, disjoint modules. There is far too much duplicating with the
ObjCInterfaceDecl case here, which I'll eliminate shortly.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147417 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/redecl-merge-bottom.h
nputs/redecl-merge-left.h
nputs/redecl-merge-right.h
edecl-merge.m
27c6da284f90e32cda0ec8f52a2b6ba5a2613252 01-Jan-2012 Douglas Gregor <dgregor@apple.com> Wire up redeclaration chains for Objective-C protocols, so that both
forward declarations and definitions of an Objective-C protocol are
represented within a single chain of ObjCProtocolDecls.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147412 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/redecl-merge-bottom.h
nputs/redecl-merge-left.h
nputs/redecl-merge-right.h
nputs/redecl-merge-top.h
edecl-merge.m
51f564f80d9f71e175635b452ffeeeff899e9bf1 31-Dec-2011 Douglas Gregor <dgregor@apple.com> Implement support for module requirements, which indicate the language
features needed for a particular module to be available. This allows
mixed-language modules, where certain headers only work under some
language variants (e.g., in C++, std.tuple might only be available in
C++11 mode).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147387 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/DependsOnModule.framework/Headers/cxx_other.h
nputs/DependsOnModule.framework/module.map
equires.m
ubframeworks.m
585ec93e1bd4fdd5a37aa19848e5f92084f0d923 23-Dec-2011 Douglas Gregor <dgregor@apple.com> When building a module with an umbrella header, warn about any headers
found within that umbrella directory that were not actually included
by the umbrella header. They should either be referenced in the module
map or included by the umbrella header.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147207 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/Module.framework/Headers/Module.h
n-demand-build.m
c3cfd2ab3338d47861ece597212f21b972ebe727 22-Dec-2011 Douglas Gregor <dgregor@apple.com> Serialize the AST reader's mapping from canonical declarations to the
set of (previously-canonical) declaration IDs to the module file, so
that future AST reader instances that load the module know which
declarations are merged. This is important in the fairly tricky case
where a declaration of an entity, e.g.,

@class X;

occurs before the import of a module that also declares that
entity. We merge the declarations, and record the fact that the
declaration of X loaded from the module was merged into the (now
canonical) declaration of X that we parsed.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147181 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/redecl-merge-bottom.h
nputs/redecl-merge-left.h
edecl-merge.m
cce54aa6a40e4c39b25532336e17ce40f0a7e087 22-Dec-2011 Douglas Gregor <dgregor@apple.com> If we end up merging an Objective-C class with an existing Objective-C
class that comes from a different module file, make sure that we load
all of the pending declarations for the original declaration.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147168 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/module.map
nputs/redecl-merge-bottom.h
nputs/redecl-merge-left-left.h
nputs/redecl-merge-right.h
edecl-merge.m
0f75323264b93a318ac9007eb5ec5b233c444068 22-Dec-2011 Douglas Gregor <dgregor@apple.com> When deserializing an Objective-C class, check whether we have another
declaration of that same class that either came from some other module
or occurred in the translation unit loading the module. In this case,
we need to merge the two redeclaration chains immediately so that all
such declarations have the same canonical declaration in the resulting
AST (even though they don't in the module files we've imported).

Focusing on Objective-C classes until I'm happy with the design, then
I'll both (1) extend this notion to other kinds of declarations, and
(2) optimize away this extra checking when we're not dealing with
modules. For now, doing this checking for PCH files/preambles gives us
better testing coverage.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147123 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/redecl-merge-left.h
nputs/redecl-merge-right.h
edecl-merge.m
1d4c1137c314cfb9ced32006cacdb80deffb66d4 20-Dec-2011 Douglas Gregor <dgregor@apple.com> When we make a previously-deserialized module definition visible,
notify the AST deserialization listener so that the AST writer knows
that it can write the macro definition.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146994 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/redecl-merge-right.h
nputs/redecl-merge-top-explicit.h
2ccd89cff3f1c18b48f649240302446a7dae28b9 20-Dec-2011 Douglas Gregor <dgregor@apple.com> When performing name lookup for a redeclaration, ignore module
visibility restrictions. This ensures that all declarations of the
same entity end up in the same redeclaration chain, even if some of
those declarations aren't visible. While this may seem unfortunate to
some---why can't two C modules have different functions named
'f'?---it's an acknowedgment that a module does not introduce a new
"namespace" of names.

As part of this, stop merging the 'module-private' bit from previous
declarations to later declarations, because we want each declaration
in a module to stand on its own because this can effect, for example,
submodule visibility.

Note that this notion of names that are invisible to normal name
lookup but are available for redeclaration lookups is how we should
implement friend declarations and extern declarations within local
function scopes. I'm not tackling that problem now.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146980 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/module.map
nputs/module_private_left.h
nputs/module_private_right.h
nputs/redecl-merge-left.h
nputs/redecl-merge-right.h
nputs/redecl-merge-top-explicit.h
odule-private.cpp
edecl-merge.m
305dc3ebaa0bea5f3b789e4b54afc79c25907615 20-Dec-2011 Douglas Gregor <dgregor@apple.com> Detect when mapping a #include/#import over to a submodule ends up
hitting a submodule that was never actually created, e.g., because
that header wasn't parsed. In such cases, complain (because the
module's umbrella headers don't cover everything) and fall back to
including the header.

Later, we'll add a warning at module-build time to catch all such
cases. However, this fallback is important to eliminate assertions in
the ASTWriter when this happens.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146933 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/Module.framework/Headers/NotInModule.h
uto-module-import.m
fc529f7fcafe7da0b8a32621e13685891e8ce52a 19-Dec-2011 Douglas Gregor <dgregor@apple.com> Once we have fully deserialized a redeclaration chain for something
with a definition pointer (e.g., C++ and Objective-C classes), zip
through the redeclaration chain to make sure that all of the
declarations point to the definition data.

As part of this, realized again why the first redeclaration of an
entity in a file is important, and brought back that idea.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146886 91177308-0d34-0410-b5e6-96231b3b80d8
edecl-merge.m
f63b0a5f5445830a845895ee16f3affeaffd2e9d 19-Dec-2011 Douglas Gregor <dgregor@apple.com> Re-implement (de-)serialization of redeclaration chains for
redeclaration templates (RedeclarableTemplateDecl), similarly to the
way (de-)serialization is implemented for Redeclarable<T>. In the
process, found a simpler formulation for handling redeclaration
chains and implemented that in both places.

The new test establishes that we're building the redeclaration chains
properly. However, the FIXME indicates where we're tickling a
different bug that has to do with us not setting the DefinitionData
pointer properly in redeclarations that we detected after the
definition itself was deserialized. The (separable) fix for that bug
is forthcoming.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146883 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/redecl-merge-bottom.h
nputs/redecl-merge-left.h
nputs/redecl-merge-right.h
nputs/redecl-merge-top.h
edecl-merge.m
adafc2edc0dc4fa25ea6f0a136f599a6ac279081 19-Dec-2011 Douglas Gregor <dgregor@apple.com> The submodule offset map can introduce "empty" remapping entries for
imported modules that don't introduce any new entities of a particular
kind. Allow these entries to be replaced with entries for another
loaded module.

In the included test case, selectors exhibit this behavior.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146870 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/redecl-merge-left.h
edecl-merge.m
ecb19382e1041f4e90f44c541173b85e4f328b84 19-Dec-2011 Douglas Gregor <dgregor@apple.com> Optimize serialized representation of redeclarable declarations for
which there are no redeclarations. This reduced by size of the PCH
file for Cocoa.h by ~650k: ~536k of that was in the new
LOCAL_REDECLARATIONS table, which went from a ridiculous 540k down to
an acceptable 3.5k, while the rest was due to the more compact
abbreviated representation of redeclarable declaration kinds (which no
longer need to store the 'first' declaration ID).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146869 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/redecl-merge-bottom.h
nputs/redecl-merge-left.h
nputs/redecl-merge-right.h
nputs/redecl-merge-top.h
edecl-merge.m
68d7bb97fc8574bb6708c4a7dc89486a895c4114 19-Dec-2011 Douglas Gregor <dgregor@apple.com> Make sure this test works in C++, too

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146868 91177308-0d34-0410-b5e6-96231b3b80d8
edecl-merge.m
a1be278c4f3a234ff61f04018d26c6beecde1654 18-Dec-2011 Douglas Gregor <dgregor@apple.com> Completely re-implement (de-)serialization of declaration
chains. The previous implementation relied heavily on the declaration
chain being stored as a (circular) linked list on disk, as it is in
memory. However, when deserializing from multiple modules, the
different chains could get mixed up, leading to broken declaration chains.

The new solution keeps track of the first and last declarations in the
chain for each module file. When we load a declaration, we search all
of the module files for redeclarations of that declaration, then
splice together all of the lists into a coherent whole (along with any
redeclarations that were actually parsed).

As a drive-by fix, (de-)serialize the redeclaration chains of
TypedefNameDecls, which had somehow gotten missed previously. Add a
test of this serialization.

This new scheme creates a redeclaration table that is fairly large in
the PCH file (on the order of 400k for Cocoa.h's 12MB PCH file). The
table is mmap'd in and searched via a binary search, but it's still
quite large. A future tweak will eliminate entries for declarations
that have no redeclarations anywhere, and should
drastically reduce the size of this table.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146841 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/module.map
nputs/redecl-merge-bottom.h
nputs/redecl-merge-left.h
nputs/redecl-merge-right.h
nputs/redecl-merge-top.h
edecl-merge.m
0af550115df1f57f17a4f125ff0e8b34820c65d1 16-Dec-2011 Douglas Gregor <dgregor@apple.com> Fix chaining of ObjCInterfaceDecl redeclarations

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146722 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/decl2.h
nputs/module.map
d63348c3382965a9e1719c8eaa63e2891dd5e234 15-Dec-2011 Douglas Gregor <dgregor@apple.com> When name lookup finds a module-private Objective-C class declaration,
check whether any previous declarations of the class were visible.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146680 91177308-0d34-0410-b5e6-96231b3b80d8
ecldef.mm
2fe9b7fb07dff15dd15dd8755a9a9e6de0fe46fc 15-Dec-2011 Richard Trieu <rtrieu@google.com> Modify how the -verify flag works. Currently, the verification string and
diagnostic message are compared. If either is a substring of the other, then
no error is given. This gives rise to an unexpected case:

// expect-error{{candidate function has different number of parameters}}

will match the following error messages from Clang:

candidate function has different number of parameters (expected 1 but has 2)
candidate function has different number of parameters

It will also match these other error messages:

candidate function
function has different number of parameters
number of parameters

This patch will change so that the verification string must be a substring of
the diagnostic message before accepting. Also, all the failing tests from this
change have been corrected. Some stats from this cleanup:

87 - removed extra spaces around verification strings
70 - wording updates to diagnostics
40 - extra leading or trailing characters (typos, unmatched parens or quotes)
35 - diagnostic level was included (error:, warning:, or note:)
18 - flag name put in the warning (-Wprotocol)



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146619 91177308-0d34-0410-b5e6-96231b3b80d8
acros.c
ormal-module-map.cpp
553689148f546783e127749438bf6d7806e6bb1d 14-Dec-2011 Douglas Gregor <dgregor@apple.com> When name lookup comes across a declaration that is in a module that
is not visible, look for any previous declarations of that entity that
might be visible.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146563 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/decl.h
nputs/def.h
nputs/module.map
ecldef.mm
3b29bb99948f9e8b4a4e829445c753f6858f607e 12-Dec-2011 Douglas Gregor <dgregor@apple.com> When we have an umbrella directory in a module map, recursively walk
the subdirectories to find headers in submodules.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146398 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/NoUmbrella.framework/Headers/SubDir/C.h
uto-module-import.m
d83d2e73fdbe425acc4cac7b8130c464cb98333d 12-Dec-2011 Douglas Gregor <dgregor@apple.com> Don't mark include guard macros as implicitly private. This isn't
actually a terribly good heuristic, and the world is too horrible for
it to work.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146393 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/Module.framework/Frameworks/SubFramework.framework/Headers/SubFramework.h
6a1db484f32eb791840dd55a8d45c86ff5bd0834 09-Dec-2011 Douglas Gregor <dgregor@apple.com> Implement the notion of umbrella directories, which implicity cover
all of the headers below that particular directory. Use umbrella
directories as a clean way to deal with (1) directories/frameworks
that don't have an umbrella header, but don't want to enumerate all of
their headers, and (2) PrivateHeaders, which we never want to
enumerate and want to keep separate from the main umbrella header.

This also eliminates a little more of the "magic" for private headers,
and frameworks in general.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146235 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/NoUmbrella.framework/Headers/A.h
nputs/NoUmbrella.framework/Headers/B.h
nputs/NoUmbrella.framework/PrivateHeaders/A_Private.h
nputs/NoUmbrella.framework/PrivateHeaders/B_Private.h
nputs/NoUmbrella.framework/module.map
nputs/NoUmbrella.framework/module_private.map
uto-module-import.m
77d029f6a24dbf70d97e61757945df53fb250ea0 08-Dec-2011 Douglas Gregor <dgregor@apple.com> Implement umbrella directories for modules, which are similar to
umbrella headers in the sense that all of the headers within that
directory (and eventually its subdirectories) are considered to be
part of the module with that umbrella directory. However, unlike
umbrella headers, which are expected to include all of the headers
within their subdirectories, Clang will automatically include all of
the headers it finds in the named subdirectory.

The intent here is to allow a module map to trivially turn a
subdirectory into a module, where the module's structure can mimic the
directory structure.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146165 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/normal-module-map/module.map
nputs/normal-module-map/nested_umbrella/a.h
nputs/normal-module-map/nested_umbrella/b.h
ormal-module-map.cpp
489ad43b77c10a98df80f1395de81e3f52697e76 08-Dec-2011 Douglas Gregor <dgregor@apple.com> Tweak the syntax of umbrella headers, so that "umbrella" is treated as
a modifier for a header declarartion, e.g.,

umbrella header "headername"

Collapse the umbrella-handling code in the parser into the
header-handling code, so we don't duplicate the header-search logic.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146159 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/DependsOnModule.framework/module.map
nputs/normal-module-map/Umbrella/module.map
nputs/normal-module-map/Umbrella2/module.map
5e3f9223db88227d6d21679c613b139d8160186d 08-Dec-2011 Douglas Gregor <dgregor@apple.com> Keep track of import dependencies between submodules within the module
that's currently being built. This is important for supporting
transitive dependencies ("export *" in the module map) completely.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146156 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/Module.framework/Headers/Sub.h
nputs/Module.framework/Headers/Sub2.h
ubmodules.m
23af6d58e392e18ae2946b799264717f480e6596 07-Dec-2011 Douglas Gregor <dgregor@apple.com> Implement inference for the "Private" submodule corresponding to
private headers in a framework.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146082 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/Module.framework/PrivateHeaders/ModulePrivate.h
uto-module-import.m
4813442c124d13a5c9cbf71beb7762275e45aacd 07-Dec-2011 Douglas Gregor <dgregor@apple.com> Make sure we pick up module_private.map when loading a module.map file.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146074 91177308-0d34-0410-b5e6-96231b3b80d8
uto-module-import.m
587986efc5ca409da3ebf0a4ab7f72ebf50a3ab9 07-Dec-2011 Douglas Gregor <dgregor@apple.com> Implement basic support for private headers in frameworks. In essence,
when we load a module map (module.map) from a directory, also load a
private module map (module_private.map) for that directory, if
present. That private module map can inject a new submodule that
captures private headers.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146012 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/DependsOnModule.framework/PrivateHeaders/DependsOnModulePrivate.h
nputs/DependsOnModule.framework/module_private.map
uto-module-import.m
e487f422cf93cdeb45ef09170b1b5f2493649d4a 06-Dec-2011 Douglas Gregor <dgregor@apple.com> Rename Objective-C-only tests to .m

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145959 91177308-0d34-0410-b5e6-96231b3b80d8
uto-module-import.c
uto-module-import.m
nferred-submodules.c
nferred-submodules.m
ac252a3b0f8101a7274309e4a5cf2d5f0fdba675 06-Dec-2011 Douglas Gregor <dgregor@apple.com> When inferring a module map for a framework, infer subframework
modules for each of its subframeworks.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145957 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/Module.framework/Frameworks/SubFramework.framework/Headers/SubFramework.h
uto-module-import.c
n-demand-build.m
ef85b56bfee855823756a6f46ee50a8c7cc5f3a6 06-Dec-2011 Douglas Gregor <dgregor@apple.com> Allow inferred submodules for any (sub)module that has an umbrella header

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145945 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/DependsOnModule.framework/module.map
uto-module-import.c
09833925a3ac68065565e9556d06e9576ec6eaa9 06-Dec-2011 Douglas Gregor <dgregor@apple.com> When suggesting a module import for a #include or #import, suggest the
most specific (sub)module based on the actual file we find, rather
than always importing the top-level module. This means
that #include'ing <Foo/Blah.h> should give us the submodule Foo.Blah.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145942 91177308-0d34-0410-b5e6-96231b3b80d8
uto-module-import.c
d620a84a01cc232a9449dbcc2c40bd43ca314fc9 06-Dec-2011 Douglas Gregor <dgregor@apple.com> Implement modules support for subframeworks (aka embedded
frameworks). A submodule can now be labeled as a "framework", and
header search will look into the appropriate Headers/PrivateHeaders
subdirectories for named headers.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145941 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/DependsOnModule.framework/Frameworks/SubFramework.framework/Headers/Other.h
nputs/DependsOnModule.framework/Frameworks/SubFramework.framework/Headers/SubFramework.h
nputs/DependsOnModule.framework/module.map
ubframeworks.m
8075ce62f7860224d7f3f9ddba38201ad89e2cbc 06-Dec-2011 Douglas Gregor <dgregor@apple.com> When building the main file to parse given a module map, don't skip
explicit submodules or umbrella headers from submodules. Instead,
build the entire module at once, and let the name-hiding mechanisms
hide the contents of explicit submodules at load time.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145940 91177308-0d34-0410-b5e6-96231b3b80d8
uto-module-import.c
e209e5026892cb07294f733c72bd51359c0f0e72 06-Dec-2011 Douglas Gregor <dgregor@apple.com> Implement inferred submodules support, which (when requested)
implicitly generates submodules corresponding to the headers that fall
within a module.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145887 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/Module.framework/Headers/Buried/Treasure.h
nputs/Module.framework/Headers/Module.h
nputs/Module.framework/Headers/Sub.h
nferred-submodules.c
1e12368db12005ddd92fd9188c86383fe30ef443 05-Dec-2011 Douglas Gregor <dgregor@apple.com> Parse inferred submodules in module maps, track their contents in
Module, and (de-)serialize this information. Semantics of inferred
submodules to follow.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145864 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/DependsOnModule.framework/module.map
209977c4d809914a20fd44873876c76cf972a56d 05-Dec-2011 Douglas Gregor <dgregor@apple.com> Inferred framework modules automatically export anything they import
(i.e., 'export *'), to better match the semantics of headers.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145813 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/AlsoDependsOnModule.framework/Headers/AlsoDependsOnModule.h
uto-module-import.c
0adaa880993ad23186c87c7f98e7a3fd2697742c 05-Dec-2011 Douglas Gregor <dgregor@apple.com> Implement support for wildcard exports in modules, allowing a module
to re-export anything that it imports. This opt-in feature makes a
module behave more like a header, because it can be used to re-export
the transitive closure of a (sub)module's dependencies.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145811 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/module.map
nputs/wildcard-submodule-exports/A_one.h
nputs/wildcard-submodule-exports/A_two.h
nputs/wildcard-submodule-exports/B_one.h
nputs/wildcard-submodule-exports/B_two.h
nputs/wildcard-submodule-exports/C_one.h
nputs/wildcard-submodule-exports/C_two.h
nputs/wildcard-submodule-exports/module.map
ildcard-submodule-exports.cpp
f6137e4d15cb6bbd10547267babfc699c1945873 03-Dec-2011 Douglas Gregor <dgregor@apple.com> Implement support for precompiled headers, preambles, and serialized
"main" files that import modules. When loading any of these kinds of
AST files, we make the modules that were imported visible into the
translation unit that loaded the PCH file or preamble.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145737 91177308-0d34-0410-b5e6-96231b3b80d8
iamond-pch.c
8c366c47283bc698f4383de7abb3e411e32da5ce 02-Dec-2011 Douglas Gregor <dgregor@apple.com> Add missing test header

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145710 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/diamond.h
6236a29f5082d4736c4593ca1a04595037db1685 02-Dec-2011 Douglas Gregor <dgregor@apple.com> Only perform checking of the predefines buffer when loading a
precompiled header. Previously, we were trying to gather predefines
buffers from all kinds of AST files (which doesn't make sense) and
were performing some validation when AST files were loaded as main
files.

With these tweaks, using PCH files that import modules no longer fails
immediately (due to mismatched predefines buffers). However, module
visibility is lost, so this feature does not yet work.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145709 91177308-0d34-0410-b5e6-96231b3b80d8
iamond-pch.c
10ce9321551efffa6ed2cff39084400e1dfcf307 02-Dec-2011 Douglas Gregor <dgregor@apple.com> Make sure that name lookup in C checks whether a name is hidden.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145700 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/module.map
07165b9e3b78ed76a7db561f392335e4a54c9e51 02-Dec-2011 Douglas Gregor <dgregor@apple.com> When making a module visible, also make any of its exported modules
visible, allowing one to create modules that import (and then
re-export) other modules.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145696 91177308-0d34-0410-b5e6-96231b3b80d8
iamond.c
1329264ce0922b3cec8c8c599108f082105fa0e1 02-Dec-2011 Douglas Gregor <dgregor@apple.com> Implement name hiding for macro definitions within modules, such that
only the macro definitions from visible (sub)modules will actually be
visible. This provides the same behavior for macros that r145640
provided for declarations.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145683 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/submodules/hash_map.h
nputs/submodules/type_traits.h
nputs/submodules/vector.h
ubmodules-preprocess.cpp
90db26000aefe9335370013eec64c85232d80227 02-Dec-2011 Douglas Gregor <dgregor@apple.com> Implementing parsing and resolution of module export declarations
within module maps, which will (eventually) be used to re-export a
module from another module. There are still some pieces missing,
however.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145665 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/module.map
ecc2c090e7146c029dd9ee9a5a2fd66b275c01c0 01-Dec-2011 Douglas Gregor <dgregor@apple.com> Implement name hiding for declarations deserialized from a non-visible
module. When that module becomes visible, so do those declarations.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145640 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/submodules/hash_map.h
nputs/submodules/module.map
nputs/submodules/vector.h
uto-module-import.c
iamond.c
ubmodules-preprocess.cpp
ubmodules.cpp
e3a8256a9c1f2f1037fcb844ed7666759124a852 30-Nov-2011 Douglas Gregor <dgregor@apple.com> Introduce an opt-in warning indicating when the compiler is treating
an #include/#import as a module import.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145500 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/DependsOnModule.framework/Headers/DependsOnModule.h
uto-module-import.c
6eb47da7ed9da877fddd0e7e30e95955d9e5e784 30-Nov-2011 Douglas Gregor <dgregor@apple.com> Add preprocessor-only test for submodule imports

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145490 91177308-0d34-0410-b5e6-96231b3b80d8
ubmodules.cpp
49009ec701feb3009450e57e40c656e2ad7c1f41 30-Nov-2011 Douglas Gregor <dgregor@apple.com> When loading a module that involves submodules (e.g., std.vector),
check whether the named submodules themselves are actually
valid, and drill down to the named submodule (although we don't do
anything with it yet). Perform typo correction on the submodule names
when possible.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145477 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/submodules/module.map
nputs/submodules/type_traits.h
nputs/submodules/vector.h
ubmodules.cpp
6649014b792f8a4b1bc1e8be8f844a72220af508 29-Nov-2011 Douglas Gregor <dgregor@apple.com> Eliminate the -emit-module option, which emitted a module by parsing a
source file (e.g., a header). Immediately steal this useful option
name for building modules from a module map file.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145444 91177308-0d34-0410-b5e6-96231b3b80d8
iamond.c
rgen.c
oad_failure.c
ookup.cpp
ookup.m
acros.c
odule-private.cpp
bjc-categories.m
edeclarations.m
f9e357d8a66c606a86a6e1aef678898b8843bd30 29-Nov-2011 Douglas Gregor <dgregor@apple.com> Teach the module import mechanism how to rebuild modules expressed via
module map, rather than assuming that there is an umbrella
header. This allows us to automatically build umbrella-less modules.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145415 91177308-0d34-0410-b5e6-96231b3b80d8
ormal-module-map.cpp
a865405e4155e8ea83d7ff1a1d8316907c300897 17-Nov-2011 Douglas Gregor <dgregor@apple.com> Add the notion of "framework" modules to module maps. Framework
modules (obviously) describe frameworks, and understand the header
layout of frameworks.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144921 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/DependsOnModule.framework/Headers/other.h
nputs/DependsOnModule.framework/module.map
2821c7f8870629b56b9c41e1c50c7a091edd544d 17-Nov-2011 Douglas Gregor <dgregor@apple.com> When we're loading a framework header, first try to turn the framework
into a module. This module can either be loaded from a module map in
the framework directory (which isn't quite working yet) or inferred
from an umbrella header (which does work, and replaces the existing
hack).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144877 91177308-0d34-0410-b5e6-96231b3b80d8
uto-module-import.c
24d1c966e1818637dad835c111355d2f28915984 17-Nov-2011 Douglas Gregor <dgregor@apple.com> Add missing header for modules test.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144862 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/normal-module-map/Umbrella/umbrella_sub.h
adb979924ade3e25342c38a5b564400b4e0540c1 17-Nov-2011 Douglas Gregor <dgregor@apple.com> A module with an umbrella header assumes that all of the headers in
the umbrella header's directory and its subdirectories are part of the
module (that's why it's an umbrella). Make sure that these headers are
considered to be part of the module for lookup purposes.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144859 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/module.map
nputs/normal-module-map/Umbrella/Umbrella.h
ormal-module-map.cpp
a081da5e44600d02983d6562bed1b4fd61e410fd 16-Nov-2011 Douglas Gregor <dgregor@apple.com> Implement (de-)serialization of the buffer contents for an overridden
file in the source manager. This allows us to properly create and use
modules described by module map files without umbrella headers (or
with incompletely umbrella headers). More generally, we can actually
build a PCH file that makes use of file -> buffer remappings, which
could be useful in libclang in the future.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144830 91177308-0d34-0410-b5e6-96231b3b80d8
ormal-module-map.cpp
261e75bd10198c336aded42f0398a13f7bf88889 16-Nov-2011 Douglas Gregor <dgregor@apple.com> When building a module from a module map that isn't simply an umbrella
header, create our own in-memory buffer to parse all of the
appropriate headers, and use that to build the module. This isn't
end-to-end testable yet; that's coming next.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144797 91177308-0d34-0410-b5e6-96231b3b80d8
ormal-module-map.cpp
f8b42d1885de688fd639efacea2b685d6a9727a2 16-Nov-2011 Douglas Gregor <dgregor@apple.com> Switch the remaining modules tests over to -emit-module-from-map.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144795 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/category_bottom.h
nputs/category_left.h
nputs/category_right.h
nputs/category_top.h
nputs/module.map
nputs/redeclarations_left.h
nputs/redeclarations_right.h
oad_failure.c
bjc-categories.m
edeclarations.m
42583320cf7977fd474572b9fe78e13eaf45fb8f 16-Nov-2011 Douglas Gregor <dgregor@apple.com> Migrate a few more modules tests over to -emit-module-from-map.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144779 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/macros.h
nputs/module.map
nputs/module_private_left.h
nputs/module_private_right.h
acros.c
odule-private.cpp
1432569f88c6da4da902df7571621f3ea3f76596 16-Nov-2011 Douglas Gregor <dgregor@apple.com> Switch some more of the modules tests over to "-emit-module-from-map",
and remove stray fprintf.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144742 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/irgen.h
nputs/module.map
rgen.c
ookup.cpp
ookup.m
db1cde7dc7bb3aaf48118bd9605192ab94a93635 16-Nov-2011 Douglas Gregor <dgregor@apple.com> Add support for building a module from a module map to the -cc1
interface. This is currently limited to modules with umbrella
headers.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144736 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/module.map
iamond.c
ormal-module-map.cpp
23d29c861f2770fe9f99ba80cca2e7cf4ac675ea 12-Nov-2011 Douglas Gregor <dgregor@apple.com> Tweak the module map file test slightly, by putting one of the headers
into a submodule. Submodules aren't actually supported anywhere else,
but we do parse them, so this verifies that we're at least seeing
through them properly.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144436 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/normal-module-map/module.map
cf70d7873fe3098bdac72e7628f4e832d14d5143 12-Nov-2011 Douglas Gregor <dgregor@apple.com> When searching for a module, speculatively load module maps to see if
the module is described in one of the module maps in a search path or
in a subdirectory off the search path that has the same name as the
module we're looking for.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144433 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/normal-module-map/Umbrella2/Umbrella2.h
nputs/normal-module-map/Umbrella2/module.map
ormal-module-map.cpp
484535e45b4d301847a157e943c7823da5d40884 12-Nov-2011 Douglas Gregor <dgregor@apple.com> Teach the search for modules to consider modules described by a module
map, so long as they have an umbrella header. This makes it possible
to introduce a module map + umbrella header for a given set of
headers, to turn it into a module.

There are two major deficiencies here: first, we don't go hunting for
module map files when we just see a module import (so we won't know
about the modules described therein). Second, we don't yet have a way
to build modules that don't have umbrella headers, or have incomplete
umbrella headers.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144424 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/normal-module-map/Umbrella/Umbrella.h
nputs/normal-module-map/Umbrella/module.map
ormal-module-map.cpp
65f3b5e99009f49d51eb00a859dbd2c2ee660718 11-Nov-2011 Douglas Gregor <dgregor@apple.com> Wire up the mapping from header files mentioned in module maps over to
the corresponding (top-level) modules. This isn't actually useful yet,
because we don't yet have a way to build modules out of module maps.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144410 91177308-0d34-0410-b5e6-96231b3b80d8
ormal-module-map.cpp
a30cfe5026b12c28b7b575b48176e0a3543ce939 11-Nov-2011 Douglas Gregor <dgregor@apple.com> Introduce basic support for parsing module map files.

Module map files provide a way to map between headers and modules, so
that we can layer a module system on top of existing headers without
changing those headers at all.

This commit introduces the module map file parser and the module map
that it generates, and wires up the module map file parser so that
we'll automatically find module map files as part of header
search. Note that we don't yet use the information stored in the
module map.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144402 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/normal-module-map/a1.h
nputs/normal-module-map/a2.h
nputs/normal-module-map/b1.h
nputs/normal-module-map/module.map
nputs/normal-module-map/nested/module.map
nputs/normal-module-map/nested/nested1.h
nputs/normal-module-map/nested/nested2.h
ormal-module-map.cpp
eee242ff426bf79149f221798966e58688383c1e 27-Oct-2011 Douglas Gregor <dgregor@apple.com> 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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143100 91177308-0d34-0410-b5e6-96231b3b80d8
edeclarations.m
aa93a875605536d72a10359a0098396192b7d4ec 17-Oct-2011 Douglas Gregor <dgregor@apple.com> For modules, all macros that aren't include guards are implicitly
public. Add a __private_macro__ directive to hide a macro, similar to
the __module_private__ declaration specifier.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142188 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/DependsOnModule.framework/Headers/DependsOnModule.h
nputs/Module.framework/Headers/Module.h
acros.c
n-demand-build.m
05edf668f0984bfa2994ddc8bb7b78d9fb24cf11 17-Oct-2011 Douglas Gregor <dgregor@apple.com> When building a module, use the macro definitions on the command line
as part of the hash rather than ignoring them. This means we'll end up
building more module variants (overall), but it allows configuration
macros such as NDEBUG to work so long as they're specified via command
line. More to come in this space.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142187 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/CmdLine.framework/Headers/CmdLine.h
n-demand-build-warnings.m
n-demand-build.m
n-demand-macros.m
08d6acf6e5efa6df57345922d412476127f856fc 29-Sep-2011 Douglas Gregor <dgregor@apple.com> Introduce an opt-in warning when a module is being implicitly built
from sources.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140746 91177308-0d34-0410-b5e6-96231b3b80d8
n-demand-build-warnings.m
8f8d581f76da8a6bf9de45746f908b970f09ee1b 17-Sep-2011 Douglas Gregor <dgregor@apple.com> When we load header file information from the external source (i.e.,
the AST reader), merge that header file information with whatever
header file information we already have. Otherwise, we might forget
something we already knew (e.g., that the header was #import'd already).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139979 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/point.h
eader-import.m
61c5e340c26971d195bd27232e7f2e71be24bb52 17-Sep-2011 Douglas Gregor <dgregor@apple.com> With modules, we can end up loading a new module after we've seen an
arbitrary amount of code. This forces us to stage the AST writer more
strictly, ensuring that we don't assign a declaration ID to a
declaration until after we're certain that no more modules will get
loaded.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139974 91177308-0d34-0410-b5e6-96231b3b80d8
bjc-categories.m
fba18aa8f2cd1994dc65e8cb9f4be201c560dc0b 16-Sep-2011 Douglas Gregor <dgregor@apple.com> Add an experimental flag -fauto-module-import that automatically turns
#include or #import direcctives of framework headers into module
imports of the corresponding framework module.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139860 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/DependsOnModule.framework/Headers/DependsOnModule.h
nputs/Module.framework/Headers/Module.h
uto-module-import.c
1f87cf479ad907b6da3505d41ce2c735aa5d9049 15-Sep-2011 Douglas Gregor <dgregor@apple.com> Add test case for mutually recursive modules

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139838 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/MutuallyRecursive1.framework/Headers/MutuallyRecursive1.h
nputs/MutuallyRecursive2.framework/Headers/MutuallyRecursive2.h
ycles.c
1a995ddaa53a20dcd063ea47eb1f533ecb0d243a 15-Sep-2011 Douglas Gregor <dgregor@apple.com> When we load the first module, make sure that we wire up the ASTConsumer to the newly-created ASTReader. This makes sure that CodeGen sees the declarations it is interested in

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139824 91177308-0d34-0410-b5e6-96231b3b80d8
rgen.c
0f50b08940ea0a9a44f2715f49ccf6bc64b95491 15-Sep-2011 Douglas Gregor <dgregor@apple.com> Teach LangOptions::resetNonModularOptions to actually do what it says it does

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139791 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/Module.framework/Headers/Module.h
n-demand-build.m
de8a9050d79d66325a18168a0994fed125a7790d 15-Sep-2011 Douglas Gregor <dgregor@apple.com> Make -E work with module imports

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139750 91177308-0d34-0410-b5e6-96231b3b80d8
acros.c
ce835df9301d5bee7fc2c70344e05541f21a5dda 15-Sep-2011 Douglas Gregor <dgregor@apple.com> Don't try to write a macro offset for an identifier that names a non-exported macro, for real this time

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139745 91177308-0d34-0410-b5e6-96231b3b80d8
acros.c
5ed6277d2e8f621ff1edb09897a23682fc034d6e 14-Sep-2011 Douglas Gregor <dgregor@apple.com> Revert my exported-macro hackery. Something is amiss

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139734 91177308-0d34-0410-b5e6-96231b3b80d8
acros.c
0c129afcfb7860b9e1ff29c34edeab17b770140b 14-Sep-2011 Douglas Gregor <dgregor@apple.com> Don't try to write a macro offset for an identifier that names a non-exported macro

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139728 91177308-0d34-0410-b5e6-96231b3b80d8
acros.c
e2978e337520bab472fdfa7dfda839bafbf750e9 14-Sep-2011 Douglas Gregor <dgregor@apple.com> Add test for the driver's handling of modules

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139727 91177308-0d34-0410-b5e6-96231b3b80d8
river.c
6e975c4517958bcc11c834336d340797356058db 14-Sep-2011 Douglas Gregor <dgregor@apple.com> For modules, use a hash of the compiler version, language options, and
target triple to separate modules built under different
conditions. The hash is used to create a subdirectory in the module
cache path where other invocations of the compiler (with the same
version, language options, etc.) can find the precompiled modules.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139662 91177308-0d34-0410-b5e6-96231b3b80d8
iamond.c
oad_failure.c
ookup.cpp
ookup.m
acros.c
odule-private.cpp
bjc-categories.m
n-demand-build.m
1c7e0472f5683a8ade62285f366637050cf113e5 13-Sep-2011 Douglas Gregor <dgregor@apple.com> When building a module on-demand, clear out the "non-modular" language
and preprocessor options (such as macro definitions) first.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139638 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/Module.framework/Headers/Module.h
n-demand-build.m
7d5e81bf24dbfd334a7c62a7ae51043c79a69aa9 13-Sep-2011 Douglas Gregor <dgregor@apple.com> Switch the serialization of LangOptions over to use the .def file. We
should no longer have the serialization of LangOptions out of sync
with the structure itself (yay).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139613 91177308-0d34-0410-b5e6-96231b3b80d8
oad_failure.c
fe522c20516878927e4f90a2aeafeeba2ea31c71 13-Sep-2011 Douglas Gregor <dgregor@apple.com> Add a struct-size check for modules when dealing with module-private fields

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139597 91177308-0d34-0410-b5e6-96231b3b80d8
odule-private.cpp
21cae2059a06f7d89eee169409c9266def1b1aca 13-Sep-2011 Douglas Gregor <dgregor@apple.com> When an import statement fails to find a module in the module cache,
but there is a corresponding umbrella header in a framework, build the
module on-the-fly so it can be immediately loaded at the import
statement. This is very much proof-of-concept code, with details to be
fleshed out over time.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139558 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/Module.framework/Headers/Module.h
n-demand-build.m
9a6da6930644b4f2dbe4885b0eb4fc1274ff56a4 12-Sep-2011 Douglas Gregor <dgregor@apple.com> Introduce a cc1-level option to provide the path to the module cache,
where the compiler will look for module files. Eliminates the
egregious hack where we looked into the header search paths for
modules.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139538 91177308-0d34-0410-b5e6-96231b3b80d8
iamond.c
oad_failure.c
ookup.cpp
ookup.m
acros.c
odule-private.cpp
bjc-categories.m
e389585f8a40f80004d3b98b99f3980305ef78a0 12-Sep-2011 Douglas Gregor <dgregor@apple.com> Diagnose attempt to mark function-local declarations as __module_private__.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139519 91177308-0d34-0410-b5e6-96231b3b80d8
odule-private.cpp
591dc84101228dc391fca05193be5870ec661edc 12-Sep-2011 Douglas Gregor <dgregor@apple.com> Allow __module_private__ on fields

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139499 91177308-0d34-0410-b5e6-96231b3b80d8
odule-private.cpp
f3a762a8de396af471f35b77f6897989867c898e 12-Sep-2011 Douglas Gregor <dgregor@apple.com> Remove the restriction on module-private friends. Since the friend
declaration may be the first declaration, we want the ability to that
declaration to be marked module-private.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139497 91177308-0d34-0410-b5e6-96231b3b80d8
odule-private.cpp
02a5e875cca1ce2f471dad06fb5557346d99c164 10-Sep-2011 Douglas Gregor <dgregor@apple.com> Don't crash when we fail to load a module. It's unbecoming of a
well-bred compiler like Clang.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139442 91177308-0d34-0410-b5e6-96231b3b80d8
oad_failure.c
6274d30d77870393d83a404dd223b8005f2b8cd5 09-Sep-2011 Douglas Gregor <dgregor@apple.com> Friends cannot be declared module-private

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139411 91177308-0d34-0410-b5e6-96231b3b80d8
odule-private.cpp
d023aec8907831a18d3514a95b843a7ee06b6b5e 09-Sep-2011 Douglas Gregor <dgregor@apple.com> Specializations cannot be module-hidden. Diagnose attempts to do so.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139406 91177308-0d34-0410-b5e6-96231b3b80d8
odule-private.cpp
e761230ae3751b525cadd8066c74ec278ee4ef57 09-Sep-2011 Douglas Gregor <dgregor@apple.com> __module_private__ is inherited by redeclarations of an entity, and
must also be present of the first declaration of that entity.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139384 91177308-0d34-0410-b5e6-96231b3b80d8
odule-private.cpp
6311d2bb3db1ec1064f45a14983ae5806adc676a 09-Sep-2011 Douglas Gregor <dgregor@apple.com> Propagate __module_private__ from previous declarations to later
declarations.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139380 91177308-0d34-0410-b5e6-96231b3b80d8
odule-private.cpp
8d267c57afb3af418ed5281b7a9bb4555d701a82 09-Sep-2011 Douglas Gregor <dgregor@apple.com> Modules: introduce the __module_private__ declaration specifier, which
indicates that a declaration is only visible within the module it is
declared in.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139348 91177308-0d34-0410-b5e6-96231b3b80d8
odule-private.cpp
556ecc7736e326d1f9e5acac43fcb7ccb8adde44 01-Sep-2011 Douglas Gregor <dgregor@apple.com> Make test slightly trickier

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138957 91177308-0d34-0410-b5e6-96231b3b80d8
bjc-categories.m
7143aab97c6e849a5a5005b7853b8c7d5af008ed 01-Sep-2011 Douglas Gregor <dgregor@apple.com> Modules hide macro definitions by default, so that silly things like
include guards don't show up as macro definitions in every translation
unit that imports a module. Macro definitions can, however, be
exported with the intentionally-ugly #__export_macro__
directive. Implement this feature by not even bothering to serialize
non-exported macros to a module, because clients of that module need
not (should not) know that these macros even exist.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138943 91177308-0d34-0410-b5e6-96231b3b80d8
acros.c
e6b8d68a927368b06ac06cc9ac9e7f60aa966d5f 01-Sep-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> Support importing of ObjC categories from modules.

The initial incentive was to fix a crash when PCH chaining categories
to an interface, but the fix was done in the "modules way" that I hear
is popular with the kids these days.

Each module stores the local chain of categories and we combine them
when the interface is loaded. We also warn if non-dependent modules
introduce duplicate named categories.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138926 91177308-0d34-0410-b5e6-96231b3b80d8
bjc-categories.m
65030af6526748ce11534e92f0ccefc44091ba13 31-Aug-2011 Douglas Gregor <dgregor@apple.com> Switch __import__ over to __import_module__, so we don't conflict with
existing practice with Python extension modules. Not that Python
extension modules should be using a double-underscored identifier
anyway, but...


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138870 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/diamond_bottom.h
nputs/diamond_left.h
nputs/diamond_right.h
iamond.c
oad_failure.c
ookup.cpp
ookup.m
6be16fe900bdd1e5f677d23ae34fffead5bcfc77 27-Aug-2011 Douglas Gregor <dgregor@apple.com> Take an entirely different approach to handling the "parsing" of
__import__ within the preprocessor, since the prior one foolishly
assumed that Preprocessor::Lex() was re-entrant. We now handle
__import__ at the top level (only), after macro expansion. This should
fix the buildbot failures.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138704 91177308-0d34-0410-b5e6-96231b3b80d8
ookup.cpp
f4a3f95c9a3b17c625358c8c35c612fd624f2681 27-Aug-2011 Douglas Gregor <dgregor@apple.com> XFAIL one of the module tests on win32, until we figure out what's happening

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138688 91177308-0d34-0410-b5e6-96231b3b80d8
ookup.cpp
6aa52ec6b969faabf3764baf79d89810b8249a7e 27-Aug-2011 Douglas Gregor <dgregor@apple.com> Introduce support for a simple module import declaration, which
loads the named module. The syntax itself is intentionally hideous and
will be replaced at some later point with something more
palatable. For now, we're focusing on the semantics:
- Module imports are handled first by the preprocessor (to get macro
definitions) and then the same tokens are also handled by the parser
(to get declarations). If both happen (as in normal compilation),
the second one is redundant, because we currently have no way to
hide macros or declarations when loading a module. Chris gets credit
for this mad-but-workable scheme.
- The Preprocessor now holds on to a reference to a module loader,
which is responsible for loading named modules. CompilerInstance is
the only important module loader: it now knows how to create and
wire up an AST reader on demand to actually perform the module load.
- We search for modules in the include path, using the module name
with the suffix ".pcm" (precompiled module) for the file name. This
is a temporary hack; we hope to improve the situation in the
future.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138679 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/diamond_bottom.h
nputs/diamond_left.h
nputs/diamond_right.h
nputs/load_failure.h
iamond.c
oad_failure.c
ookup.cpp
ookup.m
467dc88512b4ba4bb16e274ea3771dc1415d31da 26-Aug-2011 Douglas Gregor <dgregor@apple.com> Introduce a -cc1 option "-emit-module", that creates a binary module
from the given source. -emit-module behaves similarly to -emit-pch,
except that Sema is somewhat more strict about the contents of
-emit-module. In the future, there are likely to be more interesting
differences.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138595 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/lookup_left.hpp
ookup.cpp
ookup.m
3d15ab8d0822637ff5e39594c4f34172241cad2e 25-Aug-2011 Douglas Gregor <dgregor@apple.com> Use the module manager's search facility to look for methods with a
given selector, rather than walking the chain backwards. Teach its
visitor how to merge multiple result sets into a single result set,
combining the results of selector lookup in several different modules
into a single result set.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138556 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/lookup_left.h
nputs/lookup_right.h
ookup.m
851c75a279bb4441bc6802d0258ceb4ab64738d4 24-Aug-2011 Douglas Gregor <dgregor@apple.com> Introduce a depth-first search of modules into the module manager,
which supports both pre-order and post-order traversal via a visitor
mechanism. Use this depth-first search with a post-order traversal to
give predictable ordering semantics when walking all of the lexical
declarations in the translation unit.

Eventually, module imports will occur in the source code rather than
at the beginning, and we'll have to revisit this walk.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138490 91177308-0d34-0410-b5e6-96231b3b80d8
ookup.cpp
0d95f77ba180aee35b74f3bf9f8543477f3af543 24-Aug-2011 Douglas Gregor <dgregor@apple.com> In the AST reader, switch name lookup within a DeclContect over to the
module DAG-based lookup scheme. This required some reshuffling, so
that each module stores its own mapping from DeclContexts to their
lexical and visible sets for those DeclContexts (rather than one big
"chain").

Overall, this allows simple qualified name lookup into the translation
unit to gather results from multiple modules, with the lookup results
in module B shadowing the lookup results in module A when B imports A.

Walking all of the lexical declarations in a module DAG is still a
mess; we'll end up walking the loaded module list backwards, which
works fine for chained PCH but doesn't make sense in a DAG. I'll
tackle this issue as a separate commit.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138463 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/lookup_left.hpp
nputs/lookup_right.hpp
ookup.cpp
0c02adaa4da1d87495ca6a6d394f78740fa475c4 20-Aug-2011 Douglas Gregor <dgregor@apple.com> Make the loading of multiple records for the same identifier (from
different modules) more robust. It already handled (simple) merges of
the set of declarations attached to that identifier, so add a test
case that shows us getting two different declarations for the same
identifier (one struct, one function) from different modules, and are
able to use both of them.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138189 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/diamond_left.h
nputs/diamond_right.h
iamond.c
211f6e894895f552e0a98421b2f6e931ca4a8c11 20-Aug-2011 Douglas Gregor <dgregor@apple.com> Introduce a module visitation function that starts at the top-level
modules (those that no other module depends on) and performs a search
over all of the modules, visiting a new module only when all of the
modules that depend on it have already been visited. The visitor can
abort the search for all modules that a module depends on, which
allows us to minimize the number of lookups necessary when performing
a search.

Switch identifier lookup from a linear walk over the set of modules to
this module visitation operation. The behavior is the same for simple
PCH and chained PCH, but provides the proper search order for
modules. Verified with printf debugging, since we don't have enough in
place to actually test this.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138187 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/diamond_left.h
nputs/diamond_top.h
iamond.c
fac4ece118d43e43e625c6d2b9a98905b1372d51 19-Aug-2011 Douglas Gregor <dgregor@apple.com> Teach ModuleManager::addModule() to check whether a particular module
has already been loaded before allocating a new Module structure. If
the module has already been loaded (uniquing based on file name), then
just return the existing module rather than trying to load it again.

This allows us to load a DAG of modules. Introduce a simple test case
that forms a diamond-shaped module graph, and illustrates that a
source file importing the bottom of the diamond can see declarations
in all four of the modules that make up the diamond.

Note that this version moves the file-opening logic into the module
manager, rather than splitting it between the module manager and the
AST reader. More importantly, it properly handles the
weird-but-possibly-useful case of loading an AST file from "-".


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138030 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/diamond_bottom.h
nputs/diamond_left.h
nputs/diamond_right.h
nputs/diamond_top.h
iamond.c
870d1fee3c5027efe7fd23d6935952bc1f419f99 18-Aug-2011 Chad Rosier <mcrosier@apple.com> Temporarily revert r137925 to appease buildbots. Original commit message:

Teach ModuleManager::addModule() to check whether a particular module
has already been loaded before allocating a new Module structure. If
the module has already been loaded (uniquing based on file name), then
just return the existing module rather than trying to load it again.

This allows us to load a DAG of modules. Introduce a simple test case
that forms a diamond-shaped module graph, and illustrates that a
source file importing the bottom of the diamond can see declarations
in all four of the modules that make up the diamond.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137971 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/diamond_bottom.h
nputs/diamond_left.h
nputs/diamond_right.h
nputs/diamond_top.h
iamond.c
a4c189f4356f24d984aac781d7762b8c55082b7e 18-Aug-2011 Douglas Gregor <dgregor@apple.com> Teach ModuleManager::addModule() to check whether a particular module
has already been loaded before allocating a new Module structure. If
the module has already been loaded (uniquing based on file name), then
just return the existing module rather than trying to load it again.

This allows us to load a DAG of modules. Introduce a simple test case
that forms a diamond-shaped module graph, and illustrates that a
source file importing the bottom of the diamond can see declarations
in all four of the modules that make up the diamond.




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137925 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/diamond_bottom.h
nputs/diamond_left.h
nputs/diamond_right.h
nputs/diamond_top.h
iamond.c