]> granicus.if.org Git - clang/log
clang
12 years agoChange the way we store initialization kinds so that all direct inits can distinguish...
Sebastian Redl [Sun, 12 Feb 2012 16:37:36 +0000 (16:37 +0000)]
Change the way we store initialization kinds so that all direct inits can distinguish between list and parens form. This allows us to correctly diagnose the last test cases from litb.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150343 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoEmploy DirectList initialized entities to properly sort through some initialization...
Sebastian Redl [Sun, 12 Feb 2012 16:37:24 +0000 (16:37 +0000)]
Employ DirectList initialized entities to properly sort through some initialization edge cases.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150342 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoFix broken link. I believe this has been broken for at least 7 months.
Michael J. Spencer [Sun, 12 Feb 2012 09:11:39 +0000 (09:11 +0000)]
Fix broken link. I believe this has been broken for at least 7 months.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150329 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoFix the rewriter that broke with r149987.
Argyrios Kyrtzidis [Sun, 12 Feb 2012 04:48:45 +0000 (04:48 +0000)]
Fix the rewriter that broke with r149987.

r149987 changed the way parsing happens inside an @implementation;
it aggregates the declarations inside and reports them together as a DeclGroup.
This had the side effect that function declarations were reported together with
their definition, while the rewriter expected for function declarations to be
reported immediately to the consumer and thus not have a body.

Fix this by having the rewriter actually check with isThisDeclarationADefinition()
to make sure the body comes from the current decl before rewriting it.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150325 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoRepresent C++ direct initializers as ParenListExprs before semantic analysis
Sebastian Redl [Sat, 11 Feb 2012 23:51:47 +0000 (23:51 +0000)]
Represent C++ direct initializers as ParenListExprs before semantic analysis
instead of having a special-purpose function.

- ActOnCXXDirectInitializer, which was mostly duplication of
  AddInitializerToDecl (leading e.g. to PR10620, which Eli fixed a few days
  ago), is dropped completely.
- MultiInitializer, which was an ugly hack I added, is dropped again.
- We now have the infrastructure in place to distinguish between
  int x = {1};
  int x({1});
  int x{1};
-- VarDecl now has getInitStyle(), which indicates which of the above was used.
-- CXXConstructExpr now has a flag to indicate that it represents list-
   initialization, although this is not yet used.
- InstantiateInitializer was renamed to SubstInitializer and simplified.
- ActOnParenOrParenListExpr has been replaced by ActOnParenListExpr, which
  always produces a ParenListExpr. Placed that so far failed to convert that
  back to a ParenExpr containing comma operators have been fixed. I'm pretty
  sure I could have made a crashing test case before this.

The end result is a (I hope) considerably cleaner design of initializers.
More importantly, the fact that I can now distinguish between the various
initialization kinds means that I can get the tricky generalized initializer
test cases Johannes Schaub supplied to work. (This is not yet done.)

This commit passed self-host, with the resulting compiler passing the tests. I
hope it doesn't break more complicated code. It's a pretty big change, but one
that I feel is necessary.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150318 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoDrive-by fix of incorrect diagnostic, and a test case for said diagnostic. The double...
Sebastian Redl [Sat, 11 Feb 2012 23:51:21 +0000 (23:51 +0000)]
Drive-by fix of incorrect diagnostic, and a test case for said diagnostic. The double error is unfortunate, but I really don't see an alternative whose effort is worth it.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150317 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoFix parsing new expressions using init lists. Probably still do the wrong thing in...
Sebastian Redl [Sat, 11 Feb 2012 23:51:08 +0000 (23:51 +0000)]
Fix parsing new expressions using init lists. Probably still do the wrong thing in cases involving array new.
Show that many cases using initializer list constructors work, in that they parse and pass semantic analysis.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150316 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[analyzer] Malloc Checker: reduce false negatives rate by assuming that
Anna Zaks [Sat, 11 Feb 2012 23:46:36 +0000 (23:46 +0000)]
[analyzer] Malloc Checker: reduce false negatives rate by assuming that
a pointer cannot escape through calls to system functions. Also, stop
after reporting the first use-after-free.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150315 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[analyzer] Malloc Checker: Report a leak when we are returning freed
Anna Zaks [Sat, 11 Feb 2012 21:44:39 +0000 (21:44 +0000)]
[analyzer] Malloc Checker: Report a leak when we are returning freed
memory.
(As per one test case, the existing checker thought that this could
cause a lot of false positives - not sure if that's valid, to be
verified.)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150313 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[analyzer] Malloc checker: Leak bugs should be suppressed by sinks.
Anna Zaks [Sat, 11 Feb 2012 21:02:40 +0000 (21:02 +0000)]
[analyzer] Malloc checker: Leak bugs should be suppressed by sinks.
Resolves a common false positive, where we were reporting a leak inside
asserts

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150312 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[analyzer] MallocChecker: refactor/improve the symbol escape logic.
Anna Zaks [Sat, 11 Feb 2012 21:02:35 +0000 (21:02 +0000)]
[analyzer] MallocChecker: refactor/improve the symbol escape logic.

