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
Eli Friedman
8233993fc6
Get -serialize working again, plus a bit of minor cleanup.
...
llvm-svn: 52152
2008-06-09 20:02:51 +00:00
Ted Kremenek
401ef2e426
Added link to Mac OS X builds. Provide instructions for those not using Mac OS X.
...
llvm-svn: 52148
2008-06-09 14:30:01 +00:00
Matthijs Kooijman
9c995757a9
Sprinkle some "-o -" clang options to make the examples work.
...
llvm-svn: 52145
2008-06-09 14:09:10 +00:00
Ted Kremenek
420f7e76c7
Add redirection page.
...
llvm-svn: 52143
2008-06-09 13:38:32 +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
Chris Lattner
e642fcd689
Since this isn't linked from anywhere yet, I'm taking the opportunity
...
to move it to a more stable URL. If the S-A work grows, this will be
the entrypoint for the pages related to it.
llvm-svn: 52101
2008-06-08 21:55:32 +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
Eli Friedman
69d721e071
Enable the rewriter tests on all platforms; there don't appear to
...
be any regressions from this on my machine, but please let me know if
you run into issues. (The idea here is that it's better to run all
tests on all platforms if at all possible.)
llvm-svn: 52083
2008-06-07 23:20:33 +00:00
Eli Friedman
7e4f41ef3f
Don't include objc.h, so the rewriter tests work on machines without it.
...
llvm-svn: 52082
2008-06-07 23:15:03 +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
Chris Lattner
82333ccf39
Mark the right ctor explicit, patch by Cédric Venet
...
llvm-svn: 52078
2008-06-07 19:56:57 +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
Eli Friedman
445c73d19f
Fix Visual Studio project files; patch by Cédric Venet.
...
llvm-svn: 52074
2008-06-07 16:34:27 +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
92611db88f
Use a common SourceManager when processing multiple files. This allows us to cache the contents of source files already loaded from disk.
...
llvm-svn: 52066
2008-06-06 22:42:39 +00:00
Ted Kremenek
af44b83296
Updated Xcode project.
...
llvm-svn: 52065
2008-06-06 21:48:51 +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
Ted Kremenek
3ad519441f
Fix crash when running with multiple source files. This can be improved.
...
llvm-svn: 52032
2008-06-06 01:47:30 +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
Ted Kremenek
dfa8c8aef5
Ignore a few more linker arguments.
...
llvm-svn: 52023
2008-06-05 22:46:24 +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
Steve Naroff
524fbe8687
Update a test and add a FIXME.
...
llvm-svn: 51967
2008-06-04 21:38:52 +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
6da61be501
ccc-analyzer now properly eats the -install_name, -exported_symbols_list, -current_version, -compatibility_version, and -sectorder command line arguments.
...
llvm-svn: 51965
2008-06-04 20:49:03 +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
8547e1d129
Don't assume that the type of a FunctionDecl is a FunctionType; that
...
assumption isn't accurate in the presence of typedefs.
llvm-svn: 51951
2008-06-04 17:58:41 +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
Ted Kremenek
1cb246ef20
Update Xcode project.
...
llvm-svn: 51941
2008-06-04 15:38:06 +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
a2981a2c7b
Add a few more built-in functions.
...
llvm-svn: 51921
2008-06-03 22:16: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
5832c03509
Add a builtin. Fixes <rdar://problem/5982037> clang on xcode: error: incompatible operand types ('int' and 'char *').
...
llvm-svn: 51908
2008-06-03 17:37:43 +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
Chris Lattner
f4fee9e1e5
make rewrite macros insert a space when commenting out macros where the token didn't
...
lead with a space.
llvm-svn: 51896
2008-06-03 06:10:17 +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
Ted Kremenek
88bfb62ffe
Use the correct 'ccc-analyzer' when the build command is a direct invocation of gcc.
...
llvm-svn: 51883
2008-06-02 21:52:47 +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
Steve Naroff
f611964230
Fix <rdar://problem/5976164> clang ObjC rewriter: for ... in enumeration inserts undeclared function (objc_enumerationMutation should be in preamble)
...
llvm-svn: 51880
2008-06-02 20:23:21 +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
Ted Kremenek
7ccc9835ef
Use "file_language" for per-language -x options.
...
llvm-svn: 51871
2008-06-02 17:13:40 +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
09efde0ae7
Add some more test cases that demonstrate clang is a bit stricter than GCC. These can be fixed lazily if they become a problem.
...
llvm-svn: 51830
2008-05-31 23:10:15 +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
Chris Lattner
d3f3231a07
Two identifiers are not the same unless they have the same identifier info.
...
llvm-svn: 51827
2008-05-31 22:01:01 +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
cd92aebd1f
Fix <rdar://problem/5917992> clang ObjC rewriter: #end from #if statement lost in translation.
...
Some fancy footwork to accommodate embedded preprocessor directives within an interface.
llvm-svn: 51815
2008-05-31 14:15:04 +00:00
Steve Naroff
930e099b90
Fix <rdar://problem/5969777> clang ObjC rewriter: #imported file name mysteriously commented out
...
This fix involved tightening up needToScanForQualifiers(), which predated ObjCQualifiedIdType.
It also includes a minor tweak to the code that searches for the beginning of the qualified type. If the AST contained the correct beginning of the declaration (i.e. the beginning of the declaration specifiers), this code would be more robust. Since it doesn't, we apply an adhoc heuristic. Note that DeclSpec contains this info...we just don't propagate it to the AST (at present).
llvm-svn: 51812
2008-05-31 05:02:17 +00:00
Steve Naroff
a6141f0780
Hack RewriteObjC::RewriteObjCStringLiteral() to include the filename in the generated code (replacing any non-alphanumeric characters with "_"). This allows header files to contain ObjCStringLiterals.
...
llvm-svn: 51811
2008-05-31 03:35:42 +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
Ted Kremenek
a3774667d3
Correctly preserve the order between -F and -I options.
...
llvm-svn: 51803
2008-05-31 00:27:00 +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
6bb6d9f197
Use llvm: 🆑 :desc for description of the -Wimplicit-function-declaration option.
...
Patch by Holger Schurig!
llvm-svn: 51774
2008-05-30 16:42:02 +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
35c01c6f2d
Fix crash with -serialize (reported to cfe-dev). The issue was
...
essentially that we were destroying the declarations twice.
(Note that we don't use -serialize directly in the testsuite, only
SerializeTest.)
llvm-svn: 51768
2008-05-30 11:28:30 +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
Anton Korobeynikov
e1a9c26b89
Update to follow recent LLVM changes
...
llvm-svn: 51689
2008-05-29 17:42:01 +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
34873d2134
give location info to another paren expr.
...
llvm-svn: 51646
2008-05-28 16:38:23 +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
Ted Kremenek
ffdbeefc54
When the build command is xcodebuild, set the magical environment variable LDPLUSPLUS to g++ to ensure that C++ object files are linked with g++ instead of gcc.
...
llvm-svn: 51621
2008-05-27 23:18:07 +00:00
Ted Kremenek
f9671ecbfd
Correctly check to see if we are analyzing C++ files (skip).
...
llvm-svn: 51620
2008-05-27 23:17:16 +00:00
Devang Patel
1c56ace4df
Check first member alignment and uses packed struct if required.
...
llvm-svn: 51619
2008-05-27 22:45:40 +00:00
Devang Patel
d608074e09
Fix test case
...
llvm-svn: 51618
2008-05-27 22:44:22 +00:00
Eli Friedman
203cdd5aae
Add the copysign builtins; I ran into a program that wanted
...
__builtin_copysign.
llvm-svn: 51597
2008-05-27 15:59:57 +00:00
Eli Friedman
21911e89d5
A few more cases for aggregate values.
...
llvm-svn: 51596
2008-05-27 15:51:49 +00:00
Eli Friedman
5e2281ede8
Implementation of __builtin_ctlz.
...
llvm-svn: 51595
2008-05-27 15:32:46 +00:00
Eli Friedman
824f8c12fd
Assume statement expressions have side effects; this gets rid of a lot
...
of extra warnings in the Python source.
llvm-svn: 51594
2008-05-27 15:24:04 +00:00
Eli Friedman
70f5a921b7
The cache is working again; re-enable it.
...
llvm-svn: 51587
2008-05-27 08:43:22 +00:00
Eli Friedman
a904087b0d
Get the type right for wide string literals; it's wchar_t, not char.
...
llvm-svn: 51586
2008-05-27 07:57:14 +00:00
Eli Friedman
6f024557ea
Add FIXME.
...
llvm-svn: 51585
2008-05-27 05:09:49 +00:00
Eli Friedman
aee9e54dca
Don't swap function decls, and add them to the scope as they are
...
encountered. Mixing up the decls is unintuitive, and confuses the AST
destruction code. Fixes PR2360.
Note that there is a need to look up the characteristics and
declarations of a function associated with a particular name or decl,
but the original swapping code doesn't solve it properly.
http://lists.cs.uiuc.edu/pipermail/cfe-dev/2008-May/001644.html is one
suggestion for how to fix that.
llvm-svn: 51584
2008-05-27 05:07:37 +00:00
Eli Friedman
078c963a31
Add a more reliable check for whether a static declaration has already
...
been used. In preparation for the fix to PR2360, but also a minor bug
in its own right.
llvm-svn: 51583
2008-05-27 04:58:01 +00:00
Eli Friedman
ac0285a683
Stop leaking the main Sema object. (Leak found using valgrind.)
...
llvm-svn: 51580
2008-05-27 04:23:47 +00:00
Eli Friedman
3e1d35b92d
Stop leaking the target data. (Leak found with valgrind.)
...
llvm-svn: 51579
2008-05-27 04:22:24 +00:00
Eli Friedman
bdef5df44e
Generalize the float type generation code, and specifically fix the
...
codegen of X86 long double.
llvm-svn: 51578
2008-05-27 04:20:05 +00:00
Eli Friedman
3e113409cb
Implementation of gcc mode attribute; this is significant because
...
it fixes PR2204. Not too much to say about the implementation; it works
in a similar way to the vector size attribute.
At some point, we need to modify the targets to provide information
about the appropriate types.
llvm-svn: 51577
2008-05-27 03:33:27 +00:00
Eli Friedman
42ed07e10e
Rewrite struct/union layout. This is mostly cleanup; this might also fix
...
a few bugs, but I don't know of any in particular. This has good effects
besides cleanup, though: it also should make it easier to implement the
aligned and packed attributes, and also target-specific struct layouts,
because the code won't have to be duplicated in codegen.
llvm-svn: 51576
2008-05-27 03:14:44 +00:00
Eli Friedman
e2bbfe22c7
Stop leaking the TUDecl.
...
llvm-svn: 51575
2008-05-27 03:08:09 +00:00
Eli Friedman
1c2d5f56f8
Change diagnostic per suggestion, to make it a bit clearer what is
...
happening.
llvm-svn: 51574
2008-05-27 02:01:50 +00:00
Eli Friedman
df649f3da5
Emit memmove, not memcpy, for structure copies; this is unfortunately
...
required for correctness in cases of copying a struct to itself or to
an overlapping struct (itself for cases like *a = *a, and overlapping
is possible with unions).
Hopefully, this won't end up being a perf issue; LLVM *should* be able
to optimize memmove to memcpy in a lot of cases, and for small copies
the generated code *should* be mostly comparable. (In reality, LLVM
is currently horrible at optimizing memmove, but that's a bug, not a
fundamental issue.)
gcc currently generates wrong code; that's
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32667 .
llvm-svn: 51566
2008-05-26 12:59:39 +00:00
Eli Friedman
292e98cc18
Fix for PR2001. I'm not really fond of it, but it is correct (unless
...
someone tries to make a bitfield volatile?).
Not sure how to write a test; any suggestions?
llvm-svn: 51558
2008-05-25 14:13:57 +00:00
Eli Friedman
0e56c82e4a
Count the number of initializable members correctly in structs/unions
...
with unnamed members.
llvm-svn: 51557
2008-05-25 14:03:31 +00:00
Eli Friedman
e0f832bd4f
Diagnose implicit init list for empty aggregate, like struct {}. Fixes
...
PR2151 (by not creating the empty implicit init list).
llvm-svn: 51556
2008-05-25 13:49:22 +00:00
Eli Friedman
85f5497c4a
Move the error checking for variable-sized objects so we don't
...
double-report errors; fixes PR2362.
llvm-svn: 51555
2008-05-25 13:22:35 +00:00
Eli Friedman
b2bef7c1c2
Make sure to define __sparc__ on Solaris; this should "fix"
...
test/Codegen/mandel.c on Solaris. :-)
llvm-svn: 51554
2008-05-25 05:26:09 +00:00
Sanjiv Gupta
98070578bf
Generate subprogram debug info with -g.
...
Also take care of freeing memory at the right places.
llvm-svn: 51553
2008-05-25 05:15:42 +00:00
Eli Friedman
d042a969c9
Fix this test on non-X86 platforms.
...
llvm-svn: 51552
2008-05-25 04:43:38 +00:00
Eli Friedman
1f97e5798f
Always initialize NEXT_CATCH; fixes a Valgrind uninitialized read error
...
(originally reported in PR1682).
llvm-svn: 51551
2008-05-25 04:34:57 +00:00
Ted Kremenek
e37e612e7a
Fix variable misspelling.
...
llvm-svn: 51548
2008-05-24 16:16:30 +00:00
Ted Kremenek
37d6f58018
Don't use inferlanguage to override the default language for all files.
...
llvm-svn: 51547
2008-05-24 16:14:34 +00:00
Ted Kremenek
55842bd269
Don't analyze .o files.
...
llvm-svn: 51546
2008-05-24 16:09:00 +00:00
Ted Kremenek
f18f460716
Cleanup indentation and remove some dead code.
...
Analyze files not compiled using "-c". This fixes:
<rdar://problem/5961638> invoke checker when gcc is not called with "-c"
llvm-svn: 51545
2008-05-24 15:58:54 +00:00
Ted Kremenek
a08154d85f
Call the correct destructor.
...
llvm-svn: 51544
2008-05-24 15:09:56 +00:00
Steve Naroff
04c3299652
This fixes a VC++ build failure.
...
llvm-svn: 51528
2008-05-24 00:16:40 +00:00
Chris Lattner
10a7bd6341
fix a nasty off-by-one error.
...
llvm-svn: 51519
2008-05-23 23:29:33 +00:00
Chris Lattner
78f37e6d28
add some assertions to catch bad things before they die
...
somewhere deep in rewrite rope.
llvm-svn: 51515
2008-05-23 23:10:58 +00:00
Chris Lattner
17c2476d0b
fix an inconsistency computing offsets that caused a crash on rewrite-nest.m
...
llvm-svn: 51514
2008-05-23 23:06:56 +00:00
Ted Kremenek
567f333f23
Disable the use of PCH files when using xcodebuild.
...
llvm-svn: 51509
2008-05-23 22:18:16 +00:00
Steve Naroff
b3424a9ab6
Minor tweak to -ast-dump for ivars.
...
llvm-svn: 51508
2008-05-23 22:01:24 +00:00
Steve Naroff
59fefb56b1
Fix range info for explicit ivar refs.
...
llvm-svn: 51507
2008-05-23 22:00:37 +00:00
Ted Kremenek
20ccc4c3ed
Revert r51498: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=51498&r1=51497&r2=51498&view=diff
...
Turns out that there are multiple places where a redefinition diagnostic can be emitted. A cleaner solution (without touching Sema) is to have
the Driver turn off these diagnostics. (will submit this patch soon)
llvm-svn: 51502
2008-05-23 21:28:18 +00:00
Steve Naroff
c11802a521
Remove a diagnostic (temporary hack that will be removed next week).
...
llvm-svn: 51498
2008-05-23 20:57:38 +00:00
Chris Lattner
37f5b7d39c
minor changes, collect the range of an expr before rewriting the subexprs
...
no functionality change.
llvm-svn: 51497
2008-05-23 20:40:52 +00:00
Steve Naroff
fd16687b9a
Make sure method definitions get output with -ast-dump.
...
llvm-svn: 51494
2008-05-23 18:50:58 +00:00
Ted Kremenek
a4951b7796
When known, include the analyzer build in the output of scan-build.
...
llvm-svn: 51492
2008-05-23 18:17:05 +00:00
Ted Kremenek
6849601f69
More test cases for retain/release checker. These cases handle not flagging leaks for static variables.
...
llvm-svn: 51486
2008-05-23 17:25:17 +00:00
Gabor Greif
f61cb42ab5
fix typo
...
llvm-svn: 51479
2008-05-23 11:19:39 +00:00
Ted Kremenek
d6795749a6
Unbreak build. Forget to check in this header file change with a previous commit.
...
llvm-svn: 51470
2008-05-23 02:53:24 +00:00
Ted Kremenek
47c96d011e
Fix typo.
...
llvm-svn: 51466
2008-05-23 01:40:41 +00:00
Steve Naroff
e3fa7136b0
Tweak AST dumper for ObjC ivars.
...
llvm-svn: 51463
2008-05-23 00:59:14 +00:00
Ted Kremenek
db622628e8
Additional retain/release checker regression tests.
...
llvm-svn: 51454
2008-05-22 23:46:11 +00:00
Ted Kremenek
b91ef1b62b
Prototyped support in the BugReporter to emit diagnostics of the form "p now aliases q".
...
llvm-svn: 51453
2008-05-22 23:45:19 +00:00
Steve Naroff
4c290c7c0b
Make sure the source location for @property points the the @-sign (not the decl spec).
...
Also added a FIXME related to how we represent @properties in the ObjCInterfaceDecl AST.
llvm-svn: 51450
2008-05-22 23:24:08 +00:00
Dan Gohman
5d30975e5e
Change uses of llvm::Type::isFirstClassType to use the new
...
llvm::Type::isSingleValueType. Currently these two functions have
the same behavior, but soon isFirstClassType will return true for
struct and array types.
Clang may some day want to use of isFirstClassType for some of
these some day as an optimization, but it'll require some
consideration.
llvm-svn: 51446
2008-05-22 22:12:56 +00:00
Ted Kremenek
1df2f3a1f5
Expand retain/release checker to consider methods/function calls that cause a
...
tracked object to "escape": it's reference count might be incremented by the
called function, thus causing an object's lifetime to extend beyond when the
local reference count is decremented to 0.
This addresses: <rdar://problem/5933215>
llvm-svn: 51433
2008-05-22 17:31:13 +00:00
Ted Kremenek
a4010c698c
Don't use ostringstream (pulling in <sstream>) when creating the dead store diagnostic (simply not needed).
...
llvm-svn: 51432
2008-05-22 16:28:24 +00:00
Ted Kremenek
0954b4564e
Update driver include paths to work on darwin10.
...
llvm-svn: 51431
2008-05-22 15:26:22 +00:00
Eli Friedman
bb5de96bc8
Patch for PR2350; the issue was tnat we were allowing (with an error)
...
void f(const void) in one place and rejecting it in another.
llvm-svn: 51424
2008-05-22 08:54:03 +00:00