Commit Graph

35953 Commits

Author SHA1 Message Date
Bill Wendling 75ff46d917 Fix test to not depend upon metadata numbers.
llvm-svn: 150668
2012-02-16 08:58:11 +00:00
NAKAMURA Takumi 59b1bc16eb test/CodeGenObjC/arc-no-arc-exceptions.m: Disable it at -Asserts for now.
llvm-svn: 150666
2012-02-16 08:12:12 +00:00
Eli Friedman 59e41d046e Shift Microsoft enum extensions from -fms-extensions to -fms-compatibility, so -fms-extensions doesn't affect enum semantics in incompatible ways. <rdar://problem/10657186>.
llvm-svn: 150663
2012-02-16 05:20:44 +00:00
Eli Friedman 5b44688d6b Initial implementation of IRGen for the lambda conversion-to-function-pointer operator.
llvm-svn: 150660
2012-02-16 03:47:28 +00:00
Anna Zaks 95308d3798 [analyzer] Diagnostics: Ensure that the default end of diagnostic path
piece can always be generated.

The default end of diagnostic path piece was failing to generate on a
BlockEdge that was outgoing from a basic block without a terminator,
resulting in a very simple diagnostic being rendered (ex: no path
highlighting or custom visitors). Reuse another function, which is
essentially doing the same thing and correct it not to fail when a block
has no terminator.

llvm-svn: 150659
2012-02-16 03:41:01 +00:00
Anna Zaks d32ead82d9 [analyzer] Malloc Checker: Give up when a pointer escapes into a struct.
We are not properly handling the memory regions that escape into struct
fields, which led to a bunch of false positives. Be conservative here
and give up when a pointer escapes into a struct.

llvm-svn: 150658
2012-02-16 03:40:57 +00:00
Richard Smith 17100bad0a constexpr tidyups:
* Fix bug when determining whether && / || are potential constant expressions
  * Try harder when determining whether ?: is a potential constant expression
  * Produce a diagnostic on sizeof(VLA) to provide a better source location

llvm-svn: 150657
2012-02-16 02:46:34 +00:00
Nico Weber 2668f0a132 Add a few minor items to the 3.1 release notes.
llvm-svn: 150656
2012-02-16 02:35:03 +00:00
Argyrios Kyrtzidis 85620ad239 Fix the RecursiveASTVisitor to not traverse C++ default parameters twice.
llvm-svn: 150651
2012-02-16 02:02:14 +00:00
Chad Rosier ffbf9f1406 Fix test for r150648.
llvm-svn: 150650
2012-02-16 01:56:55 +00:00
Eli Friedman 5a6d507d1b Start of IRGen for lambda conversion operators.
llvm-svn: 150649
2012-02-16 01:37:33 +00:00
Bill Wendling b6f795eee6 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>

llvm-svn: 150648
2012-02-16 01:13:30 +00:00
Argyrios Kyrtzidis 3454d444dc [libclang] Do index statements inside a type source info. rdar://10872758
llvm-svn: 150647
2012-02-16 01:12:04 +00:00
Douglas Gregor d3b672c385 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.

llvm-svn: 150645
2012-02-16 01:06:16 +00:00
Dan Gohman 515a60daff 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.

llvm-svn: 150644
2012-02-16 00:57:37 +00:00
Richard Smith 90e7c12961 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.

llvm-svn: 150643
2012-02-16 00:54:02 +00:00
Richard Smith 7e14ddd41b Start off release notes for clang 3.1 with reference to C11 anonymous structs
and unions, and C++11 generalized constant expressions.

llvm-svn: 150640
2012-02-16 00:32:27 +00:00
Fariborz Jahanian 430b35edf8 objc-arc: For arc's ivar layout, treat __unsafe_unretained ivars
as unscanned. // rdar://10832643

llvm-svn: 150639
2012-02-16 00:15:02 +00:00
Eric Christopher 9a89705d03 Revert "Add a completed/incomplete type difference. This allows us to have"
This reverts commit 9a68d4584afcd0853b930bd80235b58736e785b4.

llvm-svn: 150637
2012-02-15 23:51:20 +00:00
Eric Christopher 7381907e65 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.

llvm-svn: 150631
2012-02-15 23:25:18 +00:00
Kaelyn Uhrain 618f97ca21 Silence a valgrind warning, and remove an unused var.
llvm-svn: 150629
2012-02-15 22:59:03 +00:00
Richard Smith ebeed41587 Support GCC's bug^Wextension allowing class array members to be initalized by a
parenthesized braced-init-list in the base/member initialization list.

