Douglas Gregor [Sun, 3 May 2009 15:24:25 +0000 (15:24 +0000)]
Fix crash in source-line truncation code for diagnostic
printing. Also, when we only need to truncate the line at the end,
make sure there is room for the ellipsis.
Daniel Dunbar [Sun, 3 May 2009 13:15:50 +0000 (13:15 +0000)]
Use ASTRecordLayout for computing ivar offsets instead of shadow
struct.
- We still need to do more lookup than necessary because ivars don't
live in a reasonable DeclContext.
- The only remaining client of the interface shadow struct is the
ivar layout bitmap.
Daniel Dunbar [Sun, 3 May 2009 12:57:56 +0000 (12:57 +0000)]
Add a ComputeIvarBaseOffset overload taking an implementation
decl. Only this routine will be suitable for computing the offset of a
synthesized ivar.
- No functionality change.
Daniel Dunbar [Sun, 3 May 2009 11:16:44 +0000 (11:16 +0000)]
Implement the interface/implementation layout distinction.
- These routines should now be independent of the Sema state.
- This is nearly zero functionality change, the distinction only
matters in the non-fragile ABI, and the consumers that care about
this distinction should be using getASTObjCImplementationLayout.
Daniel Dunbar [Sun, 3 May 2009 10:38:35 +0000 (10:38 +0000)]
Split out getASTObjCImplementationLayout
- The difference from getASTObjCInterfaceLayout is that the computes
the layout including synthesized ivars.
- No functionality change, they currently both compute the same thing
-- whether that includes synthesized ivars or not depends on when
they get called!!!
Daniel Dunbar [Sun, 3 May 2009 10:04:17 +0000 (10:04 +0000)]
PR4063, with feeling: Chain PP callbacks by default.
- This is somewhat cleaner and also fixes PR4063 for real, I had the
order wrong so we were just creating an empty dependency file.
Chris Lattner [Sun, 3 May 2009 07:53:25 +0000 (07:53 +0000)]
implement support for asm outputs targetting non-simple lvalue destinations
like bitfields. incidentally llvm-gcc crashes on this sort of thing also. :)
Chris Lattner [Sun, 3 May 2009 07:04:21 +0000 (07:04 +0000)]
If we have mismatched integer tied operands, but the operand
number is not mentioned in the asm string, let it past sema.
Right now these are currently rejected by the llvm code generator
but this will be fixed next.
Chris Lattner [Sun, 3 May 2009 06:50:40 +0000 (06:50 +0000)]
avoid a crash when we encounter a implicit cast of the paren expr due to
promotions. This should be fixed by not modeling asm operands (which
require the ()'s according to the grammar) as not being paren exprs.
Eli Friedman [Sun, 3 May 2009 04:46:36 +0000 (04:46 +0000)]
Add Sema support for __builtin_setjmp/__builtin_longjmp. The primary
reason for adding these is to error out in CodeGen when trying to generate
them instead of silently emitting a call to a non-existent function.
(Note that it is not valid to lower these to setjmp/longjmp; in addition
to that lowering being different from the intent, setjmp and longjmp
require a larger buffer.)
Daniel Dunbar [Sat, 2 May 2009 22:09:19 +0000 (22:09 +0000)]
Driver: Treat -m32 and -m64 as "driver-only" arguments.
- In particular, don't forward them to gcc; these participate in the
selection of the tool chain, which should know how to talk to gcc
and be fixed if it doesn't.
Chris Lattner [Sat, 2 May 2009 19:34:21 +0000 (19:34 +0000)]
when creating custom warning diagnostics, do not attempt to map
them with -Werror. Custom diags cannot be mapped, and this makes
-Werror cause a determinstic crash for the checker and other
clients of the custom diagnostics machinery. rdar://6816191
Douglas Gregor [Sat, 2 May 2009 02:18:30 +0000 (02:18 +0000)]
When determining whether an expression refers to a bit-field, look
into the left-hand side of an assignment expression. This completes
most of PR3500; the only remaining part is to deal with the
GCC-specific implementation-defined behavior for "unsigned long" (and
other) bit-fields.
Chris Lattner [Sat, 2 May 2009 01:13:16 +0000 (01:13 +0000)]
When creating a dwarf record type for an objc interface, make sure to propagate
the runtime version number onto it, so that the debugger knows it's an objc
interface, not a C struct. rdar://6848435
Ted Kremenek [Sat, 2 May 2009 00:13:27 +0000 (00:13 +0000)]
Fix crasher in CFG construction when not properly handling ASTs that contain
expressions not yet properly handled by the CFGBuilder. This failure resulted in
a null CFGBlock* being used in rare cases (causing a crash).
Douglas Gregor [Fri, 1 May 2009 23:32:58 +0000 (23:32 +0000)]
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!
Douglas Gregor [Fri, 1 May 2009 21:53:04 +0000 (21:53 +0000)]
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):
Check for method type conflict between declaration in
class/protocol and implementation which could be
an imm. implementation or down in the inheritance
hierarchy.
Ted Kremenek [Fri, 1 May 2009 19:22:20 +0000 (19:22 +0000)]
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.