Douglas Gregor [Wed, 23 Dec 2009 23:03:06 +0000 (23:03 +0000)]
When we see a CXXDefaultArgExpr during template instantiation, rebuild
the default argument so that we're sure to mark any referenced
declarations. This gets us another little step closer to fixing
PR5810.
Ted Kremenek [Wed, 23 Dec 2009 22:31:49 +0000 (22:31 +0000)]
Increase StmtIterator size by one pointer (separating out the Stmt** from the union including Decl* and Decl**).
This change is setup for adding StmtIterator support for condition variables in IfStmt, WhileStmt, etc.
Douglas Gregor [Wed, 23 Dec 2009 22:04:40 +0000 (22:04 +0000)]
There is no such thing as typeinfo for a cv-qualified type. Assert
that this is true when mangling, then fix up the various places in
Sema and/or CodeGen that need to remove qualifiers. Addresses a
linking issue when building LLVM with Clang.
Ted Kremenek [Wed, 23 Dec 2009 21:13:52 +0000 (21:13 +0000)]
Tidy up ~ASTContext a bit by turning orphan compound statements into
for loops. Also do not manually free the Type objects when the
'FreeMemory' flag is set, as they will be deallocated when the
BumpPtrAllocator is destroyed.
Douglas Gregor [Wed, 23 Dec 2009 18:19:08 +0000 (18:19 +0000)]
When using a default function argument for a function template (or
member function thereof), perform the template instantiation each time
the default argument is needed. This ensures that
(1) We get different CXXTemporary objects for each instantiation, and
(2) Any other instantiations or definitions triggered by the
instantiation of the default argument expression are guaranteed to
happen; previously, they might have been suppressed, e.g., because
they happened in an unevaluated context.
This fixes the majority of PR5810. However, it does not address the
problem where we may have multiple uses of the same CXXTemporary
within an expression when the temporary came from a non-instantiated
default argument expression.
Steve Naroff [Wed, 23 Dec 2009 17:24:33 +0000 (17:24 +0000)]
Add support for handling initializers in RewriteObjC::RewriteByRefVar().
As the FIXME indicates, RewriteByRefVar() won't work for multiple declarators (in general). I've discussed this with Fariborz and he is aware of the limitation.
Ted Kremenek [Wed, 23 Dec 2009 08:56:00 +0000 (08:56 +0000)]
Add 'DeclStmt::DoDestroy()' which doesn't actually recurse over its child expressions (via StmtIterator), as those expressions are owned by the Decls and Types (which are destroyed elsewhere). This fixes a crasher reported in <rdar://problem/7487294>.
Ted Kremenek [Wed, 23 Dec 2009 04:49:01 +0000 (04:49 +0000)]
Add CFG support for the condition variable that can appear in IfStmts in C++ mode.
Add transfer function support in GRExprEngine for IfStmts with initialized condition variables.
Ted Kremenek [Wed, 23 Dec 2009 04:00:48 +0000 (04:00 +0000)]
Fix CXXConstructExpr::getSourceRange() to not include the source ranges of CXXDefaultArgExprs when computing its range (since these expressions have no source range, and using them will make the encompassing range invalid).
Eric Christopher [Wed, 23 Dec 2009 03:49:37 +0000 (03:49 +0000)]
Update for the intrinsic changes in llvm: the object size intrinsic
only takes a boolean second argument now. Update tests accordingly.
Currently the builtin still accepts the full range for compatibility.
Ted Kremenek [Wed, 23 Dec 2009 02:52:14 +0000 (02:52 +0000)]
Fix PR 5857. When casting from a symbolic region to an integer back to a pointer value, we were not correctly layering the correct ElementRegion on the original SymbolicRegion.
Douglas Gregor [Tue, 22 Dec 2009 23:42:49 +0000 (23:42 +0000)]
Allow the first parameter of operator new to be a cv-qualified
size_t. Also, fix an issue with initialization of parameters in calls,
where we weren't removing the cv-qualifiers on the parameter type
itself. Fixes PR5823.
Daniel Dunbar [Tue, 22 Dec 2009 23:19:32 +0000 (23:19 +0000)]
Driver: When linking, don't warn about unused arguments which are obviously only
used during compilation.
- There is no easy way to define this group properly, unfortunately, and maybe
this is a losing strategy. For now this is unambiguous more friendly, though.
Douglas Gregor [Tue, 22 Dec 2009 22:47:22 +0000 (22:47 +0000)]
Make sure that reinterpret_cast gets a CastKind on all successful
paths. Fixes "cannot compile this unexpected cast lvalue yet" error in
llvm/lib/Analysis/IPA/GlobalsModRef.cpp.
Douglas Gregor [Tue, 22 Dec 2009 21:44:34 +0000 (21:44 +0000)]
Switch parameter passing for overloaded binary operators to
InitializationSequence. Fixes the -fsyntax-only failure in
llvm/lib/Transforms/Scalar/InstructionCombining.cpp.
Douglas Gregor [Tue, 22 Dec 2009 17:13:37 +0000 (17:13 +0000)]
When transforming a C++ "new" expression that was not explicitly given
a size, check whether the transformed type is itself an array type. If
so, take the major array bound as the size to allocate. Fixes PR5833.
Douglas Gregor [Tue, 22 Dec 2009 15:35:07 +0000 (15:35 +0000)]
Switch InitializedEntity from TypeLoc down to just QualTypes, since we don't use the location information but we did spend a bunch of time building faked-up TypeLocs
Douglas Gregor [Tue, 22 Dec 2009 07:24:36 +0000 (07:24 +0000)]
Switch initialization of parameters in a call over to
InitializationSequence (when a FunctionDecl is present). This required
a few small fixes to initialization sequences:
- Make sure to use the adjusted parameter type for initialization of
function parameters.
- Implement transparent union calling semantics in C
Anders Carlsson [Tue, 22 Dec 2009 06:36:32 +0000 (06:36 +0000)]
Make sure that we mangle overloaded operators that are member functions correctly, giving them the correct arity.
With this seemingly insignificant fix, we are now able to build and link clang using clang itself! (LLVM still has to be built with gcc for the time being).
Daniel Dunbar [Tue, 22 Dec 2009 01:19:25 +0000 (01:19 +0000)]
x86_64: Structures with no fields but which have padding should be classified as
integer.
- This is consistent, but may not be correct. I will revisit x86_64 ABI handling for C++ as a whole at some point.
- PR5831.
Douglas Gregor [Tue, 22 Dec 2009 01:01:55 +0000 (01:01 +0000)]
Centralize the emission/suppression/delay of diagnostics describing runtime before in the new function Sema::DiagRuntimeBehavior, addressing one of Chris' comments.
John McCall [Tue, 22 Dec 2009 00:59:39 +0000 (00:59 +0000)]
Stop diagnosing the use of inner classes as friends. ddunbar asked whether
this was useful, and on review Doug and I decided it was probably on the level
of a bug in the standard and therefore not worth a warning even in -pedantic.
If someone disagrees and urgently wants clang++ to warn about this in strict
c++98 mode, we can talk about it.
Douglas Gregor [Tue, 22 Dec 2009 00:21:20 +0000 (00:21 +0000)]
When converting from a type to itself or one of its base classes via a
constructor call, the conversion is only a standard conversion
sequence if that constructor is a copy constructor. This fixes PR5834
in a semi-lame way, because the "real" fix will be to move over to
InitializationSequence. That will happen "soonish", but not now.
Douglas Gregor [Tue, 22 Dec 2009 00:05:34 +0000 (00:05 +0000)]
When filling in value initializations within an initializer list, be
sure to fill in the initialized member of a union when a member was
explicitly designated. Fixes PR5843.
Daniel Dunbar [Mon, 21 Dec 2009 23:28:17 +0000 (23:28 +0000)]
ARM: Honor -mfpu= and set __VFP_FP__ and __ARM_NEON__ "correctly".
- Correctly is in quotes, because we are following what I interpreted as GCC's
intent (which diverges from practice, naturally).
- Also, fix the arch define for arm1136jf-s.
Douglas Gregor [Mon, 21 Dec 2009 23:17:24 +0000 (23:17 +0000)]
When a template-id refers to a single function template, and the
explicitly-specified template arguments are enough to determine the
instantiation, and either template argument deduction fails or is not
performed in that context, we can resolve the template-id down to a
function template specialization (so sayeth C++0x
[temp.arg.explicit]p3). Fixes PR5811.
Douglas Gregor [Mon, 21 Dec 2009 21:27:38 +0000 (21:27 +0000)]
Introduce an assertion to ensure that template argument deduction does
not deduce an "overload" type. Such a deduction indicates a failure in
semantic analysis (e.g., PR5811) that currently isn't caught until
code-generation time. This assertions makes it clearer that this
particular issue is a semantic-analysis problem, not a code-gen problem.
Douglas Gregor [Mon, 21 Dec 2009 20:18:30 +0000 (20:18 +0000)]
Improve on my previous fix for debug information. Rather than
recursing in CGDebugInfo::CreateTypeNode, teach
CanonicalizeTypeForDebugInfo---now called UnwrapTypeForDebugInfo---to
keep unwrapping the type until we hit something that can be
represented by debug information. Thanks to Anders for pointing this out!