Commit Graph

10005 Commits

Author SHA1 Message Date
Daniel Dunbar 79e042a8b5 Evaluation of unary deref could call integer evaluator on non-integral
expr; hilarity ensued.
 - PR3640.

llvm-svn: 65234
2009-02-21 18:14:20 +00:00
Cedric Venet 4fc88b779e Fix build on windows.
Should clang have a config.h or should we use the config.h of llvm or using the preprocessor is OK?  I did a quick fix here, but having a guideline on how to handle non portable function would be great (or ask ted to stop breaking the windows build :)).

llvm-svn: 65233
2009-02-21 17:14:49 +00:00
Steve Naroff da88fb9c73 Add test case to record a couple inconsistencies with GCC (found in <rdar://problem/6561076> [clang on Xcode] warning: cannot find protocol definition for 'OzzyP').
Removing the "cannot find protocol" warning is trivial if necessary (but I don't think it's the right thing to do).

llvm-svn: 65232
2009-02-21 17:03:43 +00:00
Steve Naroff 7a7814c32b This fixes <rdar://problem/6497650> More type mismatches issues with clang.
Move two key ObjC typechecks from Sema::CheckPointerTypesForAssignment() to ASTContext::mergeTypes().

This allows us to take advantage of the recursion in ASTContext::mergeTypes(), removing some bogus warnings.

This test case I've added includes an example where we still warn (and GCC doesn't). Need to talk with folks and decide what to do. At this point, the major bogosities should be fixed.

llvm-svn: 65231
2009-02-21 16:18:07 +00:00
Ted Kremenek bc7d915c4c Update checker build.
llvm-svn: 65227
2009-02-21 06:58:08 +00:00
Ted Kremenek 8a73c71486 Improved naming convention heuristics in the retain/release checker to better
handle method names that contain 'new', 'copy', etc., but those words might be
the substring of larger words such as 'newsgroup' and 'photocopy' that do not
indicate the allocation of objects. This should address the issues discussed in
<rdar://problem/6552389>.

llvm-svn: 65224
2009-02-21 05:13:43 +00:00
Ted Kremenek 3f49f0f06d Update scan-build help diagnostic.
llvm-svn: 65223
2009-02-21 04:46:41 +00:00
Ted Kremenek 6b8b0dfb90 Only create a preprocessed file for an ignored attribute if there currently does not exist an 'attribute_ignored_XXX.txt' file for that attribute.
llvm-svn: 65222
2009-02-21 04:46:20 +00:00
Eli Friedman 44c0f2aa88 Slight tweak to last commit: make sure to copy CVR qualifiers for fixed
pointer types.

llvm-svn: 65210
2009-02-21 00:58:02 +00:00
Eli Friedman a3b1d03e2d Re-fix r65140 correctly.
llvm-svn: 65208
2009-02-21 00:44:51 +00:00
Fariborz Jahanian 10bec1099c Handle case of none gc'able objects regardless of their
type.

llvm-svn: 65205
2009-02-21 00:30:43 +00:00
Daniel Dunbar 3c81dabd76 Emit extern_weak when needed.
- PR3629.

llvm-svn: 65203
2009-02-21 00:24:10 +00:00
Daniel Dunbar 0c4eda5923 We must always mangle attribute overloadable functions; even if in a
system header.
 - Prevents a codegen crash when anything used anything in tgmath! :)

llvm-svn: 65200
2009-02-20 23:09:27 +00:00
Steve Naroff 326064168a Fix <rdar://problem/6500554> missing objc error message.
llvm-svn: 65198
2009-02-20 22:59:16 +00:00
Chris Lattner 70946da73a switch the macroinfo argument lists from being allocated off the heap
to being allocated from the same bumpptr that the MacroInfo objects 
themselves are.

This speeds up -Eonly cocoa.h pth by ~4%, fsyntax-only is barely measurable.

llvm-svn: 65195
2009-02-20 22:46:43 +00:00
Chris Lattner f87c510cc9 detemplatify setArgumentList and some other cleanups.
llvm-svn: 65187
2009-02-20 22:31:31 +00:00
Chris Lattner 666f7a42d6 require the MAcroInfo objects are explcitly destroyed.
llvm-svn: 65179
2009-02-20 22:19:20 +00:00
Ted Kremenek b98f0eb9af Make 'RangeConstraintManager' the default ConstraintManager.
llvm-svn: 65173
2009-02-20 21:49:22 +00:00
Chris Lattner 7c981a79f7 allocate and dellocate objc decl list through AST Context instead of
with new/delete.  With disable-free, this reduces the number of 4/8 byte
mallocs from 4793/1541 to 865/456 and also drops other sizes as well.

