Commit Graph

7546 Commits

Author SHA1 Message Date
Fariborz Jahanian 88d510da9d Add ability to supply additional message to availability macros,
// rdar://10095131

llvm-svn: 146304
2011-12-10 00:28:41 +00:00
Douglas Gregor c7f46f20d1 When we manage to re-use an expression during tree transformation (=
template instantiation), and that expression might produce a
temporary, invoke MaybeBindToTemporary. Otherwise, we forget to
destroy objects, release objects, etc. Fixes <rdar://problem/10531073>.

llvm-svn: 146301
2011-12-10 00:23:21 +00:00
Richard Smith f57d8cb131 C++11 constant expressions: Don't use CheckICE in C++11; instead, determine
whether an expression is a (core) constant expression as a side-effect of
evaluation. This takes us from accepting far too few expressions as ICEs to
accepting slightly too many -- fixes for the remaining cases are coming next.

The diagnostics produced when an expression is found to be non-constant are
currently quite poor (with generic wording but reasonable source locations),
and will be improved in subsequent commits.

llvm-svn: 146289
2011-12-09 22:58:01 +00:00
David Blaikie 10eb4b67d8 Add notes for suppressing and (if it's a zero-arg function returning bool) fixing the function-to-bool conversion warning.
llvm-svn: 146280
2011-12-09 21:42:37 +00:00
Fariborz Jahanian e283346d0b objc-arc: diagnose synthesis of a 'weak unavailable' property.
// rdar://10535245

llvm-svn: 146272
2011-12-09 19:55:11 +00:00
David Blaikie 72b61203f4 Provide a separate warning for weak vtables in explicit template instantiations. There's no (current) way to fix such templates to emit strong symbols/vtables, but perhaps users want to know about the cost being incurred anyway.
llvm-svn: 146265
2011-12-09 18:32:50 +00:00
Hans Wennborg a5b1aa99c7 Make printf warnings refer to wint_t and wchar_t by name
in addition to underlying type.

llvm-svn: 146254
2011-12-09 12:22:12 +00:00
Argyrios Kyrtzidis 4996f5fba2 Save category name loc in ObjCCategoryImplDecl, patch by Jason Haslam!
llvm-svn: 146213
2011-12-09 00:31:40 +00:00
DeLesley Hutchins f7faa6a69b This patch extends thread safety analysis with support for the scoped_lockable attribute.
llvm-svn: 146174
2011-12-08 20:23:06 +00:00
David Blaikie ecd8a94acf Decltype in non-pseudo (& non-dependent) dtor calls.
llvm-svn: 146155
2011-12-08 16:13:53 +00:00
Hans Wennborg 70a1324428 Only do typo correction for implicit function decls when
they are treated as errors.

Doing typo correction when these are just warnings slows down the
compilation of source which deliberately uses implicit function
declarations.

llvm-svn: 146153
2011-12-08 15:56:07 +00:00
Hans Wennborg 772e9270f6 Make printf warnings refer to intmax_t et al. by name
in addition to underlying type.

For example, the warning for printf("%zu", 42.0);
changes from "conversion specifies type 'unsigned long'" to "conversion
specifies type 'size_t' (aka 'unsigned long')"

(This is a second attempt after r145697, which got reverted.)

llvm-svn: 146032
2011-12-07 10:33:11 +00:00
Richard Smith 42d3af9d95 When folding the size of a global scope VLA to a constant, require the array
bound to not have side effects(!). Add constant-folding support for expressions
of void type, to ensure that we can still fold ((void)0, 1) as an array bound.

llvm-svn: 146000
2011-12-07 00:43:50 +00:00
Fariborz Jahanian 6bdeb14d5d objc: issue deprecated/unavailable diagnostic when
methods with these attributes are sent to receivers
of 'id' type too. // rdar://10459930

llvm-svn: 145999
2011-12-07 00:30:00 +00:00
Hans Wennborg 2fb8b91f6f Suggest typo corrections for implicit function declarations.
A mistyped function call becomes an inmplicit function declaration in C.
Suggest typo correction when one can be found.

llvm-svn: 145930
2011-12-06 09:46:12 +00:00
Erik Verbruggen c6c8d9356d Extend warnings for missing '@end'.
Fixes PR2709.

llvm-svn: 145928
2011-12-06 09:25:23 +00:00
Richard Trieu 5f623229ec Switch a cast to a dyn_cast and check the pointer before using. Fixes a crash
in the following code:

void test4(bool (&x)(void)) {
  while (x);
}

llvm-svn: 145918
2011-12-06 04:48:01 +00:00
Eli Friedman 7c6515a653 Make sure we perform lvalue-to-rvalue conversions for enum initializers. PR11484.
llvm-svn: 145874
2011-12-06 00:10:34 +00:00
Fariborz Jahanian 56f326e7f2 objc: put out more coherent warning when method definition
attributes don't match its declaration. // rdar://10529259.

llvm-svn: 145872
2011-12-06 00:02:41 +00:00
Lang Hames df5c121f8e Add a warning for implicit conversion from function literals (and static
methods) to bool. E.g.

void foo() {}
if (f) { ... // <- Warns here.
}

Only applies to non-weak functions, and does not apply if the function address
is taken explicitly with the addr-of operator.

llvm-svn: 145849
2011-12-05 20:49:50 +00:00
David Blaikie 15a430a368 Support decltype in nested-name-specifiers.
llvm-svn: 145785
2011-12-04 05:04:18 +00:00
Fariborz Jahanian 5c12ca8a25 Move block return type inference diagnostic to a common place where
Function or array lvalue conversions happens.

llvm-svn: 145782
2011-12-03 23:53:56 +00:00
Douglas Gregor dca70af22f Implement support for the __is_final type trait, to determine whether
a class is marked 'final', from Alberto Ganesh Barbati! Fixes
PR11462.

llvm-svn: 145775
2011-12-03 18:14:24 +00:00
Fariborz Jahanian dd5eb9df0c If block literal return type is not specified, return type of the block is
inferred from return types. All the return statements have to agree about the type.
// rdar://10466373

llvm-svn: 145774
2011-12-03 17:47:53 +00:00
Francois Pichet 9c39113fdb In Microsoft mode, don't perform typo correction in a template member function dependent context because it interferes with the "lookup into dependent bases of class templates" feature.
Basically typo correction will try to offer a correction instead of looking into type dependent base classes.

I found this problem while parsing Microsoft ATL code with clang.

llvm-svn: 145772
2011-12-03 15:55:29 +00:00
Sebastian Redl df88864273 Implement overload resolution for reference-typed parameters supplied with initializer lists.
llvm-svn: 145769
2011-12-03 14:54:30 +00:00
Douglas Gregor bcfc7d0229 When we treat an #include or #import as a module import, create an
implicit ImportDecl in the translation unit to record the presence of
the import.

llvm-svn: 145727
2011-12-02 23:42:12 +00:00
Douglas Gregor ba34552e79 Introduce a module import declaration, so that we properly represent, e.g.,
__import_module__ std.vector;

in the AST.

llvm-svn: 145725
2011-12-02 23:23:56 +00:00
Nick Lewycky 45ccba64ab Revert r145697 and dependent patch r145702. It added a dependency from
lib/Analysis to lib/Sema which is cyclical.

llvm-svn: 145724
2011-12-02 23:21:43 +00:00
Douglas Gregor 2a5d14898a Make sure that name lookup in C checks whether a name is hidden.
llvm-svn: 145700
2011-12-02 20:08:44 +00:00
Hans Wennborg 70f7213d2c Make conversion specifier warning refer to typedef if possible.
For example, the warning for printf("%zu", 42.0);
changes from "conversion specifies type 'unsigned long'" to "conversion
specifies type 'size_t' (aka 'unsigned long')"

llvm-svn: 145697
2011-12-02 19:22:15 +00:00
Douglas Gregor 2b82c2a59e Implementing parsing and resolution of module export declarations
within module maps, which will (eventually) be used to re-export a
module from another module. There are still some pieces missing,
however.

llvm-svn: 145665
2011-12-02 01:47:07 +00:00
Douglas Gregor ff2be53f8f Introduce the notion of name visibility into modules. For a given
(sub)module, all of the names may be hidden, just the macro names may
be exposed (for example, after the preprocessor has seen the import of
the module but the parser has not), or all of the names may be
exposed. Importing a module makes its names, and the names in any of
its non-explicit submodules, visible to name lookup (transitively).

This commit only introduces the notion of name visible and marks
modules and submodules as visible when they are imported. The actual
name-hiding logic in the AST reader will follow (along with test cases).

llvm-svn: 145586
2011-12-01 17:11:21 +00:00
Douglas Gregor 11bb308457 When typo-correction an Objective-C superclass name, don't
typo-correct to ourselves.

llvm-svn: 145583
2011-12-01 15:37:53 +00:00
Douglas Gregor d8fb1e30eb When sending a message to a receiver that has "unknown any" type,
force the unknown any type to "id" so that the message send can be
completed without requiring a case. Fixes <rdar://problem/10506646>.

llvm-svn: 145552
2011-12-01 01:37:36 +00:00
Ted Kremenek 764d63ad94 Specially whitelist the selector 'addOperationWithBlock:' for the retain-cycle checking in -Warc-retain-cycles. This commonly
is hit by users using NSOperationQueue.  Fixes <rdar://problem/10465721>.

llvm-svn: 145548
2011-12-01 00:59:21 +00:00
Ted Kremenek 85825aebc9 Further tweak -Wurneachable-code and templates by allowing the warning to run on
explicit template specializations (which represent actual functions somebody wrote).

Along the way, refactor some other code which similarly cares about whether or
not they are looking at a template instantiation.

llvm-svn: 145547
2011-12-01 00:59:17 +00:00
Douglas Gregor de3ef502a9 Promote ModuleMap::Module to a namespace-scope class in the Basic
library, since modules cut across all of the libraries. Rename
serialization::Module to serialization::ModuleFile to side-step the
annoying naming conflict. Prune a bunch of ModuleMap.h includes that
are no longer needed (most files only needed the Module type).

llvm-svn: 145538
2011-11-30 23:21:26 +00:00
Ted Kremenek 7f770032c7 Don't run -Wunreachable-code on template instantiations. Different instantiations may produce different unreachable code results, and it is very difficult for us to prove that ALL instantiations of a template have specific unreachable code. If we come up with a better solution, then we can revisit this, but this approach will at least greatly reduce the noise of this warning for code that makes use of templates.
llvm-svn: 145520
2011-11-30 21:22:09 +00:00
John McCall e929082806 Fix the instantiation of pseudo-object expressions. This is a
really bad way to go about this, but I'm not sure there's a better
choice without substantial changes to TreeTransform --- most
notably, preserving implicit semantic nodes instead of discarding
and rebuilding them.

llvm-svn: 145480
2011-11-30 04:42:31 +00:00
Douglas Gregor 71944203de Switch the module-loading interfaces and parser from a simple
top-level module name to a module path (e.g., std.vector). We're still
missing a number of pieces for this actually to do something.

llvm-svn: 145462
2011-11-30 00:36:36 +00:00
Richard Smith 507840dbff Revert r145244. It causes us to create broken ASTs with missing type information
for some cast expressions.

Original commit message:

Removed useless ImplicitCast nodes in explicit cstyle and static casts

llvm-svn: 145447
2011-11-29 22:48:16 +00:00
Matt Beaumont-Gay c93b489138 Suppress -Warray-bounds for classes (not just structs) where the last field is
a 1-length character array.

llvm-svn: 145445
2011-11-29 22:43:53 +00:00
Lang Hames c8c3b403c5 Test isa<FunctionDecl> to exclude objective-C methods. This ensures the following cast will never fail.
llvm-svn: 145441
2011-11-29 22:37:13 +00:00
Matt Beaumont-Gay b2339826e6 Merge branch 'yo-dawg-i-herd-u-like-arrays'
llvm-svn: 145421
2011-11-29 19:27:11 +00:00
Fariborz Jahanian a45495a9f2 objc: warn if NSObject attribute appears other than in a typedef.
// rdar://10453342

llvm-svn: 145358
2011-11-29 01:48:40 +00:00
Douglas Gregor 7db3e95b0d When synthesizing an implicitly-defined copy or move constructor, or
when computing the exception specification of a copy or move constructor,
ignore non-static data member initializers. Fixes PR11418 /
<rdar://problem/10478642>.

llvm-svn: 145269
2011-11-28 20:03:15 +00:00
Fariborz Jahanian 80b831c1a9 Remove code made redundant by my previous patch.
llvm-svn: 145266
2011-11-28 19:56:36 +00:00
Fariborz Jahanian 25d09c2209 pinpoint name/location of deprecated/unavailable enumerator
whose enum has been made deprecated/unavailable in the warning.
// rdar://10201690

llvm-svn: 145264
2011-11-28 19:45:58 +00:00
Fariborz Jahanian 22b405c7aa objc: turn warning for property type mismatch in
primary and its continuation class into error.
// rdar://10142679

llvm-svn: 145255
2011-11-28 18:38:27 +00:00