Commit Graph

13045 Commits

Author SHA1 Message Date
Ted Kremenek 9a627e60cd Update checker build.
llvm-svn: 71404
2009-05-10 17:41:29 +00:00
Ted Kremenek 1f8e4346fa Add special warning about returning a retained object where a GC'ed object is expected.
llvm-svn: 71397
2009-05-10 16:52:15 +00:00
Ted Kremenek dee56e37fc retain/release checker: Flag a warning for non-owned objects returned
where an owned one is expected.  Also add preliminary checking for
returning a positive retain count object in GC mode where an owned GC
object is expected.

llvm-svn: 71388
2009-05-10 06:25:57 +00:00
Ted Kremenek 9dc1bed4a6 Update checker build.
llvm-svn: 71387
2009-05-10 05:54:23 +00:00
Ted Kremenek 3978f7972d analyzer:
- Improve -autorelease diagnostics.
- Improve VLA diagnostics.
- Use "short description" for bug when outputting to TextDiagnostics

llvm-svn: 71383
2009-05-10 05:11:21 +00:00
Ted Kremenek 1e0d6a5957 Update checker build.
llvm-svn: 71375
2009-05-10 02:22:16 +00:00
Ted Kremenek 1f991f09df Add total hack to get scan-build working again. ccc-analyzer calls
'clang -###' to get the appropriate arguments to pass to clang-cc.
This isn't a permanent solution.

llvm-svn: 71364
2009-05-09 19:19:28 +00:00
Chris Lattner da38fda583 force a target triple so that the right greppable output happens.
llvm-svn: 71361
2009-05-09 17:36:58 +00:00
Zhongxing Xu c9c3dab491 When casting VarRegion, if the var type is aggregate type and the cast-to
pointee type is scalar type, create element region regardless with the sizes
of types.

llvm-svn: 71360
2009-05-09 15:34:29 +00:00
Zhongxing Xu 4131114d99 Remove the rest TypedViewRegion processing code. There should be no
TypedViewRegion usage in region store.

llvm-svn: 71359
2009-05-09 15:23:42 +00:00
Zhongxing Xu d6daef9165 When evaluating pointer arithmetic, if the base location is a symbolic region,
convert it to the first element region.
Also do not assume the array region is typed.

llvm-svn: 71358
2009-05-09 15:18:12 +00:00
Zhongxing Xu b18d7cab0c Do not create a TypedViewRegion when the base struct region is a symbolic
region. In the future we may set the cast-to type as the same time. But for
now, we simply leave it as it is.

llvm-svn: 71357
2009-05-09 13:36:16 +00:00
Zhongxing Xu 4bc5a4c3bd add comments to test case.
llvm-svn: 71356
2009-05-09 13:27:17 +00:00
Zhongxing Xu 7c3826484e Do not layer a TypedViewRegion when casting symbolic or alloca regions.
Modify getLValueElement accordingly. Now we don't require base region 
to be a typed region. Do not create TypedViewRegion when base region is 
symbolic or alloca region. We can do so because each element region has 
its type information.

llvm-svn: 71355
2009-05-09 13:20:07 +00:00
Zhongxing Xu e3e94bbf19 Remove the case for casting to compatible type in
RegionStoreManager::CastRegion(). This case should be subsumed by others.

llvm-svn: 71353
2009-05-09 10:03:08 +00:00
Duncan Sands c76fe8b611 Correct for renaming PaddedSize -> AllocSize in
LLVM.

llvm-svn: 71350
2009-05-09 07:08:47 +00:00
Ted Kremenek 6631d7c4be Roll back to checker build 0.195.
llvm-svn: 71348
2009-05-09 07:05:44 +00:00
Zhongxing Xu 91e2ab496f Rename:
SymbolRegionRValue => SymbolRegionValue
  SymExpr::RegionRValue => SymExpr::RegionValueKind

llvm-svn: 71322
2009-05-09 04:08:27 +00:00
Zhongxing Xu 34d04b3ca9 As discussed with Ted, rename TypedRegion::getObjectType() to
TypedRegion::getValueType().

