]> granicus.if.org Git - clang/log
clang
12 years agoIf a static data member of a class template which could be used in a constant
Richard Smith [Wed, 15 Feb 2012 02:42:50 +0000 (02:42 +0000)]
If a static data member of a class template which could be used in a constant
expression is referenced, defined, then referenced again, make sure we
instantiate it the second time it's referenced. This is the static data member
analogue of r150518.

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

12 years agoImplement DR1454. This allows all intermediate results in constant expressions
Richard Smith [Wed, 15 Feb 2012 02:18:13 +0000 (02:18 +0000)]
Implement DR1454. This allows all intermediate results in constant expressions
to be core constant expressions (including pointers and references to
temporaries), and makes constexpr calculations Turing-complete. A Turing machine
simulator is included as a testcase.

This opens up the possibilty of removing CCValue entirely, and removing some
copies from the constant evaluator in the process, but that cleanup is not part
of this change.

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

12 years ago[analyzer] Malloc checker: make a bit safer.
Anna Zaks [Wed, 15 Feb 2012 02:12:00 +0000 (02:12 +0000)]
[analyzer] Malloc checker: make a bit safer.

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

12 years agoFix typo in r150549.
Richard Smith [Wed, 15 Feb 2012 02:07:05 +0000 (02:07 +0000)]
Fix typo in r150549.

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

12 years agoSplit reinterpret_casts of member pointers out from CK_BitCast; this
John McCall [Wed, 15 Feb 2012 01:22:51 +0000 (01:22 +0000)]
Split reinterpret_casts of member pointers out from CK_BitCast; this
is general goodness because representations of member pointers are
not always equivalent across member pointer types on all ABIs
(even though this isn't really standard-endorsed).

Take advantage of the new information to teach IR-generation how
to do these reinterprets in constant initializers.  Make sure this
works when intermingled with hierarchy conversions (although
this is not part of our motivating use case).  Doing this in the
constant-evaluator would probably have been better, but that would
require a *lot* of extra structure in the representation of
constant member pointers:  you'd really have to track an arbitrary
chain of hierarchy conversions and reinterpretations in order to
get this right.  Ultimately, this seems less complex.  I also
wasn't quite sure how to extend the constant evaluator to handle
foldings that we don't actually want to treat as extended
constant expressions.

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

12 years agoImplement indexing support for lambdas in libclang (both kinds), as
Douglas Gregor [Wed, 15 Feb 2012 00:54:55 +0000 (00:54 +0000)]
Implement indexing support for lambdas in libclang (both kinds), as
well as improving the RecursiveASTVisitor's walk of lambda
expressions.

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

12 years agomodern objective-c translator: start writing the main class
Fariborz Jahanian [Wed, 15 Feb 2012 00:50:11 +0000 (00:50 +0000)]
modern objective-c translator: start writing the main class
meta-data.

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

12 years ago[analyzer] Add the Malloc checker to the list of tested checkers.
Anna Zaks [Wed, 15 Feb 2012 00:19:07 +0000 (00:19 +0000)]
[analyzer] Add the Malloc checker to the list of tested checkers.

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

12 years ago[analyzer] Malloc Checker: Add another false positive as a todo test.
Anna Zaks [Wed, 15 Feb 2012 00:11:28 +0000 (00:11 +0000)]
[analyzer] Malloc Checker: Add another false positive as a todo test.

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

12 years ago[analyzer] Malloc Checker: add support for reallocf, which always frees
Anna Zaks [Wed, 15 Feb 2012 00:11:25 +0000 (00:11 +0000)]
[analyzer] Malloc Checker: add support for reallocf, which always frees
the passed in pointer on failure.

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

12 years ago[analyzer] Malloc Checker: add support for valloc + minor code
Anna Zaks [Wed, 15 Feb 2012 00:11:22 +0000 (00:11 +0000)]
[analyzer] Malloc Checker: add support for valloc + minor code
hardening.

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

12 years agoExtend all-std-headers.cpp to include C++11 headers when building in C++11 mode.
Richard Smith [Tue, 14 Feb 2012 23:06:14 +0000 (23:06 +0000)]
Extend all-std-headers.cpp to include C++11 headers when building in C++11 mode.
Conditionally include headers which older STL implementations don't provide.

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

12 years agoAdvertize support for constexpr.
Richard Smith [Tue, 14 Feb 2012 22:56:17 +0000 (22:56 +0000)]
Advertize support for constexpr.

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

12 years agoI hereby declare that all remaining constexpr issues are bugs, not unimplemented
Richard Smith [Tue, 14 Feb 2012 22:39:23 +0000 (22:39 +0000)]
I hereby declare that all remaining constexpr issues are bugs, not unimplemented
features. :)

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

