Douglas Gregor [Fri, 2 Dec 2011 17:30:13 +0000 (17:30 +0000)]
Notify the AST writer (via ASTDeserializationListener) when a
(sub)module is read from an AST file. This makes sure that the AST
writer knows how to map all modules to their global IDs.
Douglas Gregor [Fri, 2 Dec 2011 15:45:10 +0000 (15:45 +0000)]
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.
Daniel Dunbar [Fri, 2 Dec 2011 02:31:32 +0000 (02:31 +0000)]
runtime/Linux: Initial support for tying compiler-rt build into Clang build on
Linux.
- Currently just builds a full library, and only on x86, and only for the
target arch.
Add support for AVX registers to clang inline asm. Add a small testcase
and update the Sema testcase with a register that we won't hit for a while
I hope.
Douglas Gregor [Fri, 2 Dec 2011 01:47:07 +0000 (01:47 +0000)]
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.
Richard Smith [Fri, 2 Dec 2011 00:30:33 +0000 (00:30 +0000)]
Fix wrong-code bug when a const automatic variable of struct type has both a
mutable member and a constant initializer. We'd previously promoted such
variables to global constants, resulting in nasal demons if the mutable member
was modified.
This is only a temporary fix. The subtle interplay between isConstantInitializer
and CGExprConstant is very bug-prone; there are some other issues in this area
which I will be addressing in subsequent, more major reworking of this code.
Eli Friedman [Fri, 2 Dec 2011 00:11:43 +0000 (00:11 +0000)]
When we're passing a vector with an illegal type through memory on x86-64, use byval so we're sure the backend does the right thing. Fixes va_arg with illegal vectors and an obscure ABI mismatch with __m64 vectors.
Douglas Gregor [Thu, 1 Dec 2011 17:11:21 +0000 (17:11 +0000)]
Introduce the notion of name visibility into modules. For a given
(sub)module, all of the names may be hidden, just the macro names may
be exposed (for example, after the preprocessor has seen the import of
the module but the parser has not), or all of the names may be
exposed. Importing a module makes its names, and the names in any of
its non-explicit submodules, visible to name lookup (transitively).
This commit only introduces the notion of name visible and marks
modules and submodules as visible when they are imported. The actual
name-hiding logic in the AST reader will follow (along with test cases).
Douglas Gregor [Thu, 1 Dec 2011 02:07:58 +0000 (02:07 +0000)]
Infer the submodule ID for a given declaration based on the location
of that declaration, and encode the submodule ID in each declaration
stored in an AST file.
Douglas Gregor [Thu, 1 Dec 2011 01:37:36 +0000 (01:37 +0000)]
When sending a message to a receiver that has "unknown any" type,
force the unknown any type to "id" so that the message send can be
completed without requiring a case. Fixes <rdar://problem/10506646>.
Douglas Gregor [Thu, 1 Dec 2011 00:59:36 +0000 (00:59 +0000)]
Switch the ID numbers used for submodule IDs in the AST reader over to
a standard global/local scheme, so that submodule definitions will
eventually be able to refer to submodules in other top-level
modules. We'll need this functionality soonish.
Ted Kremenek [Thu, 1 Dec 2011 00:59:21 +0000 (00:59 +0000)]
Specially whitelist the selector 'addOperationWithBlock:' for the retain-cycle checking in -Warc-retain-cycles. This commonly
is hit by users using NSOperationQueue. Fixes <rdar://problem/10465721>.
Ted Kremenek [Thu, 1 Dec 2011 00:59:17 +0000 (00:59 +0000)]
Further tweak -Wurneachable-code and templates by allowing the warning to run on
explicit template specializations (which represent actual functions somebody wrote).
Along the way, refactor some other code which similarly cares about whether or
not they are looking at a template instantiation.
Richard Smith [Wed, 30 Nov 2011 23:45:35 +0000 (23:45 +0000)]
Revert most of r145372 for now. Lookahead beyond the ';' in a function
declaration tickles a bug in the way we handle visibility pragmas.
The improvement to error recovery for template function definitions declared
with the 'typedef' specifier in r145372 is unrelated and not reverted here.
Douglas Gregor [Wed, 30 Nov 2011 23:21:26 +0000 (23:21 +0000)]
Promote ModuleMap::Module to a namespace-scope class in the Basic
library, since modules cut across all of the libraries. Rename
serialization::Module to serialization::ModuleFile to side-step the
annoying naming conflict. Prune a bunch of ModuleMap.h includes that
are no longer needed (most files only needed the Module type).
[PCH] In ASTReader::FinishedDeserializing, after we do PassInterestingDeclsToConsumer
we may end up having added more pending stuff to do, so go in a loop until everything
is cleared out.
This fixes the error in rdar://10278815 which has a certain David Lynch-esque quality..
error: unknown type name 'BOOL'; did you mean 'BOOL'?
Ted Kremenek [Wed, 30 Nov 2011 21:22:09 +0000 (21:22 +0000)]
Don't run -Wunreachable-code on template instantiations. Different instantiations may produce different unreachable code results, and it is very difficult for us to prove that ALL instantiations of a template have specific unreachable code. If we come up with a better solution, then we can revisit this, but this approach will at least greatly reduce the noise of this warning for code that makes use of templates.
Akira Hatanaka [Wed, 30 Nov 2011 19:31:38 +0000 (19:31 +0000)]
Get the -march argument based on the target MIPS architecture or cpu and pass
it to GNU assembler. In addition, change function getMipsArchFromCPU() so that
it can be reused in ConstructJob().
Douglas Gregor [Wed, 30 Nov 2011 18:12:06 +0000 (18:12 +0000)]
Move the module auto-import logic after the logic that allows a
callback client to suggest an alternative search path and after we
complain when the included file can't be found. The former can't be
tested in isolation, the latter doesn't actually matter (because we
won't make a module suggestion if no header is available). However,
the flow is better this way.
Douglas Gregor [Wed, 30 Nov 2011 17:33:56 +0000 (17:33 +0000)]
Implement (de-)serialization of the description of a module and its
submodules. This information will eventually be used for name hiding
when dealing with submodules. For now, we only use it to ensure that
the module "key" returned when loading a module will always be a
module (rather than occasionally being a FileEntry).
John McCall [Wed, 30 Nov 2011 04:42:31 +0000 (04:42 +0000)]
Fix the instantiation of pseudo-object expressions. This is a
really bad way to go about this, but I'm not sure there's a better
choice without substantial changes to TreeTransform --- most
notably, preserving implicit semantic nodes instead of discarding
and rebuilding them.
Douglas Gregor [Wed, 30 Nov 2011 04:26:53 +0000 (04:26 +0000)]
Teach the preprocessor how to handle module import declarations that
involve submodules (e.g., importing std.vector), rather than always
importing the top-level module.
Douglas Gregor [Wed, 30 Nov 2011 04:03:44 +0000 (04:03 +0000)]
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.
Bob Wilson [Wed, 30 Nov 2011 01:57:58 +0000 (01:57 +0000)]
Add bigger method type encodings to protocol objects. <rdar://problem/10492418>
The new metadata are method @encode strings with additional data.
1. Each Objective-C object is marked with its class name and protocol names.
The same is done for property @encode already.
2. Each block object is marked with its function prototype's @encoding. For
example, a method parameter that is a block object that itself returns void
and takes an int would look like:
@?<v@?i>
These new method @encode strings are stored in a single array pointed to by structs protocol_t and objc_protocol_ext.
Douglas Gregor [Wed, 30 Nov 2011 00:36:36 +0000 (00:36 +0000)]
Switch the module-loading interfaces and parser from a simple
top-level module name to a module path (e.g., std.vector). We're still
missing a number of pieces for this actually to do something.
Douglas Gregor [Tue, 29 Nov 2011 22:42:06 +0000 (22:42 +0000)]
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.
Douglas Gregor [Tue, 29 Nov 2011 21:59:16 +0000 (21:59 +0000)]
Switch on-demand module building over to use module maps, always. When
we infer the module map, we'll just print the module map to a
temporary file and generate the module using that.
Ted Kremenek [Tue, 29 Nov 2011 19:39:29 +0000 (19:39 +0000)]
Relax RegionStore to allow loads from CodeTextRegions. Apparently you can actually write code that does this. This seems worthy of a checker, but the StoreManager should handle the memory abstraction without crashing. Fixes PR 11450.
Douglas Gregor [Tue, 29 Nov 2011 19:06:37 +0000 (19:06 +0000)]
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.
Richard Smith [Tue, 29 Nov 2011 09:09:06 +0000 (09:09 +0000)]
Add fix-it to remove 'typedef' from function template definitions. Such a token
was probably meant to be 'typename', which we will have already suggested if it
is appropriate.
Richard Smith [Tue, 29 Nov 2011 05:27:40 +0000 (05:27 +0000)]
PR10101: Recover better from a common copy-paste error: if a function
declaration at namespace scope is followed by a semicolon and an open-brace
(or in C++, a 'try', ':' or '='), then the error is probably a function
definition with a spurious ';', rather than a mysterious '{'.
Chandler Carruth [Tue, 29 Nov 2011 00:24:18 +0000 (00:24 +0000)]
Remove the last of my notes. I don't think these really need to be in
the release notes despite their awesomeness. If we had a thorough
discussion of the performance of Clang in 2.9 vs. 3.0, the first would
be more relevant, but we don't. The serialization stuff hopefully isn't
terribly visible to end users.
Objections to these omissions are of course welcome. =]
Chandler Carruth [Tue, 29 Nov 2011 00:15:26 +0000 (00:15 +0000)]
Last major chunk of features. This covers a couple of language
extensions and one infrastructure feature addition that has a direct
impact on other projects which use Clang.
Bill Wendling [Tue, 29 Nov 2011 00:10:10 +0000 (00:10 +0000)]
The _setjmp builtin library function should have the "returns twice"
attribute. This prevents the stack slot allocator from coming along and using a
stack which it thinks is available but isn't.
<rdar://problem/10492556>