Chris Lattner
d7983b472e
rename getProtocols -> getProtocol, as it only returns a single
...
protocol. Simplify some code to use unconditional form of the
protocol access list.
llvm-svn: 53832
2008-07-21 05:20:01 +00:00
Chris Lattner
419f699b55
use iterators instead of direct access to protocol list.
...
llvm-svn: 53831
2008-07-21 05:19:23 +00:00
Chris Lattner
dc420f4866
Fix a bunch of crashes that occur in (attempted) handling of objc properties.
...
This code would previously crash on x.y where x is 'id'.
llvm-svn: 53827
2008-07-21 04:59:05 +00:00
Chris Lattner
bf58ba78df
use the simplified form of lookupInstanceVariable for callers who
...
don't care which class actually defines it.
llvm-svn: 53825
2008-07-21 04:44:44 +00:00
Chris Lattner
8bb52cb5a2
improve the diagnostic for an erroneous objc ivar reference
...
from:
t.m:8:7: error: member reference is not to a structure or union
pool->farm = 0;
^ ~~~~
to:
t.m:8:7: error: 'NSAutoreleasePool' has member named 'farm'
pool->farm = 0;
~~~~^ ~~~~
llvm-svn: 53824
2008-07-21 04:42:08 +00:00
Chris Lattner
4befd736b2
simplify a bunch of code, no functionality change.
...
llvm-svn: 53823
2008-07-21 04:36:39 +00:00
Chris Lattner
b63a745331
rearrange some code, no functionality change.
...
llvm-svn: 53822
2008-07-21 04:28:12 +00:00
Chris Lattner
530315fe89
improve comments yet again, now I know what this does :)
...
llvm-svn: 53821
2008-07-21 04:16:33 +00:00
Chris Lattner
6886f38369
minor rename, also, reject pointer to qualified id.
...
id<NSCopyable>* is not an "objc pointer type", id<NSCopyable> is.
llvm-svn: 53820
2008-07-21 04:13:58 +00:00
Chris Lattner
c47d930448
Fix a crash that can happen when you have typedefs for pointers to
...
interfaces. Just because they x->isPointerType() doesn't mean it is
valid to just cast to a pointertype. We have to handle typedefs etc
as well.
llvm-svn: 53819
2008-07-21 04:09:54 +00:00
Chris Lattner
2a47fa7372
simplify this predicate, only checking isObjCQualifiedIdType once.
...
llvm-svn: 53817
2008-07-21 04:03:34 +00:00
Ted Kremenek
0fff6d3c06
Patch by
...
"When dumping the tokens (-dumptokens output type), the column numbers are not
correctly shown. This patch fixes that issue."
llvm-svn: 53796
2008-07-19 19:10:04 +00:00
Ted Kremenek
f41b1c45fa
"currentHandler" is a nullary selector
...
llvm-svn: 53763
2008-07-18 18:14:26 +00:00
Ted Kremenek
f7faa42c6c
Fix caching bug.
...
llvm-svn: 53759
2008-07-18 17:39:56 +00:00
Ted Kremenek
3b2294c7e6
Add panic support for NSAssertionHandler.
...
llvm-svn: 53758
2008-07-18 17:24:20 +00:00
Ted Kremenek
d785465167
Add panic function.
...
llvm-svn: 53755
2008-07-18 16:28:33 +00:00
Ted Kremenek
36f6b04295
Fix 80 col violation
...
llvm-svn: 53754
2008-07-18 15:59:33 +00:00
Ted Kremenek
b1c91bfc45
Fix regression by explicitly checking if we are negating a SymIntConstantVal.
...
llvm-svn: 53753
2008-07-18 15:54:51 +00:00
Ted Kremenek
6a62d908c3
Improve path-sensitivity when using the logical not operator.
...
llvm-svn: 53752
2008-07-18 15:46:06 +00:00
Ted Kremenek
91614e6fe6
Renamed deterministic EvalBinOp to DetermEvalBinOpNN. This name mangling is unfortunately needed because virtual methods with the same name can be hidden by subclasses.
...
llvm-svn: 53751
2008-07-18 15:27:58 +00:00
Ted Kremenek
8d6b42e096
Created ValueStateSet class to manage the creation of multiple states by a method.
...
Modified the new EvalBinOpNN to generate states instead of nodes. This is a much simpler interface and is what clients will want to do.
llvm-svn: 53750
2008-07-18 05:53:58 +00:00
Mon P Wang
194c58f56d
Add support shufpd
...
llvm-svn: 53747
2008-07-18 00:14:09 +00:00
Ted Kremenek
e330aacbed
Update signature of EvalAssume.
...
llvm-svn: 53745
2008-07-17 23:33:10 +00:00
Ted Kremenek
9c32a1ecf5
Move GRTransferFunc* into ValueStateManager, and move the assumption logic there as well.
...
llvm-svn: 53743
2008-07-17 23:15:45 +00:00
Ted Kremenek
a79d9a9c79
Remove redundant logic.
...
llvm-svn: 53740
2008-07-17 21:36:43 +00:00
Ted Kremenek
bc9118b165
Begin major changes to EvalXXX methods in GRTransferFuncs. Currently some of the methods only return an RVal; we want them to be able to create an arbitrary number of states.
...
llvm-svn: 53739
2008-07-17 21:27:31 +00:00
Daniel Dunbar
1f32c759dc
Fix for codegen crash on multibit bool bitfield initialization
...
<rdar://problem/6078606>
llvm-svn: 53737
2008-07-17 21:07:48 +00:00
Ted Kremenek
88a6b7fa80
Moved RemoveDeadBindings logic for the contents of 'Store' to a virtual RemoveDeadBindings method in StoreManager.
...
llvm-svn: 53726
2008-07-17 18:38:48 +00:00
Argyrios Kyrtzidis
ef34aed1f9
Unify ctx_iterator/ctx_begin()/ctx_end() and iterator/begin()/end() so that a single iterator type is used for both traversing decls of the same declaration context *and* of the parent declaration contexts, depending on the value of the bool parameter 'LookInParentCtx' that is passed to IdentifierResolver::begin().
...
llvm-svn: 53724
2008-07-17 17:49:50 +00:00
Argyrios Kyrtzidis
bd25998a45
When in C++, make EnumConstant names hide tag names in the same scope, instead of colliding with them.
...
llvm-svn: 53702
2008-07-16 21:01:53 +00:00
Steve Naroff
de7d0f69ba
Two fixes:
...
- Make sure ObjCIvarDecl propagates the bitfield width.
- RewriteObjC::SynthesizeIvarOffsetComputation(): Avoid using the __OFFSETOF__ mumbo jumbo for bitfields (since it isn't legal C). This fixes <rdar://problem/5986079> clang ObjC rewriter: bitfields and ivar access don't mix.
llvm-svn: 53694
2008-07-16 18:22:22 +00:00
Argyrios Kyrtzidis
7da34d050b
When checking for name collision between a tag and a previously defined namespace, the collision occured even when the tag was in a different nested scope.
...
Fix it by taking into account the scope when checking for namespace-tag name collisions.
llvm-svn: 53667
2008-07-16 07:45:46 +00:00
Argyrios Kyrtzidis
16c04102ed
Add 'this' in the comments of Parser::ParseCastExpression to indicate that it is handled.
...
llvm-svn: 53665
2008-07-16 07:23:27 +00:00
Ted Kremenek
ae543148bc
Fix regression introduced by http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20080714/006514.html .
...
The regression was the casts from integers to pointers where not being handled: they would just return UnknownVal. This would greatly decrease path-sensitivity.
llvm-svn: 53659
2008-07-16 00:23:49 +00:00
Ted Kremenek
f46dddac5b
Fix transfer function logic in GRSimpleVals for integer casts: only support casts from integers to integers.
...
This fixes a crash reported by Anders Carlsson!
llvm-svn: 53649
2008-07-15 23:17:54 +00:00
Ted Kremenek
ed1f72b67c
For the MissingDealloc check, don't treat IBOutlet ivars as being needed to be released
...
llvm-svn: 53647
2008-07-15 23:04:27 +00:00
Ted Kremenek
10c8d7653b
Use lowercase of attribute iboutlet to not conflict with the macro IBOutlet
...
llvm-svn: 53645
2008-07-15 22:38:34 +00:00
Ted Kremenek
8e3704d35a
Added parsing/sema support for __attribute__ ((IBOutlet)), a clang-specific attribute that the static analyzer will use to recognize what ivars are IBOutlets.
...
llvm-svn: 53644
2008-07-15 22:26:48 +00:00
Ted Kremenek
81bfc074c9
Distinguish between dead stores and dead initializations.
...
llvm-svn: 53628
2008-07-15 18:06:32 +00:00
Ted Kremenek
176e2c519d
isRetain() and isRelease() now only returns true if "Retain"/"Release" appears in the suffix of a function's name.
...
llvm-svn: 53621
2008-07-15 17:43:41 +00:00
Ted Kremenek
fa89e2f09c
Support retain/release tracking for CoreGraphics (CGxxxRef) objects.
...
llvm-svn: 53617
2008-07-15 16:50:12 +00:00
Ted Kremenek
c18255d80f
Refactor Dead Stores error reporting to use the simplified BugReporter::EmitBasicReport interface.
...
llvm-svn: 53573
2008-07-14 20:56:04 +00:00
Nate Begeman
191a6b1f1b
http://llvm.org/bugs/show_bug.cgi?id=2523
...
Add some code to handle vector comparisons, which is the language side
of the llvm vicmp/vfcmp instructions. Also make the vector-vector and
vector-scalar asign checks a bit more sane under the presence of lax vector
conversions.
llvm-svn: 53565
2008-07-14 18:02:46 +00:00
Ted Kremenek
0255531dd3
Added method "EmitBasicReport" to BugReporter to simplify the emission of simple bug diagnostics.
...
Refactored error reporting in CheckObjCDealloc and CheckObjCInstMethSignature to use this new bug reporting interface (major code simplification).
llvm-svn: 53560
2008-07-14 17:40:50 +00:00
Chris Lattner
6d1a3c2e2b
remove CGObjCEtoile until it compiles.
...
llvm-svn: 53552
2008-07-14 16:54:05 +00:00
Argyrios Kyrtzidis
07b8b63f9f
Use of NextToken() makes ParseIdentifierStatement unnecessary.
...
Simplify the parser by removing Parser::ParseIdentifierStatement.
llvm-svn: 53520
2008-07-12 21:04:42 +00:00
Argyrios Kyrtzidis
715eabcef5
Convert CRLF -> LF line endings.
...
llvm-svn: 53519
2008-07-12 20:28:04 +00:00
Chris Lattner
477c4be1e9
expand casts to handle what isIntegerConstantExpr handles.
...
Casts from pointers remain a problem. :)
llvm-svn: 53501
2008-07-12 01:15:53 +00:00
Chris Lattner
7174bf3722
Add support for __builtin_type_compatible_p, enums, etc.
...
llvm-svn: 53500
2008-07-12 00:38:25 +00:00
Chris Lattner
9941570ce9
start remembering diagnostics for various cases, add some missing
...
code. Switch to Eli's getIntWidth method.
llvm-svn: 53499
2008-07-12 00:14:42 +00:00
Ted Kremenek
e5b5953672
Tidy up error message.
...
llvm-svn: 53493
2008-07-11 23:17:01 +00:00
Ted Kremenek
ba1196298a
Add CSS for word wrapping of long message bubbles.
...
llvm-svn: 53492
2008-07-11 23:13:22 +00:00
Chris Lattner
cdf34e7668
Provide a structure for passing down 'is evaluated' and passing up
...
diagnosic+loc info for i-c-e evaluation.
llvm-svn: 53490
2008-07-11 22:52:41 +00:00
Ted Kremenek
3bfb314c25
Add new check: -check-objc-methodsigs. This check scans methods in
...
ObjCImplementationDecls and sees if a ancestor class defines a method with the
same selector but with a different type signature. Right now it just compares
return types, and mainly looks at differences in primitive values. The checking
will be expanded in the future.
llvm-svn: 53482
2008-07-11 22:40:47 +00:00
Chris Lattner
f09ad16cfc
simplify some code a bit.
...
llvm-svn: 53477
2008-07-11 22:15:16 +00:00
Chris Lattner
f8d7f72956
share code between sizeof(expr) and sizeof(type)
...
llvm-svn: 53475
2008-07-11 21:24:13 +00:00
Ted Kremenek
aced3ad4b8
Fix comment.
...
llvm-svn: 53473
2008-07-11 20:53:14 +00:00
Chris Lattner
b062dcc17b
implement support for __extension__, make sure the result of a
...
comparison has the right width.
llvm-svn: 53469
2008-07-11 19:29:32 +00:00
Chris Lattner
ae8cc15977
add a new getIntTypeSizeInBits method.
...
llvm-svn: 53468
2008-07-11 19:24:49 +00:00
Chris Lattner
2bd2e028ca
rename "SInt" methods to "Int" in APValue.
...
llvm-svn: 53467
2008-07-11 19:19:21 +00:00
Chris Lattner
e13042c04f
make the new evaluator avoid conversions APValue<->APSInt in some cases.
...
Add some accessors to APValue.
llvm-svn: 53465
2008-07-11 19:10:17 +00:00
Ted Kremenek
c50e1a196e
Refactored auditor interface within GRExprEngine and GRCoreEngine to use a "batch auditor" to dispatch to specialized auditors instead of having a separate vector for each audited Expr*. This not only provides a much cleaner implementation, but also allows us to install auditors for any expression.
...
llvm-svn: 53464
2008-07-11 18:37:32 +00:00
Chris Lattner
05706e8859
rearrange some code, no functionality changes.
...
llvm-svn: 53463
2008-07-11 18:11:29 +00:00
Ted Kremenek
252d03c598
Patch by Csaba Hruska and Peter Neumark:
...
"adds support (de)serialization (from)to (in memory) buffer."
llvm-svn: 53425
2008-07-10 22:10:48 +00:00
Ted Kremenek
a7b8ffb05b
Refactored most of the "Store" piece of ValueState into a Store type. The
...
current store implementation is now encapsulated by BasicStore.
These changes prompted some long due constification of ValueState. Much of the
diffs in this patch include adding "const" qualifiers.
llvm-svn: 53423
2008-07-10 22:03:41 +00:00
Ted Kremenek
976d1e0ea8
Remove unused class AnnotatedPath.
...
llvm-svn: 53413
2008-07-10 17:25:03 +00:00
Ted Kremenek
ad4a7e4a69
Move some environment methods from ValueState/ValueStateManager to Environment/EnvironmentManager.
...
llvm-svn: 53412
2008-07-10 17:19:18 +00:00
Argyrios Kyrtzidis
832e898803
Simplify the parser a bit by looking at the next token without consuming it (by Preprocessor::LookNext):
...
-Remove ParseExpressionWithLeadingIdentifier and ParseAssignmentExprWithLeadingIdentifier.
-Separate ParseLabeledStatement from ParseIdentifierStatement.
llvm-svn: 53376
2008-07-09 22:53:07 +00:00
Argyrios Kyrtzidis
80b77ac394
Add Preprocessor::LookNext method, which implements an efficient way to 'take a peek' at the next token without consuming it.
...
llvm-svn: 53375
2008-07-09 22:46:46 +00:00
Ted Kremenek
5f996d5a06
Remove getParentMap() from GRExprEngine.
...
llvm-svn: 53343
2008-07-09 19:46:42 +00:00
Ted Kremenek
ae529271e8
Fix PR2519: correctly handle CFDictionaryCreate.
...
llvm-svn: 53334
2008-07-09 18:11:16 +00:00
Ted Kremenek
a174c5270f
Extend va_start checking to include __builtin_stdarg_start.
...
llvm-svn: 53332
2008-07-09 17:58:53 +00:00
Chris Lattner
0bf679180c
Codegen support for __builtin_stdarg_start
...
llvm-svn: 53329
2008-07-09 17:28:44 +00:00
Chris Lattner
b218272778
Add parser support for __builtin_stdarg_start, PR2531
...
llvm-svn: 53328
2008-07-09 17:26:36 +00:00
Ted Kremenek
852ed373aa
Initial work on splitting the ValueState into an Environment, Store, and
...
Constraints. These concepts are already present in the current ValueState, but
the implementation is monolothic. Making ValueState more modular opens up new
design choices for customizing the analysis engine.
In the context of the analysis engine, the "Environment" is the binding between
Expr* (expressions) and intermediate symbolic values (RValues).
llvm-svn: 53252
2008-07-08 21:46:56 +00:00
Nuno Lopes
e212c3ecc2
revert my bogus attempt to fix the comment. sorry for the noise.
...
llvm-svn: 53248
2008-07-08 21:13:06 +00:00
Anders Carlsson
0166481455
Fix small bug. The evaluator now works well enough to pass all tests
...
llvm-svn: 53238
2008-07-08 16:49:00 +00:00
Anders Carlsson
4a3585b7c0
More constant expression work.
...
llvm-svn: 53235
2008-07-08 15:34:11 +00:00
Anders Carlsson
9c18165448
Move out some methods.
...
llvm-svn: 53234
2008-07-08 14:35:21 +00:00
Anders Carlsson
b5ad021cd7
More work.
...
llvm-svn: 53233
2008-07-08 14:30:00 +00:00
Seo Sanghyeon
1904f44757
Compilation fix
...
llvm-svn: 53222
2008-07-08 07:23:12 +00:00
Anders Carlsson
374b93df76
Port more of Eli's evaluator over. This makes the int evaluator handle binary and unary operators.
...
llvm-svn: 53221
2008-07-08 05:49:43 +00:00
Anders Carlsson
0a1707c6ba
Commit beginnings of int evaluator. Currently not used.
...
llvm-svn: 53219
2008-07-08 05:13:58 +00:00
Ted Kremenek
79ab0fa913
In a report-XXXXX.html, make the title include the name of the file with the bug. Patch by Jean-Daniel Dupas!
...
http://lists.cs.uiuc.edu/pipermail/cfe-dev/2008-July/002166.html
llvm-svn: 53184
2008-07-07 18:31:05 +00:00
Nuno Lopes
7bfa180056
fix CheckForConstantInitializer() for Compound Literals
...
also fix the correspondent test (it was expecting more errors than it should. please confirm my fix is correct (at least gcc agrees with me)
llvm-svn: 53174
2008-07-07 16:46:50 +00:00
Ted Kremenek
4963d1144f
Updated clients of ImmutableMap::SlimFind to use ImmutableMap::lookup instead.
...
llvm-svn: 53172
2008-07-07 16:21:19 +00:00
Nuno Lopes
d28ccad6fc
add x86 EDI register alias
...
llvm-svn: 53170
2008-07-07 12:18:07 +00:00
Ted Kremenek
37a2c0d5d1
Do not emit a "missing -dealloc" warning if a class contains no ivars that are pointers.
...
This patch aims to address some of the concerns of PR 2517: http://llvm.org/bugs/show_bug.cgi?id=2517
llvm-svn: 53168
2008-07-07 06:36:08 +00:00
Nuno Lopes
3da38fd145
move the linux predefined macro definition to the TargetInfo, where it really belongs
...
llvm-svn: 53149
2008-07-05 19:32:25 +00:00
Nuno Lopes
9b6de71b7d
predefine the macro linux when compiled on a linux system. this fixes the build of libtidy
...
llvm-svn: 53145
2008-07-05 17:58:44 +00:00
Seo Sanghyeon
d27410b580
Fix warnings
...
llvm-svn: 53141
2008-07-05 02:01:25 +00:00
Sanjiv Gupta
1e8b608751
Fixed bugzilla bug# 2489.
...
This was broken when the GenerateCode function was splitted to use GenerateFunction.
llvm-svn: 53136
2008-07-04 11:04:26 +00:00
Ted Kremenek
4d85146e6d
Use conjured symbols for variables whose values are invalidated when
...
passed-by-reference to a function. This allows us to build up constraints for
their new values and restore some lost path-sensitivity. This addresses a few
false positives since in Adium.
llvm-svn: 53125
2008-07-03 23:26:32 +00:00
Bill Wendling
e7264ec999
Remove removed header.
...
llvm-svn: 53121
2008-07-03 22:54:30 +00:00
Ted Kremenek
8044046efb
Fix a bug in the dead stores checker reported in the following email:
...
http://lists.cs.uiuc.edu/pipermail/cfe-dev/2008-July/002157.html
Essentially the observer mechanism in LiveVariables was observing block-level
expressions multiple times, leading to a case where the dead store checker could
see a value as dead when it was really live.
llvm-svn: 53115
2008-07-03 22:25:27 +00:00
Ted Kremenek
68b117fca4
Skip the "-dealloc" check if a ObjC class contains no ivars.
...
llvm-svn: 53100
2008-07-03 15:37:02 +00:00
Ted Kremenek
e66ca6f35a
For the -dealloc checker, check the LangOptions to determine whether or not the code is compiled with GC.
...
llvm-svn: 53098
2008-07-03 14:35:01 +00:00
Ted Kremenek
1d3c797c90
Have BugReporter::getCFG and BugReporter::getLiveVariables returns pointers instead of references, because they can both fail
...
on functions we cannot construct full CFGs for yet.
llvm-svn: 53081
2008-07-03 05:26:14 +00:00
Ted Kremenek
0e7d25233e
Added static analysis check to see if a subclass of NSObject implements -dealloc, and whether or not that implementation calls [super dealloc].
...
llvm-svn: 53075
2008-07-03 04:29:21 +00:00
Anders Carlsson
7a241baf2f
Shuffle things around in preparation for integrating Eli's constant evaluator.
...
llvm-svn: 53074
2008-07-03 04:20:39 +00:00
Chris Lattner
1cb0e61e98
Fix PR2252: don't warn on negating an unsigned value ever, and don't emit
...
'integer constant is so large that it is unsigned' warning for hex literals.
llvm-svn: 53070
2008-07-03 03:47:30 +00:00
Chris Lattner
9ff58d7caf
Fix PR2020 by recovering by defining an anonymous enum, instead of recovering
...
by filling in the body of a union with enum constants.
llvm-svn: 53069
2008-07-03 03:30:58 +00:00
Ted Kremenek
c7efb536d5
Unify the code path for the Dead Stores checker to always use the BugReporter interface.
...
llvm-svn: 53054
2008-07-02 23:16:33 +00:00
Ted Kremenek
b1d0118a1a
Refactored some of the BugReporter interface so that data such as the ASTContext&, PathDiagnosticClient*, can be provided by an external source.
...
Split BugReporter into BugReporter and GRBugReporter so checkers not based on GRExprEngine can still use the BugReporter mechanism.
llvm-svn: 53048
2008-07-02 21:24:01 +00:00
Ted Kremenek
125d4a3b2d
GRExprEngine now expects the LiveVariables information to be provided by its creator.
...
This allows an optimization in AnalysisConsumer where the same LiveVariables information is used between multiple analyses.
llvm-svn: 53046
2008-07-02 20:13:38 +00:00
Ted Kremenek
d8ca1f6dd9
Added version of CheckDeadStores that accepts a client-provided LiveVariables object.
...
Modified the DeadStores logic in AnalysisConsumer.cpp to use the LiveVariables object created by the AnalysisManager.
llvm-svn: 53043
2008-07-02 18:39:20 +00:00
Ted Kremenek
c3b30340d9
Added method "HandleTranslationUnit" to ASTConsumer. This is called by ParseAST when all of the ASTs in a translation unit have been built.
...
llvm-svn: 53042
2008-07-02 18:32:45 +00:00
Ted Kremenek
ab54e51b38
Unlike NSWindow objects, NSPanel objects initially do not have self-ownership.
...
llvm-svn: 52963
2008-07-01 17:21:27 +00:00
Argyrios Kyrtzidis
2a40249b65
Update some comments.
...
llvm-svn: 52957
2008-07-01 11:22:40 +00:00
Argyrios Kyrtzidis
ed9834272f
Add Sema support for C++ classes.
...
llvm-svn: 52956
2008-07-01 10:37:29 +00:00
Ted Kremenek
bc6d850088
Temporarily treat "Autorelease" as "StopTracking". This is the original behavior.
...
llvm-svn: 52940
2008-07-01 00:01:02 +00:00
Chris Lattner
9a8d1d9e56
Make a few related changes:
...
1) add a new ASTContext::getFloatTypeSemantics method.
2) Use it from SemaExpr.cpp, CodeGenTypes.cpp and other places.
3) Change the TargetInfo.h get*Format methods to return their
fltSemantics byref instead of by pointer.
4) Change CodeGenFunction::EmitBuiltinExpr to allow builtins which
sometimes expand specially and othertimes fall back to libm.
5) Add support for __builtin_nan("") to codegen, cases that don't pass
in an empty string are currently lowered to libm calls.
6) Fix codegen of __builtin_infl.
llvm-svn: 52914
2008-06-30 18:32:54 +00:00
Ted Kremenek
a0e071c861
Added "Autorelease" ArgEffect to better simulate "autorelease" messages. Right
...
now this does the same thing as "MayEscape", but more functionality will go in
here shortly.
llvm-svn: 52904
2008-06-30 16:57:41 +00:00
Chris Lattner
d68c04f162
Fix a bug reported by Kelly Wilson, where we incorrectly
...
rejected FP immediates like 08.123
llvm-svn: 52890
2008-06-30 06:44:49 +00:00
Chris Lattner
6016a515e5
refactor some code out into a new method.
...
llvm-svn: 52889
2008-06-30 06:39:54 +00:00
Chris Lattner
a7e619c17b
make type attribute processing static instead of methods on Sema.
...
llvm-svn: 52881
2008-06-29 00:50:08 +00:00
Chris Lattner
b632a6e534
make the rest of the decl attribute processing methods be
...
static functions instead of methods on sema.
llvm-svn: 52880
2008-06-29 00:43:07 +00:00
Chris Lattner
a663a0a1b6
make most of Sema public. Sema is a class private to the Sema library
...
anyway, so there is no real loss here. Start making attribute processing
methods static functions instead of methods on Sema.
llvm-svn: 52879
2008-06-29 00:28:59 +00:00
Chris Lattner
9e2aafea38
move a few methods, no other change.
...
llvm-svn: 52878
2008-06-29 00:23:49 +00:00
Chris Lattner
c4ecec545e
handle type attributes when converting types, not when processing decls.
...
llvm-svn: 52877
2008-06-29 00:19:33 +00:00
Chris Lattner
58418ffa32
Make ProcessDeclAttributes walk the declarator structure pulling
...
decl attributes out of the various places they can hide. This makes
us correctly reject things like this:
t.c:2:22: error: mode attribute only supported for integer and floating-point types
int **__attribute((mode(HI)))* i32;
^
because you can't make a pointer be HImode.
llvm-svn: 52876
2008-06-29 00:16:31 +00:00
Chris Lattner
2727d1b221
move some code from all callers of ProcessDeclAttributes into
...
the implementation of ProcessDeclAttributes.
llvm-svn: 52875
2008-06-29 00:02:00 +00:00
Chris Lattner
a574154106
more attribute refactoring/renaming, no functionality change.
...
llvm-svn: 52874
2008-06-28 23:58:55 +00:00
Chris Lattner
4627b74233
more minor tidiness.
...
llvm-svn: 52873
2008-06-28 23:50:44 +00:00
Chris Lattner
ed9cbbc4f0
more cleanups, refactor HandleVectorTypeAttribute
...
to work list the rest of the attr handlers. Also, rename
it to HandleVectorSizeAttribute to match its attr name.
No functionality change.
llvm-svn: 52872
2008-06-28 23:48:25 +00:00
Chris Lattner
4a927cba2e
adjust the prototypes of a bunch of decl processing methods to take
...
the single attribute they look at by reference instead of by pointer.
This is a subtle indicator that they take the specified attribute, not
a whole list of them.
This also make HandleExtVectorTypeAttribute work the same way as the rest
of the attributes, adds some comments etc. No functionality change.
llvm-svn: 52871
2008-06-28 23:36:30 +00:00
Argyrios Kyrtzidis
f4ebe9ea4f
Handle unnamed bitfields when parsing C++ classes.
...
llvm-svn: 52855
2008-06-28 08:10:48 +00:00
Eli Friedman
4f89ccb1df
Fix for PR2501; this patch makes usual arithmetic conversions for
...
integers which have the same width and different signedness work
correctly. (The testcase in PR2501 uses a comparison between long and
unsigned int).
llvm-svn: 52853
2008-06-28 06:23:08 +00:00
Argyrios Kyrtzidis
853fbea313
Replace CurFunctionDecl and CurMethodDecl with methods getCurFunctionDecl() and getCurMethodDecl() that return the appropriate Decl through CurContext.
...
llvm-svn: 52852
2008-06-28 06:07:14 +00:00
Chris Lattner
e6c693d932
Fix a bug where we didn't promote 'const float' (or typedefs) to
...
double in some places.
llvm-svn: 52846
2008-06-27 22:48:56 +00:00
Chris Lattner
acbc2d200d
the 'mode' attribute is a decl attribute, not a type attribute. Move it to
...
SemaDeclAttr, and do some cleanups.
llvm-svn: 52844
2008-06-27 22:18:37 +00:00
Cedric Venet
3903908794
Add missing include file (due to a file splitting in llvm).
...
Add new file to Sema Project for VS.
this unbreak the build for VS2005 (with the associated patch on llvm).
llvm-svn: 52830
2008-06-27 17:53:02 +00:00
Ted Kremenek
cf1ab19086
Added a simple static analysis check to look for improper uses of CFCreateNumber.
...
llvm-svn: 52799
2008-06-26 23:59:48 +00:00
Chris Lattner
2c6fcf5abb
move decl attribute processing to a new SemaDeclAttr.cpp.
...
llvm-svn: 52792
2008-06-26 18:38:35 +00:00
Chris Lattner
d1224b2493
clang uses the llvm backend, so define __llvm__ like llvm-gcc.
...
Additionally, define __clang__ so clients can predicate based on
clang features.
llvm-svn: 52788
2008-06-26 17:26:01 +00:00
Chris Lattner
cf31de3760
Make Declarator::getDeclSpec() return a const reference to avoid
...
cases where mutation can introduce bugs. Propagate around 'const'.
llvm-svn: 52772
2008-06-26 06:49:43 +00:00
Chris Lattner
3e39fa365d
add a comment about something that was surprising, at least to me.
...
llvm-svn: 52771
2008-06-26 06:39:41 +00:00
Chris Lattner
4b413ea3bf
fix a bug handling type attributes in the declspec. declspec processing
...
used to mutate the attribute list for declspecs when the type was
converted, breaking the case where one declspec was shared by multiple
declarators.
This fixes rdar://6032532.
llvm-svn: 52769
2008-06-26 06:27:57 +00:00
Chris Lattner
bf231a61fd
refactor more objc codegen interfaces to pass around selectors so
...
we don't push strings into LLVM IR and then have to read them back out.
llvm-svn: 52765
2008-06-26 05:08:00 +00:00
Chris Lattner
882034dd99
indenting and other minor things.
...
llvm-svn: 52764
2008-06-26 04:52:29 +00:00
Chris Lattner
da35bc8e53
refactor interface to GenerateClassStructure to avoid converting a
...
string to LLVM IR and then regenerating the string from IR.
llvm-svn: 52762
2008-06-26 04:47:04 +00:00
Chris Lattner
d9b98863c4
remove the old getSelector implementation, which removes some
...
calls to getStringValue
llvm-svn: 52761
2008-06-26 04:44:19 +00:00
Chris Lattner
6cfec78e48
avoid a lot of unneeded selector processing work by passing around
...
selectors instead of Value*'s.
llvm-svn: 52760
2008-06-26 04:42:20 +00:00
Chris Lattner
9a05d04a0d
use cheaper/simpler getselector call for @selector exprs.
...
llvm-svn: 52759
2008-06-26 04:38:58 +00:00
Chris Lattner
6d522c0133
start avoid doing lots of unneeded work handling selectors
...
llvm-svn: 52758
2008-06-26 04:37:12 +00:00
Chris Lattner
42587147d4
improve indentation, avoid thrashing on maps and recalculating strings as much.
...
llvm-svn: 52757
2008-06-26 04:24:57 +00:00
Chris Lattner
87ab27d42f
give CreateObjCRuntime a full CGM so it can get whatever state it needs,
...
instead of passing in just a couple random things it currently
happens to use.
llvm-svn: 52756
2008-06-26 04:19:03 +00:00
Chris Lattner
63dd337fc2
Fix 80 col violations, assert on assumptions.
...
llvm-svn: 52755
2008-06-26 04:10:42 +00:00
Chris Lattner
d46944d639
a temporary minimal hack to get clang building after the getStringValue changes in llvm mainline.
...
llvm-svn: 52753
2008-06-26 04:05:20 +00:00
Ted Kremenek
3185c9c9cd
CF ref checker:
...
Tracked objects now have their type information tracked with them.
Enhanced summaries for ObjC methods to include the type information of the receiver.
Used the enhanced summaries to support the idiom that NSWindow owns itself (it sends a release message to itself upon close).
Added some comments.
Did some cleanups with the checker logic using operator overloading (reduced redundant code which I was concerned about being the source of bugs).
llvm-svn: 52741
2008-06-25 21:21:56 +00:00
Argyrios Kyrtzidis
8a73d1f327
The assert at Sema::ObjCActOnStartOfMethodDef should check CurMethodDecl instead of CurFunctionDecl.
...
llvm-svn: 52719
2008-06-25 14:24:09 +00:00
Mon P Wang
28898b2888
Updated atomic intrinsic name from llvm r52706. Fixed dropped bit in shufps.
...
llvm-svn: 52707
2008-06-25 08:21:36 +00:00
Argyrios Kyrtzidis
ac1b916441
'Educate' IdentifierResolver about the declaration context of CXXFieldDecls.
...
llvm-svn: 52698
2008-06-24 23:08:34 +00:00
Argyrios Kyrtzidis
a781452193
The only caller of this knows that the current token is l_brace, so this can be an assert; suggestion by Chris.
...
llvm-svn: 52696
2008-06-24 22:31:41 +00:00
Argyrios Kyrtzidis
7bbb20e338
Add parsing support for C++ classes.
...
Note that Parser::ParseCXXMemberSpecification is temporarily disabled until the Sema support is in place.
Once ParseCXXMemberSpecification is enabled, the Parser/cxx-class.cpp test will pass.
llvm-svn: 52694
2008-06-24 22:12:16 +00:00
Chris Lattner
b1d329da07
"Support for Objective-C message sends which return structures. Also includes a small fix for constant string handling that should have been in the last patch (sorry!) and a hook for generating selectors (rest of this implementation to follow in the next patch)."
...
Patch by David Chisnall!
llvm-svn: 52681
2008-06-24 17:04:18 +00:00
Chris Lattner
6447ed3a1f
"This is a small fix for a bug where static object instances were being incorrectly generated. The bug was caused by my inability to read the GNU libobjc source and is only apparent when JITing code (static compilation does not expose the bug due to the data layout of other globals)."
...
Patch by David Chisnall!
llvm-svn: 52680
2008-06-24 17:01:28 +00:00
Ted Kremenek
17ae57faa8
Update serialization for ObjCMessageExpr to handle additional bit-swizziling of receiver information.
...
llvm-svn: 52679
2008-06-24 17:00:08 +00:00
Ted Kremenek
a3a37ae8c8
ObjCMessageExpr objects that represent messages to class methods now can contain the ObjCInterfaceDecl* of the target class if it was available when the ObjCMessageExpr object was constructed. The original interfaces of the class has been preserved (requiring no functionality changes from clients), but now a "getClasSInfo" method returns both the ObjCInterfaceDecl* and IdentifierInfo* of the target class.
...
llvm-svn: 52676
2008-06-24 15:50:53 +00:00
Ted Kremenek
f890bfe0ff
Remove unneeded method arguments.
...
llvm-svn: 52668
2008-06-24 03:56:45 +00:00
Ted Kremenek
b1d1329ac7
Cache ObjC summaries by IdentifierInfo*, not by ObjCInterfaceDecl.
...
llvm-svn: 52667
2008-06-24 03:49:48 +00:00
Ted Kremenek
0cfc16100b
Added ObjCSummaryCache, a new summary cache object to cache summaries for Objective-C methods. Instead of mapping from Selectors -> Summaries, we will now map from (ObjCInterfaceDecl*,Selectors) -> Summaries. This will allow more nuanced summary generation. This patch just swaps in the new data structure; the rest of the code works as before by allowing the ObjCInterfaceDecl* to be null.
...
llvm-svn: 52653
2008-06-23 23:30:29 +00:00
Ted Kremenek
ea736c5d02
Rename summary methods for "instance methods" to "class methods" (the names got screwed up). No functionality change.
...
llvm-svn: 52650
2008-06-23 22:21:20 +00:00
Ted Kremenek
ab4a8b5213
The CF retain/release checker now assumes that allocations do not fail. Eventually we will add a flag to the driver to enable allocation failures (documented as a FIXME).
...
llvm-svn: 52632
2008-06-23 18:02:52 +00:00
Chris Lattner
7fa2758b45
add a fixme back
...
llvm-svn: 52607
2008-06-21 22:44:51 +00:00
Chris Lattner
091f698d29
"this patch adds code generation hooks for Objective-C constant strings. It also modifies Sema so that Objective-C constant strings are treated as untyped objects if the interface for the constant string class can not be found. This is consistent with Apple GCC. I thought it was consistent with GNU GCC, since this was causing failures when trying to compile GNUstep with (GNU) GCC, but it appears that this is not the case when attempting to produce a simple test case to demonstrate it. Possibly there is a way of making the error go away, but I haven't found out what it is yet."
...
Patch by David Chisnall!
llvm-svn: 52599
2008-06-21 21:44:18 +00:00
Chris Lattner
c4f38851e6
Don't add isa with @defs only to work around it in the code generator, patch
...
by David Chisnall.
llvm-svn: 52597
2008-06-21 21:37:25 +00:00
Chris Lattner
5a92bab4f0
"This moves built-in Objective-C types up the scope chains to where they can be replaced by versions included from the runtime library's headers."
...
This makes it ok to use @"foo" without a declaration for NSConstantString.
Patch by David Chisnall!
llvm-svn: 52593
2008-06-21 20:20:39 +00:00
Chris Lattner
535b830449
add parser and sema support for the funny ObjC '@defs' thing.
...
Patch by David Chisnall!
llvm-svn: 52586
2008-06-21 19:39:06 +00:00
Chris Lattner
5d20a70d01
remove dead enums.
...
llvm-svn: 52581
2008-06-21 18:06:44 +00:00
Chris Lattner
a9b3cae8fd
Switch 'super' from being a weird cast thing to being a predefined expr node.
...
Patch by David Chisnall with objc rewriter and stmtdumper updates from me.
llvm-svn: 52580
2008-06-21 18:04:54 +00:00
Argyrios Kyrtzidis
e6aff3db25
K&R-style functions not allowed in C++.
...
llvm-svn: 52575
2008-06-21 10:00:56 +00:00
Ted Kremenek
c9cea053ba
When using the dead-stores checker with the BugReporter class, properly capture the diagnostic associated with a specific warning and emit it.
...
llvm-svn: 52565
2008-06-20 23:13:39 +00:00
Ted Kremenek
34a691734e
Modified the dead stores checker to...
...
1) Check if a dead store appears as a subexpression. For such cases, we emit
a verbose diagnostic so that users aren't confused. This addresses:
<rdar://problem/5968508> checker gives misleading report for dead store in loop
2) Don't emit a dead store warning when assigning a null value to a pointer.
This is a common form of defensive programming. We may wish to make
this an option to the the checker one day.
This addresses the feature request in the following email:
http://lists.cs.uiuc.edu/pipermail/cfe-dev/2008-June/001978.html
llvm-svn: 52555
2008-06-20 21:45:25 +00:00
Ted Kremenek
99ecdd175d
Added ParentMap, a class to represent a lazily constructed mapping from child to parents.
...
llvm-svn: 52553
2008-06-20 21:40:36 +00:00
Mike Stump
d7667bd8e0
Remove tabs.
...
llvm-svn: 52507
2008-06-19 20:57:50 +00:00
Mike Stump
65643c6480
One more test checkin.
...
Remove an extra space at the end of a line.
llvm-svn: 52504
2008-06-19 19:52:46 +00:00
Mike Stump
01e07653d4
Test commit to see if new account works.
...
I choose to remove extraneous whitespace at end of lines as a semantic
nop for the test.
llvm-svn: 52503
2008-06-19 19:28:49 +00:00
Ted Kremenek
46c82ab994
Introduce initial transfer function support for __imag__ and __real__. We don't
...
have complex RValues yet, so this logic is only fully implemented when __imag__
and __real__ are used on non-complex types.
llvm-svn: 52501
2008-06-19 17:55:38 +00:00
Ted Kremenek
9a935fbdeb
Added a new ProgramPoint: PostPurgeDeadSymbols. This new program point distinguishes between the cases when we just evaluated the transfer function of a Stmt* (PostStmt) or performed a load (PostLoad). This solves a caching bug observed in a recent bug report.
...
llvm-svn: 52443
2008-06-18 05:34:07 +00:00
Ted Kremenek
3802fedfe4
Fix non-termination bug reported by Thomas Clement!
...
llvm-svn: 52426
2008-06-17 19:14:06 +00:00
Chris Lattner
5696e7badf
Change self/_cmd to be instances of ImplicitParamDecl instead of ParmVarDecl.
...
Patch by David Chisnall!
llvm-svn: 52422
2008-06-17 18:05:57 +00:00
Ted Kremenek
c6501dbc10
Fix more strict-aliasing warnings.
...
Fix indentation of class declarations in ExprCXX.h
llvm-svn: 52380
2008-06-17 03:11:08 +00:00
Ted Kremenek
08e171183f
This patch is motivated by numerous strict-aliasing warnings when compiling
...
clang as a Release build.
The big change is that all AST nodes (subclasses of Stmt) whose children are
Expr* store their children as Stmt* or arrays of Stmt*. This is to remove
strict-aliasing warnings when using StmtIterator. None of the interfaces of any
of the classes have changed (except those with arg_iterators, see below), as the
accessor methods introduce the needed casts (via cast<>). While this extra
casting may seem cumbersome, it actually adds some important sanity checks
throughout the codebase, as clients using StmtIterator can potentially overwrite
children that are expected to be Expr* with Stmt* (that aren't Expr*). The casts
provide extra sanity checks that are operational in debug builds to catch
invariant violations such as these.
For classes that have arg_iterators (e.g., CallExpr), the definition of
arg_iterator has been replaced. Instead of it being Expr**, it is an actual
class (called ExprIterator) that wraps a Stmt**, and provides the necessary
operators for iteration. The nice thing about this class is that it also uses
cast<> to type-checking, which introduces extra sanity checks throughout the
codebase that are useful for debugging.
A few of the CodeGen functions that use arg_iterator (especially from
OverloadExpr) have been modified to take begin and end iterators instead of a
base Expr** and the number of arguments. This matches more with the abstraction
of iteration. This still needs to be cleaned up a little bit, as clients expect
that ExprIterator is a RandomAccessIterator (which we may or may not wish to
allow for efficiency of representation).
This is a fairly large patch. It passes the tests (except CodeGen/bitfield.c,
which was already broken) on both a Debug and Release build, but it should
obviously be reviewed.
llvm-svn: 52378
2008-06-17 02:43:46 +00:00
Ted Kremenek
1c77e8f26b
Silence uninitialized value warning in Release build.
...
llvm-svn: 52376
2008-06-16 23:46:27 +00:00
Ted Kremenek
bba87243aa
Silence uninitialized value warning during Release build.
...
llvm-svn: 52375
2008-06-16 23:45:12 +00:00
Ted Kremenek
34f664d443
Introduce preliminary support for NSString format-string checking.
...
Patch by Nikita Zhuk!
llvm-svn: 52336
2008-06-16 18:00:42 +00:00
Chris Lattner
22b9ff4131
force size of alloca to i32, which is currently required by LLVM IR.
...
This fixes use of alloca on 64-bit systems.
llvm-svn: 52334
2008-06-16 17:15:14 +00:00
Eli Friedman
327944b343
Basic support for volatile loads and stores. Stores the volatile
...
qualifier in the lvalue, and changes lvalue loads/stores to honor
the volatile flag. Places which need some further attention are marked
with FIXMEs.
Patch by Cédric Venet.
llvm-svn: 52264
2008-06-13 23:01:12 +00:00
Argyrios Kyrtzidis
de794aadae
Fix "copy & paste" error.
...
llvm-svn: 52227
2008-06-11 23:15:56 +00:00
Eli Friedman
61b529f466
Don't crash if we can't find FileEntry info for a typedef, since one
...
isn't guaranteed to exist. This fixes a crash with conflicting typedefs
coming from stdin.
This also fixes the crash in PR2406, but doesn't completely fix the
issue; it appears there's something strange about the physical location
for the definition of int64_t in stdlib.h.
llvm-svn: 52209
2008-06-11 06:20:39 +00:00
Argyrios Kyrtzidis
406fb231f8
-Add DeclChain member to DeclContext.
...
-ScopedDecls get chained to their DeclContext.
-DeclContext's DeclChain replaces FunctionDecl's DeclChain and EnumDecl's ElementList.
llvm-svn: 52164
2008-06-10 01:32:09 +00:00
Argyrios Kyrtzidis
d0c1df4c84
Make CodeGenFunction::EmitDecl() recognise CXXClass/CXXStruct/CXXUnion.
...
llvm-svn: 52162
2008-06-09 23:42:47 +00:00
Argyrios Kyrtzidis
d8cb25ee90
Dump the name of CXXStruct/CXXUnion/CXXClass Decl subclasses.
...
llvm-svn: 52161
2008-06-09 23:36:53 +00:00
Argyrios Kyrtzidis
554a07bab3
-Changes to TagDecl:
...
Added TagKind enum.
Added getTagKind() method.
Added convenience methods: isEnum(), isStruct(), isUnion(), isClass().
-RecordDecl/CXXRecordDecl::Create() accept a TagKind enum instead of a DeclKind one.
llvm-svn: 52160
2008-06-09 23:19:58 +00:00
Argyrios Kyrtzidis
2951e14520
Added new C++ AST Decl subclasses.
...
llvm-svn: 52155
2008-06-09 21:05:31 +00:00
Sanjiv Gupta
224e8ea2bb
Generate debug descriptors for array types while generating the debug info.
...
llvm-svn: 52140
2008-06-09 10:47:41 +00:00
Eli Friedman
e6e0f23a29
Add code to make test/CodeGen/struct-init.c work correctly without the
...
pointer cast hack currently in isIntegerConstantExpr
(in lib/AST/Expr.cpp). Also removes an odd test that even gcc doesn't accept.
The reason the pointer cast hack is relevant here is that it makes Sema
end up misinterpreting the relevant expression as a null pointer constant.
The reason for this patch is that I plan to remove the pointer cast hack
sometime soon because it causes strange issues, especially in its
current form; see my recent email to cfe-dev
"[PATCH] add constant expression evaluation to the AST and fix PR2413".
llvm-svn: 52120
2008-06-09 05:05:07 +00:00
Eli Friedman
7567573926
For struct initialization, check compatibility with the unqualified
...
type; this isn't explicitly stated in the standard, but it doesn't
really make sense for them to have an effect here. Fixes the included
testcase, sent to me by Steve Naroff.
llvm-svn: 52113
2008-06-09 03:52:40 +00:00
Nuno Lopes
b6f7953818
implement the alias attirbute (in both Sema and Codegen)
...
llvm-svn: 52092
2008-06-08 15:45:52 +00:00
Nuno Lopes
cc041ea68e
fix compiler warnings
...
llvm-svn: 52089
2008-06-08 10:16:34 +00:00
Eli Friedman
c98a7add43
Don't crash emitting an initializer for a static local with union type.
...
This fix just makes sure to construct the global with the appropriate
type, and fixes up the one user this affects to compensate.
llvm-svn: 52084
2008-06-08 01:23:18 +00:00
Chris Lattner
a5678ccd4a
capture whether a CharacterLiteral was wide or not in the AST.
...
Patch by Mike Stump!
llvm-svn: 52081
2008-06-07 22:35:38 +00:00
Chris Lattner
a0173131fa
Fix ast dumping to work with long double literals, e.g. we dump:
...
long double X() { return 1.0L; }
as:
long double X()
(CompoundStmt 0xb06a00 <t.c:2:17, col:32>
(ReturnStmt 0xb068d0 <col:19, col:26>
(FloatingLiteral 0xb02cf0 <col:26> 'long double' 1.000000)))
llvm-svn: 52080
2008-06-07 22:13:43 +00:00
Eli Friedman
3ce7b20590
Fix crash with conversion to an address-space-qualified pointer. Bug
...
reported on cfe-dev by Cédric Venet.
Note that I seriously doubt that this perticular construct is useful,
though: it's a pointer in an alternate address space pointing into
unqualified address space.
llvm-svn: 52076
2008-06-07 17:27:51 +00:00
Eli Friedman
7dbab8a6a1
Fix the line endings in the newly added DeclBase.cpp.
...
llvm-svn: 52075
2008-06-07 16:52:53 +00:00
Sanjiv Gupta
1929242a94
Create debug type descriptors for aggregate/enum types.
...
llvm-svn: 52070
2008-06-07 04:46:53 +00:00
Ted Kremenek
ef17049bac
Reclaim memory owned by ObjCForwardProtocolDecls.
...
llvm-svn: 52063
2008-06-06 21:05:33 +00:00
Eli Friedman
fd1e32b1f3
Reorganize this loop a bit so it doesn't crash for empty unions. Fixes
...
PR2419.
llvm-svn: 52060
2008-06-06 20:12:37 +00:00
Ted Kremenek
71fff8b4de
Implement "Destroy" and destructor for ObjCClassDecl, allowing us to reclaim its memory and the memory of the Decls it owns.
...
llvm-svn: 52059
2008-06-06 20:11:53 +00:00
Ted Kremenek
2e34af659a
Implement "Destroy" and destructor for ObjCProtocolDecl, allowing us to reclaim its memory and the memory of the Decls it owns.
...
llvm-svn: 52055
2008-06-06 19:48:57 +00:00
Eli Friedman
01321c3b8c
Clean up dead code from SemaInit landing.
...
llvm-svn: 52054
2008-06-06 19:40:52 +00:00
Ted Kremenek
5144fe2287
Because of a lack of a clear ownership role between ObjCInterfaceDecls and
...
ObjCPropertyDecls, have TranslationUnit destroy ObjCPropertyDecls. This is a
horrible hack, and must be removed eventually.
llvm-svn: 52051
2008-06-06 17:21:42 +00:00
Ted Kremenek
09a0d04ea0
Initial work on additional memory collection for ObjC AST objects. We now
...
have Destroy methods of ObjcMethodDecl and ObjCInterfaceDecl which recursively
destroy their owned Decls and Stmts. There are a few cases where it is not
clear what to do (FIXMEs included in the patch).
llvm-svn: 52050
2008-06-06 16:45:15 +00:00
Nuno Lopes
9b07b7b099
implement constant expr. sub ptr ptr
...
llvm-svn: 52049
2008-06-06 16:41:08 +00:00
Devang Patel
8f5645cd51
During interface layout, don't forget super class.
...
llvm-svn: 52035
2008-06-06 02:14:01 +00:00
Devang Patel
e1f10511ba
Undo previous check-in.
...
llvm-svn: 52034
2008-06-06 02:00:35 +00:00
Devang Patel
1216b05d3d
During interface layout, don't forget super class.
...
llvm-svn: 52033
2008-06-06 01:50:12 +00:00
Steve Naroff
d32ae8edf2
Oops...remove weird printf:-)
...
llvm-svn: 52025
2008-06-05 22:58:33 +00:00
Steve Naroff
946166f4e9
Second half of "fix" for <rdar://problem/5986085> clang on xcode: error: redefinition of 'XCElementToggler' as different kind of symbol
...
llvm-svn: 52024
2008-06-05 22:57:10 +00:00
Steve Naroff
a44099f022
super fix submitted by David Chisnall.
...
llvm-svn: 52014
2008-06-05 18:14:25 +00:00
Steve Naroff
31e1d41338
Fixed a recent test regression from last night (r51976).
...
llvm-svn: 52006
2008-06-05 15:03:27 +00:00
Steve Naroff
25449a5221
Fix <rdar://problem/5986833> clang on xcode: incompatible type returning 'void', expected 'int'.
...
- Changed Sema::ObjCActOnStartOfMethodDef() to more accurately type "self" in factory methods.
- Changed Sema::ActOnInstanceMessage() to use the new type to restrict the lookup.
llvm-svn: 52005
2008-06-05 14:49:39 +00:00
Steve Naroff
f9c65246dd
Fix <rdar://problem/5987482> clang on xcode: null dereference in Sema::ActOnMemberReferenceExpr.
...
In addition to fixing the crasher, this commit fixes further improves property lookup (by searching protocols of qualified interfaces..."NSObject <prot>").
llvm-svn: 52001
2008-06-05 13:55:23 +00:00
Sanjiv Gupta
158143ad54
Emit debug information for global and static variables when -g is specified.
...
llvm-svn: 51993
2008-06-05 08:59:10 +00:00
Steve Naroff
d1c3d1130b
Fix trivial crasher and downgrade an error to warning (to match GCC).
...
llvm-svn: 51976
2008-06-05 04:33:44 +00:00
Steve Naroff
cfdf6166fc
Support "<p>" as a short-hand for "id<p>". Here's a comment from GCC (the only documentation I could find on it).
...
/* Make "<SomeProtocol>" equivalent to "id <SomeProtocol>" - nisse@lysator.liu.se . */
This commit adds the parser magic. The type associated with <p> is still incorrect. Will discuss with Chris.
llvm-svn: 51972
2008-06-05 00:02:44 +00:00
Steve Naroff
d5bf26fa26
Fix crash identified by <rdar://problem/5986085>.
...
llvm-svn: 51969
2008-06-04 23:08:38 +00:00
Devang Patel
dbb7263fd9
Add ObjCInterface layout support.
...
Reuse RecordLayout.
llvm-svn: 51968
2008-06-04 21:54:36 +00:00
Devang Patel
21979193bb
Refactoring.
...
Move field layout code in a ASTRecordLayout member fn.
llvm-svn: 51966
2008-06-04 21:22:16 +00:00
Ted Kremenek
46267c839d
Added fixmes.
...
llvm-svn: 51964
2008-06-04 20:48:08 +00:00
Steve Naroff
d9c2607014
Parser::ParseObjCSynchronizedStmt() needs to Enter/Exit a decl scope.
...
llvm-svn: 51963
2008-06-04 20:36:13 +00:00
Eli Friedman
3e1852fa7e
Make sure the types are consistent for a void conditional. No visible
...
difference, but it's better to be consistent.
llvm-svn: 51961
2008-06-04 19:47:51 +00:00
Eli Friedman
2425cd8158
For setting attributes, don't assume there are ParamVarDecls available,
...
because trying to access non-existent ParamVarDecls can crash.
Testcase from the original source for PR2414.
llvm-svn: 51960
2008-06-04 19:41:28 +00:00
Nuno Lopes
7bd6e58ddc
fix crash when codegening 'cond ? lhs : call-to-void-func()'
...
llvm-svn: 51958
2008-06-04 19:15:45 +00:00
Nuno Lopes
28bcfec325
fix type of ?: operator. If one of the operator is void, the type should be void as well.
...
Please confirm this is safe
llvm-svn: 51957
2008-06-04 19:14:12 +00:00
Fariborz Jahanian
6e59392e4b
Fix a gcc compatibility issue which allows more protocol-qualified id on RHS to be
...
assigned to less protocol qualified object on LHS.
llvm-svn: 51956
2008-06-04 19:00:03 +00:00
Eli Friedman
67b827900e
Make the width and alignment for long double consistent with the
...
hardcoded data layout in getTargetDescription. Hopefully fixes a test
failure.
Of course, this should be fixed properly, but that's a bigger fix.
llvm-svn: 51948
2008-06-04 17:01:45 +00:00
Eli Friedman
c0b54901f4
clang fix to parallel LLVM r51928
...
(http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20080602/063306.html ).
llvm-svn: 51944
2008-06-04 16:13:19 +00:00
Ted Kremenek
b147ad1051
Moved LangOptions from TranslationUnit to ASTContext. This induced a variety of cleanups in some ASTConsumers.
...
llvm-svn: 51943
2008-06-04 15:55:15 +00:00
Steve Naroff
c68e382ba9
ASTContext::typesAreCompatible(): id is compatible with all qualified id types.
...
llvm-svn: 51939
2008-06-04 15:07:33 +00:00
Steve Naroff
f4308aac53
Sema::ActOnClassMessage() needs to look through it's local implementation for private class methods.
...
llvm-svn: 51938
2008-06-04 14:43:54 +00:00
Argyrios Kyrtzidis
6301884dc0
Move Decl and DeclContext implementations into a new DeclBase.cpp file.
...
llvm-svn: 51936
2008-06-04 13:04:04 +00:00
Steve Naroff
5ccccf0326
Make sure we look through categories when searching for a classes property.
...
Fixes <rdar://problem/5984338> clang on xcode: property implementation must have its declaration in interface 'PBXOpenQuicklyModule'
llvm-svn: 51925
2008-06-04 04:46:04 +00:00
Steve Naroff
cff2688180
Give the "isa" slot a name!
...
llvm-svn: 51924
2008-06-04 03:03:48 +00:00
Steve Naroff
b115be707d
Put back my temporary hack until Eli addresses this in a more complete fashion.
...
llvm-svn: 51920
2008-06-03 22:06:04 +00:00
Steve Naroff
13c360cec4
Implement another property related FIXME:
...
Fix <rdar://problem/5967199> clang on xcode: error: member reference is not to a structure or union
llvm-svn: 51919
2008-06-03 21:56:14 +00:00
Eli Friedman
149614bfe7
Re-fix r51907 in a way which doesn't affect valid code. This essentially
...
moves the check for the invalid construct to a point where it doesn't
affect other uses of isIntegerConstantExpr, and we can warn properly
when the extension is used. This makes it a bit more complicated, but
it's a lot cleaner.
Steve, please tell me if this check is sufficient to handle the
relevant system header. I know it's enough to handle the testcase, but
I don't know what exactly the original looks like.
llvm-svn: 51918
2008-06-03 21:01:11 +00:00
Steve Naroff
ec62418fc5
Fixup recent "super" regression.
...
llvm-svn: 51913
2008-06-03 18:21:00 +00:00
Steve Naroff
aaf5108d26
Change Expr::isIntegerConstantExpr() to allow for pointer types (for GCC compatibility). Note FIXME.
...
Fix <rdar://problem/5977870> clang on xcode: error: arrays with static storage duration must have constant integer length
llvm-svn: 51907
2008-06-03 17:15:29 +00:00
Steve Naroff
b788d9bd27
Allow implicit pointer/int conversions on ObjCQualifiedIdTypes in Sema::CheckCompareOperands() and Sema::CheckAssignmentConstraints().
...
Fixes <rdar://problem/5980804> clang on xcode: error: incompatible type sending 'id<XDUMLType>', expected 'NSCellType'.
llvm-svn: 51902
2008-06-03 14:04:54 +00:00
Steve Naroff
0b225dac9b
Finish up r51900.
...
llvm-svn: 51901
2008-06-03 13:21:30 +00:00
Steve Naroff
1ba306cde5
Allow for a GCC cast extension.
...
Fixes part of <rdar://problem/5980829> clang on xcode: used type 'NSRange' where arithmetic or pointer type is required.
llvm-svn: 51900
2008-06-03 12:56:35 +00:00
Steve Naroff
b877e2c3ca
Fix parser bug/FIXME with @catch .
...
<rdar://problem/5980846> clang on xcode: error: declarator requires an identifier (for @catch )
llvm-svn: 51895
2008-06-03 05:36:54 +00:00
Steve Naroff
ebf4cb4841
Fix <rdar://problem/5979875> clang on xcode: error: use of undeclared identifier 'super'
...
llvm-svn: 51888
2008-06-02 23:03:37 +00:00
Chris Lattner
fd2fe8270e
handle the full assignment-expression grammar when using an
...
objc message send in an initializer expression.
llvm-svn: 51882
2008-06-02 21:31:07 +00:00
Ted Kremenek
0b6b0e7157
Teach the CF retain checker about "_init" methods. Fixes: <rdar://problem/5956379>
...
llvm-svn: 51872
2008-06-02 17:14:13 +00:00
Nuno Lopes
3fe4651e2e
fix decl attributes cleaning
...
this plugs the leak of attributes and also fixes a crash in the test
llvm-svn: 51862
2008-06-01 22:53:53 +00:00
Argyrios Kyrtzidis
28172cb812
Include <string> header to allow compiling for MSVC.
...
llvm-svn: 51847
2008-06-01 21:23:24 +00:00
Nuno Lopes
363212b3fa
fix PR2357 (#ifs didnt invalidate the multiple-inclusion optimization state)
...
llvm-svn: 51843
2008-06-01 18:31:24 +00:00
Eli Friedman
412c66839e
Don't name the ObjC types if there aren't any ObjC objects in the file.
...
Patch by David Chisnall.
llvm-svn: 51840
2008-06-01 16:00:02 +00:00
Eli Friedman
f6b091f73a
First cut at setting attributes for functions and calls; this puts us
...
much closer to passing the gcc struct layout tests.
It might be possible to refactor this a bit, but I'm not sure there's
actually enough common code for that to be useful.
To get the calling convention completely correct, a bit of
platform-specific code is necessary even for x86-Linux. On x86-Linux, the
alignment of function parameters is extremely strange; as far as I can tell,
it's always 4 except for SSE vectors or structs containing SSE vectors. I'm
continuing to investigate this.
llvm-svn: 51839
2008-06-01 15:54:49 +00:00
Eli Friedman
10c2417570
Make sure _Bool globals have the correct type.
...
llvm-svn: 51838
2008-06-01 15:31:44 +00:00
Eli Friedman
149a57f7d4
Minor cleanup to use the ConvertTypeForMem helper.
...
llvm-svn: 51837
2008-06-01 15:16:01 +00:00
Anton Korobeynikov
3b6dd58ee7
Remove spurious == 0
...
llvm-svn: 51836
2008-06-01 15:14:46 +00:00
Anton Korobeynikov
1200aca763
Support for code generation of Objective-C top-level language constructs.
...
Implemented by David Chisnall!
llvm-svn: 51835
2008-06-01 14:13:53 +00:00
Steve Naroff
e643e12313
Tweak Sema::ObjCQualifiedIdTypesAreCompatible() to handle qualified interface types on the RHS.
...
This eliminates a bogus warning identified in the test below.
This fixes <rdar://problem/5968256> clang on xcode: error: incompatible type initializing 'NSObject<XCSelectionSource> *', expected 'id<NSObject,XCSelectionSource>'
llvm-svn: 51832
2008-06-01 02:43:50 +00:00
Steve Naroff
524011f389
Teach Sema::CheckConditionalOperands() to check for ObjCQualifiedIdType's. This fixes a bogus error.
...
<rdar://problem/5967036> clang on xcode: error: incompatible operand types ('id<DTOutputStreams>' and 'DTFilterOutputStream *')
llvm-svn: 51828
2008-05-31 22:33:45 +00:00
Eli Friedman
252e5f1b29
Calculate alignment for local variables.
...
llvm-svn: 51826
2008-05-31 21:20:41 +00:00
Ted Kremenek
380df93fd6
Added "InitializeTU" to ASTConsumer. This is used by Sema::ParseAST to pass a
...
TranslationUnit object instead of an ASTContext. By default it calls
Initialize(ASTConstext& Context) (to match with the current interface used by
most ASTConsumers).
Modified the ObjC-Rewriter to use InitializeTU, and to tell the TranslationUnit
to not free its Decls. This is a workaround for: <rdar://problem/5966749>
llvm-svn: 51825
2008-05-31 20:11:04 +00:00
Steve Naroff
a326bae77a
Fix <rdar://problem/5965704> clang: bad receiver type 'id const'
...
llvm-svn: 51809
2008-05-31 02:19:15 +00:00
Steve Naroff
66002283e6
Teach Expr::isLvalue() about ObjC properties. For now, all properties are writable. Added a FIXME for another day.
...
llvm-svn: 51800
2008-05-30 23:23:16 +00:00
Eli Friedman
6859a1b961
PR1893: Fix up the type of tentative definitions of incomplete array
...
types so that they end up the correct size.
llvm-svn: 51787
2008-05-30 20:39:54 +00:00
Eli Friedman
34994cbcbf
Fix and enable generating general union initializers. Essentially, what
...
this does is reconstruct the type for structs and arrays if the type
wouldn't be compatible otherwise.
The assertion about packing in the struct type reconstruction code
sucks, but I don't see any obvious way to fix it. Maybe we need a general
utility method to take a list of types and alignments and try to construct an
unpacked type if possible?
llvm-svn: 51785
2008-05-30 19:58:50 +00:00
Eli Friedman
c18d9d53bb
Allow the type of a global to be different from the type of its
...
associated declaration. This is a prerequisite to handling
general union initializations; for example, an array of unions involving
pointers has to be turned into a struct because the elements can have
incompatible types.
I refactored the code a bit to make it more readable; now, the logic for
definitions is all in EmitGlobalVarInit.
The second parameter for GetAddrOfGlobalVar is now dead; I'll remove it
separately.
By itself, this patch should not cause any visible changes.
llvm-svn: 51783
2008-05-30 19:50:47 +00:00
Eli Friedman
66572afde4
Allow a pointer implicitly cast to a bool as a constant expression, as
...
required by the standard (the standard doesn't know anything about
implicit casts).
Disallow pointers cast to non-integral arithmetic types as constant
expressions. This was previously allowed by accident.
llvm-svn: 51779
2008-05-30 18:14:48 +00:00
Eli Friedman
3360d898ec
Make sure to allow assigning a pointer to a bool.
...
llvm-svn: 51778
2008-05-30 18:07:22 +00:00
Ted Kremenek
8595668eca
Fix some strict-aliasing warnings by using Stmt* instead of Expr* in VariableArrayType, EnumConstantDecl, and VarDecl.
...
llvm-svn: 51772
2008-05-30 16:14:41 +00:00
Eli Friedman
f7fe41656c
Fix constant vector init for initializer lists with an incomplete list
...
of elements.
llvm-svn: 51769
2008-05-30 12:02:14 +00:00
Eli Friedman
617ba48fd5
Always check that the definition of a function has the correct type.
...
This fixes a crash on the included testcase (found in NetHack).
llvm-svn: 51767
2008-05-30 11:13:18 +00:00
Sanjiv Gupta
18de624ca0
Emit parameter and local variable debug information with -g.
...
llvm-svn: 51765
2008-05-30 10:30:31 +00:00
Eli Friedman
711665c309
Add FIXME to CodeGen struct layout.
...
llvm-svn: 51764
2008-05-30 10:29:32 +00:00
Eli Friedman
a2eaffc747
Some additions to constant initializer generation code. Adds
...
bit-field initialization; ugly code, X86-only, but it works, at least
for basic stuff. Separates/adds union initialization; currently disabled,
though, because the struct/array code needs modifications to support
elements of the wrong type.
Fixes PR2381 and PR2309 with the bit-field initialization. And NetHack
compiles and appears to work with a few tweaks (to work around the lack
of transparent_union support, and clang being a bit strict about
conflicting declarations).
llvm-svn: 51763
2008-05-30 10:24:46 +00:00
Eli Friedman
3df5efe83e
Cleanup/refactoring of Sema struct layout. This patch unifies the struct
...
and union codepaths and fixes some minor bugs.
I'm reasonably confident this is accurate, at least for X86. I'll
correct any bugs as I find them; I haven't found any for a while,
though.
llvm-svn: 51762
2008-05-30 09:31:38 +00:00
Steve Naroff
ec94403018
Add basic support for properties references (a missing feature).
...
While it is far from complete, it does fix the following <rdar://problem/5967199> clang on xcode: error: member reference is not to a structure or union
llvm-svn: 51719
2008-05-30 00:40:33 +00:00
Ted Kremenek
5fc6dc070c
Fix one strict-aliasing warning.
...
llvm-svn: 51707
2008-05-29 21:52:26 +00:00
Steve Naroff
021ca18bb5
- Move ObjC Expresssion AST's from Expr.h => ExprObjC.h
...
- #include ExprObjC.h in many places
llvm-svn: 51703
2008-05-29 21:12:08 +00:00
Chris Lattner
8c80070de2
Implement support for -w, which silences all warnings. PR2384.
...
llvm-svn: 51683
2008-05-29 15:36:45 +00:00
Eli Friedman
43a6d51494
More complete/correct implementation of the comparison operators for
...
constant expressions.
llvm-svn: 51682
2008-05-29 15:17:49 +00:00
Eli Friedman
3c28524632
Fix an extremely subtle bug with pointer comparisons: they have to be
...
unsigned because it's possible (at least in theory) to have
have both positive and negative pointers pointing to the same object.
llvm-svn: 51681
2008-05-29 15:09:15 +00:00
Eli Friedman
133e8040ca
Rearrange EmitLValueForField a bit to work properly for _Bool bitfields
...
in unions (we don't want to do the union-specific bitcast for
bit-fields).
llvm-svn: 51678
2008-05-29 11:33:25 +00:00
Eli Friedman
045bf4ff82
Add codegen support for a few more kinds of initializer constant
...
expressions.
llvm-svn: 51677
2008-05-29 11:22:45 +00:00
Eli Friedman
174d9c26f1
Add CodeGen support for alignment on globals, both for unusual natural
...
alignment and alignment attributes.
llvm-svn: 51676
2008-05-29 11:10:27 +00:00
Eli Friedman
b65ff27f53
A couple minor fixes to make debug info usable for arbitrary code: don't
...
emit incomplete types, because they crash llc, and always use the
logical location as the current location so we don't crash doing invalid
queries on CurLoc.
llvm-svn: 51675
2008-05-29 11:08:17 +00:00
Eli Friedman
d72a9624a1
Tentative declarations are supposed to have common linkage, not weak.
...
This change makes clang generate the same thing as llvm-gcc.
llvm-svn: 51674
2008-05-29 11:03:17 +00:00
Eli Friedman
5a6d0ede91
Always use packed structs. This isn't really very nice, but there's
...
nothing fundamentally wrong with it. Emitting unpacked structs where
possible is more work for almost no practical benefit. We'll probably
want to fix it at some point anyway, but it's low priority.
The issue with long double in particular is that LLVM thinks an X86 long
double is 10 bytes, while clang considers it for all purposes to be
either 12 or 16 bytes, depending on the platform, even in a packed
struct.
llvm-svn: 51673
2008-05-29 10:58:49 +00:00
Eli Friedman
bb936ce207
Implementation of stdarg.h.
...
llvm-svn: 51672
2008-05-29 10:40:55 +00:00
Chris Lattner
ae2c57fbbe
Fix rewrite rope to keep the leaf list up-to-date as it erases leaves
...
from the rope. rdar://5952468
llvm-svn: 51651
2008-05-28 18:45:56 +00:00
Chris Lattner
c5c27f7bfe
add an assertion
...
llvm-svn: 51645
2008-05-28 16:35:02 +00:00
Chris Lattner
a120a521a5
Fix a couple crashes on invalid input.
...
llvm-svn: 51622
2008-05-27 23:32:43 +00:00