We use the same logic here as the RetainRelease checker.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150311 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoobjective-c translator. more modern abi stuff, focusing on ivar related
Fariborz Jahanian [Sat, 11 Feb 2012 20:10:52 +0000 (20:10 +0000)]
objective-c translator. more modern abi stuff, focusing on ivar related
meta-data.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150310 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoImplement core issue 5: a temporary created for copy-initialization has a
Richard Smith [Sat, 11 Feb 2012 19:22:50 +0000 (19:22 +0000)]
Implement core issue 5: a temporary created for copy-initialization has a
cv-unqualified type. This is essential in order to allow move-only objects of
const-qualified types to be copy-initialized via a converting constructor.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150309 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoMake sure to try instantiating a templated type which is used in an _Atomic
Richard Smith [Sat, 11 Feb 2012 18:03:45 +0000 (18:03 +0000)]
Make sure to try instantiating a templated type which is used in an _Atomic
before complaining that it's incomplete.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150308 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[analyzer] New checker for assignment of non-0/1 values to Boolean variables.
Ryan Govostes [Sat, 11 Feb 2012 16:32:09 +0000 (16:32 +0000)]
[analyzer] New checker for assignment of non-0/1 values to Boolean variables.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150306 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoImplement warning for non-wide string literals with an unexpected encoding. Downgrad...
Eli Friedman [Sat, 11 Feb 2012 05:08:10 +0000 (05:08 +0000)]
Implement warning for non-wide string literals with an unexpected encoding.  Downgrade error for non-wide character literals with an unexpected encoding to a warning for compatibility with gcc and older versions of clang.  <rdar://problem/10837678>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150295 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoBegin refactoring to use the newly added triple predicates for
Chandler Carruth [Sat, 11 Feb 2012 03:31:12 +0000 (03:31 +0000)]
Begin refactoring to use the newly added triple predicates for
simplicity. Also addresses a FIXME, although not one that could be
observed.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150294 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoBasic support for referring to captured variables from lambdas. Some simple examples...
Eli Friedman [Sat, 11 Feb 2012 02:57:39 +0000 (02:57 +0000)]
Basic support for referring to captured variables from lambdas.  Some simple examples seem to work.  Tests coming up soon.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150293 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoMake sure Sema creates a field for 'this' captures. (Doug, please double-check that...
Eli Friedman [Sat, 11 Feb 2012 02:51:16 +0000 (02:51 +0000)]
Make sure Sema creates a field for 'this' captures.  (Doug, please double-check that this is correct.)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150292 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[libclang] For a reference of an implicit template instantiation just give
Argyrios Kyrtzidis [Sat, 11 Feb 2012 02:00:00 +0000 (02:00 +0000)]
[libclang] For a reference of an implicit template instantiation just give
a reference for the instantiation decl. Also test that its location is correct
after previous commit.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150291 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoFor class template implicit instantiation, also update its location to point
Argyrios Kyrtzidis [Sat, 11 Feb 2012 01:59:57 +0000 (01:59 +0000)]
For class template implicit instantiation, also update its location to point
to the pattern template that it came from, otherwise we had this situation:

template <typename T1, typename T2>
struct S {
};

template <typename T>
struct S<T, int> {
};

void f() {
  S<int, int> s; // location of declaration "S<int, int>" was of "S<T1, T2>" not "S<T, int>"
}

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150290 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoconst-qualify CXXRecordDecl::getCaptureFields.
Eli Friedman [Sat, 11 Feb 2012 00:18:00 +0000 (00:18 +0000)]
const-qualify CXXRecordDecl::getCaptureFields.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150284 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoAdd simple semantic test for C++11 [expr.prim.lambda]p16, which covers recursive...
Douglas Gregor [Fri, 10 Feb 2012 23:38:02 +0000 (23:38 +0000)]
Add simple semantic test for C++11 [expr.prim.lambda]p16, which covers recursive capture. This is far more interesting for IRgen.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150283 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoImplement C++11 [expr.lambda.prim]p13, which prohibits lambdas in
Douglas Gregor [Fri, 10 Feb 2012 23:30:22 +0000 (23:30 +0000)]
Implement C++11 [expr.lambda.prim]p13, which prohibits lambdas in
default arguments if in fact those lambdas capture any entity.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150282 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoobjc translator: more modern metadata stuff.
Fariborz Jahanian [Fri, 10 Feb 2012 23:18:24 +0000 (23:18 +0000)]
objc translator: more modern metadata stuff.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150281 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoSet UserLabelPrefix and MCountName correctly for DragonFly BSD. Patch by Sascha...
Eli Friedman [Fri, 10 Feb 2012 23:02:29 +0000 (23:02 +0000)]
Set UserLabelPrefix and MCountName correctly for DragonFly BSD.  Patch by Sascha Wildner.

Setting UserLabelPrefix correctly fixes PR11949.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150280 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoSupport all null pointer literals in format strings.
David Blaikie [Fri, 10 Feb 2012 21:07:25 +0000 (21:07 +0000)]
Support all null pointer literals in format strings.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150276 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoobjctive-c translator: modern metadata for ivars. wip.
Fariborz Jahanian [Fri, 10 Feb 2012 20:47:10 +0000 (20:47 +0000)]
objctive-c translator: modern metadata for ivars. wip.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150275 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoHave the driver pass CPU and target feature information to cc1as.
Jim Grosbach [Fri, 10 Feb 2012 20:37:10 +0000 (20:37 +0000)]
Have the driver pass CPU and target feature information to cc1as.

When creating the MCSubtargetInfo, the assembler driver uses the CPU and
feature string to construct a more accurate model of what instructions
are and are not legal.

rdar://10840476

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150273 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[libclang] Indexing API: fully index using decls and directives.
Argyrios Kyrtzidis [Fri, 10 Feb 2012 20:10:48 +0000 (20:10 +0000)]
[libclang] Indexing API: fully index using decls and directives.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150268 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[libclang] Indexing API: Fully index implict template instantiations.
Argyrios Kyrtzidis [Fri, 10 Feb 2012 20:10:44 +0000 (20:10 +0000)]
[libclang] Indexing API: Fully index implict template instantiations.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150267 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoAdd ArrayRef goodness in MultiplexASTMutationListener.
Argyrios Kyrtzidis [Fri, 10 Feb 2012 20:10:38 +0000 (20:10 +0000)]
Add ArrayRef goodness in MultiplexASTMutationListener.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150266 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoUpdate MultiplexASTMutationListener with the missing methods from ASTMutationListener.
Argyrios Kyrtzidis [Fri, 10 Feb 2012 20:10:36 +0000 (20:10 +0000)]
Update MultiplexASTMutationListener with the missing methods from ASTMutationListener.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150265 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[libclang] Encode the template specialization parameters of a function
Argyrios Kyrtzidis [Fri, 10 Feb 2012 20:10:32 +0000 (20:10 +0000)]
[libclang] Encode the template specialization parameters of a function
specialization in its USR string.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150264 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoEnhance checking for null format string literal to take into account __null. Fixes...
Ted Kremenek [Fri, 10 Feb 2012 19:13:51 +0000 (19:13 +0000)]
Enhance checking for null format string literal to take into account __null.   Fixes <rdar://problem/8269537>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150260 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoAllow implicit capture of 'this' in a lambda even when the capture
Douglas Gregor [Fri, 10 Feb 2012 17:46:20 +0000 (17:46 +0000)]
Allow implicit capture of 'this' in a lambda even when the capture
default is '=', and reword the warning about explicitly capturing
'this' in such lambdas to indicate that only explicit capture is
banned.

Introduce Fix-Its for this and other "save the programmer from
themself" rules regarding what can be explicitly captured and what
must be implicitly captured.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150256 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoAdd test from [expr.prim.lambda]p12, which deals with odr-use and
Douglas Gregor [Fri, 10 Feb 2012 16:48:36 +0000 (16:48 +0000)]
Add test from [expr.prim.lambda]p12, which deals with odr-use and
nested captures. We currently don't get odr-use correct in array
bounds, so that bit is commented out while we sort out what we need to
do.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150255 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoDon't introduce a lambda's operator() into the class until after we
Douglas Gregor [Fri, 10 Feb 2012 16:13:20 +0000 (16:13 +0000)]
Don't introduce a lambda's operator() into the class until after we
have finished parsing the body, so that name lookup will never find
anything within the closure type. Then, add this operator() and the
conversion function (if available) before completing the class.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150252 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoPR11684, core issue 1417:
Richard Smith [Fri, 10 Feb 2012 11:05:11 +0000 (11:05 +0000)]
PR11684, core issue 1417:

o Correct the handling of the restrictions on usage of cv-qualified and
  ref-qualified function types.
o Fix a bug where such types were rejected in template type parameter default
  arguments, due to such arguments not being treated as a template type arg
  context.
o Remove the ExtWarn for usage of such types as template arguments; that was
  a standard defect, not a GCC extension.
o Improve the wording and unify the code for diagnosing cv-qualifiers with the
  code for diagnosing ref-qualifiers.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150244 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoTest cleanup: prefer static_assert to handmade alternative.
Richard Smith [Fri, 10 Feb 2012 10:55:13 +0000 (10:55 +0000)]
Test cleanup: prefer static_assert to handmade alternative.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150243 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoLoosen the test from r150238 a bit to make some of our bots happy.
Evgeniy Stepanov [Fri, 10 Feb 2012 10:04:01 +0000 (10:04 +0000)]
Loosen the test from r150238 a bit to make some of our bots happy.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150242 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoTrack whether a function type has a trailing return type as type sugar. Use this
Richard Smith [Fri, 10 Feb 2012 09:58:53 +0000 (09:58 +0000)]
Track whether a function type has a trailing return type as type sugar. Use this
to pretty-print such function types better, and to fix a case where we were not
instantiating templates in lexical order. In passing, move the Variadic bit from
Type's bitfields to FunctionProtoType to get the Type bitfields down to 32 bits.
Also ensure that we always substitute the return type of a function when
substituting explicitly-specified arguments, since that can cause us to bail
out with a SFINAE error before we hit a hard error in parameter substitution.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150241 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago--lies.
Richard Smith [Fri, 10 Feb 2012 09:37:07 +0000 (09:37 +0000)]
--lies.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150240 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoAdd a lambda example from the working draft.
Douglas Gregor [Fri, 10 Feb 2012 09:37:05 +0000 (09:37 +0000)]
Add a lambda example from the working draft.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150239 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoFix function prolog codegen whe coerce-to type is a struct.
Evgeniy Stepanov [Fri, 10 Feb 2012 09:30:15 +0000 (09:30 +0000)]
Fix function prolog codegen whe coerce-to type is a struct.

This changes function prolog in such a way as to avoid out-of-bounds
stack store in the case when coerce-to type has a larger storage size
than the real argument type.

Fixes PR11905.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150238 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoAdd various tests for captures and the reaching scope of the lambda
Douglas Gregor [Fri, 10 Feb 2012 09:26:04 +0000 (09:26 +0000)]
Add various tests for captures and the reaching scope of the lambda
expression. Implement C++11 [expr.prim.lambda]p12's requirement that
capturing a variable will odr-use it.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150237 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoImplement the conversion to a function pointer for lambda expressions,
Douglas Gregor [Fri, 10 Feb 2012 08:36:38 +0000 (08:36 +0000)]
Implement the conversion to a function pointer for lambda expressions,
per C++ [expr.prim.lambda]p6.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150236 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoExtend CXXRecordDecl with a function that determines the mapping from
Douglas Gregor [Fri, 10 Feb 2012 07:45:31 +0000 (07:45 +0000)]
Extend CXXRecordDecl with a function that determines the mapping from
the variables captured by a lambda to the fields that store the
captured values. To be used in IRgen.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150235 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoUpdate to new resolution for DR1458. When taking the address of an object of
Richard Smith [Fri, 10 Feb 2012 07:41:06 +0000 (07:41 +0000)]
Update to new resolution for DR1458. When taking the address of an object of
incomplete class type which has an overloaded operator&, it's now just
unspecified whether the overloaded operator or the builtin is used.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150234 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoRemove stray semi-colon.
Daniel Dunbar [Fri, 10 Feb 2012 06:00:29 +0000 (06:00 +0000)]
Remove stray semi-colon.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150231 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoMove -Wswitch from -Wmost to -Wall, consitent with GCC.
David Blaikie [Fri, 10 Feb 2012 05:15:16 +0000 (05:15 +0000)]
Move -Wswitch from -Wmost to -Wall, consitent with GCC.

This is a relatively noisy warning for a codebase not explicitly designed for
it (effectively enforcing a stylistic constraint about the use of defaults
in switches over enums) & there's nothing Clang does to clean up the noise
when compared to GCC's implementation so the same decision seems suitable.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150230 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoRevert r145999. This turned out to be a bad idea. Unfortunately, 'id' is used so...
Ted Kremenek [Fri, 10 Feb 2012 02:45:47 +0000 (02:45 +0000)]
Revert r145999.  This turned out to be a bad idea.  Unfortunately, 'id' is used so profusely
in many APIs and large codebases that this made the deprecated warning trigger happy to
the point of not being useful.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150223 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoMake sure we convert struct layout pragmas to attributes for class templates the...
Eli Friedman [Fri, 10 Feb 2012 02:02:21 +0000 (02:02 +0000)]
Make sure we convert struct layout pragmas to attributes for class templates the same way we do for non-template classes.  <rdar://problem/10791194>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150221 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[analyzer] MallocChecker: add a list of false positives based on running
Anna Zaks [Fri, 10 Feb 2012 01:11:03 +0000 (01:11 +0000)]
[analyzer] MallocChecker: add a list of false positives based on running
the checker over postgres and sqlite.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150216 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[analyzer] MallocChecker Cleanup - harden against crashes, fix an error
Anna Zaks [Fri, 10 Feb 2012 01:11:00 +0000 (01:11 +0000)]
[analyzer] MallocChecker Cleanup - harden against crashes, fix an error
(use of return instead of continue), wording.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150215 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoobjc translator: mode modern abi stuff.
Fariborz Jahanian [Fri, 10 Feb 2012 00:04:22 +0000 (00:04 +0000)]
objc translator: mode modern abi stuff.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150212 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoRemove evil const_cast that's not needed anymore.
Bill Wendling [Thu, 9 Feb 2012 22:45:21 +0000 (22:45 +0000)]
Remove evil const_cast that's not needed anymore.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150210 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoSwitching to using dyn_cast_or_null, and fixing line endings in the test case.
Aaron Ballman [Thu, 9 Feb 2012 22:16:56 +0000 (22:16 +0000)]
Switching to using dyn_cast_or_null, and fixing line endings in the test case.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150209 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoUse SmallVector when we can instead of std::vector.
Bill Wendling [Thu, 9 Feb 2012 22:16:49 +0000 (22:16 +0000)]
Use SmallVector when we can instead of std::vector.

This looks like it had a small, but measurable performance improvement on -O0
compile time for our ObjC tests.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150208 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[analyzer] Proactively avoid inlining vararg functions and blocks until we properly...
Ted Kremenek [Thu, 9 Feb 2012 21:59:52 +0000 (21:59 +0000)]
[analyzer] Proactively avoid inlining vararg functions and blocks until we properly support them.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150207 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoobjc: If a method is not implemented in the category implementation but
Fariborz Jahanian [Thu, 9 Feb 2012 21:30:24 +0000 (21:30 +0000)]
objc: If a method is not implemented in the category implementation but
has been declared in its primary class, superclass,
or in one of their protocols, no need to issue unimplemented method.
// rdar://10823023

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150206 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoMake sure a variable with a C++ direct initializer triggers jump scope checking....
Eli Friedman [Thu, 9 Feb 2012 20:13:14 +0000 (20:13 +0000)]
Make sure a variable with a C++ direct initializer triggers jump scope checking.  Fixes PR10620 / <rdar://problem/9958362> .

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150204 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoexamples/analyzer-plugin/: unbreak build
Dylan Noblesmith [Thu, 9 Feb 2012 20:02:49 +0000 (20:02 +0000)]
examples/analyzer-plugin/: unbreak build

It was never updated for API changes in r149311/r149336/r149339
and r147688.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150202 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agocmake: create a relative symlink to clang, not absolute
Dylan Noblesmith [Thu, 9 Feb 2012 20:02:46 +0000 (20:02 +0000)]
cmake: create a relative symlink to clang, not absolute

Hardcoding the location of the build directory seems like it would
break at `make install`/packaging time.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150201 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoClass objects passed by value follow the same rules as structure objects.
Akira Hatanaka [Thu, 9 Feb 2012 19:54:16 +0000 (19:54 +0000)]
Class objects passed by value follow the same rules as structure objects.
Double fields of by-value class objects should be passed in floating point
registers.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150200 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoKill the brief and full explanation fields from StaticDiagInfoRec. They were unused...
Benjamin Kramer [Thu, 9 Feb 2012 19:38:26 +0000 (19:38 +0000)]
Kill the brief and full explanation fields from StaticDiagInfoRec. They were unused and wasted space for nothing.

- per PR11952.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150199 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoFix bugs in function MipsABIInfo::returnAggregateInRegs. Functions returning
Akira Hatanaka [Thu, 9 Feb 2012 18:49:26 +0000 (18:49 +0000)]
Fix bugs in function MipsABIInfo::returnAggregateInRegs. Functions returning
class objects follow the same rules as those returning struct objects.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150196 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoDon't allow deduction of a lambda result type from an initializer
Douglas Gregor [Thu, 9 Feb 2012 18:40:39 +0000 (18:40 +0000)]
Don't allow deduction of a lambda result type from an initializer
list; it is not an expression.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150194 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[libclang] Add a libclang test I neglected to commit.
Argyrios Kyrtzidis [Thu, 9 Feb 2012 18:31:22 +0000 (18:31 +0000)]
[libclang] Add a libclang test I neglected to commit.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150193 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[PCH] Add a PCH test.
Argyrios Kyrtzidis [Thu, 9 Feb 2012 18:31:19 +0000 (18:31 +0000)]
[PCH] Add a PCH test.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150192 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoTests for C++ [expr.prim.lambda]p5. We already implement all of these
Douglas Gregor [Thu, 9 Feb 2012 18:19:44 +0000 (18:19 +0000)]
Tests for C++ [expr.prim.lambda]p5. We already implement all of these
semantics.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150190 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoGetting Started: Add a missing "cd ../..".
Benjamin Kramer [Thu, 9 Feb 2012 16:04:50 +0000 (16:04 +0000)]
Getting Started: Add a missing "cd ../..".

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150181 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoUpdated information on how to perform command line testing on Windows when built...
Aaron Ballman [Thu, 9 Feb 2012 15:23:18 +0000 (15:23 +0000)]
Updated information on how to perform command line testing on Windows when built from MSVC.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150180 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoRemove unused fun.
Benjamin Kramer [Thu, 9 Feb 2012 12:05:18 +0000 (12:05 +0000)]
Remove unused fun.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150172 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoImplement return type deduction for lambdas per C++11
Douglas Gregor [Thu, 9 Feb 2012 10:18:50 +0000 (10:18 +0000)]
Implement return type deduction for lambdas per C++11
[expr.prim.lambda]p4, including the current suggested resolution of
core isue 975, which allows multiple return statements so long as the
types match. ExtWarn when user code is actually making use of this
extension.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150168 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoRestore the appropriate lexical declaration context for a lambda's
Douglas Gregor [Thu, 9 Feb 2012 08:52:43 +0000 (08:52 +0000)]
Restore the appropriate lexical declaration context for a lambda's
function call operator (to the lambda class). This allows us to IRgen
calls to simple (non-capturing) lambdas, e.g.,

  [](int i, int j) -> int { return i + j; }(1, 2)

Eli will be providing test cases as he brings up more IRgen.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150166 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoRemove the "unsupported" error for lambda expressions. It's annoying,
Douglas Gregor [Thu, 9 Feb 2012 08:26:42 +0000 (08:26 +0000)]
Remove the "unsupported" error for lambda expressions. It's annoying,
and rapidly becoming untrue.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150165 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoAdd a test for the non-aggregaticity of lambda types per C++11
Douglas Gregor [Thu, 9 Feb 2012 08:15:36 +0000 (08:15 +0000)]
Add a test for the non-aggregaticity of lambda types per C++11
[expr.prim.lambda].

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150164 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoImplement C++ [expr.prim.lambda]p2, which bans lambda expressions in
Douglas Gregor [Thu, 9 Feb 2012 08:14:43 +0000 (08:14 +0000)]
Implement C++ [expr.prim.lambda]p2, which bans lambda expressions in
unevaluated operands. Be certain that we're marking everything
referenced within a capture initializer as odr-used.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150163 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[PCH] Add some comments, per Ted's request.
Argyrios Kyrtzidis [Thu, 9 Feb 2012 07:46:54 +0000 (07:46 +0000)]
[PCH] Add some comments, per Ted's request.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150162 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoFix ASTReader::FinishedDeserializing().
Argyrios Kyrtzidis [Thu, 9 Feb 2012 07:31:52 +0000 (07:31 +0000)]
Fix ASTReader::FinishedDeserializing().

We were passing a decl to the consumer after all pending deserializations were finished
but this was not enough; due to processing by the consumer we may end up into yet another
deserialization process but the way FinishedDeserializing() was setup we would not ensure
that everything was fully deserialized before returning to the consumer.

Separate ASTReader::FinishedDeserializing() into two semantic actions.
The first is ensuring that a deserialization process ends up will fully deserialized decls/types even
if the process is started by the consumer.
The second is pushing "interesting" decls to the consumer; we make sure that we don't re-enter this
section recursively be checking a variable.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150160 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoDon't cache the artificial type for the this pointer, there's no
Eric Christopher [Thu, 9 Feb 2012 07:26:21 +0000 (07:26 +0000)]
Don't cache the artificial type for the this pointer, there's no
difference in the qual type. This is a workaround for the fact that
the type isn't artificial but the this decl is, however, we don't
have any way of representing it in the current metadata. For now,
however, just don't cache the full type.

Fixes rdar://10831526 and probably a couple of others.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150159 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[analyzer] MallocChecker: address a diagnostic "fixme".
Anna Zaks [Thu, 9 Feb 2012 06:48:19 +0000 (06:48 +0000)]
[analyzer] MallocChecker: address a diagnostic "fixme".

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150158 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoDR1359: A constexpr constructor does not need to initialize an empty struct or
Richard Smith [Thu, 9 Feb 2012 06:40:58 +0000 (06:40 +0000)]
DR1359: A constexpr constructor does not need to initialize an empty struct or
empty union. This still rejects anonymous member structs or unions which only
contain such empty class types, pending standard wording defining exactly what
an empty class type is.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150157 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[analyzer] Add custom path diagnostic to the Malloc Checker.
Anna Zaks [Thu, 9 Feb 2012 06:25:51 +0000 (06:25 +0000)]
[analyzer] Add custom path diagnostic to the Malloc Checker.

Very simple so far - we just highlight every allocation and release
site.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150156 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[analyzer] MallocChecker cleanup, more tests.
Anna Zaks [Thu, 9 Feb 2012 06:25:47 +0000 (06:25 +0000)]
[analyzer] MallocChecker cleanup, more tests.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150155 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[PCH] Set the DeclContext before doing any deserialization, to make sure internal
Argyrios Kyrtzidis [Thu, 9 Feb 2012 06:02:44 +0000 (06:02 +0000)]
[PCH] Set the DeclContext before doing any deserialization, to make sure internal
calls to Decl::getASTContext() by Decl's methods will find the TranslationUnitDecl
without crashing due to a parent declaration context still deserializing.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150153 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoCorrect comment Clang C++ use in production.
David Blaikie [Thu, 9 Feb 2012 03:57:02 +0000 (03:57 +0000)]
Correct comment Clang C++ use in production.

This was from way-back-when (r82583) when Clang's C++ support wasn't prime-time
yet. Production quality C++ was tested experimentally from r100119 and turned
on by default in r141063.

Patch by Justin Bogner.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150148 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoUse RAII object for cleanups.
Eli Friedman [Thu, 9 Feb 2012 03:47:20 +0000 (03:47 +0000)]
Use RAII object for cleanups.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150147 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoRefactor lambda IRGen so AggExprEmitter::VisitLambdaExpr does the right thing.
Eli Friedman [Thu, 9 Feb 2012 03:32:31 +0000 (03:32 +0000)]
Refactor lambda IRGen so AggExprEmitter::VisitLambdaExpr does the right thing.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150146 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoCWG issue 1405: mutable members are allowed in literal types, but can't undergo
Richard Smith [Thu, 9 Feb 2012 03:29:58 +0000 (03:29 +0000)]
CWG issue 1405: mutable members are allowed in literal types, but can't undergo
lvalue-to-rvalue conversions in constant expressions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150145 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoAttempting to initialize a union member that does not exist no longer crashes.
Aaron Ballman [Thu, 9 Feb 2012 03:29:06 +0000 (03:29 +0000)]
Attempting to initialize a union member that does not exist no longer crashes.

Patch by Remi Gacogne

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150144 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoBasic IRGen for LambdaExprs with captures.
Eli Friedman [Thu, 9 Feb 2012 03:19:12 +0000 (03:19 +0000)]
Basic IRGen for LambdaExprs with captures.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150141 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoA tiny bit more lambda IRGen.
Eli Friedman [Thu, 9 Feb 2012 02:56:22 +0000 (02:56 +0000)]
A tiny bit more lambda IRGen.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150140 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoFix a typo in the LambdaExpr class.
Eli Friedman [Thu, 9 Feb 2012 02:55:22 +0000 (02:55 +0000)]
Fix a typo in the LambdaExpr class.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150139 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoImplement capture-by-copy for arrays in lambdas.
Douglas Gregor [Thu, 9 Feb 2012 02:45:47 +0000 (02:45 +0000)]
Implement capture-by-copy for arrays in lambdas.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150138 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[PCH] Avoid using Decl::setAttrs() and Decl::setLexicalDeclContext() from the ASTRead...
Argyrios Kyrtzidis [Thu, 9 Feb 2012 02:44:08 +0000 (02:44 +0000)]
[PCH] Avoid using Decl::setAttrs() and Decl::setLexicalDeclContext() from the ASTReaderDecl
directly; they internally call Decl::getASTContext() which may crash if a declaration context
parent is still deserializing.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150137 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoDon't complain about the lack of a constructor for a lambda expression. They are...
Douglas Gregor [Thu, 9 Feb 2012 02:20:38 +0000 (02:20 +0000)]
Don't complain about the lack of a constructor for a lambda expression. They are constructed in different ways

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150136 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoWhen we create a non-static data member in the closure object for a
Douglas Gregor [Thu, 9 Feb 2012 02:12:34 +0000 (02:12 +0000)]
When we create a non-static data member in the closure object for a
capture, make sure we actually add the field.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150135 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoFactor the logic for capturing variables in a lambda into its own
Douglas Gregor [Thu, 9 Feb 2012 01:56:40 +0000 (01:56 +0000)]
Factor the logic for capturing variables in a lambda into its own
function; it's going to get longer soon. No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150132 91177308-0d34-0410-b5e6-96231b3b80d8