Commit Graph

35364 Commits

Author SHA1 Message Date
Fariborz Jahanian 48fd81b484 objc-arc: introduce -no-finalize-removal which in gc mode,
leaves "finalize' behind and in arc mode, does not
include it. This allows the migrated source to be compiled
in both gc and arc mode. // rdar://10532441

llvm-svn: 149079
2012-01-26 20:57:58 +00:00
John McCall 18a962bab5 Don't suppress access-control or invalid-type diagnostics from a
declarator just because we were able to build an invalid decl
for it.  The invalid-type diagnostics, in particular, are still useful
to know, and may indicate something about why the decl is invalid.

Also, recover from an illegal pointer/reference-to-unqualified-retainable
type using __strong instead of __autoreleasing;  in general, a random
object is much more likely to be __strong, so this avoids unnecessary
cascading errors in the most common case.

llvm-svn: 149074
2012-01-26 20:04:03 +00:00
Douglas Gregor 35696d1a88 Try harder to get X7 defined
llvm-svn: 149072
2012-01-26 18:38:13 +00:00
Argyrios Kyrtzidis b2e31e4443 Change HasMutableFields to HasOnlyCMembers and consider that a tag inside
another tag does not break C-like-ness. rdar://10756831

llvm-svn: 149071
2012-01-26 18:28:08 +00:00
Douglas Gregor 360a66e3d9 Don't separately serialize the list of instance variables in an
Objective-C class. The AST reader just throws away this data anyway!

llvm-svn: 149067
2012-01-26 17:31:14 +00:00
Douglas Gregor e6e5406122 Force layout of more of the unions and structures in this test
llvm-svn: 149066
2012-01-26 17:23:00 +00:00
Fariborz Jahanian 194904e499 objc: 'id' and block pointer compare in mergeTypes is
made symmetrical. // rdar://10734265

llvm-svn: 149065
2012-01-26 17:08:50 +00:00
NAKAMURA Takumi b8efa1e091 AST/ExprConstant.cpp: Silence a warning on ms cl.exe. "bool" does not prefer to be compared to integer.
llvm-svn: 149059
2012-01-26 09:37:36 +00:00
Chandler Carruth d0a41fead3 Suppress any warnings from this test. They aren't interesting, and they
end up in the same output file as the layout stuff. There may even be
a race condition which is causing this output to confuse the FileCheck
in some cases. I actually don't know how on earth the parsing of the
layout file even works given that there are diagnostics in the middle of
it. ;]

llvm-svn: 149058
2012-01-26 09:28:50 +00:00
Douglas Gregor e9fc377a44 Extend the ExternalASTSource interface to allow the AST source to
provide the layout of records, rather than letting Clang compute
the layout itself. LLDB provides the motivation for this feature:
because various layout-altering attributes (packed, aligned, etc.)
don't get reliably get placed into DWARF, the record layouts computed
by LLDB from the reconstructed records differ from the actual layouts,
and badness occurs. This interface lets the DWARF data drive layout,
so we don't need the attributes preserved to get the answer write.

The testing methodology for this change is fun. I've introduced a
variant of -fdump-record-layouts called -fdump-record-layouts-simple
that always has the simple C format and provides size/alignment/field
offsets. There is also a -cc1 option -foverride-record-layout=<file>
to take the output of -fdump-record-layouts-simple and parse it to
produce a set of overridden layouts, which is introduced into the AST
via a testing-only ExternalASTSource (called
LayoutOverrideSource). Each test contains a number of records to lay
out, which use various layout-changing attributes, and then dumps the
layouts. We then run the test again, using the preprocessor to
eliminate the layout-changing attributes entirely (which would give us
different layouts for the records), but supplying the
previously-computed record layouts. Finally, we diff the layouts
produced from the two runs to be sure that they are identical.

Note that this code makes the assumption that we don't *have* to
provide the offsets of bases or virtual bases to get the layout right,
because the alignment attributes don't affect it. I believe this
assumption holds, but if it does not, we can extend
LayoutOverrideSource to also provide base offset information.

Fixes the Clang side of <rdar://problem/10169539>.

llvm-svn: 149055
2012-01-26 07:55:45 +00:00
Eric Christopher f59218e5d9 Use createRecordFwdDecl here since that's what we're doing.
llvm-svn: 149051
2012-01-26 07:11:58 +00:00
Eric Christopher 8913bd6c63 Revert previous patch unifying all of the C++ record prep in one area,
the gdb testsuite complains too much about the ordering of items printed,
even if the offsets in the debug info are correct.

This reverts commit 027cb30af828f07750f9185782822297a5c57231.