llvm-svn: 71321
2009-05-09 03:57:34 +00:00
Ted Kremenek d73cfc734b Add back test cases for ns_returns_retained and cf_returns_retained.
llvm-svn: 71312
2009-05-09 03:10:32 +00:00
Ted Kremenek 669604cded Add back attribute string lookup for 'ns_returns_retained' and
'cf_returns_retained'.

llvm-svn: 71311
2009-05-09 03:08:29 +00:00
Ted Kremenek c2de72776c Add back analyzer support for ns_returns_retained and cf_returns_retained.
llvm-svn: 71309
2009-05-09 02:58:13 +00:00
Ted Kremenek 9ecdfaf66d Add back Parse/Sema support for attributes cf_returns_retained and
ns_returns_retained, but do not include the other ownership attributes
we previously had.

llvm-svn: 71308
2009-05-09 02:44:38 +00:00
Ted Kremenek 2d0ff62a0d It lives! The retain/release checker now tracks objects that are sent
'autorelease'.

llvm-svn: 71307
2009-05-09 01:50:57 +00:00
Ted Kremenek 8326c2fdfc Fix lurking bug in one of the versions of
GRStmtNodeBuilder::generateNode() where the HasGeneratedNode flag
wouldn't properly be set.

llvm-svn: 71306
2009-05-09 01:37:12 +00:00
Zhongxing Xu 8038f7b30f rename: MemRegion:
RValueType => ObjectType
 LValueType => LocationType

No functionality change.

llvm-svn: 71304
2009-05-09 00:50:33 +00:00
Ted Kremenek 9ec08aa3f7 More hacking on autorelease errors. We now can emit basic errors (disabled for
now until ready).

llvm-svn: 71303
2009-05-09 00:44:07 +00:00
Ted Kremenek d35272f96b Put most of the boilerplate logic in place for reporting autorelease errors.
llvm-svn: 71301
2009-05-09 00:10:05 +00:00
Fariborz Jahanian 5276014db2 We want to diagnose sending message to a forward class
and we also want to tell which message is actually 
being sent.

llvm-svn: 71296
2009-05-08 23:45:49 +00:00
Daniel Dunbar 793cc3e0c3 ABITest: Improve test driver marginally, to allow running a specific
test index.

llvm-svn: 71295
2009-05-08 23:40:45 +00:00
Ted Kremenek 8c8fb488e6 retain/release checker: Add stub for HandleAutoreleaseCounts.
llvm-svn: 71290
2009-05-08 23:32:51 +00:00
Zhongxing Xu ca143e73ea Fix PR4182.
llvm-svn: 71288
2009-05-08 23:28:07 +00:00
Ted Kremenek 884a8996c5 retain/release checker: Refactor error-reporting code in EvalDeadSymbols and
EvalEndPath. This sets the stage for handling autorelease counts.

llvm-svn: 71283
2009-05-08 23:09:42 +00:00
Ted Kremenek c218c84a80 Make BlockEntrace program points taggable.
llvm-svn: 71280
2009-05-08 23:08:34 +00:00
Ted Kremenek c56062d72e Fix typo in method name.
llvm-svn: 71279
2009-05-08 23:07:51 +00:00
Fariborz Jahanian 1bd844da80 Warn if forward class is used as a receiver.
llvm-svn: 71278
2009-05-08 23:02:36 +00:00
Daniel Dunbar 3a53b857d0 ABITest: Move more of the common Makefile bits into the common
Makefile.

llvm-svn: 71274
2009-05-08 22:49:52 +00:00
Daniel Dunbar 811e62c8c1 ABITest: Fix a bug in generating test values for structures w/ no
non-padding fields.

llvm-svn: 71273
2009-05-08 22:48:39 +00:00
Daniel Dunbar b997f3bcc3 x86_64 ABI: Ignore padding bit-fields during classification.
- {return-types,single-args}-{32,64} pass the first 1k ABI tests with
   bit-fields enabled.