12 years agoconstexpr: evaluation support for nullptr comparisons.
Richard Smith [Tue, 14 Feb 2012 22:35:28 +0000 (22:35 +0000)]
constexpr: evaluation support for nullptr comparisons.

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

12 years agoImplement C++ core issue 974, which permits default arguments for
Douglas Gregor [Tue, 14 Feb 2012 22:28:59 +0000 (22:28 +0000)]
Implement C++ core issue 974, which permits default arguments for
lambda expressions. Because these issue was pulled back from Ready
status at the Kona meeting, we still emit an ExtWarn when using
default arguments for lambda expressions.

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

12 years agoIf a constexpr function template specialization is referenced, and then the
Richard Smith [Tue, 14 Feb 2012 22:25:15 +0000 (22:25 +0000)]
If a constexpr function template specialization is referenced, and then the
template is defined, and then the specialization is referenced again, don't
forget to instantiate the template on the second reference. Use the source
location of the first reference as the point of instantiation, though.

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

12 years ago[libclang] Indexing: only index implicit template instantiations via an opt-in indexi...
Argyrios Kyrtzidis [Tue, 14 Feb 2012 22:23:11 +0000 (22:23 +0000)]
[libclang] Indexing: only index implicit template instantiations via an opt-in indexing option.

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

12 years agoGeneralize -Wempty-body: warn when statement body is empty (closes: PR11329)
Dmitri Gribenko [Tue, 14 Feb 2012 22:14:32 +0000 (22:14 +0000)]
Generalize -Wempty-body: warn when statement body is empty (closes: PR11329)

* if, switch, range-based for: warn if semicolon is on the same line.
* for, while: warn if semicolon is on the same line and either next
statement is compound statement or next statement has more
indentation.

Replacing the semicolon with {} or moving the semicolon to the next
line will always silence the warning.

Tests from SemaCXX/if-empty-body.cpp merged into SemaCXX/warn-empty-body.cpp.

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