llvm-svn: 149049
2012-01-26 07:01:04 +00:00
Bob Wilson 853b5ebfd3 Fix a minor bug in r148582, which made -ccc-host-triple into an alias option.
I'm not adding a testcase because -ccc-host-triple is slated to be removed,
but clang crashes if you try to use -ccc-host-triple without this fix.

llvm-svn: 149048
2012-01-26 06:22:30 +00:00
Eric Christopher 5720033cc1 Remove another duplicated variable.
llvm-svn: 149047
2012-01-26 06:20:57 +00:00
Richard Smith a07ed4addb constexpr: evaluate (bool)&x as true when x is a local variable or a temporary.
llvm-svn: 149045
2012-01-26 04:47:34 +00:00
Argyrios Kyrtzidis 789f373f34 Remove the headers now that ::close() is not used.
llvm-svn: 149044
2012-01-26 04:42:21 +00:00
Argyrios Kyrtzidis 623e8778c1 In FixItRewriteToTemp::RewriteFilename don't try to close the file descriptor
with close(); return it instead.

Fixes mingw build and eliminates possible racing issues.

llvm-svn: 149043
2012-01-26 04:19:04 +00:00
Anna Zaks 60835eb11e [analyzer] The CFContainer test should only be run on x86_64.
llvm-svn: 149042
2012-01-26 04:00:23 +00:00
NAKAMURA Takumi 69ee7d5c52 Rewrite/FrontendActions.cpp: Tweak to unbreak msvc.
llvm-svn: 149041
2012-01-26 03:47:18 +00:00
Bob Wilson 269e6377dd Revert r148249: "Make the auto-detection hack for the iOS simulator set the target triple correctly."
There were some problems with this, so I'm backing it out for now.

llvm-svn: 149040
2012-01-26 03:37:03 +00:00
Peter Collingbourne c331a1eb19 Improve efficiency of Sema::MaybeBindToTemporary by working with the
canonical type directly and adding a fast path for the common case
that the type is directly a RecordType.

llvm-svn: 149039
2012-01-26 03:33:51 +00:00
Peter Collingbourne dad62f1bce Simplify {Record,Enum}Type::classof.
llvm-svn: 149038
2012-01-26 03:33:46 +00:00
Peter Collingbourne 53860cfeb0 Adjust CLANG_BUILD_EXAMPLES to mean whether the examples are built
by default, rather than whether they may be built at all.

llvm-svn: 149037
2012-01-26 03:33:40 +00:00
Peter Collingbourne 1425b4556a Use function pointers, rather than references, to pass Destroyers
around, in the process cleaning up the various gcc/msvc compiler
workarounds.

llvm-svn: 149036
2012-01-26 03:33:36 +00:00
Douglas Gregor e67bb67a9b Add missing include of <unistd.h>
llvm-svn: 149035
2012-01-26 03:20:14 +00:00
Eli Friedman f49643ddce Add an additional testcase for a lambda with implicit void return type.
llvm-svn: 149034
2012-01-26 03:16:41 +00:00
Ted Kremenek 1ca6ce5a22 Post link to checker-260, which is checker-259 with some experimental checks enabled.
llvm-svn: 149032
2012-01-26 03:02:34 +00:00
Eli Friedman 34b49061aa Refactor to share code for handling return statements between lambda expressions and block literals. As it turns out, almost all the logic can be shared.
llvm-svn: 149031
2012-01-26 03:00:14 +00:00
Argyrios Kyrtzidis 24e9afff43 Introduce 3 new fixit options:
-fixit-recompile
	applies fixits and recompiles the result
-fixit-to-temporary
	applies fixits to temporary files
-fix-only-warnings">,
    applies fixits for warnings only, not errors

Combining "-fixit-recompile -fixit-to-temporary" allows testing the result of fixits
without touching the original sources.

llvm-svn: 149027
2012-01-26 02:40:48 +00:00
Chris Lattner e8c94f7d98 fix to go along with an llvm change: VMCore now returns an UndefValue
when asking for a ConstantStruct with all undef elements.

llvm-svn: 149025
2012-01-26 02:33:22 +00:00
Ted Kremenek 37e965221c Enable several checkers under --analyze for general testing.
llvm-svn: 149016
2012-01-26 02:27:38 +00:00
Eric Christopher 9f94fa368a Tidy and remove some unused variables.
llvm-svn: 149015
2012-01-26 02:05:28 +00:00
Rafael Espindola 273fd772ab Fix our handling of #pragma GCC visibility.
Now the lexer just produces a token and the parser is the one responsible for
activating it.
This fixes problem like the one pr11797 where the lexer and the parser were not
in sync. This also let us be more strict on where in the file we accept
these pragmas.

