Commit Graph

101448 Commits

Author SHA1 Message Date
Chandler Carruth 4c6fdca035 Implement a warning for known shift overflows on constant shift
expressions. Consider the code:

  int64_t i = 10 << 30;

This compiles fine, but most developers expect it to produce the value
for 10 gigs, not -2 gigs. This is actually undefined behavior because
the LHS is a signed integer type.

The warning is currently gated behind -Wshift-overflow.

There is a special case where only the sign bit is overridden that gets
a custom error message and is by default ignored. This case is much less
likely to cause observed buggy behavior, it's just undefined behavior
according to the spec. This warning can be enabled with
-Wshift-sign-overflow.

Original patch by Oleg Slezberg, with style tweaks and some correctness
fixes by me.

llvm-svn: 126342
2011-02-23 23:34:11 +00:00
Ted Kremenek e4b316c15c Fix bogus -Warray-bounds warning involving 'array[true]' reported in PR 9296.
llvm-svn: 126341
2011-02-23 23:06:04 +00:00
Devang Patel 7b0f796c55 Use DW_FORM_data2 for DW_AT_language and let users use DW_LANG_lo_user=0x8000 to DW_LANG_hi_user=0xffff range.
llvm-svn: 126339
2011-02-23 22:37:04 +00:00
Devang Patel 37e056e455 Check only relevant strings in output to increase stability of the tests.
llvm-svn: 126338
2011-02-23 22:35:57 +00:00
Jim Grosbach fe4858f269 Remove file. Previous commit deleted content, but left the file around.
llvm-svn: 126337
2011-02-23 21:43:31 +00:00
Jim Grosbach 0c03a3a146 Revert r125595, which is an X86-only undocumented assembly syntax extension
enabled for all targets. Non-X86 targets should not have this behavior
enabled by default.

Joerg, if you would like to resubmit with the behavior conditionalized to be
X86-ELF only, that's fine.

llvm-svn: 126336
2011-02-23 21:26:51 +00:00
Johnny Chen d88d96cac9 Add emulation for "ADR" operations. Add a ThumbImm8Scaled() convenience function
and rename the original ThumbImmScaled() function to ThumbImm7Scaled().

llvm-svn: 126335
2011-02-23 21:24:25 +00:00
Nick Lewycky 3607989847 Preserve what the user passed to -include when emitting .d files. Fixes PR8974!
llvm-svn: 126334
2011-02-23 21:16:44 +00:00
Argyrios Kyrtzidis 506220fef7 [analyzer] Migrate StackAddrLeakChecker to CheckerV2.
llvm-svn: 126333
2011-02-23 21:04:54 +00:00
Argyrios Kyrtzidis f1b5d1f01b [analyzer] Refactor EndOfFunctionNodeBuilder.
-Introduce EndOfFunctionNodeBuilder::withCheckerTag to allow it be "specialized" with a
 checker tag and not require the checkers to pass a tag.
-For EndOfFunctionNodeBuilder::generateNode, reverse the order of tag/P parameters since
 there are actual calls that assume the second parameter is ExplodedNode.

llvm-svn: 126332
2011-02-23 21:04:49 +00:00
Argyrios Kyrtzidis 66b38c2261 [analyzer] Migrate IdempotentOperationChecker to CheckerV2.
llvm-svn: 126331
2011-02-23 21:04:44 +00:00
Rafael Espindola 9e18e96264 Put in the symbol table symbols only used in a .globl statement.
Fixes PR9292.

