Commit Graph

59140 Commits

Author SHA1 Message Date
Ted Kremenek 407d81b2cd Add another test case found due to an analyzer regression.
llvm-svn: 70600
2009-05-01 23:35:18 +00:00
Daniel Dunbar 6d0eecad6c Make install target actually work, dependencies FTW.
llvm-svn: 70599
2009-05-01 23:34:58 +00:00
Douglas Gregor cf7b2afc62 When printing a source line as part of a diagnostic, the source line
might be wider than we're supposed to print. In this case, we try to
select the "important" subregion of the source line, which contains
everything that we want to show (e.g., with underlining and the caret
itself) and tries to also contain some of the context. 

From the fantastically long line in the test case, we get an error
message that slices down to this:

message-length.c:18:120: warning: comparison of distinct pointer types
      ('int *' and 'float *')
  a_func_to_call(ip == FloatPointer, ip[ALongIndexName], 
                 ~~ ^  ~~~~~~~~~~~~

There are a bunch of gee-it-sounds-good heuristics in here, which seem
to do well on the various simple tests I've thrown at it. However,
we're going to need to look at a bunch more diagnostics to tweak these
heuristics.

This is the second part of <rdar://problem/6711348>. Almost there! 

llvm-svn: 70597
2009-05-01 23:32:58 +00:00
Anders Carlsson 2bbb86b02e It's an error to call offsetof on a non-POD type.
llvm-svn: 70595
2009-05-01 23:20:30 +00:00
Daniel Dunbar c52d01f8d9 Add ONLY_MAN_DOCS variable to only install the man page, not the html
and ps documentation.

llvm-svn: 70589
2009-05-01 23:11:42 +00:00
Anders Carlsson aa10d656b5 Get rid of CXXDestroyExpr.
llvm-svn: 70586
2009-05-01 22:21:22 +00:00
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
Dan Gohman 410b4fdceb Change the description string of the LoopInfo pass.
"Construction" makes it sound like a pass that might
modify the CFG to construct natural loops.

llvm-svn: 70580
2009-05-01 21:58:05 +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
Stuart Hastings e54523d56e Prevent looping when DenseSet is abused.
llvm-svn: 70572
2009-05-01 20:47:53 +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
Misha Brukman 3268c95840 HTML-escape '>' as '&gt;' in sample C++ code.
llvm-svn: 70569
2009-05-01 20:40:51 +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
Bob Wilson 62a3124fb8 Allow CONCAT_VECTORS nodes to be legal or have custom lowering for some targets.
Changes to take advantage of this will come later.

llvm-svn: 70560
2009-05-01 17:55:32 +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
Dan Gohman d195a22e51 Actually insert inserted instructions into the InsertedValues map.
llvm-svn: 70557
2009-05-01 17:13:31 +00:00
Dan Gohman 60c613b492 Add an accessor method to allow clients to test if a given expression
is associated with a SCEV expansion.

llvm-svn: 70556
2009-05-01 17:08:34 +00:00
Dan Gohman 65dbe7874f Make RequiresTypeConversion canonicalize the types before calling the
target hooks canLosslesslyBitCastTo and isTruncateFree. This allows
targets to avoid worrying about handling all combinations of integer
and pointer types.

llvm-svn: 70555
2009-05-01 17:07:43 +00:00
Dan Gohman 7227bc88f0 When printing a SCEVUnknown with pointer type, don't print an
artificial "ptrtoint", as it tends to clutter up complicated
expressions. The cast operators now print both source and
destination types, which is usually sufficient.

llvm-svn: 70554
2009-05-01 17:02:22 +00:00
Dan Gohman 150b4c3890 Short-circuit inttoptr-ptrtoint constant expressions; these aren't
always folded by the regular constant folder because it doesn't have
TargetData information.

llvm-svn: 70553
2009-05-01 17:00:00 +00:00
Dan Gohman 719f7d5c86 Make SCEVExpander::addInsertedValue able to accept Values, not just
Instructions.

llvm-svn: 70552
2009-05-01 16:58:31 +00:00
Dan Gohman d3aa4215ef Minor whitespace fix.
llvm-svn: 70551
2009-05-01 16:56:32 +00:00
Dan Gohman 90f73564d0 Fix an 80-column violation.
llvm-svn: 70550
2009-05-01 16:44:56 +00:00
Dan Gohman 194e42c612 When creating cast scevs, canonicalize the destination type. This
avoids duplicate scevs that differ only in type.

llvm-svn: 70549
2009-05-01 16:44:18 +00:00
Dan Gohman cee10c5351 Fix a compiler warning on hosts where uint64_t isn't unsigned long long.
llvm-svn: 70548
2009-05-01 16:33: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
Dan Gohman 6be8530158 Fix some code to work if TargetLowering is not available.
llvm-svn: 70546
2009-05-01 16:29:14 +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
Bill Wendling 80b9abf8f4 Simplify more code and add timer stuff.
llvm-svn: 70539
2009-05-01 08:40:06 +00:00
Bill Wendling 03968bd796 Simplify more code.
llvm-svn: 70537
2009-05-01 08:35:12 +00:00
Torok Edwin 83aec26ef8 hasSCEV() was declared in ScalarEvolution.h, but never defined. This must have
gone lost during the pImpl conversion.

llvm-svn: 70536
2009-05-01 08:33:47 +00:00
Bill Wendling 87cbaf4bc9 Simplify some code.
llvm-svn: 70534
2009-05-01 08:32:14 +00:00
Bill Wendling 1c24c74495 Fix whitespace. It was confusing me.
llvm-svn: 70533
2009-05-01 08:25:13 +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
Mike Stump 43a675bf8a Lets install the manual page with install-clang! Radar 6838692
llvm-svn: 70529
2009-05-01 01:47:55 +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