Commit Graph

12658 Commits

Author SHA1 Message Date
Ted Kremenek 2c32773fa2 Add a new BFS GRWorkList and make it the default worklist model for
GRCoreEngine. This tends to result in shorter paths for pathological cases.

llvm-svn: 70585
2009-05-01 22:18:46 +00:00
Anders Carlsson f58c243830 Rename CXXExprWithCleanup to CXXExprWithTemporaries.
llvm-svn: 70584
2009-05-01 22:18:43 +00:00
Anders Carlsson 4ac533dc90 We can now call member functions where the base is a pointer.
llvm-svn: 70579
2009-05-01 21:55:16 +00:00
Douglas Gregor 4818553abd Implement -fmessage-length=N, which word-wraps diagnostics to N columns.
Also, put a line of whitespace between the diagnostic and the source
code/caret line when the start of the actual source code text lines up
(or nearly lines up) with the most recent line of the diagnostic. For
example, here it's okay for the last line of the diagnostic to be
(vertically) next to the source line, because there is horizontal
whitespace to separate them:

decl-expr-ambiguity.cpp:12:16: error: function-style cast to a builtin
      type can only take one argument
  typeof(int)(a,5)<<a;

However, here is a case where we need the vertical separation (since
there is no horizontal separation):

message-length.c:10:46: warning: incompatible pointer types initializing 'void
      (int, float, char, float)', expected 'int (*)(int, float, short,
      float)'

      int (*fp1)(int, float, short, float) = f;

This is part one of <rdar://problem/6711348>.

llvm-svn: 70578
2009-05-01 21:53:04 +00:00
Douglas Gregor 8d9c509975 Implement bit-field promotion rules for C99. Fixes PR3500.
llvm-svn: 70571
2009-05-01 20:41:21 +00:00
Eli Friedman 6630d6495f Add support for -Wno-format-zero-length.
llvm-svn: 70570
2009-05-01 20:41:13 +00:00
Fariborz Jahanian 07b7165b50 Check for method type conflict between declaration in
class/protocol and implementation which could be
an imm. implementation or down in the inheritance
hierarchy.

llvm-svn: 70568
2009-05-01 20:07:12 +00:00
Anders Carlsson b781bcdc30 Replace more release+static_cast with takeAs.
llvm-svn: 70567
2009-05-01 19:49:17 +00:00
Anders Carlsson 3cbc85985a Replace a bunch of static_cast + release with takeAs.
llvm-svn: 70566
2009-05-01 19:30:39 +00:00
Ted Kremenek 9c21f1d174 StoreManager::CastRegion:
- Don't layer TypedViewRegions on top of any region except
  SymbolicRegions and AllocaRegions.  This follows from my offline
  discussion within Zhongxing about how TypedViewRegions really only
  represent memory getting re-appropriated for a new purpose.

Fallout	from this change:
- Move test case from xfail_rdar_6440393.m to misc-ps-64.m
  (it now passes).

- test/Analysis/fields.c now fails for region store (crash).
  Marking XFAIL.

- test/Analysis/rdar-6441136-region.c now fails (only runs with region store).
  Marking XFAIL.

  Diagnosis: The analyzer now correctly identifies an early out-of-bounds memory
   access then the one flagged:

  rdar-6541136-region.c:17:3: warning: Load or store into an out-of-bound memory position.
    *p = 1;
    ^~

  Changing the line:
   char *p = (void*) &wonky[1];
  to
   char *p = (void*) &wonky[0];

  (which should delay the buffer overrun) causes region store to crash, probably
  because it expects a TypedViewRegion.

- test/Analysis/casts.c (region store) now fails (crash).
  Marking XFAIL.

llvm-svn: 70565
2009-05-01 19:22:20 +00:00
Ted Kremenek a11c607312 Basic Store: Always convert a non::LocAsInteger to a Loc when storing to a pointer.
llvm-svn: 70564
2009-05-01 19:04:28 +00:00
Ted Kremenek 0e3cc24e79 Update CMake file.
llvm-svn: 70563
2009-05-01 18:43:00 +00:00
Anders Carlsson bfdea0f136 Get rid of the implicit deref call when calling member functions where the base is a pointer.
llvm-svn: 70562
2009-05-01 18:34:30 +00:00
Ted Kremenek 5cfe43ddd3 Add function prototype for OSAtomicCompareAndSwap32Barrier.
llvm-svn: 70559
2009-05-01 17:37:31 +00:00
Ted Kremenek 38ce220817 Fix run line in failing test case (it was missing the '%s' for the
file name, thus causing the test case to hang).

