Commit Graph

35471 Commits

Author SHA1 Message Date
Eli Friedman 9ccdb1d01b Make sure we call MaybeCreateExprWithCleanups for the sub-expression of an indirect goto.
llvm-svn: 149441
2012-01-31 22:47:07 +00:00
Eli Friedman 87d3280985 A couple minor fixes to template instantiation for for-range loops.
llvm-svn: 149440
2012-01-31 22:45:40 +00:00
Bob Wilson a223401498 Use new Triple::getMacOSXVersion function.
llvm-svn: 149439
2012-01-31 22:43:59 +00:00
Fariborz Jahanian a1c1b152f0 arc migrator: twik previous patch to exclude user provided
explicit type cast. // rdar://10521744

llvm-svn: 149437
2012-01-31 22:09:44 +00:00
Fariborz Jahanian eb00284f22 arc migrator: Do not attempt to migrate to bridge casts which
cancel out each other. Leave it alone so users can take a look
(unmigrated code forces error diagnostic). // rdar://10521744

llvm-svn: 149435
2012-01-31 21:58:23 +00:00
Douglas Gregor 232e3431e2 Split compiler builtin module into "stdlib" builtins and "intrinsic"
builds, and bring mm_alloc.h into the fold. Start playing some tricks
with these builtin modules to mirror the include_next tricks that the
headers already perform.

llvm-svn: 149434
2012-01-31 21:57:50 +00:00
Chad Rosier 8109d5e95d Remove extraneous whitespace.
llvm-svn: 149424
2012-01-31 21:45:04 +00:00
Bob Wilson 9d3f7af8c3 Fix more fallout from the introduction of "macosx" and "ios" triples.
The Darwin toolchain constructor was assuming that all Darwin triples would
have an OS string starting with "darwin".  Triples starting with "macosx"
would misinterpret the version number, and "ios" triples would completely
miss the version number (or worse) because the OS name is not 6 characters
long.  We lose some sanity checking of triple strings here, since the
Triple.getOSVersion function doesn't do all the checking that the previous
code did, but this still seems like a step in the right direction.

llvm-svn: 149422
2012-01-31 21:30:03 +00:00
Anna Zaks 87b6ff09f9 [analyzer] Add checks for common anti-patterns in strncat.
(Since this is syntax only, might be a good candidate for turning into a
compiler warning.)

llvm-svn: 149407
2012-01-31 19:33:39 +00:00
Anna Zaks ee5e8ae845 [analyzer] Change the warning to suggest 'strlcat/strlcpy' as
replacements for 'starcat/strcpy' instead of 'strncat/strncpy'.

llvm-svn: 149406
2012-01-31 19:33:31 +00:00
Chad Rosier ebaefe7527 Fix 80-column violation.
llvm-svn: 149405
2012-01-31 19:31:12 +00:00
Ted Kremenek 3814359657 Revert r149359. This was a hack to a problem with an easy workaround, and it doesn't feel like general solution.
llvm-svn: 149404
2012-01-31 19:19:25 +00:00
Matt Beaumont-Gay ecc05b0dc3 Pacify gcc's -Wreturn-type.
A separate unreachable message will make it easier to debug if either of the
unreachables is reached.

llvm-svn: 149402
2012-01-31 18:59:25 +00:00
David Chisnall 92d436b49a Support @compatibility_alias at run time (GNUstep Runtime)
Patch by Niels Grewe!

llvm-svn: 149401
2012-01-31 18:59:20 +00:00
Chris Lattner 21ae40e513 fix a crash on:
__has_builtin

in an empty file, as we were overwriting the EOF token.  Overwriting an arbitrary token
never seems like a good idea in the error case.  This fixes a bug reported on the GCC
list :)

llvm-svn: 149397
2012-01-31 18:53:44 +00:00
Jean-Daniel Dupas cb197b0e42 FormatCheckers should emit all diagnostics using EmitFormatDiagnostic().
llvm-svn: 149394
2012-01-31 18:12:08 +00:00
Hans Wennborg 27a59958bd Format string warnings: don't a.k.a. wchar_t with wchar_t.
This fixes the case where Clang would output:
 error: format specifies type 'wchar_t *' (aka 'wchar_t *')

ArgTypeResult::getRepresentativeTypeName needs to take into account
that wchar_t can be a built-in type (as opposed to in C, where it is a
typedef).