12 years ago[analyzer] Make Malloc Checker optimistic in presence of inlining.
Anna Zaks [Tue, 14 Feb 2012 21:55:24 +0000 (21:55 +0000)]
[analyzer] Make Malloc Checker optimistic in presence of inlining.
(In response of Ted's review of r150112.)

This moves the logic which checked if a symbol escapes through a
parameter to invalidateRegionCallback (instead of post CallExpr visit.)

To accommodate the change, added a CallOrObjCMessage parameter to
checkRegionChanges callback.

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

12 years agoRemove recusive expression visitation in ExprEngine::VisitIncrementDecrementOperator().
Ted Kremenek [Tue, 14 Feb 2012 21:38:30 +0000 (21:38 +0000)]
Remove recusive expression visitation in ExprEngine::VisitIncrementDecrementOperator().

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

12 years agoPending clear answer from WG21 on whether core issue 903 is intended to apply to
Richard Smith [Tue, 14 Feb 2012 21:38:30 +0000 (21:38 +0000)]
Pending clear answer from WG21 on whether core issue 903 is intended to apply to
C++11 or just C++17, restrict the set of null pointer constants in C++11 mode
back to those which were considered null in C++98.

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

12 years agoRemove recursive visitation in ExprEngine for UO_Not, UO_Minus, UO_LNot.
Ted Kremenek [Tue, 14 Feb 2012 21:31:00 +0000 (21:31 +0000)]
Remove recursive visitation in ExprEngine for UO_Not, UO_Minus, UO_LNot.

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

12 years agoRemove recursive visitation in ExprEngine for UO_Deref, UO_AddrOf, and UO_Extension.
Ted Kremenek [Tue, 14 Feb 2012 21:27:05 +0000 (21:27 +0000)]
Remove recursive visitation in ExprEngine for UO_Deref, UO_AddrOf, and UO_Extension.

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

12 years agoRemove ExprEngine recursive visitation of unary UO_Imag operation.
Ted Kremenek [Tue, 14 Feb 2012 21:27:02 +0000 (21:27 +0000)]
Remove ExprEngine recursive visitation of unary UO_Imag operation.

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

12 years agoFurther remove some recursive visitiation in ExprEngine that is no longer needed...
Ted Kremenek [Tue, 14 Feb 2012 21:26:59 +0000 (21:26 +0000)]
Further remove some recursive visitiation in ExprEngine that is no longer needed because the CFG is fully linearized.

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

12 years agoCheck the return type of lambda expressions.
Douglas Gregor [Tue, 14 Feb 2012 21:20:44 +0000 (21:20 +0000)]
Check the return type of lambda expressions.

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

12 years agoPR11650: Implement resolution of core issue 1301. Value initialization can't be
Richard Smith [Tue, 14 Feb 2012 21:14:13 +0000 (21:14 +0000)]
PR11650: Implement resolution of core issue 1301. Value initialization can't be
used to construct an object of union type with a deleted default constructor
(plus fixes for some related value-initialization corner cases).

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

12 years agoWarn about non-int main() results in GNU C mode instead of erroring.
John McCall [Tue, 14 Feb 2012 19:50:52 +0000 (19:50 +0000)]
Warn about non-int main() results in GNU C mode instead of erroring.

Based on a patch by Vasiliy Korchagin!

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

12 years agomore objective-c translator for modern abi.
Fariborz Jahanian [Tue, 14 Feb 2012 19:31:35 +0000 (19:31 +0000)]
more objective-c translator for modern abi.
metadata for protocol definitions used on
class qualifiers.

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

12 years agoImplement support for lambda capture pack expansions, e.g.,
Douglas Gregor [Tue, 14 Feb 2012 19:27:52 +0000 (19:27 +0000)]
Implement support for lambda capture pack expansions, e.g.,

  [&values...] { print(values...); }

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

12 years agoUse several weighted factors to determine typo candidate viablity.
Kaelyn Uhrain [Tue, 14 Feb 2012 18:56:48 +0000 (18:56 +0000)]
Use several weighted factors to determine typo candidate viablity.

Replace the simple Levenshtein edit distance for typo correction
candidates--and the hacky way adding namespace qualifiers would affect
the edit distance--with a synthetic "edit distance" comprised of several
factors and their relative weights. This also allows the typo correction
callback object to convey more information about the viability of a
correction candidate than simply viable or not viable.

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

12 years agoSimplify and robustify lambda PCH test
Douglas Gregor [Tue, 14 Feb 2012 18:47:12 +0000 (18:47 +0000)]
Simplify and robustify lambda PCH test

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

12 years agoImplement AST (de-)serialization for lambda expressions.
Douglas Gregor [Tue, 14 Feb 2012 17:54:36 +0000 (17:54 +0000)]
Implement AST (de-)serialization for lambda expressions.

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

12 years agomore modern objc translator. Focusing on metadata for methods.
Fariborz Jahanian [Tue, 14 Feb 2012 17:19:02 +0000 (17:19 +0000)]
more modern objc translator. Focusing on metadata for methods.

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

12 years agoinclude clang's config.h unconditionally (v2)
Dylan Noblesmith [Tue, 14 Feb 2012 15:54:49 +0000 (15:54 +0000)]
include clang's config.h unconditionally (v2)

And remove HAVE_CLANG_CONFIG_H, now that the header is generated
in the autoconf build, too.

Reverts r149571/restores r149504, now that config.h is generated
correctly by LLVM's configure in all build configurations.

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

12 years agoUse a simpler (and more efficient) pattern to pad vectors.
Benjamin Kramer [Tue, 14 Feb 2012 12:06:21 +0000 (12:06 +0000)]
Use a simpler (and more efficient) pattern to pad vectors.

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

12 years agoFix crash-on-invalid for 'operator int[]()' in C++11.
David Blaikie [Tue, 14 Feb 2012 09:00:46 +0000 (09:00 +0000)]
Fix crash-on-invalid for 'operator int[]()' in C++11.

Signed off by Richard Smith.

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

12 years agoFix use-after-free introduced by me being an idiot.
Ted Kremenek [Tue, 14 Feb 2012 06:54:46 +0000 (06:54 +0000)]
Fix use-after-free introduced by me being an idiot.

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

12 years agoRemove useless if statement.
Eli Friedman [Tue, 14 Feb 2012 03:54:45 +0000 (03:54 +0000)]
Remove useless if statement.

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

12 years agoAdd a coverage test for lambda expression IRGen.
Eli Friedman [Tue, 14 Feb 2012 03:07:59 +0000 (03:07 +0000)]
Add a coverage test for lambda expression IRGen.

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

12 years agoImplement new DiagnosticsRenderer that packages notes retrieved by clang_getDiagnosti...
Ted Kremenek [Tue, 14 Feb 2012 02:46:03 +0000 (02:46 +0000)]
Implement new DiagnosticsRenderer that packages notes retrieved by clang_getDiagnosticSetFromTU() as
child diagnostics of primary diagnostics.  By using the DiagnosticRenderer, these Diagnostics now
match with those generated for serialized diagnostics.

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

12 years agoRefactor DiagnosticRenderer and SDiagsRenderer to have some functionality
Ted Kremenek [Tue, 14 Feb 2012 02:46:00 +0000 (02:46 +0000)]
Refactor DiagnosticRenderer and SDiagsRenderer to have some functionality
pulled into DiagnosticNoteRenderer, and common DiagnosticRenderer that
assumes that all custom diagnostic messages are notes.  Also extend
DiagnosticRenderer to work with StoredDiagnostics in preparation for
subsequent changes.

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

12 years agoAdd helper methods to StoredDiagnostic.
Ted Kremenek [Tue, 14 Feb 2012 02:43:12 +0000 (02:43 +0000)]
Add helper methods to StoredDiagnostic.

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

12 years agoFix another issue introduced by the proposed wording for core issue 1358: since
Richard Smith [Tue, 14 Feb 2012 02:33:50 +0000 (02:33 +0000)]
Fix another issue introduced by the proposed wording for core issue 1358: since
the instantiation of a constexpr function temploid is now always constexpr, a
defaulted constexpr function temploid is often ill-formed by the rule in
[dcl.fct.def.default]p2 that an explicitly-defaulted constexpr function must
have a constexpr implicit definition. To avoid making loads of completely
reasonable code ill-formed, do not apply that rule to templates.

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

12 years agoImplement IRGen of lambda expressions which capture arrays.
Eli Friedman [Tue, 14 Feb 2012 02:31:03 +0000 (02:31 +0000)]
Implement IRGen of lambda expressions which capture arrays.

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

12 years agoRefactor out new function EmitInitializerForField from EmitMemberInitializer. The...
Eli Friedman [Tue, 14 Feb 2012 02:15:49 +0000 (02:15 +0000)]
Refactor out new function EmitInitializerForField from EmitMemberInitializer.  The new function will be used to initialize the fields of lambda expressions.

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

12 years ago[analyzer] Malloc Checker: realloc: add dependency between the symbols
Anna Zaks [Tue, 14 Feb 2012 00:26:13 +0000 (00:26 +0000)]
[analyzer] Malloc Checker: realloc: add dependency between the symbols
in realloc map.

If there is no dependency, the reallocated ptr will get garbage
collected before we know that realloc failed, which would lead us to
missing a memory leak warning.

Also added new test cases, which we can handle now.
Plus minor cleanups.

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

12 years agoSimple test ensuring that we perform direct initialization when copy-capturing in...
Douglas Gregor [Tue, 14 Feb 2012 00:03:38 +0000 (00:03 +0000)]
Simple test ensuring that we perform direct initialization when copy-capturing in lambdas

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

12 years agoLink together the call operator produced from transforming a lambda
Douglas Gregor [Tue, 14 Feb 2012 00:00:48 +0000 (00:00 +0000)]
Link together the call operator produced from transforming a lambda
expression with the original call operator, so that we don't try to
separately instantiate the call operator. Test and tweak a few more
bits for template instantiation of lambda expressions.

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

12 years agoMark the cxa_guard_{abort,acquire,release} functions nounwind.
Nick Lewycky [Mon, 13 Feb 2012 23:45:02 +0000 (23:45 +0000)]
Mark the cxa_guard_{abort,acquire,release} functions nounwind.

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

12 years agoDeal with a horrible C++11 special case. If a non-literal type has a constexpr
Richard Smith [Mon, 13 Feb 2012 22:16:19 +0000 (22:16 +0000)]
Deal with a horrible C++11 special case. If a non-literal type has a constexpr
constructor, and that constructor is used to initialize an object of static
storage duration such that all members and bases are initialized by constant
expressions, constant initialization is performed. In this case, the object
can still have a non-trivial destructor, and if it does, we must emit a dynamic
initializer which performs no initialization and instead simply registers that
destructor.

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

12 years agoAdd a subgroup of -Wreturn-type, -Wreturn-type-c-linkage.
Matt Beaumont-Gay [Mon, 13 Feb 2012 22:04:08 +0000 (22:04 +0000)]
Add a subgroup of -Wreturn-type, -Wreturn-type-c-linkage.

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

12 years agoIntroduce support for template instantiation of lambda
Douglas Gregor [Mon, 13 Feb 2012 22:00:16 +0000 (22:00 +0000)]
Introduce support for template instantiation of lambda
expressions. This is mostly a simple refact, splitting the main "start
a lambda expression" function into smaller chunks that are driven
either from the parser (Sema::ActOnLambdaExpr) or during AST
transformation (TreeTransform::TransformLambdaExpr). A few minor
interesting points:

  - Added new entry points for TreeTransform, so that we can
  explicitly establish the link between the lambda closure type in the
  template and the lambda closure type in the instantiation.
  - Added a bit into LambdaExpr specifying whether it had an explicit
  result type or not. We should have had this anyway.

This code is 'lightly' tested.

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

12 years agomodern objc translator. More ivar rewrite work.
Fariborz Jahanian [Mon, 13 Feb 2012 21:34:45 +0000 (21:34 +0000)]
modern objc translator. More ivar rewrite work.

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

12 years agoobjc modern translator. ivar offset symbols.
Fariborz Jahanian [Mon, 13 Feb 2012 20:59:02 +0000 (20:59 +0000)]
objc modern translator. ivar offset symbols.

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

12 years ago[analyzer] Malloc Checker: realloc: correct the way we are handing the
Anna Zaks [Mon, 13 Feb 2012 20:57:07 +0000 (20:57 +0000)]
[analyzer] Malloc Checker: realloc: correct the way we are handing the
case when size is 0.

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

12 years agoAdd a script that produces a list of all diagnostics that are defined in
Dmitri Gribenko [Mon, 13 Feb 2012 20:21:52 +0000 (20:21 +0000)]
Add a script that produces a list of all diagnostics that are defined in
Diagnostic*.td files but not used in sources.

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

12 years agoRemove unused diagnostics from include/clang/Basic/Diagnostic*.td files.
Dmitri Gribenko [Mon, 13 Feb 2012 20:13:24 +0000 (20:13 +0000)]
Remove unused diagnostics from include/clang/Basic/Diagnostic*.td files.

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

12 years agoDon't route explicit construction via list-initialization through the functional...
Sebastian Redl [Mon, 13 Feb 2012 19:55:43 +0000 (19:55 +0000)]
Don't route explicit construction via list-initialization through the functional cast code path. It sometimes does the wrong thing, produces horrible error messages, and is just unnecessary.

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

12 years agoSink variable into assert
Matt Beaumont-Gay [Mon, 13 Feb 2012 19:29:45 +0000 (19:29 +0000)]
Sink variable into assert

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

12 years agoobjective-c translator: more rewriting of ivar types
Fariborz Jahanian [Mon, 13 Feb 2012 18:57:49 +0000 (18:57 +0000)]
objective-c translator: more rewriting of ivar types
into a c-type which closely matches the objective-c type.

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

12 years agoWhen generating diagnostic information due to a clang failure, allow multiple
Chad Rosier [Mon, 13 Feb 2012 18:16:28 +0000 (18:16 +0000)]
When generating diagnostic information due to a clang failure, allow multiple
-arch options if the're all the same.

Patch by Jeremy Huddleston.
rdar://10849701

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

12 years ago[analyzer] Malloc checker: rework realloc handling:
Anna Zaks [Mon, 13 Feb 2012 18:05:39 +0000 (18:05 +0000)]
[analyzer] Malloc checker: rework realloc handling:

1) Support the case when realloc fails to reduce False Positives. (We
essentially need to restore the state of the pointer being reallocated.)