llvm-svn: 150625
2012-02-15 22:38:09 +00:00
Kaelyn Uhrain 5986c3e90a 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).

llvm-svn: 150622
2012-02-15 22:14:18 +00:00
Douglas Gregor 33e863cfc8 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

:)

llvm-svn: 150620
2012-02-15 22:08:38 +00:00
Fariborz Jahanian ff51338772 objective-c translator: fixes an obscure rewriting bug
which attempted to rewrite the same meta-data twice.

llvm-svn: 150618
2012-02-15 22:01:47 +00:00
Douglas Gregor 13f09b4191 Factor the construction of the lambda-to-function-pointer conversion function declaration into a separate function. No functionality change
llvm-svn: 150617
2012-02-15 22:00:51 +00:00
David Blaikie af90ec11e1 Provide common include for all diagnostic headers.
Reviewed by Ted Kremenek.

llvm-svn: 150616
2012-02-15 21:58:34 +00:00
Benjamin Kramer a8cafe23e3 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.

llvm-svn: 150615
2012-02-15 20:57:03 +00:00
David Blaikie 040a3a28f1 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.

llvm-svn: 150612
2012-02-15 19:45:34 +00:00
Douglas Gregor 74f7d50f6a 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.

llvm-svn: 150611
2012-02-15 19:33:52 +00:00
David Chisnall 1026fb0797 Add some Solaris include paths and fix a -lgcc_eh that apparently should be -lgcc_s.
llvm-svn: 150602
2012-02-15 18:24:31 +00:00
Nico Weber a92c1eed0f Tweak comment above DiagGroup<"all">.
llvm-svn: 150600
2012-02-15 18:18:51 +00:00
Douglas Gregor 02267a8e48 A little more lambda capture initialization diagnostics cleanup
llvm-svn: 150589
2012-02-15 17:05:32 +00:00
Douglas Gregor 19666fb1aa Introduce a new initialization entity for lambda captures, and
specialize location information and diagnostics for this entity.

llvm-svn: 150588
2012-02-15 16:57:26 +00:00
David Chisnall a9ed5d76b4 Fix copy-and-paste error in comment
llvm-svn: 150587
2012-02-15 16:25:46 +00:00
Douglas Gregor cf11eb76ed Specialize noreturn diagnostics for lambda expressions.
llvm-svn: 150586
2012-02-15 16:20:15 +00:00
Douglas Gregor 85dae892a4 Fix silly precedence error.
llvm-svn: 150585
2012-02-15 15:59:09 +00:00
Douglas Gregor b9e38f19f7 Specialize the diagnostic complaining about conflicting types of
return statements within a lambda; this diagnostic previously referred
to blocks.

llvm-svn: 150584
2012-02-15 15:57:22 +00:00
Douglas Gregor d8c61785ed Implement code completion support for lambda capture lists.
llvm-svn: 150583
2012-02-15 15:34:24 +00:00
David Chisnall f571cde869 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.  

llvm-svn: 150580
2012-02-15 13:39:01 +00:00
Dmitri Gribenko 7bde858705 Convert ad-hoc `int array[expr ? -1 : 1]' assertions
in test/SemaCXX/nullptr.cpp to static_assert

llvm-svn: 150579
2012-02-15 13:30:53 +00:00
Hans Wennborg d99d688358 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".

llvm-svn: 150578
2012-02-15 09:59:46 +00:00
Richard Smith d3cf238e26 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.

llvm-svn: 150560
2012-02-15 02:42:50 +00:00
Richard Smith b228a86fcf 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.

llvm-svn: 150557
2012-02-15 02:18:13 +00:00
Anna Zaks d1ff1cbe23 [analyzer] Malloc checker: make a bit safer.
llvm-svn: 150556
2012-02-15 02:12:00 +00:00
Richard Smith 19582e85bd Fix typo in r150549.
llvm-svn: 150555
2012-02-15 02:07:05 +00:00
John McCall c62bb39142 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.

llvm-svn: 150551
2012-02-15 01:22:51 +00:00
Douglas Gregor 3009383b9f Implement indexing support for lambdas in libclang (both kinds), as
well as improving the RecursiveASTVisitor's walk of lambda
expressions.

llvm-svn: 150549
2012-02-15 00:54:55 +00:00
Fariborz Jahanian fdc06e32cf modern objective-c translator: start writing the main class
meta-data.

llvm-svn: 150548
2012-02-15 00:50:11 +00:00
Anna Zaks a432feaf26 [analyzer] Add the Malloc checker to the list of tested checkers.
llvm-svn: 150535
2012-02-15 00:19:07 +00:00