llvm-svn: 70558
2009-05-01 17:29:33 +00:00
Chris Lattner a020b07634 teach -parse-noop about int128_t and friends.
llvm-svn: 70547
2009-05-01 16:33:20 +00:00
Ted Kremenek afbff15e64 BugReporter (extensive diagnostics): introduce the notion of a "dead"
location context.  This allows us to postpone the decision of whether
or not a context should add a control-flow piece to the diagnostics
when inspecting its subexpressions.

llvm-svn: 70545
2009-05-01 16:08:09 +00:00
Douglas Gregor f16a8a7443 Finish a thought in CheckVariableDeclaration's comment. No functionality change
llvm-svn: 70544
2009-05-01 15:47:09 +00:00
Douglas Gregor 72a57b89aa Add testcase that illustrates the problem from r69699 regarding tentative definitions of statics
llvm-svn: 70543
2009-05-01 15:45:53 +00:00
Ted Kremenek 29d0880e50 Remove #if 0'ed code.
llvm-svn: 70542
2009-05-01 15:19:33 +00:00
Ted Kremenek 3b201db3c0 Add failing static analyzer case (this crashes).
llvm-svn: 70532
2009-05-01 04:13:51 +00:00
Eli Friedman f4e3ad6500 PR4013 and PR4105: pointer-like types can only be cast to/from integers
and other pointer-like types.

llvm-svn: 70531
2009-05-01 02:23:58 +00:00
Chris Lattner 2ab6983e41 C/ObjC work well enough with clang for them not to be a gcc strength anymore.
llvm-svn: 70528
2009-05-01 01:42:13 +00:00
Chris Lattner 0936387c46 add word
llvm-svn: 70527
2009-05-01 01:40:42 +00:00
Chris Lattner 0cfae87d80 C/ObjC work well enough to claim support for them now.
llvm-svn: 70526
2009-05-01 01:40:17 +00:00
Mike Stump d898026e8a Don't assert when we think we need copy/dispose, but don't need them.
Radar 6838889

llvm-svn: 70525
2009-05-01 01:31:57 +00:00
Anders Carlsson b4e463287e Don't use indirect memory destinations for inline asm. Fixes 6841383.
llvm-svn: 70523
2009-05-01 00:16:04 +00:00
Anders Carlsson 5e965472b9 C++ destructors can have a single unnamed void parameter. Fixes <rdar://problem/6841210>.
llvm-svn: 70519
2009-04-30 23:18:11 +00:00
Fariborz Jahanian e29b4f0785 Remove a warning when this file is compiled optimized.
llvm-svn: 70518
2009-04-30 23:08:58 +00:00
Anders Carlsson a088693557 Rework the way we handle constructor decls to be less hacky and fix PR3948 completely.
llvm-svn: 70516
2009-04-30 22:41:11 +00:00
Fariborz Jahanian 68592fc9e1 Use of super class ivar to synthesize property is back to being error.
llvm-svn: 70514
2009-04-30 21:39:24 +00:00
Ted Kremenek 2ff8a79d27 retain/release checker: Hook up attributes 'objc_ownership_retain' and
'objc_ownership_release' to the effects on receivers.

llvm-svn: 70507
2009-04-30 20:00:31 +00:00
Sebastian Redl aae83b4596 Make a home for exception specs in the AST. Now Sema can hook them up.
llvm-svn: 70506
2009-04-30 19:20:55 +00:00
Ted Kremenek 2acb5adac9 Allow attributes 'objc_ownership_retain' and 'objc_ownership_release' to be
applied to ObjCMethodDecls, not just parameters. This allows one to specific
side-effects on the receiver of a message expression. No checker support yet.