llvm-svn: 126330
2011-02-23 20:22:07 +00:00
Matt Beaumont-Gay b7edc188e2 fix typo in *all* of the test cases
llvm-svn: 126328
2011-02-23 19:40:41 +00:00
Matt Beaumont-Gay 006cdae008 fix typo in test too
llvm-svn: 126327
2011-02-23 19:39:05 +00:00
Argyrios Kyrtzidis 68cab73ab9 [analyzer] const goodness.
llvm-svn: 126326
2011-02-23 19:38:45 +00:00
Argyrios Kyrtzidis d0732a660a [analyzer] Rename runPathSensitiveCheckers -> expandGraphWithCheckers.
llvm-svn: 126325
2011-02-23 19:38:41 +00:00
Argyrios Kyrtzidis da02a25ae6 [analyzer] Migrate ChrootChecker to CheckerV2.
llvm-svn: 126324
2011-02-23 19:38:39 +00:00
Matt Beaumont-Gay 5d2144602f fix typo
llvm-svn: 126323
2011-02-23 18:55:30 +00:00
Richard Osborne bfa5cc0e08 Add XCore intrinsic for clre instruction.
llvm-svn: 126322
2011-02-23 18:52:05 +00:00
Chandler Carruth e71b378dc7 Fix the behavior of -Wignored-qualifiers on return type qualifiers in
several ways. We now warn for more of the return types, and correctly
locate the ignored ones. Also adds fix-it hints to remove the ignored
qualifiers. Fixes much of PR9058, although not all of it.

Patch by Hans Wennborg, a couple of minor style tweaks from me.

llvm-svn: 126321
2011-02-23 18:51:59 +00:00
Richard Osborne 4995b05f56 Add llvm.xcore.waitevent intrinsic. The effect of this intrinsic is to enable
events on the thread and wait until a resource is ready to event. The vector
of the resource that is ready is returned.

llvm-svn: 126320
2011-02-23 18:35:59 +00:00
Jakob Stoklund Olesen ed172998a6 It is safe to ignore LastSplitPoint when the variable is not live out.
No code will be inserted after the split point anyway.

llvm-svn: 126319
2011-02-23 18:26:31 +00:00
Douglas Gregor 4a4e0eb782 Mention libclang in the Doxygen documentation
llvm-svn: 126316
2011-02-23 17:45:25 +00:00
Richard Osborne 2c610aa3ed Add XCore intrinsic for the setv instruction.
llvm-svn: 126315
2011-02-23 16:46:37 +00:00
Richard Osborne 12377e0947 Fix format for setc instruction.
llvm-svn: 126314
2011-02-23 15:20:16 +00:00
Richard Osborne aab96995f6 Add XCore intrinsic for settw instruction.
llvm-svn: 126313
2011-02-23 14:45:03 +00:00
David Chisnall 8aab5de75c Fix type mismatch between property function that CGObjCGNU was returning and the one CGObjC was calling. Fixes bug r9294.
llvm-svn: 126312
2011-02-23 14:05:31 +00:00
Frits van Bommel 026982e24f Implement TODO for implicit C-array-to-ArrayRef conversion.
llvm-svn: 126311
2011-02-23 13:43:06 +00:00
NAKAMURA Takumi ff75d8d502 CMake: Don't use ${CMAKE_CFG_INTDIR} for installed llvm-lit on Visual Studio.
llvm-svn: 126310
2011-02-23 12:07:49 +00:00
Oscar Fuentes 2ece0b171f Export TARGET_TRIPLE on LLVM.cmake. It is necessary for running tests
on Clang when it builds using LLVM as an external library.

Fixes PR9293.

llvm-svn: 126309
2011-02-23 11:28:40 +00:00
Argyrios Kyrtzidis bf61d97a98 [analyzer] Migrate UnreachableCodeChecker to CheckerV2.
llvm-svn: 126308
2011-02-23 07:19:23 +00:00
Argyrios Kyrtzidis aad8372516 [analyzer] Migrate to CheckerV2:
NSAutoreleasePoolChecker
	ObjCAtSyncChecker

