]> granicus.if.org Git - clang/log
clang
12 years agoStart of IRGen for lambda conversion operators.
Eli Friedman [Thu, 16 Feb 2012 01:37:33 +0000 (01:37 +0000)]
Start of IRGen for lambda conversion operators.

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

12 years agoUse the new method for specifying garbage collection metadata in the module.
Bill Wendling [Thu, 16 Feb 2012 01:13:30 +0000 (01:13 +0000)]
Use the new method for specifying garbage collection metadata in the module.

The garbage collection metadata needs to be merged "intelligently", when two or
more modules are linked together, and not merely appended. (Appending creates a
section which is too large.) The module flags metadata method is the way to do
this.
<rdar://problem/8198537>

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

12 years ago[libclang] Do index statements inside a type source info. rdar://10872758
Argyrios Kyrtzidis [Thu, 16 Feb 2012 01:12:04 +0000 (01:12 +0000)]
[libclang] Do index statements inside a type source info. rdar://10872758

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

12 years agoImplicitly define a lambda's conversion functions (to function
Douglas Gregor [Thu, 16 Feb 2012 01:06:16 +0000 (01:06 +0000)]
Implicitly define a lambda's conversion functions (to function
pointers and block pointers). We use dummy definitions to keep the
invariant that an implicit, used definition has a body; IR generation
will substitute the actual contents, since they can't be represented
as C++.

For the block pointer case, compute the copy-initialization needed to
capture the lambda object in the block, which IR generation will need
later.

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

12 years agoTeach clang to add metadata tags to calls and invokes in ObjC with
Dan Gohman [Thu, 16 Feb 2012 00:57:37 +0000 (00:57 +0000)]
Teach clang to add metadata tags to calls and invokes in ObjC with
-fno-objc-arc-exceptions. This will allow the optimizer to perform
optimizations which are only safe under that flag.

This is a part of rdar://10803830.

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

12 years agoMark the parenthesized array member initialization diagnostic as DefaultError,
Richard Smith [Thu, 16 Feb 2012 00:54:02 +0000 (00:54 +0000)]
Mark the parenthesized array member initialization diagnostic as DefaultError,
and move it out of -Wgnu so that -Wno-gnu leaves it enabled. As requested by
Eli.

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

12 years agoStart off release notes for clang 3.1 with reference to C11 anonymous structs
Richard Smith [Thu, 16 Feb 2012 00:32:27 +0000 (00:32 +0000)]
Start off release notes for clang 3.1 with reference to C11 anonymous structs
and unions, and C++11 generalized constant expressions.

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

12 years agoobjc-arc: For arc's ivar layout, treat __unsafe_unretained ivars
Fariborz Jahanian [Thu, 16 Feb 2012 00:15:02 +0000 (00:15 +0000)]
objc-arc: For arc's ivar layout, treat __unsafe_unretained ivars
as unscanned. // rdar://10832643

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

12 years agoRevert "Add a completed/incomplete type difference. This allows us to have"
Eric Christopher [Wed, 15 Feb 2012 23:51:20 +0000 (23:51 +0000)]
Revert "Add a completed/incomplete type difference. This allows us to have"

This reverts commit 9a68d4584afcd0853b930bd80235b58736e785b4.

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

12 years agoAdd a completed/incomplete type difference. This allows us to have
Eric Christopher [Wed, 15 Feb 2012 23:25:18 +0000 (23:25 +0000)]
Add a completed/incomplete type difference. This allows us to have
partial types for contexts and forward decls while allowing us to
complete types later on for debug purposes.

This piggy-backs on the metadata replacement and rauw changes
for temporary nodes and takes advantage of the incremental
support I added in earlier. This allows us to, if we decide,
to limit adding methods and variables to structures in order
to limit the amount of debug information output into a .o file.

The caching is a bit complicated though so any thoughts on
untangling that are welcome.

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

12 years agoSilence a valgrind warning, and remove an unused var.
Kaelyn Uhrain [Wed, 15 Feb 2012 22:59:03 +0000 (22:59 +0000)]
Silence a valgrind warning, and remove an unused var.

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

12 years agoSupport GCC's bug^Wextension allowing class array members to be initalized by a
Richard Smith [Wed, 15 Feb 2012 22:38:09 +0000 (22:38 +0000)]
Support GCC's bug^Wextension allowing class array members to be initalized by a
parenthesized braced-init-list in the base/member initialization list.

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

12 years agoImprove typo correction involving nested name specifiers.
Kaelyn Uhrain [Wed, 15 Feb 2012 22:14:18 +0000 (22:14 +0000)]
Improve typo correction involving nested name specifiers.

Snooping in other namespaces when the identifier being corrected is
already qualified (i.e. a valid CXXScopeSpec is passed to CorrectTypo)
and ranking synthesized namespace qualifiers relative to the existing
qualifier is now performed. Support for disambiguating the string
representation of synthesized namespace qualifers has also been added
(the change to test/Parser/cxx-using-directive.cpp is an example of an
ambiguous relative qualifier).

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

12 years agoLambda closure types have a conversion function to a block pointer
Douglas Gregor [Wed, 15 Feb 2012 22:08:38 +0000 (22:08 +0000)]
Lambda closure types have a conversion function to a block pointer
with the same parameter types and return type as the function call
operator. This is the real answer to

  http://stackoverflow.com/questions/4148242/is-it-possible-to-convert-a-c0x-lambda-to-a-clang-block

:)

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

12 years agoobjective-c translator: fixes an obscure rewriting bug
Fariborz Jahanian [Wed, 15 Feb 2012 22:01:47 +0000 (22:01 +0000)]
objective-c translator: fixes an obscure rewriting bug
which attempted to rewrite the same meta-data twice.

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