This is a very small perf win, nothing major.

llvm-svn: 65171
2009-02-20 21:44:01 +00:00
Chris Lattner 68d42c77b2 fix indentation
llvm-svn: 65170
2009-02-20 21:38:52 +00:00
Chris Lattner 696197cd30 silence some warnings in no asserts mode.
llvm-svn: 65169
2009-02-20 21:37:53 +00:00
Chris Lattner 2229872d2f add plumbing to get ASTContext& down to allocation/deallocation points in ObjCList,
but don't start using it yet.  Renamed some methods to be more consistent.

llvm-svn: 65168
2009-02-20 21:35:13 +00:00
Chris Lattner 4d1eb76ada newly factored, we can now move the set and destroy methods out of line.
llvm-svn: 65166
2009-02-20 21:16:26 +00:00
Chris Lattner f2b000c5dd factor a bunch of common code out of the ObjCList template class
into a new shared ObjCListBase class.

llvm-svn: 65164
2009-02-20 21:14:14 +00:00
Ted Kremenek b087942765 Greatly simplify the logic in ExplodedGraphImpl::TrimGraph. Now we just do a
vanilla reverse-BFS followed by a forward-DFS instead of resulting to strange
histrionics (whose purpose I can no longer remember) in the reverse-BFS stage.
This fixes an assertion failure in BugReporter due to edge cases where no root
was being hit in the reverse-BFS phase.

llvm-svn: 65160
2009-02-20 21:10:26 +00:00
Chris Lattner a2e2167c25 prune #includes
llvm-svn: 65158
2009-02-20 21:06:29 +00:00
Chris Lattner 2e635f6102 rename ObjCList::clear() -> ObjCList::Destroy(). Require that destroy is called
before the dtor.

llvm-svn: 65156
2009-02-20 21:02:11 +00:00
Chris Lattner f1ccb0cef0 rearrange the contents of DeclObjC to be by-class. Fix some 80 column issues
and other non-semantic changes.

llvm-svn: 65155
2009-02-20 20:59:54 +00:00
Daniel Dunbar e8f256c7f9 Unbreak Darwin PIC handling; my refactoring yesterday was bogus.
llvm-svn: 65154
2009-02-20 20:52:47 +00:00
Chris Lattner 2d3a7be2f0 more random cleanups, add some fixme's. ObjCCategoryImplDecl really
shouldn't be a NamedDecl.

llvm-svn: 65153
2009-02-20 20:48:45 +00:00
Chris Lattner a4af543375 destroy should forward to base class.
llvm-svn: 65151
2009-02-20 20:42:28 +00:00
Chris Lattner d7ba858314 move the @implementation ivar list to being an ObjCList, which prevents
it from being leaked, among other things.

llvm-svn: 65150
2009-02-20 20:41:34 +00:00
Ted Kremenek 01144480fd PTH generation: Clear the cleaning bit for literals (whose spellings are cached).
llvm-svn: 65148
2009-02-20 20:32:39 +00:00
Daniel Dunbar 2f3a3d9f7a Add some IRgen improvement notes.
llvm-svn: 65146
2009-02-20 19:34:45 +00:00
Daniel Dunbar 27032de34b Shorten; no functionality change.
llvm-svn: 65145
2009-02-20 19:34:33 +00:00
Chris Lattner ed2776a85c remove dead list.
llvm-svn: 65142
2009-02-20 18:57:29 +00:00
Daniel Dunbar 5006f4a5f0 Take advantage of noreturn attribute to add unreachable instruction &
clear insertion point. The rest of IRgen should theoretically take
advantage of this to avoid emitting dead code. Theory != Practice.

llvm-svn: 65141
2009-02-20 18:54:31 +00:00
Anders Carlsson c4c6031859 Always try to fold array sizes, and warn if we could fold something that isn't an ICE. This makes us compatible with GCC.
llvm-svn: 65140
2009-02-20 18:53:20 +00:00
Daniel Dunbar 6ef6a04dd6 Fix test case.
llvm-svn: 65139
2009-02-20 18:53:07 +00:00
Chris Lattner a499715c83 remove some more methods from objc decls, using the iterator
interfaces more consistently.

llvm-svn: 65138
2009-02-20 18:43:26 +00:00
Daniel Dunbar ce39954d5d Handle constant int -> ptr casts of lvalue results.
- PR3463 (again).