llvm-svn: 71272
2009-05-08 22:26:44 +00:00
Daniel Dunbar 4752783057 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.

llvm-svn: 71270
2009-05-08 21:30:11 +00:00
Fariborz Jahanian 3e68a1facc Fixes a bug in my last patch. Order of types reversed.
llvm-svn: 71267
2009-05-08 21:10:00 +00:00
Daniel Dunbar fdda3501a0 Darwin x86_32: Ignore padding bit-fields when looking for "single
element" structures.

llvm-svn: 71266
2009-05-08 21:04:47 +00:00
Daniel Dunbar 4861346c44 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.

llvm-svn: 71261
2009-05-08 20:55:49 +00:00
Daniel Dunbar 85f4028f2e Darwin x86_32: Ignore arrays of empty structures inside records.
- This eliminates 5/1000 failures on return-types-32, on the current
   ABITest config.

llvm-svn: 71250
2009-05-08 20:21:04 +00:00
Fariborz Jahanian fe9e3940eb Refactoring of my last patch.
llvm-svn: 71248
2009-05-08 20:20:55 +00:00
Daniel Dunbar 51c4bc320e ABITest: Move default set of test args into common makefile.
Also, tweak default list of bit-fields to try.

llvm-svn: 71246
2009-05-08 20:10:52 +00:00
Ted Kremenek 3a0516b25a retain checker: Track the number of times a tracked object is sent
'autorelease'. This isn't used yet to flag errors.

llvm-svn: 71244
2009-05-08 20:01:42 +00:00
Fariborz Jahanian b2ab73d93c More type checking for properties, accessors and
use of dot-syntax expression. This is to match gcc's.

llvm-svn: 71243
2009-05-08 19:36:34 +00:00
Anton Korobeynikov 2f910827eb Provide dummy va_list typedef for msp430
llvm-svn: 71233
2009-05-08 18:24:57 +00:00
Chris Lattner 96afab520b further improvements to gnu objc EH stuff, patch by David Chisnall!
llvm-svn: 71227
2009-05-08 17:36:08 +00:00
Chris Lattner a02cb80f99 "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."
Patch by David Chisnall!

llvm-svn: 71220
2009-05-08 15:39:58 +00:00
Chris Lattner 5b9241b2a6 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.

llvm-svn: 71218
2009-05-08 15:36:58 +00:00
Ted Kremenek 062c14ba24 Remove experimental ownership attributes from Clang.
llvm-svn: 71216
2009-05-08 15:19:25 +00:00
Zhongxing Xu d2e8fa14df Region store: when casting VarRegions, if the cast-to pointee type is
incomplete, do not compute its size and return the original region.

llvm-svn: 71213
2009-05-08 07:28:25 +00:00
Chris Lattner dc04654697 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 :)

llvm-svn: 71212
2009-05-08 06:58:22 +00:00
Zhongxing Xu afc875c766 Replace the heuristic isSmallerThan with ASTContext::getTypeSize().
llvm-svn: 71206
2009-05-08 02:12:59 +00:00
Zhongxing Xu c0c074655d Replace getTypeWidth() with ASTContext::getTypeSize().
llvm-svn: 71205
2009-05-08 02:00:55 +00:00
Zhongxing Xu 1ba79dfeea Revert r71079.
llvm-svn: 71202
2009-05-08 01:33:18 +00:00
Daniel Dunbar 766004f179 Add various other bits I use to run ABITest.
llvm-svn: 71201
2009-05-08 00:49:21 +00:00
Ted Kremenek 3975f17f04 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).

llvm-svn: 71200
2009-05-08 00:32:39 +00:00
Chris Lattner b6e9eb6956 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."

Patch by David Chisnall!

llvm-svn: 71198
2009-05-08 00:11:50 +00:00
Eli Friedman 7ce29a18e1 Fix crash with constant initialization of bit-fields in unions.
llvm-svn: 71194
2009-05-07 23:42:42 +00:00
Ted Kremenek 9157fbb6a6 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.

