Richard Smith [Fri, 24 Feb 2012 22:12:32 +0000 (22:12 +0000)]
When checking whether a reference to a variable is an ICE, look at the type of
the declaration, not at the type of the DeclRefExpr, since within a lambda the
DeclRefExpr can be more const than the declaration is.
Douglas Gregor [Fri, 24 Feb 2012 21:25:53 +0000 (21:25 +0000)]
C++11 [class.ctor]p5 says that
A defaulted default constructor for a class X is defined as deleted if [...]
- X is a union and all of its variant members are of const-qualified type.
A pedantic reading therefore says that
union X { };
has a deleted default constructor, which is both silly and almost
certainly unintended. Pretend as if this this read
- X is a union with one or more variant members, and all of its
variant members are of const-qualified type.
Richard Smith [Fri, 24 Feb 2012 18:42:08 +0000 (18:42 +0000)]
cxx_status: Consistently refer to C++11 as "C++11", not as "C++'11" nor as
"C++0x". Use "C++98" to refer to C++98, not "C++". Add heading for C++98
support section.
Richard Smith [Fri, 24 Feb 2012 18:37:14 +0000 (18:37 +0000)]
cxx_status: extended sizeof has been essentially complete for some time. As
agreed on IRC, any remaining issues are best dealt with as bugs.
We have no __has_feature check for this; please shout if you'd like one. This
feature seems too small to be worth its own release notes bullet (again, please
shout if you disagree).
Douglas Gregor [Fri, 24 Feb 2012 17:41:38 +0000 (17:41 +0000)]
Two minor, related fixes for template instantiation with blocks:
- Make sure that the block expression is instantiation-dependent if the
block is in a dependent context
- Make sure that the C++ 'this' expression gets captured even if we
don't rebuild the AST node during template instantiation. This would
also have manifested as a bug for lambdas.
Douglas Gregor [Fri, 24 Feb 2012 07:38:34 +0000 (07:38 +0000)]
Implement a new type trait __is_trivially_constructible(T, Args...)
that provides the behavior of the C++11 library trait
std::is_trivially_constructible<T, Args...>, which can't be
implemented purely as a library.
Since __is_trivially_constructible can have zero or more arguments, I
needed to add Yet Another Type Trait Expression Class, this one
handling arbitrary arguments. The next step will be to migrate
UnaryTypeTrait and BinaryTypeTrait over to this new, more general
TypeTrait class.
Fixes the Clang side of <rdar://problem/10895483> / PR12038.
Ted Kremenek [Fri, 24 Feb 2012 07:12:52 +0000 (07:12 +0000)]
Make PathDiagnosticBuilder sensitive to varying LocationContexts, thus fixing a bug in the inlining diagnostics where the wrong location could be used.
Ted Kremenek [Fri, 24 Feb 2012 06:00:00 +0000 (06:00 +0000)]
Reapply r151317, but when computing the PathDiagnostic profile and size keep into account the nested structure. Also fix a problem with how
inlining impacted Plist diagnostics, and adjust some ranges in the Plist output due to richer information.
Eli Friedman [Thu, 23 Feb 2012 23:47:16 +0000 (23:47 +0000)]
Handle "#pragma GCC visibility" in a few more places. Switch over "#pragma pack" to use the same handling that gcc does. Fixes <rdar://problem/10871094> and <rdar://problem/10893316>.
(Hopefully, common usage of these pragmas isn't irregular enough to break our current handling. Doug has ideas for a more crazy approach if necessary.)
Howard Hinnant [Thu, 23 Feb 2012 20:22:10 +0000 (20:22 +0000)]
* tgmath_logb.patch implements the missing logb function (see C99 standard 7.22, paragraph 5). * tgmath_fabs_complex.patch corrects the return types for the complex fabs functions. These must be non-complex float/double/long double (see C99 standard 7.22, paragraph 4 and 7.3.8.1). Patch contributed by Kristof Beyls.
objective-c default synthesis. classes which adopt protocol properties
must still auto synthesize those propeties which have been redeclared
in the class. // rdar://10907410
Richard Smith [Thu, 23 Feb 2012 01:36:12 +0000 (01:36 +0000)]
Update parser's disambiguation to cope with braced function-style casts in
C++11, and with braced-init-list initializers in conditions. This exposed an
ambiguity with enum underlying types versus bitfields, which we resolve by
treating 'enum E : T {' as always defining an enumeration (even if it would
only successfully parse as a bitfield). This appears to be g++ compatible.
Anna Zaks [Thu, 23 Feb 2012 01:05:27 +0000 (01:05 +0000)]
[analyzer] Invalidate the region passed to pthread_setspecific() call.
Make this call an exception in ExprEngine::invalidateArguments:
'int pthread_setspecific(ptheread_key k, const void *)' stores
a value into thread local storage. The value can later be retrieved
with 'void *ptheread_getspecific(pthread_key)'. So even thought the
parameter is 'const void *', the region escapes through the
call.
(Here we just blacklist the call in the ExprEngine's default
logic. Another option would be to add a checker which evaluates
the call and triggers the call to invalidate regions.)
Teach the Malloc Checker, which treats all system calls as safe about
the API.
Anna Zaks [Wed, 22 Feb 2012 19:24:52 +0000 (19:24 +0000)]
[analyzer] Malloc cleanup:
- We should not evaluate strdup in the Malloc Checker, it's the job of
CString checker, so just update the RefState to reflect allocated
memory.
- Refactor to reduce LOC: remove some wrapper auxiliary functions, make
all functions return the state and add the transition in one place
(instead of in each auxiliary function).
Revert part of r148839 and keep DefaultTargetTriple in the form adjusted
by -target and similar options. As discussed in PR 12026, the change
broke support for target-prefixed tools, i.e. calling x86_64--linux-ld
when compiling for x86_64--linux. Improve the test cases added
originally in r149083 to not require execution, just executable files.
Document the hack with appropiate FIXME comments.
Chad Rosier [Wed, 22 Feb 2012 17:55:22 +0000 (17:55 +0000)]
[driver] Add a warning for when -mcpu= is specified without an argument. There
are likely many other OPT_xxxx_EQ options that could/should be added here.
rdar://10704648
Douglas Gregor [Wed, 22 Feb 2012 17:32:19 +0000 (17:32 +0000)]
Teach overload resolution to prefer user-defined conversion via a
lambda closure type's function pointer conversion over user-defined
conversion via a lambda closure type's block pointer conversion,
always. This is a preference for more-standard code (since blocks
are an extension) and a nod to efficiency, since function pointers
don't require any memory management. Fixes PR12063.
Hans Wennborg [Wed, 22 Feb 2012 10:17:01 +0000 (10:17 +0000)]
Warn about non-standard format strings (pr12017)
This adds the -Wformat-non-standard flag (off by default,
enabled by -pedantic), which warns about non-standard
things in format strings (such as the 'q' length modifier,
the 'S' conversion specifier, etc.)
Francois Pichet [Wed, 22 Feb 2012 08:25:53 +0000 (08:25 +0000)]
In -fdelayed-template-parsing mode, reenter every scope when late parsing a templated function; (Not just the template parameter scope as previously). Also enter the scope stack in the correct order.
Otherwise this breaks some invariant during name lookup especially when dealing with shadowed declaration
Richard Smith [Wed, 22 Feb 2012 06:49:09 +0000 (06:49 +0000)]
Accept braced-init-lists in conditions, and, in passing, dramatically improve
the diagnostic for using a parenthesized direct-initializer in a condition.
Douglas Gregor [Wed, 22 Feb 2012 05:02:47 +0000 (05:02 +0000)]
Generate an AST for the conversion from a lambda closure type to a
block pointer that returns a block literal which captures (by copy)
the lambda closure itself. Some aspects of the block literal are left
unspecified, namely the capture variable (which doesn't actually
exist) and the body (which will be filled in by IRgen because it can't
be written as an AST).
Because we're switching to this model, this patch also eliminates
tracking the copy-initialization expression for the block capture of
the conversion function, since that information is now embedded in the
synthesized block literal. -1 side tables FTW.