llvm-svn: 65133
2009-02-20 18:22:23 +00:00
Chris Lattner f5b77513b0 remove some slow O(n) methods.
llvm-svn: 65132
2009-02-20 18:18:36 +00:00
Chris Lattner ed89b3ff2f Change ObjCForwardProtocolDecl to use an ObjCList.
llvm-svn: 65131
2009-02-20 18:10:37 +00:00
Daniel Dunbar cdbb5e336d Set call attribute for direct calls (i.e. noreturn).
- Remove an unused variant of EmitCallExpr overload.

llvm-svn: 65130
2009-02-20 18:06:48 +00:00
Chris Lattner 9ee23b7f1a move the interace list of @class to use ObjCList.
llvm-svn: 65129
2009-02-20 18:04:31 +00:00
Steve Naroff 17b2f5d728 Fix <rdar://problem/6586239> bitfield constraints not enforced (for ObjC)
llvm-svn: 65128
2009-02-20 17:57:11 +00:00
Chris Lattner a11480defa remove a dead list.
llvm-svn: 65127
2009-02-20 17:53:35 +00:00
Chris Lattner d0b80c8c75 add support for amd64-*, patch by Brooks Davis!
llvm-svn: 65124
2009-02-20 17:04:14 +00:00
Daniel Dunbar ba1c8f5a3c ccc: Spell mattr correctly.
llvm-svn: 65119
2009-02-20 07:47:48 +00:00
Daniel Dunbar e1889f935a ccc: Basic translation of gcc subtarget feature options to LLVM
options (i.e., -mno-red-zone, -msoft-float, -mno-sse, etc.)
 - Also, make sure unwind tables default to on Darwin/x86_64.
 - PR3604.

