Bill Wendling [Thu, 12 May 2011 19:02:15 +0000 (19:02 +0000)]
LLVM doesn't always optimize away the four loads from this:
(__m128){ p[0], p[1], p[2], p[3] }
which produces really bad code. This could be done in instcombine, but it's
probably better to do it in the front-end instead.
<rdar://problem/9424836>
Sean Hunt [Thu, 12 May 2011 03:51:51 +0000 (03:51 +0000)]
Make it so that we actually generate definitions for explicitly
defaulted default constructors.
As it happens, making sure that we handle out-of-line defaulted
functions properly will involved making sure that we actually parse them
correctly, so that's coming after.
Richard Smith [Thu, 12 May 2011 00:06:17 +0000 (00:06 +0000)]
Fix PR9902: correctly substitute alias templates within the template in which they are defined: provide an empty list of arguments for each containing template context during substitution.
Douglas Gregor [Wed, 11 May 2011 23:45:11 +0000 (23:45 +0000)]
Implement CWG1170, which makes access-control errors into template
argument deduction failures. Only implemented in C++0x, since this is
a significant change in behavior from C++98/03.
Douglas Gregor [Wed, 11 May 2011 23:26:17 +0000 (23:26 +0000)]
When checking for the necessary 'template<>' headers based on the
nested of an out-of-line declaration, only require a 'template<>'
header for each enclosing class template that hasn't been previously
specialized; previously, we were requiring 'template<>' for enclosing
class templates and members of class templates that hadn't been
previously specialized. Fixes <rdar://problem/9422013>.
John McCall [Wed, 11 May 2011 07:19:11 +0000 (07:19 +0000)]
Teach CFG building how to deal with CXXMemberCallExprs and BoundMemberTy,
then teach -Wreturn-type to handle the same. Net effect: we now correctly
handle noreturn attributes on member calls in the CFG.
Douglas Gregor [Tue, 10 May 2011 21:23:31 +0000 (21:23 +0000)]
Tweak the diagnostics for the C++0x extensions to friend types to note
that they are C++0x extensions, and put them in the appropriate
group. We already support most of the semantics. Addresses
<rdar://problem/9407525>.
Change magic string "abc" to better magic string "qux".
Wait, what?
So, we run Clang (and LLVM) tests in an environment where the md5sum of the
input files becomes a component of the path. When testing the preprocessor,
the path becomes part of the output (in line directives). In this test, we
were grepping for the absence of "abc" in the output. When the stars aligned
properly, the md5sum component of the path contained "abc" and the test
failed. Oops.
Sean Hunt [Tue, 10 May 2011 19:08:14 +0000 (19:08 +0000)]
Re-do R131114 without breaking code.
I've edited one diagnostic which would print "copy constructor" for copy
constructors and "constructor" for any other constructor. If anyone is
extremely enamored with this, it can be reinstated with a simple boolean
flag rather than calling getSpecialMember, which is inappropriate.
Douglas Gregor [Tue, 10 May 2011 18:27:06 +0000 (18:27 +0000)]
Reimplement Sema::MatchTemplateParametersToScopeSpecifier() based on
the semantic context referenced by the nested-name-specifier rather
than the syntactic form of the nested-name-specifier. The previous
incarnation was based on my complete misunderstanding of C++
[temp.expl.spec]. The latest C++0x working draft clarifies the
requirements here, and this rewrite is intended to follow that.
Along the way, improve source location information in the
diagnostics. For example, if we report that a specific type needs or
doesn't need a 'template<>' header, we dig out that type in the
nested-name-specifier and highlight its range.
Fixes: PR5907, PR9421, PR8277, PR8708, PR9482, PR9668, PR9877, and
<rdar://problem/9135379>.
Sean Hunt [Tue, 10 May 2011 00:49:42 +0000 (00:49 +0000)]
Further implement defaulting constructors.
Focus is on default constructors for the time being. Currently the
exception specification and prototype are processed correctly. Codegen
might work but in all likelihood doesn't.
Note that due to an error, out-of-line defaulting of member functions is
currently impossible. It will continue to that until I muster up the
courage to admit that I secretly pray to epimetheus and that I need to
rework the way default gets from Parse -> Sema.
Douglas Gregor [Mon, 9 May 2011 20:45:16 +0000 (20:45 +0000)]
When determining whether we need to instantiate a function type,
also consider whether any of the parameter types (as written, prior to
decay) are dependent. Fixes PR9880 and <rdar://problem/9408413>.
Anders Carlsson [Sun, 8 May 2011 17:25:05 +0000 (17:25 +0000)]
Don't emit complete constructors for abstract classes. Also, don't emit
complete destructors for abstract classes unless the destructor is virtual
and thus needs to be in the vtable.
Douglas Gregor [Sun, 8 May 2011 06:09:53 +0000 (06:09 +0000)]
Relax the conversion rules for Objective-C GC qualifiers a
bit by allowing __weak and __strong to be added/dropped as part of
implicit conversions (qualification conversions in C++). A little
history: GCC lets one add/remove/change GC qualifiers just about
anywhere, implicitly. Clang did roughly the same before, but we
recently normalized the semantics of qualifiers across the board to
get a semantics that we could reason about (yay). Unfortunately, this
tightened the screws a bit too much for GC qualifiers, where it's
common to add/remove these qualifiers at will.
Overall, we're still in better shape than we were before: we don't
permit directly changing the GC qualifier (e.g., __weak -> __strong),
so type safety is improved. More importantly, we're internally
consistent in our handling of qualifiers, and the logic that allows
adding/removing GC qualifiers (but not adding/removing address
spaces!) only touches two obvious places.
Douglas Gregor [Sat, 7 May 2011 22:06:45 +0000 (22:06 +0000)]
In C++, allow us to emit a global as 'constant' even if it has class
type, so long as it is known to have a constant initializer and the
class type is a POD class. Fixes <rdar://problem/9306265>.
Francois Pichet [Sat, 7 May 2011 19:04:49 +0000 (19:04 +0000)]
Don't fail at parsing __declspec(property(get=get_func_name)). Just skip everything inside property() for now while we wait for the BoostPro people to provide a complete patch.
Douglas Gregor [Fri, 6 May 2011 23:28:47 +0000 (23:28 +0000)]
When checking for a prior declaration of the name of a namespace, skip
any names that aren't in the appropriate identifier namespaces. Fixes
an embarrassing bug where we give a redefinition error due to an
Objective-C category (<rdar://problem/9388207>).
Douglas Gregor [Fri, 6 May 2011 21:43:30 +0000 (21:43 +0000)]
Keep track of the file ID corresponding to the original file used to
build a precompiled header. Use this information to eliminate the call
to SourceManager::getLocation() while loading a precompiled preamble,
since SourceManager::getLocation() itself causes unwanted
deserialization.
Francois Pichet [Fri, 6 May 2011 20:48:22 +0000 (20:48 +0000)]
Add support for Microsoft __if_exists and __if_not_exists construct inside function definition.
Allow to include or exclude code depending on if a symbol exists or not. Just like a #ifdef but for C/C++ symbols.
More doc: http://msdn.microsoft.com/en-us/library/x7wy9xh3(v=VS.100).aspx
Support at class and namespace scopes will be added later.
Sean Hunt [Fri, 6 May 2011 20:44:56 +0000 (20:44 +0000)]
Modify some deleted function methods to better reflect reality:
- New isDefined() function checks for deletedness
- isThisDeclarationADefinition checks for deletedness
- New doesThisDeclarationHaveABody() does what
isThisDeclarationADefinition() used to do
- The IsDeleted bit is not propagated across redeclarations
- isDeleted() now checks the canoncial declaration
- New isDeletedAsWritten() does what it says on the tin.
- isUserProvided() now correct (thanks Richard!)
Eli Friedman [Fri, 6 May 2011 18:04:18 +0000 (18:04 +0000)]
Don't emit nsw flags for vector operations; there's basically no benefit, and a lot of downside (like PR9850, which is about clang's xmmintrin.h making an unexpected transformation on an expression involving _mm_add_epi32).
Eli Friedman [Fri, 6 May 2011 17:27:27 +0000 (17:27 +0000)]
Add an implementation of thunks for varargs methods. The implementation is a bit messy, but it is correct as long as the method in question doesn't use indirect gotos. A couple of possible alternative implementations are outlined in FIXME's in this patch. rdar://problem/8077308 .
Douglas Gregor [Fri, 6 May 2011 16:33:08 +0000 (16:33 +0000)]
Introduce a new libclang parsing flag,
CXTranslationUnit_NestedMacroInstantiations, which indicates whether
we want to see "nested" macro instantiations (e.g., those that occur
inside other macro instantiations) within the detailed preprocessing
record. Many clients (e.g., those that only care about visible tokens)
don't care about this information, and in code that uses preprocessor
metaprogramming, this information can have a very high cost.
Axel Naumann [Fri, 6 May 2011 15:24:04 +0000 (15:24 +0000)]
Reset the emitted initializers.
This enables incremental codegen, where the initializer array can be removed from the module, such that only new initializers will be emitted and run.
Move logic for passing down -mrelax-all / -relax-all into a common
function. Extend the logic to check if the input was compiled.
Use -relax-all as default only if -O0 is used for compilation.
Fixes bug 9290.
Sean Hunt [Fri, 6 May 2011 01:42:00 +0000 (01:42 +0000)]
Do defaulted constructors properly.
Explictly defaultedness is correctly reflected on the AST, but there are
no changes to how that affects the definition of functions or much else
really.
Richard Smith [Thu, 5 May 2011 22:36:10 +0000 (22:36 +0000)]
Slight tweak to alias template error handling: don't guess that a template-id in an alias declaration was meant to be a specialization. Use a generic, but more accurate, diagnostic.
Richard Smith [Thu, 5 May 2011 22:07:51 +0000 (22:07 +0000)]
Update www: we now mangle references to function parameters properly. Also, this is really more a decltype issue rather than a late-specified return type issue.
Douglas Gregor [Thu, 5 May 2011 20:27:22 +0000 (20:27 +0000)]
When the environment variable LIBCLANG_RESOURCE_USAGE is set, teach
libclang to emit information about resource usage after parsing, code
completion, etc.
When instantiating a block expression, the instantiated
blockScopeInfo's CapturesCXXThis field need get set as
well. // rdar://9362021. John M. please review.
Douglas Gregor [Thu, 5 May 2011 16:13:52 +0000 (16:13 +0000)]
Scoped enumerations should not be treated as integer types (in the C
sense). Fixes <rdar://problem/9366066> by eliminating an inconsistency
between C++ overloading (which handled scoped enumerations correctly)
and C binary operator type-checking (which didn't).
Douglas Gregor [Thu, 5 May 2011 15:50:42 +0000 (15:50 +0000)]
When providing code completions for an Objective-C property access,
also include methods with zero-argument selectors. Implements
<rdar://problem/9048332>.