llvm-svn: 71193
2009-05-07 23:40:42 +00:00
Daniel Dunbar 5bcbf1ccbd Add to the house of cards that is ABITestGen.
- Support generating structures with bit-fields.

llvm-svn: 71192
2009-05-07 23:19:55 +00:00
Mike Stump 5580bdcaa2 Add a warning for a missing copy attribute on a property that is a
block pointer.  Radar 6441502

llvm-svn: 71190
2009-05-07 23:06:50 +00:00
Daniel Dunbar 81ded69511 Remove -fobjc-tight-layout, seems to work!
llvm-svn: 71184
2009-05-07 21:58:26 +00:00
Mike Stump 5e16a0d9e7 Allow qualifiers on blocks. Radar 6441502
llvm-svn: 71183
2009-05-07 21:56:17 +00:00
Ted Kremenek ba53fe98e7 More attribute renaming:
- Rename 'ns_returns_owned' -> 'ns_returns_retained'.
- Rename 'cf_returns_owned' -> 'cf_returns_retained'.

llvm-svn: 71182
2009-05-07 21:49:45 +00:00
Fariborz Jahanian 0d451813f9 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.

llvm-svn: 71181
2009-05-07 21:49:26 +00:00
Anders Carlsson 6840b65ab7 add isFriendSpecified.
llvm-svn: 71174
2009-05-07 19:41:51 +00:00
Ted Kremenek 094bc31000 Fix <rdar://problem/6848739>. When using -analyze, -Werror has no effect.
llvm-svn: 71172
2009-05-07 19:02:53 +00:00
Mike Stump f70bcf7d1a Tighten up relationals with blocks and ints. Radar 6441502
llvm-svn: 71171
2009-05-07 18:43:07 +00:00
Ted Kremenek a6e08327c0 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.

llvm-svn: 71169
2009-05-07 18:27:16 +00:00
Douglas Gregor 1bbffbceae Big update to the C++ status table to reflect "recent"
development. Still much more to write!

llvm-svn: 71167
2009-05-07 17:50:16 +00:00
Sebastian Redl fb23ddf661 Fix a FIXME in new expression checking.
llvm-svn: 71163
2009-05-07 16:14:23 +00:00
Douglas Gregor 938439b6fe Document the dependent type equivalence test case's purpose.
llvm-svn: 71162
2009-05-07 15:40:54 +00:00
Douglas Gregor 6d7a30c73e Test a few more variants of dependent type names
llvm-svn: 71161
2009-05-07 15:31:47 +00:00
Douglas Gregor ae1e53c87b Compute the canonical template name when building a template
specialization type for a dependent template name.

llvm-svn: 71153
2009-05-07 06:49:52 +00:00
Douglas Gregor 6bc50585e3 Start canonicalizing template names. This is not yet complete, but it
improves type identity with dependent types.

llvm-svn: 71152
2009-05-07 06:41:52 +00:00
Chris Lattner ed58599a7e Add support for LLLi -> int128 in builtins.def
llvm-svn: 71148
2009-05-07 04:47:06 +00:00
Chris Lattner 5c633e38a8 Make this test portable to non-x86 hosts, patch by Mark Cianciosa!
llvm-svn: 71146
2009-05-07 04:21:16 +00:00
Mike Stump 1b821b4fc5 Improve semantic checking for blocks. Radar 6441502
llvm-svn: 71145
2009-05-07 03:14:14 +00:00
Ted Kremenek 9abe474852 Add preliminary support for enhancing null-pointer dereference diagnostics.
llvm-svn: 71135
2009-05-07 00:45:33 +00:00
Ted Kremenek 75edb2e8a0 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.

llvm-svn: 71134
2009-05-07 00:45:08 +00:00
Sebastian Redl f08aa62c80 Back out r70506 (exception spec in AST) again. We won't have exception specs until we've had a lot more discussion.
llvm-svn: 71125
2009-05-06 23:27:55 +00:00
Daniel Dunbar f9d90275f9 Handle -march for the LLVM recognized cpu names.
- x86 target feature handling should not be feature complete, even if
   the code quality is lacking.

