Douglas Gregor [Thu, 25 Feb 2010 04:46:04 +0000 (04:46 +0000)]
Restore the invariant that a nested-name-specifier can only contain
class types, dependent types, and namespaces. I had previously
weakened this invariant while working on parsing pseudo-destructor
expressions, but recent work in that area has made these changes
unnecessary.
Daniel Dunbar [Thu, 25 Feb 2010 04:37:45 +0000 (04:37 +0000)]
Frontend: Pull CodeGenAction out more, and eliminate CreateBackendConsumer.
This is the way I would like to move the frontend function towards -- distinct
pieces of functionality should be exposed only via FrontendAction
implementations which have clean and relatively-stable APIs.
This also isolates the surface area in clang which depends on LLVM CodeGen.
Douglas Gregor [Thu, 25 Feb 2010 01:56:36 +0000 (01:56 +0000)]
Use CXXPseudoDestructorExpr as the stored representation for dependent
expressions that look like pseudo-destructors, e.g.,
p->T::~T()
where p has dependent type.
At template instantiate time, we determine whether we actually have a
pseudo-destructor or a member access, and funnel down to the
appropriate routine in Sema.
John McCall [Thu, 25 Feb 2010 01:37:24 +0000 (01:37 +0000)]
Catch more uses of uninitialized implicit conversion sequences.
When diagnosing bad conversions, skip the conversion for ignored object
arguments. Fixes PR 6398.
Douglas Gregor [Wed, 24 Feb 2010 23:40:28 +0000 (23:40 +0000)]
Retain complete source information for the type after the '~' in a
CXXPseudoDestructorExpr.
Update template instantiation for pseudo-destructor expressions to use
this source information and to make use of
Sema::BuildPseudoDestructorExpr when the base expression is dependent
or refers to a scalar type.
Douglas Gregor [Wed, 24 Feb 2010 23:13:13 +0000 (23:13 +0000)]
Make sure that we finish the DeclSpec when parsing a C++
type-specifier-seq. Fixes some conditional-jump-on-unitialized-value
errors in valgrind. Also counts as attempt #2 at making the MSVC
buildbot happy.
Douglas Gregor [Wed, 24 Feb 2010 22:38:50 +0000 (22:38 +0000)]
Split ActOnPseudoDestructorExpr into the part that interprets the
parser's data structures and the part that performs semantic analysis
and AST building, in preparation for improved template instantiation
of pseudo-destructor expressions.
Douglas Gregor [Wed, 24 Feb 2010 21:29:12 +0000 (21:29 +0000)]
ActOnPseudoDestructorExpr now performs all semantic analysis for
pseudo-destructor expressions, and builds the CXXPseudoDestructorExpr
node directly. Currently, this only affects pseudo-destructor
expressions when they are parsed, but not after template
instantiation. That's coming next...
Improve parsing of pseudo-destructor-names. When parsing the
nested-name-specifier and we hit the sequence of tokens X :: ~, query
the actual module to determine whether X is a type-name (in which case
the X :: is part of the pseudo-destructor-name but not the
nested-name-specifier) or not (in which case the X :: is part of the
nested-name-specifier).
Douglas Gregor [Wed, 24 Feb 2010 18:44:31 +0000 (18:44 +0000)]
Rework parsing of pseudo-destructor expressions and explicit
destructor calls, e.g.,
p->T::~T
We now detect when the member access that we've parsed, e.g.,
p-> or x.
may be a pseudo-destructor expression, either because the type of p or
x is a scalar or because it is dependent (and, therefore, may become a
scalar at template instantiation time).
We then parse the pseudo-destructor grammar specifically:
and hand those results to a new action, ActOnPseudoDestructorExpr,
which will cope with both dependent member accesses of destructors and
with pseudo-destructor expressions.
This commit affects the parsing of pseudo-destructors, only; the
semantic actions still go through the semantic actions for member
access expressions. That will change soon.
John McCall [Wed, 24 Feb 2010 07:14:12 +0000 (07:14 +0000)]
Canonicalize parameter and return types before computing ABI info. Eliminates
a common source of oddities and, in theory, removes some redundant ABI
computations. Also fixes a miscompile I introduced yesterday by refactoring
some code and causing a slightly different code path to be taken that
didn't perform *parameter* type canonicalization, just normal type
canonicalization; this in turn caused a bit of ABI code to misfire because
it was looking for 'double' or 'float' but received 'const float'.
Charles Davis [Wed, 24 Feb 2010 02:27:18 +0000 (02:27 +0000)]
When we encounter a function-specific attribute in a declaration specifier,
apply it only to the function itself, and never to the return type. Fixes part
of PR6408.
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.