2) Realloc behaves differently under special conditions (from pointer is
null, size is 0). When detecting these cases, we should consider
under-constrained states (size might or might not be 0). The
old version handled this in a very hacky way. The code did not
differentiate between definite and possible (no consideration for
under-constrained states). Further, after processing each special case,
the realloc processing function did not return but chained to the next
special case processing. So you could end up in an execution in which
you first see the states in which size is 0 and realloc ~ free(),
followed by the states corresponding to size is not 0 followed by the
evaluation of the regular realloc behavior.

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

12 years agoSplit the storage of lambda information between the LambdaExpr and the
Douglas Gregor [Mon, 13 Feb 2012 17:20:40 +0000 (17:20 +0000)]
Split the storage of lambda information between the LambdaExpr and the
CXXRecordDecl in a way that actually makes some sense:
  - LambdaExpr contains all of the information for initializing the
  lambda object, including the capture initializers and associated
  array index variables.
  - CXXRecordDecl's LambdaDefinitionData contains the captures, which
  are needed to understand the captured variable references in the
  body of the lambda.

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

12 years agoKeep track of the set of array index variables we use when we
Douglas Gregor [Mon, 13 Feb 2012 16:35:30 +0000 (16:35 +0000)]
Keep track of the set of array index variables we use when we
synthesize a by-copy captured array in a lambda. This information will
be needed by IR generation.

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