llvm-svn: 71123
2009-05-06 21:56:32 +00:00
Ted Kremenek bb8d546208 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.

llvm-svn: 71121
2009-05-06 21:39:49 +00:00
Daniel Dunbar 908a66dc9b If stderr isn't a terminal, don't try to guess the terminal width or
look at COLUMNS.

llvm-svn: 71120
2009-05-06 21:28:42 +00:00
Daniel Dunbar bb36aed06b 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.

llvm-svn: 71117
2009-05-06 21:07:50 +00:00
Ted Kremenek 83ffab06ef Update checker build.
llvm-svn: 71112
2009-05-06 20:13:50 +00:00
Daniel Dunbar 16af476c42 Document environment variables we handle, and don't mention -pipe (it
isn't yet supported... lazy developers).

llvm-svn: 71109
2009-05-06 19:18:09 +00:00
Ted Kremenek 0626df4eeb 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.

llvm-svn: 71094
2009-05-06 18:19:24 +00:00
Chris Lattner 164ac10f82 More content.
llvm-svn: 71088
2009-05-06 17:22:08 +00:00
Zhongxing Xu ea8c48d5a1 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.

llvm-svn: 71080
2009-05-06 11:51:48 +00:00
Zhongxing Xu bc3864829d add getTargetInfo() method to ASTContext.
llvm-svn: 71079
2009-05-06 11:48:29 +00:00
Zhongxing Xu c98868136f Add a GDM for recording the cast type of regions.
llvm-svn: 71076
2009-05-06 08:33:50 +00:00
Zhongxing Xu 24ed0b28a8 The super region of ElementRegion no longer needs to be TypedRegion. In the
future we would create ElementRegion directly on top of typeless regions.

llvm-svn: 71075
2009-05-06 08:15:46 +00:00
Zhongxing Xu 1813e23a52 Implement a heuristic type size comparison method for now.
llvm-svn: 71074
2009-05-06 08:08:27 +00:00
Chris Lattner 51f57a4195 adjust this to bourne shell syntax
llvm-svn: 71070
2009-05-06 06:00:28 +00:00
Daniel Dunbar e5ae096bf8 Tweak x86 -mcpu defaults.
- Default to yonah on Darwin (to get SSE3).

 - Default to Pentium4 (32-bit) and x86-64 (64-bit) on
   non-Darwin. Welcome to the 21st century.

llvm-svn: 71069
2009-05-06 04:58:14 +00:00
Anders Carlsson cd8db41c52 Add parsing of friend specifiers.
llvm-svn: 71067
2009-05-06 04:46:28 +00:00
Douglas Gregor 080fe61d64 Eliminate extra vertical space in Clang diagnostics
llvm-svn: 71066
2009-05-06 04:43:47 +00:00
Chris Lattner 37ac812f9c daniel is buggy :)
llvm-svn: 71065
2009-05-06 04:38:30 +00:00
Chris Lattner dbcc5ca57f Fix rdar://6860124 - invalid input constraint 'J' in asm
This recognizes all the target-independent constant constraints
that have target-specific meanings.

llvm-svn: 71064
2009-05-06 04:33:31 +00:00
Daniel Dunbar 67dba989bb Add missing include.
llvm-svn: 71063
2009-05-06 04:07:06 +00:00
Daniel Dunbar bc45101e09 Cleanup some FIXMEs.
llvm-svn: 71062
2009-05-06 03:48:17 +00:00
Daniel Dunbar 4dbaaa6f43 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.

llvm-svn: 71061
2009-05-06 03:16:41 +00:00
Zhongxing Xu b2d4a52e3f remove commented code.
llvm-svn: 71060
2009-05-06 02:54:11 +00:00
Chris Lattner 2080787636 add some content
llvm-svn: 71059
2009-05-06 02:47:51 +00:00
Zhongxing Xu d5e09be293 Make StoreManager::CastRegion() virtual and implement a new CastRegion() for
RegionStore.