12 years agoFactor the construction of the lambda-to-function-pointer conversion function declara...
Douglas Gregor [Wed, 15 Feb 2012 22:00:51 +0000 (22:00 +0000)]
Factor the construction of the lambda-to-function-pointer conversion function declaration into a separate function. No functionality change

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

12 years agoProvide common include for all diagnostic headers.
David Blaikie [Wed, 15 Feb 2012 21:58:34 +0000 (21:58 +0000)]
Provide common include for all diagnostic headers.

Reviewed by Ted Kremenek.

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

12 years agoStore the warning option corresponding to a diagnostics as an index into the option...
Benjamin Kramer [Wed, 15 Feb 2012 20:57:03 +0000 (20:57 +0000)]
Store the warning option corresponding to a diagnostics as an index into the option table instead of storing the name.

Another 8 bytes + relocation removed from every diagnostic on x86_64.

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

12 years agoRemove the unuseful -fdiagnostics-show-name
David Blaikie [Wed, 15 Feb 2012 19:45:34 +0000 (19:45 +0000)]
Remove the unuseful -fdiagnostics-show-name

This option was added in r129614 and doesn't have any use case that I'm aware
of. It's possible that external tools are using these names - and if that's
the case we can certainly reassess the functionality, but for now it lets us
shave out a few unneeded bits from clang.

Move the "StaticDiagNameIndex" table into the only remaining consumer, diagtool.
This removes the actual diagnostic name strings from clang entirely.

Reviewed by Chris Lattner & Ted Kremenek.

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

12 years agoWhen overload resolution picks an implicitly-deleted special member
Douglas Gregor [Wed, 15 Feb 2012 19:33:52 +0000 (19:33 +0000)]
When overload resolution picks an implicitly-deleted special member
function, provide a specialized diagnostic that indicates the kind of
special member function (default constructor, copy assignment
operator, etc.) and that it was implicitly deleted. Add a hook where
we can provide more detailed information later.

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

12 years agoAdd some Solaris include paths and fix a -lgcc_eh that apparently should be -lgcc_s.
David Chisnall [Wed, 15 Feb 2012 18:24:31 +0000 (18:24 +0000)]
Add some Solaris include paths and fix a -lgcc_eh that apparently should be -lgcc_s.

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

12 years agoTweak comment above DiagGroup<"all">.
Nico Weber [Wed, 15 Feb 2012 18:18:51 +0000 (18:18 +0000)]
Tweak comment above DiagGroup<"all">.

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

12 years agoA little more lambda capture initialization diagnostics cleanup
Douglas Gregor [Wed, 15 Feb 2012 17:05:32 +0000 (17:05 +0000)]
A little more lambda capture initialization diagnostics cleanup

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

12 years agoIntroduce a new initialization entity for lambda captures, and
Douglas Gregor [Wed, 15 Feb 2012 16:57:26 +0000 (16:57 +0000)]
Introduce a new initialization entity for lambda captures, and
specialize location information and diagnostics for this entity.

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

12 years agoFix copy-and-paste error in comment
David Chisnall [Wed, 15 Feb 2012 16:25:46 +0000 (16:25 +0000)]
Fix copy-and-paste error in comment

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

12 years agoSpecialize noreturn diagnostics for lambda expressions.
Douglas Gregor [Wed, 15 Feb 2012 16:20:15 +0000 (16:20 +0000)]
Specialize noreturn diagnostics for lambda expressions.

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

12 years agoFix silly precedence error.
Douglas Gregor [Wed, 15 Feb 2012 15:59:09 +0000 (15:59 +0000)]
Fix silly precedence error.

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

12 years agoSpecialize the diagnostic complaining about conflicting types of
Douglas Gregor [Wed, 15 Feb 2012 15:57:22 +0000 (15:57 +0000)]
Specialize the diagnostic complaining about conflicting types of
return statements within a lambda; this diagnostic previously referred
to blocks.

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

12 years agoImplement code completion support for lambda capture lists.
Douglas Gregor [Wed, 15 Feb 2012 15:34:24 +0000 (15:34 +0000)]
Implement code completion support for lambda capture lists.

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

12 years agoFirst pass at Solaris toolchain support. This version compiles and links hello
David Chisnall [Wed, 15 Feb 2012 13:39:01 +0000 (13:39 +0000)]
First pass at Solaris toolchain support.  This version compiles and links hello
world on Solaris 11 for both x86 and x86-64 using the built-in assembler and
Solaris (not GNU) ld, however it currently relies on a hard-coded GCC location
to find crtbegin.o and crtend.o, as well as libgcc and libgcc_eh.

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

12 years agoConvert ad-hoc `int array[expr ? -1 : 1]' assertions
Dmitri Gribenko [Wed, 15 Feb 2012 13:30:53 +0000 (13:30 +0000)]
Convert ad-hoc `int array[expr ? -1 : 1]' assertions
in test/SemaCXX/nullptr.cpp to static_assert

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

12 years agoMake -Wformat fix-its preserve original conversion specifiers.
Hans Wennborg [Wed, 15 Feb 2012 09:59:46 +0000 (09:59 +0000)]
Make -Wformat fix-its preserve original conversion specifiers.

This commit makes PrintfSpecifier::fixType() and ScanfSpecifier::fixType()
only fix a conversion specification enough that Clang wouldn't warn about it,
as opposed to always changing it to use the "canonical" conversion specifier.
(PR11975)

This preserves the user's choice of conversion specifier in cases like:

printf("%a", (long double)1);
where we previously suggested "%Lf", we now suggest "%La"

printf("%x", (long)1);
where we previously suggested "%ld", we now suggest "%lx".

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

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