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!
Douglas Gregor [Mon, 21 Dec 2009 19:57:21 +0000 (19:57 +0000)]
Teach debug info generation to handle TemplateSpecializationType,
ElaboratedType, QualifiedNameType, and SubstTemplateTypeParmType type
nodes. Also, produce an "unsupported" diagnostic for C++0x type nodes
and "typeof" nodes, rather than asserting nondescriptly.
Eli Friedman [Mon, 21 Dec 2009 01:42:38 +0000 (01:42 +0000)]
Fix for PR5840: fix the kind of name lookup used for classes in
Sema::getTypeName.
"LookupNestedNameSpecifierName" isn't quite the right kind of lookup, though;
it doesn't ignore namespaces. Someone more familiar with the lookup code
should fix this properly.
Douglas Gregor [Sun, 20 Dec 2009 22:01:25 +0000 (22:01 +0000)]
Switch default-initialization of variables of class type (or array thereof) over to InitializationSequence. I could swear that this fixes a PR somewhere, but I couldn't figure out which one
John McCall [Sun, 20 Dec 2009 07:58:13 +0000 (07:58 +0000)]
Don't inject the class name until that magical lbrace.
Because of the rules of base-class lookup* and the restrictions on typedefs, it
was actually impossible for this to cause any problems more serious than the
spurious acceptance of
template <class T> class A : B<A> { ... };
instead of
template <class T> class A : B<A<T> > { ... };
but I'm sure we can all agree that that is a very important restriction which
is well worth making another Parser->Sema call for.
(*) n.b. clang++ does not implement these rules correctly; we are not ignoring
non-type names
John McCall [Sun, 20 Dec 2009 05:57:29 +0000 (05:57 +0000)]
Test the lookup I wasn't sure would be done properly after the last patch.
Clang reasonably adds all the base specifiers in one pass; this is now required
for correctness to prevent lookup from going mad. But this has the advantage of
establishing the correct context when looking up base specifiers, which will be
important for access control.
Daniel Dunbar [Sat, 19 Dec 2009 17:50:07 +0000 (17:50 +0000)]
Remove ';' after method definition. Noticed by clang++, which one would think
would have a higher respect for its own code. This is getting old, is this
warning really adding value?
John McCall [Sat, 19 Dec 2009 10:49:29 +0000 (10:49 +0000)]
Refactor to remove more dependencies on PreDeclaratorDC. I seem to have made
the redeclaration problems in the [temp.explicit]p3 testcase worse, but I can
live with that; they'll need to be fixed more holistically anyhow.
John McCall [Sat, 19 Dec 2009 09:28:58 +0000 (09:28 +0000)]
Just push a new scope when parsing an out-of-line variable definition.
Magically fixes all the terrible lookup problems associated with not pushing
a new scope. Resolves an ancient xfail and an LLVM misparse.
Eli Friedman [Sat, 19 Dec 2009 08:11:05 +0000 (08:11 +0000)]
Initialization improvements: addition of string initialization and a few
small bug fixes in SemaInit, switch over SemaDecl to use it more often, and
change a bunch of diagnostics which are different with the new initialization
code.
Daniel Dunbar [Sat, 19 Dec 2009 03:30:57 +0000 (03:30 +0000)]
Targets: Allow CreateTargetInfo to mutate the target features.
- In particular, it can claim features for itself instead of always passing them on to LLVM.
- This allows using the target features as a generic mechanism for passing target specific options to the TargetInfo instance, which may need them for initializing preprocessor defines, etc.
Douglas Gregor [Sat, 19 Dec 2009 03:01:41 +0000 (03:01 +0000)]
Switch more of Sema::CheckInitializerTypes over to
InitializationSequence. Specially, switch initialization of a C++
class type (either copy- or direct-initialization).
Also, make sure that we create an elidable copy-construction when
performing copy initialization of a C++ class variable. Fixes PR5826.
John McCall [Sat, 19 Dec 2009 02:05:44 +0000 (02:05 +0000)]
Unresolved implicit member accesses are dependent if the object type is dependent.
Avoids an assertion arising during object-argument initialization in overload
resolution. In theory we can resolve this at definition time if the class
hierarchy for the member is fully known.
John McCall [Sat, 19 Dec 2009 00:35:18 +0000 (00:35 +0000)]
Teach TryAnnotateTypeOrScopeToken to deal with already-annotated
scope specifiers. Fix a tentative parsing bug that came up in LLVM.
Incidentally fixes some random FIXMEs in an existing testcase.
Eli Friedman [Fri, 18 Dec 2009 23:47:41 +0000 (23:47 +0000)]
Work in progress for setting the vtable pointers for all bases correctly in
the constructor. This doesn't handle cases requiring the VTT at the moment,
and generates unnecessary stores, but I think it's essentially correct.
Ted Kremenek [Fri, 18 Dec 2009 20:13:39 +0000 (20:13 +0000)]
Enhance GRExprEngine::VisitCallExpr() to be used in an lvalue context. Uncovered a new failing test case along the way, but we're making progress on handling C++ references in the analyzer.
Daniel Dunbar [Fri, 18 Dec 2009 18:42:37 +0000 (18:42 +0000)]
ARM: Fix predefines (__ARM_ARCH_..., __REGISTER_PREFIX).
- This should be done leveraging the backend, but I'm a little refactored
out. I'll fix it one day, I promise.
Torok Edwin [Fri, 18 Dec 2009 17:29:14 +0000 (17:29 +0000)]
Move the 4.4.2 c++ include search to the top, otherwise it was picking the 4.1.3
dirs on my system. Which is wrong, since it was missing the x86_64-pc-linux-gnu
suffix.
Douglas Gregor [Fri, 18 Dec 2009 16:20:58 +0000 (16:20 +0000)]
Change clang_codeComplete API to return the results in a structure on
the heap, so that clients are not forced to copy the results during
the initial iteration. A separate clang_disposeCodeCompleteResults
function frees the returned results.
Ken Dyck [Fri, 18 Dec 2009 15:55:54 +0000 (15:55 +0000)]
Change the return type of ASTContext::getTypeSizeInChars() from uint64_t to the
new opaque value type, CharUnits. This will help us avoid accidentally mixing
quantities that are in bit and character units.
Ken Dyck [Fri, 18 Dec 2009 15:24:05 +0000 (15:24 +0000)]
Rename getByteSize() and getTypeSizeInBytes() in ASTContext to getCharWidth()
and getTypeSizeInChars() to reflect their basis in character type units, not
that of a possibly independent architecture-specific byte.