This CastRegion() performs casts according to the kind of the region being 
cast instead of the type that is cast to.

llvm-svn: 71058
2009-05-06 02:42:32 +00:00
Daniel Dunbar 5e051f9a86 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).

llvm-svn: 71056
2009-05-06 02:12:32 +00:00
Ted Kremenek 82f7cfa156 Update checker build.
llvm-svn: 71046
2009-05-06 00:14:14 +00:00
Daniel Dunbar 94fa27171b Override some pod2man defaults.
llvm-svn: 71045
2009-05-06 00:10:37 +00:00
Fariborz Jahanian a16904bc41 Fixes a bug for objc2's gc in the presense of type-casts.
llvm-svn: 71041
2009-05-05 23:28:21 +00:00
Ted Kremenek a8106efce9 BugReporter (extensive diagnostics): improve location context generation for the
start of 'do' and '@synchronized' statements.

llvm-svn: 71038
2009-05-05 23:13:38 +00:00
Ted Kremenek b3c657bbd4 source-level CFG: have the body for the @synchronized start with its own basic
block. This makes it a little easier for diagnostics generation.

llvm-svn: 71037
2009-05-05 23:11:51 +00:00
Ted Kremenek 98017051ae BugReporter (extensive diagnostics): Fix getEnclosingStmtLocation to reason
about Exprs that are not consumed and fix where the loop iteration diagnostic
goes.

llvm-svn: 71027
2009-05-05 22:19:17 +00:00
Ted Kremenek 90a6145ad1 Fix subtle bug in ParentMap::isConsumedExpr(): correctly ignore *parents* that
are ParenExpr or CastExprs.

llvm-svn: 71026
2009-05-05 22:16:12 +00:00
Chris Lattner c45529b17b Fix rdar://6849429 - -Wunused-value with deeply nested macro expansion generates untraceable warnings
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

 M1(M2)
 ^~~~~~
/Users/sabre/Desktop/clang-unused-value-macro.c:6:5: note: instantiated from:

 M1(M2)
    ^~
/Users/sabre/Desktop/clang-unused-value-macro.c:3:12: note: instantiated from:

#define M2 1;
           ^

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.

llvm-svn: 71025
2009-05-05 22:03:18 +00:00
Chris Lattner 882abeb2f8 rename test
llvm-svn: 71024
2009-05-05 21:52:01 +00:00
Fariborz Jahanian f3648b8913 Patch to support Gnu runtime's typed selectors.
Patch by David Chisnall.

llvm-svn: 71023
2009-05-05 21:36:57 +00:00
Chris Lattner b732397343 257 -> FS
llvm-svn: 70996
2009-05-05 18:54:47 +00:00
Daniel Dunbar c4bb4274b6 Enable tight Objective-C interface layout unconditionally.
- I will remove the flag when I'm comfortable there is no fallout
   from this.

llvm-svn: 70993
2009-05-05 18:52:50 +00:00
Ted Kremenek 213ff5a98e Implement attribute 'ns_autorelease'.
llvm-svn: 70990
2009-05-05 18:44:20 +00:00
Fariborz Jahanian 3baaffba6b Issue a warning in odd case of instance method used
in a 'Class' receiver which is not a root instance
method.

llvm-svn: 70987
2009-05-05 18:34:37 +00:00
Chris Lattner eaefb3a8ca 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.

llvm-svn: 70985
2009-05-05 17:48:42 +00:00
Ted Kremenek dad8889d62 Enhance ownership attribute tests with functions that use the attributes!
llvm-svn: 70984
2009-05-05 17:46:22 +00:00
Chris Lattner 36797ab251 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.

llvm-svn: 70971
2009-05-05 06:16:31 +00:00
Chris Lattner 448a228521 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

llvm-svn: 70969
2009-05-05 05:16:17 +00:00
Chris Lattner f216fd96fe 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

llvm-svn: 70966
2009-05-05 05:05:36 +00:00
Chris Lattner 362d8ae328 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