llvm-svn: 65118
2009-02-20 07:35:04 +00:00
Daniel Dunbar b9b440cde6 ccc: Use toolchain hook for default relocation model value.
llvm-svn: 65116
2009-02-20 06:48:26 +00:00
Daniel Dunbar e4be42c17f Add some stdlib builtins
llvm-svn: 65115
2009-02-20 06:36:40 +00:00
Chris Lattner 90669d0500 switch ObjCMethodDecl's parameter list from being explicitly managed to an ObjCList.
llvm-svn: 65114
2009-02-20 06:23:21 +00:00
Chris Lattner fa62dc3483 switch the interface ivar list from being explicitly managed to using ObjCList.
llvm-svn: 65113
2009-02-20 06:10:45 +00:00
Chris Lattner 8d10c11606 move more objc destruction out of dtors into Destroy.
llvm-svn: 65112
2009-02-20 06:03:09 +00:00
Chris Lattner 55c8d39695 move some objc decl destruction out of dtors into Destroy method.
llvm-svn: 65111
2009-02-20 05:54:35 +00:00
Zhongxing Xu 617bc3d02e Add an example in comments.
llvm-svn: 65110
2009-02-20 05:19:30 +00:00
Ted Kremenek 40cd13ecff Fix potential use of uninitialized variable.
llvm-svn: 65109
2009-02-20 04:34:29 +00:00
Eli Friedman cf7cbe7441 A few small tweaks to isConstantInitializer. (No test because this
isn't getting used by Sema or CodeGen at the moment...)

llvm-svn: 65107
2009-02-20 02:36:22 +00:00
Eli Friedman 7157825d44 Use -verify for consistency.
llvm-svn: 65106
2009-02-20 02:03:47 +00:00
Eli Friedman 0b8337c30b Add support for * (unary dereference) operator to ExprConstant.
llvm-svn: 65105
2009-02-20 01:57:15 +00:00
Daniel Dunbar 63e03cbe8c ccc: Use toolChain arch name instead of looking for arch command line
argument; the toolchain should always know the arch.
 - Fixes: <rdar://problem/6582911> -ccc-clang-archs doesn't work for excluding ppc

llvm-svn: 65104
2009-02-20 01:48:01 +00:00
Chris Lattner caae716837 optimize the 'StoredDeclsMap' for the common case where there is
exactly one decl with a specific name in a specific context.  This
avoids a bunch of malloc traffic and shrinks StoredDeclsMap to hold
one pointer instead of 3 words (for a std::vector).

This speeds up -fsyntax-only on cocoa.h with PTH by ~7.3%.

llvm-svn: 65103
2009-02-20 01:44:05 +00:00
Daniel Dunbar 1b84824f83 ccc: Store arch name in all toolchains.
- No functionality change.

llvm-svn: 65102
2009-02-20 01:36:35 +00:00
Eli Friedman ce98257691 Suppress constant initializer checking when the declaration isn't valid.
This prevents emitting diagnostics which are almost certainly useless.

(Note that the test is checking that we emit only one diagnostic.)

llvm-svn: 65101
2009-02-20 01:34:21 +00:00
Daniel Dunbar 92cfae68e9 ccc: Give all tools access to the toolchain they are in.
- No functionality change.

llvm-svn: 65100
2009-02-20 01:30:38 +00:00
Eli Friedman 719ed1a9ab Initialize the Init variable to something reasonable when we emit an
error, so we don't crash.

llvm-svn: 65099
2009-02-20 01:18:21 +00:00
Eli Friedman 742421e2e7 ExprConstant handling for a couple more cases of pointer-to-int casts
from the testsuite.

llvm-svn: 65098
2009-02-20 01:15:07 +00:00
Fariborz Jahanian c86fb5ecb4 More objc gc's ir-gen fixes.
llvm-svn: 65097
2009-02-20 01:14:43 +00:00
Chris Lattner 29578f3f41 make the redeclaration case faster for the common instance of a redeclaration
where there is exactly one existing declaration.  This is common.

this speeds up clang about 3% on cocoa.h for me 0.165 -> 0.160s

llvm-svn: 65096
2009-02-20 01:10:07 +00:00
Chris Lattner 33f219d1a9 80 cols
llvm-svn: 65095
2009-02-20 00:56:18 +00:00
Chris Lattner 24e24d51a1 slight code simplifications.
llvm-svn: 65094
2009-02-20 00:55:03 +00:00
Mike Stump 2a9baebae1 Deox and Capitolize.
llvm-svn: 65093
2009-02-20 00:45:51 +00:00
Chris Lattner 464ceb4ec8 map source ranges through macro expansions. Before:
t.m:5:2: error: invalid operands to binary expression ('typeof(P)' (aka 'struct mystruct') and 'typeof(F)' (aka 'float'))
 MAX(P, F);
 ^~~~~~~~~
t.m:1:78: note: instantiated from:
#define MAX(A,B)    ({ __typeof__(A) __a = (A); __typeof__(B) __b = (B); __a < __b ? __b : __a; })
                                                                             ^

(no ranges on the second diagnostics)

After:

t.m:5:2: error: invalid operands to binary expression ('typeof(P)' (aka 'struct mystruct') and 'typeof(F)' (aka 'float'))
 MAX(P, F);
 ^~~~~~~~~
t.m:1:78: note: instantiated from:
#define MAX(A,B)    ({ __typeof__(A) __a = (A); __typeof__(B) __b = (B); __a < __b ? __b : __a; })
                                                                         ~~~ ^ ~~~

(ranges!)

llvm-svn: 65090
2009-02-20 00:25:28 +00:00
Mike Stump f5a5c4fa11 Fix spacing.
llvm-svn: 65089
2009-02-20 00:19:45 +00:00
Chris Lattner 1973d84625 refactor, pass ranges down instead of the whole
DiagnosticInfo.

llvm-svn: 65088
2009-02-20 00:18:51 +00:00
Ted Kremenek a26ad40e41 Add test case for <rdar://problem/6562655>.
llvm-svn: 65085
2009-02-20 00:10:09 +00:00
Ted Kremenek c537a6d3f1 Fix crash from <rdar://problem/6562655>: 'init' method only return a receiver alias if the return type is a location.
llvm-svn: 65084
2009-02-20 00:05:35 +00:00
Chris Lattner cf868c458c replace a dirty hack with a clean solution. Too bad we can't
use Blocks for our callbacks ;-)

llvm-svn: 65083
2009-02-19 23:53:20 +00:00
Ted Kremenek 68abaa984d retain/release checker: Generate an intermediate simulation node for "leak"
transitions and then generate a subsequent node that removes the dead symbol
bindings. This should drastically improve caching in the simulation graph when
retain-counted objects are being tracked.

llvm-svn: 65082
2009-02-19 23:47:02 +00:00
Chris Lattner 810d330cd3 Fix a long standard problem with clang retaining "too much" sugar
information about types.  We often print diagnostics where we say 
"foo_t" is bad, but the user doesn't know how foo_t is declared 
(because it is a typedef).  Fix this by expanding sugar when present
in a diagnostic (and not one of a few special cases, like vectors).

Before:
t.m:5:2: error: invalid operands to binary expression ('typeof(P)' and 'typeof(F)')
 MAX(P, F);
 ^~~~~~~~~
t.m:1:78: note: instantiated from:
#define MAX(A,B)    ({ __typeof__(A) __a = (A); __typeof__(B) __b = (B); __a < __b ? __b : __a; })
                                                                             ^

After:
t.m:5:2: error: invalid operands to binary expression ('typeof(P)' (aka 'struct mystruct') and 'typeof(F)' (aka 'float'))
 MAX(P, F);
 ^~~~~~~~~