llvm-svn: 149014
2012-01-26 02:02:57 +00:00
Eric Christopher 5bfde1aa42 Collect this information together. No reason to have it split.
llvm-svn: 149013
2012-01-26 01:57:29 +00:00
Eric Christopher a15e6352fe Refactor into its own function.
llvm-svn: 149012
2012-01-26 01:57:13 +00:00
Chandler Carruth 0b1756b880 Reintroduce r148981 with significantly improved regression test. Now it
both actually tests what it wants to, doesn't have bogus and broken
assertions in it, and is also formatted much more cleanly and
consistently. Probably still some more that can be improved here, but
its much better.

Original commit message:
----
Try to unbreak the FreeBSD toolchain's detection of 32-bit targets
inside a 64-bit freebsd machine with the 32-bit compatibility layer
installed. The FreeBSD image always has the /usr/lib32 directory, so
test for the more concrete existence of crt1.o. Also enhance the tests
for freebsd to clarify what these trees look like and exercise the new
code.

Thanks to all the FreeBSD folks for helping me understand what caused
the failure and how we might fix it. =] That helps a lot. Also, yay
build bots.

llvm-svn: 149011
2012-01-26 01:35:15 +00:00
NAKAMURA Takumi e3593114a1 StaticAnalyzer/Checkers: Fix CMake build.
llvm-svn: 149009
2012-01-26 01:14:39 +00:00
Anna Zaks 06f10bf05a [analyzer] Add an AST checker that checks for a common pitfall when
using CFArrayCreate & family.

Specifically, CFArrayCreate's input should be:
'A C array of the pointer-sized values to be in the new array.'

(radar://10717339)

llvm-svn: 149008
2012-01-26 01:05:43 +00:00
Fariborz Jahanian 26d8371b07 objc: allow block pointer matching 'id' type when
they show up as argument types of two block pointers.
// rdar://10734265

llvm-svn: 149007
2012-01-26 00:45:38 +00:00
Eli Friedman 1da70394f6 Slight refactoring; catch yet another case where we were missing an lvalue-to-rvalue conversion.
llvm-svn: 149003
2012-01-26 00:26:18 +00:00
Fariborz Jahanian 0c859d67ef arc migrator: Added an option to the migrator
unused yet.

llvm-svn: 149001
2012-01-26 00:08:04 +00:00
Ted Kremenek 8e4c4266de Rework flushing of diagnostics to PathDiagnosticConsumer. Now all the reports are batched up before being flushed
to the underlying consumer implementation.  This allows us to unique reports across analyses to multiple functions (which
shows up with inlining).

llvm-svn: 148997
2012-01-25 23:47:14 +00:00
Eli Friedman 9562f39e2f Don't stack-allocate an IntegerLiteral which can be referred to after the current method returns. PR11744, part 2.
llvm-svn: 148995
2012-01-25 23:20:27 +00:00
Argyrios Kyrtzidis e8be6652ce Revert r148981 because it fails test/Driver/freebsd.c
Original log:

Author: chandlerc <chandlerc@91177308-0d34-0410-b5e6-96231b3b80d8>
Date:   Wed Jan 25 21:32:31 2012 +0000

    Try to unbreak the FreeBSD toolchain's detection of 32-bit targets
    inside a 64-bit freebsd machine with the 32-bit compatibility layer
    installed. The FreeBSD image always has the /usr/lib32 directory, so
    test for the more concrete existence of crt1.o. Also enhance the tests
    for freebsd to clarify what these trees look like and exercise the new
    code.

    Thanks to all the FreeBSD folks for helping me understand what caused
    the failure and how we might fix it. =] That helps a lot. Also, yay
    build bots.

llvm-svn: 148993
2012-01-25 22:55:16 +00:00
Eli Friedman a98d1f8ca6 Add some ABI tweaks for i386-pc-win32 triple so that we return structs in an MSVC-compatible way. Patch by Joe Groff.
llvm-svn: 148992
2012-01-25 22:46:34 +00:00
Eli Friedman 04342eee52 Improve the error message slightly for files that aren't using the expected UTF-8 encoding. Patch by Seth Cantrell.
llvm-svn: 148991
2012-01-25 22:34:12 +00:00
Eli Friedman f7f102f81a Fix a crash involving a multi-dimensional dependent VLA. PR11744.
llvm-svn: 148989
2012-01-25 22:19:07 +00:00
Ted Kremenek 807f7e38a9 Post open source analyzer build checker-259.
llvm-svn: 148988
2012-01-25 22:18:04 +00:00
Richard Smith 1b78b3d1b1 constexpr: add support for anonymous struct and union members in literal types.
llvm-svn: 148987
2012-01-25 22:15:11 +00:00
Eric Christopher bfecca3331 Clean up comment.
llvm-svn: 148982
2012-01-25 21:47:09 +00:00