llvm-svn: 70965
2009-05-05 04:57:08 +00:00
Douglas Gregor b8420464c6 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.

llvm-svn: 70963
2009-05-05 04:50:50 +00:00
Anders Carlsson dae1abc7ac Refactor global decls to hold either a regular Decl or a CXXConstructorDecl + ctor type or a CXXDestructorDecl + dtor type.
llvm-svn: 70962
2009-05-05 04:44:02 +00:00
Ted Kremenek 09356a83c4 Update checker build.
llvm-svn: 70961
2009-05-05 03:56:29 +00:00
Ted Kremenek 94c464ef22 Implement attribute 'cf_returns_owned' (mirrors 'ns_returns_owned').
llvm-svn: 70952
2009-05-05 00:46:09 +00:00
Daniel Dunbar 3f86b9cb06 Remove an unneeded lookup routine.
llvm-svn: 70951
2009-05-05 00:36:57 +00:00
Ted Kremenek de1aa1e4dd Rename ownership attributes:
ns_ownership_returns -> ns_returns_owned
 ns_ownership_retain -> ns_retains
 ns_ownership_release -> ns_releases
 cf_ownership_retain ->  cf_retains
 cf_ownership_release -> cf_releases

llvm-svn: 70949
2009-05-05 00:21:59 +00:00
Ted Kremenek e5c315826e Fix unused variable warning
llvm-svn: 70946
2009-05-05 00:06:16 +00:00
Ted Kremenek 6ae5615d80 Remove possibly incorrect assertion that doesn't matter.
llvm-svn: 70943
2009-05-05 00:02:18 +00:00
Ted Kremenek bbec22d2b2 Rename attribute 'ns_ownership_returns' to 'ns_returns_ownership'.
llvm-svn: 70941
2009-05-04 23:52:59 +00:00
Ted Kremenek 6bdfcf47ad Remove experimental attribute 'ns_ownership_make_collectable.'
llvm-svn: 70940
2009-05-04 23:46:06 +00:00
Fariborz Jahanian 32ff7aeefa Provide basic support for generation of objc2's
objc_assign_global API when assigning to global
objective-c object pointer.

llvm-svn: 70939
2009-05-04 23:27:20 +00:00
Daniel Dunbar 9b042e06ee Fix the field count in interface record layout (it was incorrectly
compensating for super classes). This was making the reported class
sizes for empty classes very, very wrong.
 - Also, we now report the size info for an empty class like gcc (as
   the offset of the start, not as 0, 0).

 - Add a few more test cases we were mishandling before (padding bit
   field at end of struct, for example).

llvm-svn: 70938
2009-05-04 23:23:09 +00:00
Fariborz Jahanian c46fff0f5f Adding more test to ivar-layout-64.m.
llvm-svn: 70918
2009-05-04 21:46:27 +00:00
Daniel Dunbar 9252ee1779 Compute interface instanceStart and instanceSize using the record
layout.
 - This is much simpler / more efficient.

 - This also properly computes the size in the presence of bit-fields.

llvm-svn: 70916
2009-05-04 21:26:30 +00:00
Daniel Dunbar a8aa586a72 Add ASTRecordLayout::getFieldCount accessor, change NextOffset field to 64-bits.
llvm-svn: 70914
2009-05-04 21:10:32 +00:00
Daniel Dunbar 228895d56a Add ASTRecordLayout::getNextOffset accessor, and some doxygen comments.
llvm-svn: 70909
2009-05-04 21:00:40 +00:00
Daniel Dunbar 45bfd982f1 Initialize NextOffset correctly, otherwise tight layout fails for
empty classes.

llvm-svn: 70905
2009-05-04 20:52:37 +00:00
Fariborz Jahanian 60637985de ignore weak_import attribute on objc method decls.
llvm-svn: 70901
2009-05-04 19:35:12 +00:00
Ted Kremenek 0836a19931 Rename attributes 'objc_ownership...' to 'ns_ownership...'.
llvm-svn: 70897
2009-05-04 19:10:19 +00:00