llvm-svn: 149387
2012-01-31 14:59:59 +00:00
Erik Verbruggen 81dbd56501 [CFG] Removed unused local variable.
llvm-svn: 149385
2012-01-31 13:44:00 +00:00
Benjamin Kramer e76b42b298 Don't zero terminate the bitmap twice.
llvm-svn: 149377
2012-01-31 10:30:46 +00:00
Richard Smith de21b245c6 constexpr: the result of a relational operator between pointers to void is
unspecified unless the pointers are equal; therefore, such a comparison is not
a constant expression unless the pointers are equal.

llvm-svn: 149366
2012-01-31 06:41:30 +00:00
Chris Lattner f4a4bec3a0 ConstantArray::get() (for strings) is going away, use
ConstantDataArray::getString instead.

Many instances of ConstantArray::get() could be moved to 
use more efficient ConstantDataArray methods that avoid a ton
of intermediate Constant*'s for each element (e.g. 
GetConstantArrayFromStringLiteral).  I don't plan on doing this
in the short-term though.

llvm-svn: 149363
2012-01-31 06:13:55 +00:00
Ted Kremenek fdc870d6b2 Don't warn about -Wshorten-64-to-32 in unreachable code. Fixes <rdar://problem/10759934>. Apparently this is a common idiom in Linux (among other places).
llvm-svn: 149359
2012-01-31 05:37:48 +00:00
Ted Kremenek 8a92c8bb4f Make a bunch of local functions 'static'.
llvm-svn: 149358
2012-01-31 05:37:37 +00:00
Chris Lattner 236b357361 enhance some optimization logic to handle ConstantDataSequential
as well as ConstantArray.

llvm-svn: 149347
2012-01-31 04:36:19 +00:00
Richard Smith fe800031ec constexpr: catch a collection of integral undefined behaviors:
-INT_MIN and INT_MIN / -1
  Shift by a negative or too large quantity
  Left shift of negative value
  Overflow in left shift

llvm-svn: 149344
2012-01-31 04:08:20 +00:00
Argyrios Kyrtzidis 2753ca84f0 Reapply r149311 which I reverted by mistake.
Original log:

 Convert ProgramStateRef to a smart pointer for managing the reference counts of ProgramStates.  This leads to a slight memory
 improvement, and a simplification of the logic for managing ProgramState objects.
 # Please enter the commit message for your changes. Lines starting

llvm-svn: 149339
2012-01-31 02:23:28 +00:00
Chandler Carruth d7fa2e04f6 Revert r149083 which is not the direction we're going in the Clang
driver based on discussions with Doug Gregor. There are several issues:
1) The patch was not reviewed prior to commit and there were review comments.
2) The design of the functionality (triple-prefixed tool invocation)
   isn't the design we want for Clang going forward: it focuses on the
   "user triple" rather than on the "toolchain triple", and forces that
   bit of state into the API of every single toolchain instead of
   handling it automatically in the common base classes.
3) The tests provided are not stable. They fail on a few Linux variants
   (Gentoo among them) and on mingw32 and some other environments.

I *am* interested in the Clang driver being able to invoke
triple-prefixed tools, but we need to design that feature the right way.
This patch just extends the previous hack without fixing the underlying
problems with it. I'm working on a new design for this that I will mail
for review by tomorrow.

I am aware that this removes functionality that NetBSD relies on, but
this is ToT, not a release. This functionality hasn't been properly
designed, implemented, and tested yet. We can't "regress" until we get
something that really works, both with the immediate use cases and with
long term maintenance of the Clang driver.

For reference, the original commit log:
Keep track of the original target the user specified before
normalization. This used to be captured in DefaultTargetTriple and is
used for the (optional) $triple-$tool lookup for cross-compilation.
Do this properly by making it an attribute of the toolchain and use it
in combination with the computed triple as index for the toolchain
lookup.

llvm-svn: 149337
2012-01-31 02:21:20 +00:00
Argyrios Kyrtzidis 0dc0c5411f Revert r149311 which failed to compile.
Original log:

Convert ProgramStateRef to a smart pointer for managing the reference counts of ProgramStates.  This leads to a slight memory
improvement, and a simplification of the logic for managing ProgramState objects.

llvm-svn: 149336
2012-01-31 02:14:24 +00:00
Nico Weber 3435ede0ca Fix "long double" and __SIZE_TYPE__ on powerpc, now with test fix.
Fixes PR11867. Patch from Jeremy Huddleston!

llvm-svn: 149334
2012-01-31 02:07:33 +00:00
Richard Smith 006bfc91e8 constexpr: remove integral conversion overflow checking introduced in r149286.
As Eli points out, this is implementation-defined, and the way we define it
makes this fine.

llvm-svn: 149327
2012-01-31 01:47:46 +00:00
Nico Weber 496cdc2cb7 Let %S, %ls, %C match 16bit types in NSStrings.
As discussed at http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20120130/052200.html