llvm-svn: 70505
2009-04-30 19:18:03 +00:00
Ted Kremenek 290fbb1d42 Hook up Sema support for attributes on Objective-C method declarations that
appear between the return type and the selector. This is a separate code path
from regular attribute processing, as we only want to (a) accept only a specific
set of attributes in this place and (b) want to distinguish to clients the
context in which an attribute was added to an ObjCMethodDecl.

Currently, the attribute 'objc_ownership_returns' is the only attribute that
uses this new feature. Shortly I will add a warning for 'objc_ownership_returns'
to be placed at the end of a method declaration.

llvm-svn: 70504
2009-04-30 18:41:06 +00:00
Ted Kremenek 8c06515f2b Add parsing support in an Objective-C method declaration for attributes between
the return type and selector. Haven't hooked this up to Sema yet.

llvm-svn: 70501
2009-04-30 17:55:29 +00:00
Steve Naroff a80dd1cae1 Name the "return-type" DiagGroup and reference it in a few places.
llvm-svn: 70500
2009-04-30 17:53:16 +00:00
Douglas Gregor ef462e6bb0 Properly compute the alignment of typedefs that make use of the
"aligned" attribute. Previously, we were skipping over these
attributes when we jumped directly to the canonical type. Now,
ASTContext::getTypeInfo walks through typedefs and other
"non-canonical" types manually, looking for "aligned" attributes on
typedefs.

As part of this change, I moved the GNU-specific logic (such as
determining the alignment of void or of a function pointer) out of the
expression evaluator and into ASTContext::getTypeInfo.

llvm-svn: 70497
2009-04-30 17:32:17 +00:00
Fariborz Jahanian 18c435a17d API for message dispatch of methods returning floats
to match gcc's closely.

llvm-svn: 70493
2009-04-30 16:31:11 +00:00
Steve Naroff 62e0cb0a22 Warn about invalid return statements by default.
This fixes <rdar://problem/6839489> 10A345: Clang does not warm about mismatched returns (void return from a bool function)
 
Will implement -Wreturn-type, -Wno-return-type in another commit.

llvm-svn: 70492
2009-04-30 16:01:26 +00:00
Ted Kremenek 10e21109d7 Update checker build.
llvm-svn: 70489
2009-04-30 15:15:37 +00:00
Eli Friedman 902fddd1cf Fix for PR4108: be a bit looser with the casts that we accept in
constant initializers.

llvm-svn: 70483
2009-04-30 07:03:22 +00:00
Chris Lattner 8ca336a86a accept and ignore two new warning specifiers. -Wno-discard-qual seems easy
to hook up if someone was interested.

llvm-svn: 70482
2009-04-30 06:36:43 +00:00
Chris Lattner b822fad20f fix i128 to return in 2 64-bit registers (rax/rdx on x86-64)
llvm-svn: 70481
2009-04-30 06:22:07 +00:00
Chris Lattner 7d4f5c47ce only support int128_t on 64-bit and larger targets. 32-bit targets don't
have support for __divti3 and friends.

llvm-svn: 70480
2009-04-30 06:18:40 +00:00
Ted Kremenek b4e27a1838 Handle case in EvalReturn where we cache out in the ExplodedGraph.
llvm-svn: 70475
2009-04-30 05:51:50 +00:00
Ted Kremenek 497df9126f retain/release checker: Use the ObjCMethodDecl in the @implementation if no
matching ObjCMethodDecl exists in the @interface.

llvm-svn: 70474
2009-04-30 05:47:23 +00:00
Ted Kremenek b2a143fad6 retain/release checker: Resolve method decl in @interface after getting the
ObjCInterfaceDecl, not before.

llvm-svn: 70473
2009-04-30 05:41:14 +00:00
Chris Lattner 0a415ec50c int128_t is apparently 128-bit aligned on all 64-bit targets, and
not supported on 32-bit targets, so we can define it to be 128-bit
aligned there too :)

llvm-svn: 70465
2009-04-30 02:55:13 +00:00
Chris Lattner f122cef4df initial support for __[u]int128_t, which should be basically
compatible with VC++ and GCC.  The codegen/mangling angle hasn't
been fully ironed out yet.  Note that we accept int128_t even in
32-bit mode, unlike gcc.

llvm-svn: 70464
2009-04-30 02:43:43 +00:00