12 years agoRemove empty directories left behind by git-svn.
Benjamin Kramer [Mon, 13 Feb 2012 16:32:02 +0000 (16:32 +0000)]
Remove empty directories left behind by git-svn.

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

12 years agoDon't allocate unused storage for captures/capture initializers in lambda expressions
Douglas Gregor [Mon, 13 Feb 2012 15:51:35 +0000 (15:51 +0000)]
Don't allocate unused storage for captures/capture initializers in lambda expressions

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

12 years agoMove the storage of lambda captures and capture initializers from
Douglas Gregor [Mon, 13 Feb 2012 15:44:47 +0000 (15:44 +0000)]
Move the storage of lambda captures and capture initializers from
LambdaExpr over to the CXXRecordDecl. This allows us to eliminate the
back-link from the closure type to the LambdaExpr, which will simplify
and lazify AST deserialization.

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

12 years agoAdd back in the code to create forward decls using temporary mdnodes.
Eric Christopher [Mon, 13 Feb 2012 15:08:45 +0000 (15:08 +0000)]
Add back in the code to create forward decls using temporary mdnodes.

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

12 years agoTestcase for previous commit.
Eric Christopher [Mon, 13 Feb 2012 15:04:15 +0000 (15:04 +0000)]
Testcase for previous commit.