llvm-svn: 149325
2012-01-31 01:43:25 +00:00
Eli Friedman 290e6ba165 Clean up switch in Expr::CanThrow. No functional change.
llvm-svn: 149321
2012-01-31 01:21:45 +00:00
Ted Kremenek 1dd7fd7106 Minor refactor within ExplodedGraph::reclaimRecentlyAllocatedNodes(). No functionality change.
llvm-svn: 149320
2012-01-31 01:20:02 +00:00
Ted Kremenek f8c36e005a Convert checker over to using ProgramStateRef.
llvm-svn: 149319
2012-01-31 01:19:57 +00:00
Fariborz Jahanian 97795c8872 fix test.
llvm-svn: 149313
2012-01-31 01:05:11 +00:00
Ted Kremenek b1ca33fde5 Convert ProgramStateRef to a smart pointer for managing the reference counts of ProgramStates. This leads to a slight memory
improvement, and a simplification of the logic for managing ProgramState objects.

llvm-svn: 149311
2012-01-31 00:57:20 +00:00
Ted Kremenek 13a4487f4d Convert more uses of 'const ProgramState *' to 'ProgramStateRef' (and related cleanups).
llvm-svn: 149310
2012-01-31 00:57:15 +00:00
Nico Weber 2dd5756bf1 Revert r149285, it breaks test/Preprocessor/init.c.
llvm-svn: 149301
2012-01-30 23:53:44 +00:00
Fariborz Jahanian c93fa98e4c test for a v-table dispatch that consumes an
argument. twik to support the test case.
// rdar://10444476

llvm-svn: 149298
2012-01-30 23:39:30 +00:00
Richard Smith 911e142f03 constexpr: disallow signed integer overflow in integral conversions in constant
expressions in C++11.

llvm-svn: 149286
2012-01-30 22:27:01 +00:00
Nico Weber aa11e6e28c Fix "long double" and __SIZE_TYPE__ on powerpc.
Fixes PR11867. Patch from Jeremy Huddleston!

llvm-svn: 149285
2012-01-30 22:25:29 +00:00
Douglas Gregor 56435b49e0 Remove tgmath.h from the module map for now, because it currently causes a
cyclic module dependency due to its inclusion of math.h and
complex.h. I'll take another shot at it later.

llvm-svn: 149283
2012-01-30 22:22:39 +00:00
Fariborz Jahanian f2bda69cd2 objc-arc: Perform null check on receiver before sending methods which
consume one or more of their arguments. If not done, this will cause a leak
as method will not consume the argument when receiver is null.
In this patch, the null path releases consumed argument.
// rdar://10444474

llvm-svn: 149279
2012-01-30 21:40:37 +00:00
Anna Zaks 58cc6cabe5 [analyzer] Rename the checker as per Ted's comment. Remove the reference
from the driver.

llvm-svn: 149276
2012-01-30 21:14:16 +00:00
Jean-Daniel Dupas 537aa1ac68 Disable "non literal format string" for NSString that result from a macro expansion.
This is to prevent diagnostic when using NSLocalizedString or CFCopyLocalizedString
macros which are usually used in place of NS and CF strings literals.

llvm-svn: 149268
2012-01-30 19:46:17 +00:00
Anna Zaks 6523e46941 [analyzer] Make osx.cocos.CFContainersSyntax a default checker.
llvm-svn: 149258
2012-01-30 19:12:37 +00:00
Douglas Gregor 71022cac1f Fix typo spotted by Sebastian. Thanks!
llvm-svn: 149257
2012-01-30 18:49:05 +00:00
John McCall a023b6924a Per discussion on cxx-abi-dev, don't drop leading zeroes from the
mangling of floating-point literals.  I just went ahead and
reimplemented toString() here;  if someone wants to generalize
the library routine to do this, or feels strongly that we should
be post-processing, please feel free.

llvm-svn: 149256
2012-01-30 18:36:31 +00:00
Benjamin Kramer e0513cb3b3 SmallBitVectorize the deduced parameter set.
llvm-svn: 149253
2012-01-30 16:17:39 +00:00
Chandler Carruth 4c727853ed Fix yet another issue introduced when renaming '-ccc-host-triple' to
'-target'. The original flag was part of a flag group that marked it as
driver-only. The new flag didn't ever get equivalent treatment. This
caused the '-target' flag to get passed down to any raw GCC invocation.
Marking it as a driver option fixes this and PR11875.

llvm-svn: 149244
2012-01-30 12:25:35 +00:00