t.m:1:78: note: instantiated from:
#define MAX(A,B)    ({ __typeof__(A) __a = (A); __typeof__(B) __b = (B); __a < __b ? __b : __a; })
                                                                             ^

llvm-svn: 65081
2009-02-19 23:45:49 +00:00
Ted Kremenek 513f0b147e Added a new method to GRStmtNodeBuilder to build nodes using an arbitrary
PostStmt program point. This allows clients to pass in PostStmtCustom program
points.

llvm-svn: 65080
2009-02-19 23:45:28 +00:00
Ted Kremenek 406d2c17f5 ProgramPoint::Profile now specially handles PostStmtCustom (hashes on tag and data) so that clients don't need a unique address for the pair itself.
llvm-svn: 65079
2009-02-19 23:43:16 +00:00
Chris Lattner a8bac26e2c pretty printing vector types should print the element type, not just the attribute.
llvm-svn: 65078
2009-02-19 23:42:29 +00:00
Fariborz Jahanian 0f466c746f More objc's gc ir-gen stuff.
llvm-svn: 65077
2009-02-19 23:36:06 +00:00
Chris Lattner ae0197e134 GetTypeForDeclarator can return null on error now, handle this.
llvm-svn: 65076
2009-02-19 23:13:55 +00:00
Daniel Dunbar 2a07da78c0 ccc: Give nicer error when spawning a subprocess fails.
llvm-svn: 65075
2009-02-19 22:59:57 +00:00
Daniel Dunbar 1c8560d93e Extend Evaluate() to fold (int) <pointer type>.
- PR3463, PR3398, <rdar://problem/6553401> crash on relocatable
   symbol addresses as constants in static locals.

 - There are many more scenarious we could handle (like arithmetic on
   such an int) but this is the main use case.

llvm-svn: 65074
2009-02-19 22:24:01 +00:00
Daniel Dunbar cf04aa1a02 Simplify, no functionality change.
llvm-svn: 65073
2009-02-19 22:16:29 +00:00
Ted Kremenek e76eb060c7 Fix another PTH warning that should not be a note.
llvm-svn: 65072
2009-02-19 22:14:49 +00:00
Ted Kremenek 36b005db45 Make PTH warnings actual warnings instead of 'notes'.
llvm-svn: 65071
2009-02-19 22:13:40 +00:00
Mike Stump a67033294a Add enough checking to ensure that non-constant block literals don't
appear to be constant.  I'll probably redo this and throw it all away
later once we have codegen for BlockDeclRefExprs.

llvm-svn: 65070
2009-02-19 22:01:56 +00:00
Daniel Dunbar a118a07157 ccc: Also look for .gch files when seeing if we should auto load a
token-cache for clang.

llvm-svn: 65069
2009-02-19 22:01:23 +00:00
Daniel Dunbar 18e1444f82 Remove IRgen constant emission assumption that LValue APValue results
only occur for pointer types; they are also possible for integer types
now.
 - No intended functionality change, IntExprEvaluate doesn't return
   LValue results yet.

llvm-svn: 65066
2009-02-19 21:44:24 +00:00
Daniel Dunbar ca097adca8 Change IntExprEvaluator to operate on an APValue not an APSInt.
- Prep for handling lvalues, no intended functionality change.

llvm-svn: 65063
2009-02-19 20:17:33 +00:00
Daniel Dunbar 96f8677e11 Arguments to unordered comparison builtins may need implicit casts.
- <rdar://problem/6094103> sema fails to promote type arguments to __builtin_isgreater (and friends)

llvm-svn: 65059
2009-02-19 19:28:43 +00:00
Anders Carlsson f96954ca30 Add irgen support for the noinline attribute.
llvm-svn: 65056
2009-02-19 19:22:11 +00:00
Anders Carlsson 880971241b Add sema support for the noinline attribute.
llvm-svn: 65055
2009-02-19 19:16:48 +00:00
Ted Kremenek 193cbdcbe3 Update checker build.
llvm-svn: 65054
2009-02-19 19:08:21 +00:00
Daniel Dunbar e3c92bc672 Add another IntExprEvaluator::Success overload to suck up remained of
manual setting of the Result.

 - Idiom now enforces that result will always have correct width and
   type; this exposed three new bugs:

    o Enum constant decl value can have different width than type
      (PR3173).

    o EvaluateInteger should not run an IntExprEvaluator over
      non-integral expressions.

    o FloatExprEvaluate was not handling casts correctly (it was
      evaluating the cast in the IntExprEvaluator!).

llvm-svn: 65053
2009-02-19 18:37:50 +00:00