PR11970.

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

12 years agoTemporarily walk back a few of my recent debug info limiting changes
Eric Christopher [Mon, 13 Feb 2012 14:56:11 +0000 (14:56 +0000)]
Temporarily walk back a few of my recent debug info limiting changes
while reworking how we handle wanting to emit only parts of structures.

Fixes PR11970.

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

12 years agoStaticAnalyzer/Core: fix MSVC build
Dylan Noblesmith [Mon, 13 Feb 2012 14:22:35 +0000 (14:22 +0000)]
StaticAnalyzer/Core: fix MSVC build

Fix build breakage from r150378: MSVC only allows taking the
address of a member function using the &ClassName::Function
syntax.# It was giving

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

12 years agodrop more llvm:: prefixes on SmallString<>
Dylan Noblesmith [Mon, 13 Feb 2012 12:32:26 +0000 (12:32 +0000)]
drop more llvm:: prefixes on SmallString<>

More cleanup after r149799.

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

12 years agodrop more llvm:: prefixes on OwningPtr<>
Dylan Noblesmith [Mon, 13 Feb 2012 12:32:21 +0000 (12:32 +0000)]
drop more llvm:: prefixes on OwningPtr<>

More cleanup after r149798.

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

12 years agoexamples/analyzer-plugin: hook up to build
Dylan Noblesmith [Mon, 13 Feb 2012 12:32:15 +0000 (12:32 +0000)]
examples/analyzer-plugin: hook up to build