llvm-svn: 126307
2011-02-23 07:19:18 +00:00
Argyrios Kyrtzidis 99ea46462a [analyzer] Add LangOptions in CheckerManager.
llvm-svn: 126306
2011-02-23 07:19:14 +00:00
Ted Kremenek 1a241d1619 Teach CFGBuilder about null pointer constants in conditionals, and how they can be used to prune branches. Fixes false null pointer dereference warning in PR 8183.
llvm-svn: 126305
2011-02-23 05:11:46 +00:00
Ted Kremenek c49211c79a Add null check in CursorVisitor::RunVisitorWorkList() when visiting LabelDecls. Fixes <rdar://problem/9040579>.
llvm-svn: 126304
2011-02-23 04:54:51 +00:00
Anders Carlsson d99dbcc2a9 Don't give an error for 'try' and 'throw' if they occur in system headers.
llvm-svn: 126303
2011-02-23 03:46:46 +00:00
Sean Callanan 34770edf43 Fixed a bug in the enhanced disassembler that caused
it to ignore valid uses of FS and GS as additional
base registers in address computations.  Added a test
case for this.

llvm-svn: 126302
2011-02-23 03:31:28 +00:00
Sean Callanan be81988c99 Fixed a bug in the enhanced disassembly tester that
caused it to only parse one line of input.

llvm-svn: 126301
2011-02-23 03:29:41 +00:00
Anders Carlsson 33e56a047f Add a -fcxx-exceptions flag to clang -cc1. This controls the newly added CXXExceptions flag.
llvm-svn: 126300
2011-02-23 03:16:42 +00:00
Anders Carlsson 6bbd268396 Add a CXXExceptions flag to LangOptions.
llvm-svn: 126299
2011-02-23 03:04:54 +00:00
Evan Cheng 97e6428014 Change VFPNeonA8 definition to make the code easier to read.
llvm-svn: 126298
2011-02-23 02:35:33 +00:00
Stuart Hastings bf83659d11 Omit private_extern declarations of extern symbols; followup to
r124468.  Patch by Rafael Avila de Espindola!

llvm-svn: 126297
2011-02-23 02:27:05 +00:00
Ted Kremenek 204f1d26d4 Add doxygen comments to Sema::DiagRuntimeBehavior().
llvm-svn: 126296
2011-02-23 02:26:43 +00:00
Evan Cheng d6b641e5bc More fcopysign correctness and performance fix.
The previous codegen for the slow path (when values are in VFP / NEON
registers) was incorrect if the source is NaN.

The new codegen uses NEON vbsl instruction to copy the sign bit. e.g.
        vmov.i32        d1, #0x80000000
        vbsl    d1, d2, d0
If NEON is not available, it uses integer instructions to copy the sign bit.
rdar://9034702

llvm-svn: 126295
2011-02-23 02:24:55 +00:00
Ted Kremenek ef59fe7845 Add test case (from PR 8876) for suppressing 'indirection of non-volatile null pointer...' warning due to reachability analysis.
llvm-svn: 126294
2011-02-23 02:15:19 +00:00
Johnny Chen 5278cd11ba Modify EmulateSUBSPImm() to handle the cases with generic Rd value instead of
Rd == 13.  Add opcode entries for the generic "sub (sp minus immediate)" operations.

llvm-svn: 126293
2011-02-23 01:55:07 +00:00
Peter Collingbourne 4b66c47a16 Sema: diagnose kernel calls to non-global functions
llvm-svn: 126292
2011-02-23 01:53:29 +00:00
Ted Kremenek 477c8f5440 Add test case for PR 9284, a false positive for -Warray-bounds that is now addressed using basic reachability analysis.
llvm-svn: 126291
2011-02-23 01:52:07 +00:00
Ted Kremenek 3427fac7c8 Enhance Sema::DiagRuntimeBehavior() to delay some diagnostics to see if the related code is reachable. This suppresses some
diagnostics that occur in unreachable code (e.g., -Warray-bound).

We only pay the cost of doing the reachability analysis when we issue one of these diagnostics.

llvm-svn: 126290
2011-02-23 01:52:04 +00:00
Ted Kremenek 80861ca9b5 Migrate CFGReachabilityAnalysis out of the IdempotentOperationsChecker and into its own analysis file.
llvm-svn: 126289
2011-02-23 01:51:59 +00:00