Blaine Garst [Tue, 23 Feb 2010 21:51:17 +0000 (21:51 +0000)]
Unconditionally support block introspection data in a new field at the end
of the block descriptor field. This field is the ObjC style @encode
signature of the implementation function, and was to this point
conditionally provided in the block literal data structure. That
provisional support is removed.
Additionally, eliminate unused enumerations for the block literal flags field.
The first shipping ABI unconditionally set (1<<29) but this bit is unused
by the runtime, so the second ABI will unconditionally have (1<<30) set so
that the runtime can in fact distinguish whether the additional data is
present or not.
Ted Kremenek [Tue, 23 Feb 2010 21:19:33 +0000 (21:19 +0000)]
Dead emit dead store warnings when assigning nil to an ObjC object
pointer (for defensive programming). This matches the behavior with
assigning NULL to a regular pointer. Fixes <rdar://problem/7631278>.
Ted Kremenek [Tue, 23 Feb 2010 07:17:57 +0000 (07:17 +0000)]
Add test case for <rdar://problem/7242010>, which appears to have been fixed
in the recent changes to RegionStore::InvalidateRegions(). Note that we
are still not yet modeling 'memcpy()' explicitly.
Charles Davis [Tue, 23 Feb 2010 06:13:55 +0000 (06:13 +0000)]
When comparing two calling conventions after redeclaring a function, compare
the canonical calling conventions instead of comparing the raw calling
conventions directly. Fixes PR6361.
Charles Davis [Tue, 23 Feb 2010 04:52:00 +0000 (04:52 +0000)]
When a reference to a field of a struct/union/class is passed to the
__alignof__ operator, make sure to take into account the packed alignment
of the struct/union/class itself. Matches GCC's behavior and fixes PR6362.
John McCall [Tue, 23 Feb 2010 00:48:20 +0000 (00:48 +0000)]
Perform two more constructor/destructor code-size optimizations:
1) emit base destructors as aliases to their unique base class destructors
under some careful conditions. This is enabled for the same targets that can
support complete-to-base aliases, i.e. not darwin.
2) Emit non-variadic complete constructors for classes with no virtual bases
as calls to the base constructor. This is enabled on all targets and in
theory can trigger in situations that the alias optimization can't (mostly
involving virtual bases, mostly not yet supported).
These are bundled together because I didn't think it worthwhile to split them,
not because they really need to be.
Douglas Gregor [Tue, 23 Feb 2010 00:15:22 +0000 (00:15 +0000)]
Implement crazy destructor name lookup semantics differently in
C++98/03 and C++0x, since the '0x semantics break valid C++98/03
code. This new mess is tracked by core issue 399, which is still
unresolved.
Douglas Gregor [Mon, 22 Feb 2010 23:17:23 +0000 (23:17 +0000)]
Rework the CIndex API for displaying diagnostics. Instead of printing
the diagnostics to a FILE*, return a CXString containing the formatted
diagnostic.
Douglas Gregor [Sun, 21 Feb 2010 22:15:06 +0000 (22:15 +0000)]
Eliminate the default arguments to ASTContext::getFunctionType(),
fixing up a few callers that thought they were propagating NoReturn
information but were in fact saying something about exception
specifications.
Douglas Gregor [Sun, 21 Feb 2010 20:15:42 +0000 (20:15 +0000)]
Attempt to fix the MSVC9 failure with c-indext-test, where the CIndex DLL
and the c-index-test executable end up getting different copies of
stderr, causing non-deterministic ordering of output. Fixed by
flushing the file after printing a diagnostic (only on Windows).
Douglas Gregor [Sun, 21 Feb 2010 18:36:56 +0000 (18:36 +0000)]
Implement support for parsing pseudo-destructor expression with a nested-name-specifier, e.g.,
typedef int Int;
int *p;
p->Int::~Int();
This weakens the invariant that the only types in nested-name-specifiers are tag types (restricted to class types in C++98/03). However, we weaken this invariant as little as possible, accepting arbitrary types in nested-name-specifiers only when we're in a member access expression that looks like a pseudo-destructor expression.
Douglas Gregor [Sun, 21 Feb 2010 18:30:38 +0000 (18:30 +0000)]
A constructor template cannot be used to copy to an object of the same class type (per C++ [class.copy]p3). Make sure that includes copies that involve a derived-to-base conversion. Fixes PR6141.
Douglas Gregor [Sun, 21 Feb 2010 18:29:16 +0000 (18:29 +0000)]
Implement AST import for C++ member functions, including constructors, destructors, and conversions. Unfortunately, this cannot be tested yet, since we don't have C++ PCH support.
Douglas Gregor [Sun, 21 Feb 2010 18:24:45 +0000 (18:24 +0000)]
Collect the code that imports all of the members of a declaration context into a single function, ImportDeclContext. Use it rather than explicit loops. No functionality change.
Chandler Carruth [Sun, 21 Feb 2010 10:19:54 +0000 (10:19 +0000)]
Commiting a revert from dgregor of a bit of destructor logic until we can
figure out how not to break lots of code using this. See PR6358 and PR6359 for
motivating examples. FIXME's left in the code and the test.
Chandler Carruth [Sun, 21 Feb 2010 07:08:09 +0000 (07:08 +0000)]
Make Decl::isOutOfLine() virtual, and use that to determine when definitions
are for out of line declarations more easily. This simplifies the logic and
handles the case of out-of-line class definitions correctly. Fixes PR6107.
Ted Kremenek [Sun, 21 Feb 2010 05:15:32 +0000 (05:15 +0000)]
Clang really intends to reject attribute 'warn_unused_result' on Objective-C methods, but
instead it crashes on them. We might extend this attribute to work on methods, but for
now fix the crasher. Addresses <rdar://problem/7670939>.
Douglas Gregor [Fri, 19 Feb 2010 16:47:56 +0000 (16:47 +0000)]
Only parse C++0x attribute specifiers in declarators when in C++0x
mode. This allows us to detect invalid VLAs in Objective-C++
mode. This should be the last of <rdar://problem/7660386>.
Douglas Gregor [Fri, 19 Feb 2010 16:08:35 +0000 (16:08 +0000)]
Implement C++ name lookup for instance variables of Objective-C classes
from an instance method. Previously, we were following the Objective-C
name lookup rules for ivars, which are of course completely different
from and incompatible with the Objective-C++ rules.
For the record, the Objective-C++ rules are the sane ones.
Douglas Gregor [Fri, 19 Feb 2010 15:18:45 +0000 (15:18 +0000)]
Make Sema::ActOnClassMessage robust when name lookup for the receiver
name finds something other than a TypedefDecl or an
ObjCInterfaceDecl. This is a small part of <rdar://problem/7660386>.
John McCall [Fri, 19 Feb 2010 09:25:03 +0000 (09:25 +0000)]
More refactoring around constructor/destructor code generation.
Fix some bugs with function-try-blocks and simplify normal try-block
code generation.
This implementation excludes a deleting destructor's call to
operator delete() from the function-try-block, which I believe
is correct but which I can't find straightforward support for at
a moment's glance.
Ted Kremenek [Fri, 19 Feb 2010 00:42:33 +0000 (00:42 +0000)]
Change InitListExpr to allocate the array for holding references
to initializer expressions in an array allocated using ASTContext.
This plugs a memory leak when ASTContext uses a BumpPtrAllocator to
allocate memory for AST nodes.
In my mind this isn't an ideal solution; it would be nice to have
a general "vector"-like class that allocates memory using ASTContext,
but whose guts could be separated from the methods of InitListExpr
itself. I haven't gone and taken this approach yet because it isn't
clear yet if we'll eventually want an alternate solution for recylcing
memory using by InitListExprs as we are constructing the ASTs.