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.
John McCall [Fri, 18 Dec 2009 10:48:10 +0000 (10:48 +0000)]
Look through using decls when checking whether a name is an acceptable
nested-name specifier name.
I accidentally checked in the test case for this in the last commit ---
fortunately, that refactor was inspired by having debugged this problem already,
so I can fix the bug quick (though probably not fast enough for the buildbots).
John McCall [Fri, 18 Dec 2009 10:40:03 +0000 (10:40 +0000)]
Pull Sema::isAcceptableLookupResult into SemaLookup. Extract the criteria into
different functions and pick the function at lookup initialization time.
In theory we could actually divide the criteria functions into N different
functions for the N cases, but it's so not worth it.
Among other things, lets us invoke LookupQualifiedName without recomputing
IDNS info every time.
Do some refactoring in SemaDecl to avoid an awkward special case in LQN
that was only necessary for redeclaration testing for anonymous structs/unions ---
which could be done more efficiently with a scoped lookup anyway.
Douglas Gregor [Fri, 18 Dec 2009 05:02:21 +0000 (05:02 +0000)]
Switch the initialization required by return statements over to the
new InitializationSequence. This fixes some bugs (e.g., PR5808),
changed some diagnostics, and caused more churn than expected. What's
new:
- InitializationSequence now has a "C conversion sequence" category
and step kind, which falls back to
- Changed the diagnostics for returns to always have the result type
of the function first and the type of the expression second.
CheckSingleAssignmentConstraints to peform checking in C.
- Improved ASTs for initialization of return values. The ASTs now
capture all of the temporaries we need to create, but
intentionally do not bind the tempoary that is actually returned,
so that it won't get destroyed twice.
- Make sure to perform an (elidable!) copy of the class object that
is returned from a class.
- Fix copy elision in CodeGen to properly see through the
subexpressions that occur with elidable copies.
- Give "new" its own entity kind; as with return values and thrown
objects, we don't bind the expression so we don't call a
destructor for it.
Note that, with this patch, I've broken returning move-only types in
C++0x. We'll fix it later, when we tackle NRVO.
Daniel Dunbar [Fri, 18 Dec 2009 02:43:17 +0000 (02:43 +0000)]
Add -dwarf-debug-flags, which provides a way to embed the cc1 level options used
to compile a translation unit into the debug info for that file.
- Used by parts of Darwin build process to check compiler flags, etc.
- <rdar://problem/7256886> clang does not emit AT_APPLE_flags
Sean Callanan [Fri, 18 Dec 2009 00:04:09 +0000 (00:04 +0000)]
Testcase fixes to reflect instruction table changes in the LLVM backend
(http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20091214/092780.html)
The instruction fixes were checked and approved by Chris Lattner, but
these testcase fixes are mine; please yell at me if there are any
problems with either.
John McCall [Thu, 17 Dec 2009 23:21:11 +0000 (23:21 +0000)]
Patch over yet more problems with friend declarations which were provoking
problems on LLVM-Code-Syntax. This proved remarkably easy to "fix" once
I settled on how I was going to approach it.