Daniel Dunbar [Fri, 8 May 2009 21:30:11 +0000 (21:30 +0000)]
Darwin x86_32: When coercing a "single element" structure, make sure
to use a wide enough type. This might be wider than the "single
element"'s type in the presence of padding bit-fields.
- Darwin x86_32 now passes the first 1k ABI tests with bit-field
generation enabled.
Daniel Dunbar [Fri, 8 May 2009 20:55:49 +0000 (20:55 +0000)]
Darwin x86_32: Improve bit-field handling for returning records.
- This turns out to be a no-op now that most of the handling for
everything else is in place.
Chris Lattner [Fri, 8 May 2009 15:39:58 +0000 (15:39 +0000)]
"This patch fixes message sends to super in categories for the GNU runtime. This used to work, but I broke it when I modified the code to emit the same thing as GCC for message sends to super in classes."
Chris Lattner [Fri, 8 May 2009 15:36:58 +0000 (15:36 +0000)]
Fix the atomics sema code to convert operands to the argument types
of the underlying _N builtin, not the the type of the pointee of the
actual type. This ensures that atomics involving pointers end up
using the correct integer type when they are resolved, avoiding
aborts in codegen.
Chris Lattner [Fri, 8 May 2009 06:58:22 +0000 (06:58 +0000)]
reimplement __sync_* builtins to be variadic and to follow the same
semantic rules that gcc and icc use. This implements the variadic
and concrete versions as builtins and has sema do the
disambiguation. There are probably a bunch of details to finish up
but this seems like a large monotonic step forward :)
Ted Kremenek [Fri, 8 May 2009 00:32:39 +0000 (00:32 +0000)]
Fix <rdar://problem/6845148>. Signed integers compared against pointers should
implicitly be changed to unsigned values in GRSimpleVals.cpp. This can happen
when the comparison involves logic in specialized transfer functions (e.g.,
OSAtomicCompareAndSwap).
Chris Lattner [Fri, 8 May 2009 00:11:50 +0000 (00:11 +0000)]
initial support for ObjC exceptions with the GNU runtime:
"This patch is a first pass at adding support for exceptions for the GNU runtime. There are a few limitations at present:
- @synchronized() is not yet supported at all. gcc currently emits calls to runtime library functions that don't exist for this directive.
- Only id @catch statements are currently working. This is enough for NS_DURING and friends, but I need to spend more time reading the output from gcc -S to work out how it finds the class pointer to make arbitrary class type catch statements work.
- I've tested it with a few common cases[1] and the clang test suite (which doesn't test exceptions for the GNU runtime, but shows I haven't broken anything else), but there are probably a lot of cases I've missed."
Ted Kremenek [Thu, 7 May 2009 23:40:42 +0000 (23:40 +0000)]
Minor code cleanup in retain/release checker in preparation for some
other changes. Instead of repeatedly checking for GC mode when
getting the return effect, just do this computation once.
a forward class declaration matching a typedef name of a class
refers to the underlying class.
This is radar 6859726. Steve, please read the radar for my rational.
Ted Kremenek [Thu, 7 May 2009 18:27:16 +0000 (18:27 +0000)]
analyzer: Add ProgramPoint 'PostLValue' just to distinguish (for
analysis introspection) when we computed an lvalue. This shouldn't
effect the current analysis results in any way.
Ted Kremenek [Thu, 7 May 2009 00:45:08 +0000 (00:45 +0000)]
Bug fix: Not all ConstraintManagers always return a null state when setting
isFeasible to false. This is something we may wish to do further validation on.
Ted Kremenek [Wed, 6 May 2009 21:39:49 +0000 (21:39 +0000)]
Refactor BugReporter interface to have a new 'BugReporterContext' and
'BugReporterVisitor'. This simplifies callbacks from BugReporter to BugReports
(via VisitNode). It also lays the foundation for arbitrary visitor "call backs"
that can be registered to a BugReporterContext as a PathDiagnostic is
constructed. These call backs can help operate as separate "experts" that can
work on constructed pieces of a PathDiagnostic for which they possess special
knowledge.
Daniel Dunbar [Wed, 6 May 2009 21:07:50 +0000 (21:07 +0000)]
More x86 target feature support.
- Apologies for the extremely gross code duplication, I want to get
this working and then decide how to get this information out of the
back end.
- This replaces -m[no-]sse4[12] by -m[no-]sse4, it appears gcc
doesn't distinguish them?
- -msse, etc. now properly disable/enable related features.
- Don't always define __SSE3__...
- The main missing functionality bit here is that we don't initialize
the features based on the CPU for all -march options.
Ted Kremenek [Wed, 6 May 2009 18:19:24 +0000 (18:19 +0000)]
Fix analyzer regression reported in PR 4164:
- Update the old StoreManager::CastRegion to strip off 'ElementRegions' when
casting to void* (Zhongxing: please validate)
- Pass-by-reference argument invalidation logic in CFRefCount.cpp:
- Strip ElementRegions when the ElementRegion is just a 'raw data' view
on top of the underlying typed region.
Zhongxing Xu [Wed, 6 May 2009 11:51:48 +0000 (11:51 +0000)]
Improve RegionStoreManager::getSizeInElements()
- add a static function getTypeWidth(), which computes the width of a type
with the help of TargetInfo.
- no-outofbounds.c now passes for region store.
Chris Lattner [Wed, 6 May 2009 04:33:31 +0000 (04:33 +0000)]
Fix rdar://6860124 - invalid input constraint 'J' in asm
This recognizes all the target-independent constant constraints
that have target-specific meanings.
Daniel Dunbar [Wed, 6 May 2009 03:16:41 +0000 (03:16 +0000)]
Improve handling of (X86) target features.
- This is a WIP...
- This adds -march= handling to the driver, and fixes the defaulting
of -mcpu on Darwin (which was using the wrong test).
Instead of handling -m{sse, ...} in the driver, pass them to clang-cc as
-target-feature [+-]name
In clang-cc, communicate with the (clang) target to discover the legal
features of a target, and the features which are enabled based on
-mcpu. This is currently hardcoded just enough to not be a feature
regression, we need to get this information from the backend's
TableGen information somehow.
This is used to construct the full list of features which are being
used, which is in turn used to initialize the predefines.
Daniel Dunbar [Wed, 6 May 2009 02:12:32 +0000 (02:12 +0000)]
Add --analyze-auto.
- Currently just an alias for --analyze, eventually we want to refit
--analyze so that it is less automatic (i.e., does not force plist
output and does not hard code the list of checks).
Ted Kremenek [Tue, 5 May 2009 22:19:17 +0000 (22:19 +0000)]
BugReporter (extensive diagnostics): Fix getEnclosingStmtLocation to reason
about Exprs that are not consumed and fix where the loop iteration diagnostic
goes.
The "instantiated from" messages coming from the caret diagnostics system are
basically walking the macro expansion tree, emitting each level as it goes. However, it was
skipping certain leaves in the tree by skipping up the entire instantiation arm every time
it went up one spelling arm. This caused it to miss some things. For example, in this
testcase:
#define M1(x) x
#define M2 1;
void foo() {
M1(M2)
}
we now print:
/Users/sabre/Desktop/clang-unused-value-macro.c:6:2: warning: expression result unused
Previously we didn't print the last line, so we never emitted the caret pointing to the 1!
Incidentally, the spaces between the lines is really noisy, I think we should reconsider
this heuristic (which adds them when the printed code starts too close to the start of the
line).
The regression test can't use -verify, because -verify doesn't catch notes for macro
instantiation history.
Chris Lattner [Tue, 5 May 2009 17:48:42 +0000 (17:48 +0000)]
remove some incorrect and unimplemented atomic builtins (e.g.
__sync_umin_and_fetch), add some missing atomic builtins (e.g.
__sync_fetch_and_nand) and reorder the list to match the GCC
documentation. The builtins still need work and codegen
implementation, more patches coming.
Chris Lattner [Tue, 5 May 2009 06:16:31 +0000 (06:16 +0000)]
When defining a function whose type has no prototype, make an effort
to go back and clean up existing uses of the bitcasted function. This
is not just an optimization: it is required for correctness to get
always inline functions to work, see testcases in function-attributes.c.
Chris Lattner [Tue, 5 May 2009 05:16:17 +0000 (05:16 +0000)]
fix some more cases where we'd emit a file with a line of 0 for implicit
types. In this case, it was objc_selector and objc_class. This fixes
rdar://6852754 - clang sometimes generates incorrect/unknown file/line info for DW_TAG__structure_type dies
Chris Lattner [Tue, 5 May 2009 05:05:36 +0000 (05:05 +0000)]
Do not generate bogus location info for DW_TAG_inheritance
DIEs. We were generating a loc with line of 0 and a file.
These tags do not need locations at all, just remove it.
this fixes rdar://6852792 - Clang generates incorrect (and unnecessary) file and line info for DW_TAG_inheritance dies
Chris Lattner [Tue, 5 May 2009 04:57:08 +0000 (04:57 +0000)]
Fix generated debug info for decls with no location (which include self/_cmd
in ObjC) to not emit file/line location information. Previously
we would output a file with bogus line information. This fixes:
rdar://6852814 - Clang generates incorrect file & line info for automatic/understood formal parameters for objc-programs
Douglas Gregor [Tue, 5 May 2009 04:50:50 +0000 (04:50 +0000)]
Turns out that Sebastian already implemented the logic to compute the
composite pointer type, and his is better! Updated relational- and
equality-operator checking accordingly.