This was never being compiled at all and was bitrotting
as a result.

Also compile SampleAnalyzerPlugin as a module, not a library,
and fix a mistake with not passing the source files
to add_clang_library().

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

12 years agoFix typo in PrintfConversionSpecifier::isDoubleArg()
Hans Wennborg [Mon, 13 Feb 2012 10:32:27 +0000 (10:32 +0000)]
Fix typo in PrintfConversionSpecifier::isDoubleArg()

This makes the printf diagnostics issue warnigns for %a, %A, %e, etc.
when used with the wrong argument.

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

12 years agoUpdate constexpr implementation to match CWG's chosen approach for core issues
Richard Smith [Mon, 13 Feb 2012 03:54:03 +0000 (03:54 +0000)]
Update constexpr implementation to match CWG's chosen approach for core issues
1358, 1360, 1452 and 1453.
 - Instantiations of constexpr functions are always constexpr. This removes the
   need for separate declaration/definition checking, which is now gone.
 - This makes it possible for a constexpr function to be virtual, if they are
   only dependently virtual. Virtual calls to such functions are not constant
   expressions.
 - Likewise, it's now possible for a literal type to have virtual base classes.
   A constexpr constructor for such a type cannot actually produce a constant
   expression, though, so add a special-case diagnostic for a constructor call
   to such a type rather than trying to evaluate it.
 - Classes with trivial default constructors (for which value initialization can
   produce a fully-initialized value) are considered literal types.
 - Classes with volatile members are not literal types.
 - constexpr constructors can be members of non-literal types. We do not yet use
   static initialization for global objects constructed in this way.

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

12 years agoDelete a simplistic helper function now that llvm::Triple can provide
Chandler Carruth [Mon, 13 Feb 2012 02:02:09 +0000 (02:02 +0000)]
Delete a simplistic helper function now that llvm::Triple can provide
this functionality.

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

12 years agomore of rewriting ivar types.
Fariborz Jahanian [Sun, 12 Feb 2012 21:36:23 +0000 (21:36 +0000)]
more of rewriting ivar types.

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

12 years agoMove -Wdangling-else under -Wparentheses to be backwards compatibile with GCC.
David Blaikie [Sun, 12 Feb 2012 19:51:50 +0000 (19:51 +0000)]
Move -Wdangling-else under -Wparentheses to be backwards compatibile with GCC.

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

12 years agoImplement the standard decltype() semantics described in C++11
Douglas Gregor [Sun, 12 Feb 2012 18:57:57 +0000 (18:57 +0000)]
Implement the standard decltype() semantics described in C++11
[dcl.type.simple]p4, which treats all xvalues as returning T&&. We had
previously implemented a pre-standard variant of decltype() that
doesn't cope with, e.g., static_ast<T&&>(e) very well.

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

12 years agoWithin the body of a lambda expression, decltype((x)) for an
Douglas Gregor [Sun, 12 Feb 2012 18:42:33 +0000 (18:42 +0000)]
Within the body of a lambda expression, decltype((x)) for an
id-expression 'x' will compute the type based on the assumption that
'x' will be captured, even if it isn't captured, per C++11
[expr.prim.lambda]p18. There are two related refactors that go into
implementing this:

  1) Split out the check that determines whether we should capture a
  particular variable reference, along with the computation of the
  type of the field, from the actual act of capturing the
  variable.
  2) Always compute the result of decltype() within Sema, rather than
  AST, because the decltype() computation is now context-sensitive.

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

12 years agoProper initializer list support for new expressions and type construct expressions...
Sebastian Redl [Sun, 12 Feb 2012 18:41:05 +0000 (18:41 +0000)]
Proper initializer list support for new expressions and type construct expressions. Array new still missing.

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

12 years agoLambdas have a deleted default constructor and a deleted copy
Douglas Gregor [Sun, 12 Feb 2012 17:34:23 +0000 (17:34 +0000)]
Lambdas have a deleted default constructor and a deleted copy
assignment operator, per C++ [expr.prim.lambda]p19. Make it so.

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

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