Commit Graph

1370 Commits

Author SHA1 Message Date
Ted Kremenek b5ef37f28e Make the destructor of ConstraintManager virtual.
llvm-svn: 55448
2008-08-27 23:13:01 +00:00
Steve Naroff ec33ed9ced First wave of changes to support "blocks" (an extension to C).
This commit adds the declaration syntax (and associated type).

llvm-svn: 55417
2008-08-27 16:04:49 +00:00
Zhongxing Xu f71b5f39bb Refactor Assume logic into a separate class ConstraintManager.
llvm-svn: 55412
2008-08-27 14:03:33 +00:00
Daniel Dunbar 55310df79c Initial support for Obj-C dot-syntax for getters.
llvm-svn: 55410
2008-08-27 06:57:25 +00:00
Daniel Dunbar 4684f37333 Add synthesized property methods to protocols and categories in Sema.
- It is not clear that this is the right approach, but this is at
   least consistent with how interfaces are handled.

 - This means NeXT now emits the correct metadata for properties in
   protocols.

 - This currently introduces a spurious warning involving inherited
   properties in protocols or categories; however, it also fixes some
   situations where we were failing to emit a warning. I will scrub
   this code tomorrow and fix this issue as well as number of other
   missed warnings / error situations that appear to exist.

llvm-svn: 55407
2008-08-27 05:40:03 +00:00
Daniel Dunbar c4adb70968 Fix "possibly uninitialized" warning.
llvm-svn: 55406
2008-08-27 05:13:46 +00:00
Daniel Dunbar eb1f9a2566 NeXT: Refactor protocol method metadata emission.
Also, fix category protocol list metadata.

llvm-svn: 55405
2008-08-27 02:31:56 +00:00
Daniel Dunbar e7ecbc539e Add addPropertyMethods implementations for
ObjC{Category,Protocol}Decl.
 - No functionality change.

llvm-svn: 55404
2008-08-27 02:09:39 +00:00
Ted Kremenek 912c28444f Added "Auditor" interface for auditing the construction of ExplodedGraphs.
llvm-svn: 55403
2008-08-27 01:56:11 +00:00
Ted Kremenek 6f7c419308 Make implementation of ExplodedNodeImpl::addPredecessor out-of-line.
llvm-svn: 55402
2008-08-27 01:27:52 +00:00
Daniel Dunbar 28e76caea1 NeXT: Emit correct properties for category.
- Was emitting duplicates of class properties instead of the category
   properties.

llvm-svn: 55395
2008-08-26 23:03:11 +00:00
Ted Kremenek af665820e4 Remove default value for 'Pred' argument to GRCoreEngineImpl::GenerateNode().
llvm-svn: 55392
2008-08-26 22:34:23 +00:00
Daniel Dunbar 3c76cb5cad NeXT: Emit metadata for synthetsized properties.
Also, fix method lookup to not use LLVM module symbol table.

llvm-svn: 55390
2008-08-26 21:51:14 +00:00
Daniel Dunbar 89654eef3a Objective-C @synthesize support.
- Only supports simple assignment and atomic semantics are ignored.
 - Not quite usable yet because the methods do not actually get added
   to the class metadata.
 - Added ObjCPropertyDecl::getSetterKind (one of Assign, Copy, Retain).
 - Rearrange CodeGenFunction so synthesis can reuse function prolog /
   epilog code.

llvm-svn: 55365
2008-08-26 08:29:31 +00:00
Daniel Dunbar 5e558bcf26 Add ObjCPropertyDecl::isReadOnly.
Respect isReadOnly when generating synthesized method decls.

llvm-svn: 55364
2008-08-26 07:16:44 +00:00
Daniel Dunbar 6962f5a73b constify ObjC*::getClassMethod,getInstanceMethod
No (intended) functionality change.

llvm-svn: 55362
2008-08-26 06:53:45 +00:00
Daniel Dunbar e36c39f3bf Missed a file; part of:
Move implicit Obj-C param creation into ObjCMethodDecl.
 - Add ObjCMethodDecl::createImplicitParams.
 - Remove ObjCMethodDecl::set{Self,Cmd}Decl
 - Remove Sema::CreateImplicitParameter

No (intended) functionality change.

llvm-svn: 55357
2008-08-26 06:08:30 +00:00
Daniel Dunbar 279d1ccc57 Move implicit Obj-C param creation into ObjCMethodDecl.
- Add ObjCMethodDecl::createImplicitParams.
 - Remove ObjCMethodDecl::set{Self,Cmd}Decl
 - Remove Sema::CreateImplicitParameter

No (intended) functionality change.

llvm-svn: 55356
2008-08-26 06:07:48 +00:00
Daniel Dunbar 3b4fdb0951 Rename ObjCPropertyImplDecl::PropertyImplKind (consistency)
- Change enum name to Kind.
 - Change enum constants to English strings.

Also, fix getPropertyImplementation (which probably should be renamed)

llvm-svn: 55354
2008-08-26 04:47:31 +00:00
Daniel Dunbar 222ab49928 Fix return type for setter method.
llvm-svn: 55353
2008-08-26 02:53:23 +00:00
Daniel Dunbar ad3cdc2ba7 Synthesize property setter method as we do for getter.
- Also, fix Parser to construct proper SetterName selector (should be
   lifted out of parser though).

llvm-svn: 55352
2008-08-26 02:32:45 +00:00
Daniel Dunbar 40bf7fe20e In incompatible pointer-typed ?: expressions, add implicit conversion
of RHSs to id type instead of void* if either has Objective-C object
type.
 - This ensures the result can still be used in normal places an
   object can be used, like a message send.

Add implicit conversions for ?: applied to qualified id types to
ensure that the RHSs are compatible. 
 - This prevents a codegen crash (creating invalid PHI nodes).
 - Again, this relates to the fact that qualified id types have no
   canonical types.
 - Note that the implicit type casted to is incorrect, however this
   doesn't currently cause problems because of the flexibility of the
   id type.

Test cases for above.

llvm-svn: 55346
2008-08-26 00:41:39 +00:00
Eli Friedman 3d421e190a Do typechecking and codegen for K&R-style function declarations
correctly.  Not a regression, but made more obvious by my recent fix 
which made function type compatibility checking a bit more strict.

llvm-svn: 55339
2008-08-25 21:31:01 +00:00
Eli Friedman 0a2ba3f10b Fix for PR2720; be a little bit more permissive in initializers for
casting pointers to integers.

Eventually, we should check whether we can evaluate an expression 
using Expr::tryEvaluate, and this codepath should be tightened to only 
handle standard-compliant cases.

llvm-svn: 55331
2008-08-25 20:46:57 +00:00
Daniel Dunbar f2e69888c5 Support __PRETTY_FUNCTION__ and friends in Obj-C methods.
Add CodeGenFunction::EmitUnsupportedLValue 
 - Gives error and returns undef value.

Swap some asserts() over to using EmitUnsupportedLValue
 - Rumor has it users (and even some developers) prefer carat
   diagnostics to backtraces.
 - Works better in Release-Asserts to boot.

llvm-svn: 55328
2008-08-25 20:45:57 +00:00
Ted Kremenek 2a2c875b9c Added 'extents' for Regions.
Added 'getExtent()' to StoreManager.
Implemented 'getExtent()' for BasicStoreManager.

llvm-svn: 55321
2008-08-25 19:33:03 +00:00
Anders Carlsson 1ec2ccd8ee Objective-C foreach selector elements must be lvalues.
llvm-svn: 55316
2008-08-25 18:16:36 +00:00
Daniel Dunbar ef957f3489 Change another is-a-pointer check to check in terms of LLVM type.
llvm-svn: 55312
2008-08-25 10:38:11 +00:00
Daniel Dunbar 427f873196 Do is-a-pointer checks in terms of LLVM types in
EmitScalarConversion().
 - Important for allowing Obj-C void * to id<X> casts and so on.
 - Not sure about this fix however, perhaps Type should understand
   that id is effectively a pointer type.

llvm-svn: 55311
2008-08-25 09:51:32 +00:00
Daniel Dunbar 81128e04e7 Stop asserting in TargetInfo::validateInputConstraint
- Sema gives a perfectively nice error message on invalid constraints.

llvm-svn: 55310
2008-08-25 09:46:27 +00:00
Daniel Dunbar ca8531a2d7 Fix Obj-C super sends inside class methods.
- NeXT loads the super class at runtime; this required changing the
   runtime interface to pass more information down.

llvm-svn: 55307
2008-08-25 08:19:24 +00:00
Daniel Dunbar 236e02c62c Name struct types generated for Obj-C classes.
llvm-svn: 55304
2008-08-25 06:28:15 +00:00
Daniel Dunbar eb99810502 Use DenseMap on IdentifierInfo instead of StringMap.
llvm-svn: 55303
2008-08-25 06:18:57 +00:00
Daniel Dunbar c61d0e9ee9 NeXT: Emit symbols used to manage linking of Obj-C classes.
- This ensures that references to undefined classes cause link
   errors.
 - NOTE: This relies on platform specific asm directives currently,
   this should be factored out.

Also, don't emit a SYMBOLS metadata entry if there are no symbols.

llvm-svn: 55302
2008-08-25 06:02:07 +00:00
Anders Carlsson ab55d9cd74 Handle emitting __builtin_huge_valf as a constant expr.
llvm-svn: 55299
2008-08-25 03:27:15 +00:00
Anders Carlsson c13b85a6b8 Make code generation of ivar ref exprs more like member exprs.
llvm-svn: 55298
2008-08-25 01:53:23 +00:00
Anders Carlsson 4c03d98e45 Handle static variables inside obj-c methods.
llvm-svn: 55297
2008-08-25 01:38:19 +00:00
Anders Carlsson 88e89a5a5d Convert qualified interface types correctly.
llvm-svn: 55287
2008-08-24 18:05:19 +00:00
Anders Carlsson c7c20702b1 Fix silly bug in objc_gc attribute parsing and add test case
llvm-svn: 55286
2008-08-24 16:33:25 +00:00
Argyrios Kyrtzidis bf667e23d1 Pass SourceRanges by reference to the various Diag methods.
llvm-svn: 55284
2008-08-24 13:14:02 +00:00
Argyrios Kyrtzidis 26da1f46e4 Add a Parser::Diag overload that can receive a custom string along with a SourceRange.
llvm-svn: 55283
2008-08-24 12:51:04 +00:00
Argyrios Kyrtzidis 75b34536d0 Rename Preprocessor::DisableBacktrack -> Preprocessor::CommitBacktrackedTokens.
llvm-svn: 55281
2008-08-24 12:29:43 +00:00
Zhongxing Xu 9470a96b18 Moved HTMLDiagnostics to lib/Driver.
llvm-svn: 55274
2008-08-24 02:33:36 +00:00
Anders Carlsson 6305c5f437 Add support for parsing the objc_gc attribute. Tests will come shortly.
llvm-svn: 55269
2008-08-23 23:22:21 +00:00
Chris Lattner a2e25e5e72 adjust to changes in various APIs from LLVM. We can't print
an APInt directly to an ostream now, so add some hacks.  It would
be better to switch all of the bugreport (and friends) stuff over
to raw_ostream.

llvm-svn: 55264
2008-08-23 22:23:37 +00:00
Anders Carlsson fbcd85137b Make sure to create CXX record decls for the implicit Obj-C type declarations. This lets us compile Cocoa.h as Objective-C++
llvm-svn: 55261
2008-08-23 22:20:38 +00:00
Anders Carlsson 4f177f803a treat bool literals as constatnt expressions.
llvm-svn: 55255
2008-08-23 21:12:35 +00:00
Anders Carlsson f93f56a28e Reserved C++ words are valid selectors in Objective-C++
llvm-svn: 55253
2008-08-23 21:00:01 +00:00
Anders Carlsson 131be8b4f4 Handle static initializers in Objective-C++ methods.
llvm-svn: 55250
2008-08-23 19:42:54 +00:00
Argyrios Kyrtzidis ce4528f008 Add CodeGen support for CXXZeroInitValueExpr.
llvm-svn: 55249
2008-08-23 19:35:47 +00:00
Anders Carlsson 0fbd44699a Handle AddrLabelExprs in Expr::isConstantExpr
llvm-svn: 55245
2008-08-23 18:49:32 +00:00
Daniel Dunbar 28ff072b70 Drop a dead call to isConstantExpr()
llvm-svn: 55244
2008-08-23 18:44:10 +00:00
Daniel Dunbar d644ad61e9 NeXT: Clean up constant CFString handling.
- Use CodeGenModule::GetAddrOfConstantCFString

Some tweaks of CodeGenModule::GetAddrOfConstantCFString

llvm-svn: 55243
2008-08-23 18:37:06 +00:00
Chris Lattner 22a4aee8e3 Add header search paths for dragonfly, patch by Sascha Wildner!
llvm-svn: 55242
2008-08-23 18:25:07 +00:00
Chris Lattner 5637ef5fce Add dragonfly target support, patch by Sascha Wildner
llvm-svn: 55241
2008-08-23 18:23:14 +00:00
Argyrios Kyrtzidis 5d240d07f2 Add a safety check.
Make sure there's no "dangling" backtrack position when Preprocessor is destroyed.

llvm-svn: 55236
2008-08-23 12:12:06 +00:00
Argyrios Kyrtzidis bd024c7fdb Change line endings: CRLF -> LF
llvm-svn: 55235
2008-08-23 12:05:53 +00:00
Daniel Dunbar c8317a44cf Implement Obj-C ivar references to aggregates.
Implement Obj-C lvalue message sends (aggregate returns).

Update several places to emit more precise ErrorUnsupported warnings
  for currently unimplemented Obj-C features (main missing chunks are
  property references, Obj-C exception handling, and the for ... in
  syntax).

llvm-svn: 55234
2008-08-23 10:51:21 +00:00
Daniel Dunbar 97ff50dd6e NeXT: Fix message sends which return structures.
- Simplify the sending code a bit.

llvm-svn: 55232
2008-08-23 09:25:55 +00:00
Daniel Dunbar b8767ac183 Add TargetInfo::useNeXTRuntimeAsDefault
- Used to autoselect runtime when neither -fnext-runtime nor
   -fgnu-runtime is specified.
 - Default impl is false, all darwin targets set it to true.

llvm-svn: 55231
2008-08-23 08:43:39 +00:00
Daniel Dunbar f6397fed10 NeXT: Implement super message sends.
llvm-svn: 55225
2008-08-23 04:28:29 +00:00
Daniel Dunbar 97db84ce6d Trim CGObjCRuntime::GenerateMessageSend[Super]
- Returns an RValue.
 - Reduced to only taking the CodeGenFunction, Expr, and Receiver.
 - Becomes responsible for emitting the arguments.

Add CodeGenFunction::EmitCallExprExt
 - Takes optional extra arguments to insert at the head of the call.
 - This allows the Obj-C runtimes to call into this and isolates the
   argument and call instruction generation code to one place. Upshot
   is that we now pass structures (more) correctly.

Also, fix one aspect of generating methods which take structure
arguments (for NeXT). This probably needs to be merged with the
SetFunctionAttributes code in CodeGenModule.cpp

llvm-svn: 55223
2008-08-23 03:46:30 +00:00
Chris Lattner f440440616 make sure that ParseAST invokes the action for end of translation unit.
llvm-svn: 55222
2008-08-23 03:19:52 +00:00
Daniel Dunbar d4f616b853 Move [LR]Value into CGValue.h
- No (intended) functional change.

llvm-svn: 55221
2008-08-23 03:10:25 +00:00
Chris Lattner 9e8c057ab7 add action to know about end of translation unit.
llvm-svn: 55218
2008-08-23 02:06:50 +00:00
Chris Lattner ce90ef51b9 we already have a handle on the 'in' keyword, don't bother getting two.
llvm-svn: 55217
2008-08-23 02:02:23 +00:00
Chris Lattner 2cc35ae286 minor cleanup, remove finalize method.
llvm-svn: 55216
2008-08-23 02:00:52 +00:00
Chris Lattner 2ebb178f8b Fix a FIXME by not creating an invalid AST on erroneous input. Also
make diagnostic output in some other malformed cases significantly
more useful.  This fixes PR2708

llvm-svn: 55215
2008-08-23 01:48:03 +00:00
Ted Kremenek 4e7713c04d Simplify interface to Store::AddDecl
llvm-svn: 55213
2008-08-23 00:50:55 +00:00
Daniel Dunbar 80a840bc70 NeXT: Emit property metadata (classes, protocols, categories).
llvm-svn: 55209
2008-08-23 00:19:03 +00:00
Anders Carlsson 8e82b7fd0f Use isa instead of dyn_cast.
llvm-svn: 55207
2008-08-22 22:10:48 +00:00
Argyrios Kyrtzidis a65490c5df Allow nested backtracks.
llvm-svn: 55204
2008-08-22 21:27:50 +00:00
Daniel Dunbar 938a77f4c9 NeXT: Emit category metadata.
llvm-svn: 55197
2008-08-22 20:34:54 +00:00
Anders Carlsson 87fc5a5e6b Add preliminary (and probably broken) codegen support for C++ static initializers.
llvm-svn: 55180
2008-08-22 16:00:37 +00:00
Argyrios Kyrtzidis 857fcc2f8e Add support for C++'s "type-specifier ( expression-list )" expression:
-The Parser calls a new "ActOnCXXTypeConstructExpr" action.
-Sema, depending on the type and expressions number:
   -If the type is a class, it will treat it as a class constructor. [TODO]
   -If there's only one expression (i.e. "int(0.5)" ), creates a new "CXXFunctionalCastExpr" Expr node
   -If there are no expressions (i.e "int()" ), creates a new "CXXZeroInitValueExpr" Expr node.

llvm-svn: 55177
2008-08-22 15:38:55 +00:00
Nico Weber ed9b4100a8 Move most of HeaderSearch initialization to libDriver.
For example, adding the default system include paths in clients is now as
simple as

  InitHeaderSearch init(headers);
  init.AddDefaultSystemIncludePaths(langopts);
  init.Realize();

llvm-svn: 55174
2008-08-22 09:25:22 +00:00
Anders Carlsson 41e0881b34 Initial sema support for C++ static initializers.
llvm-svn: 55166
2008-08-22 05:00:02 +00:00
Eli Friedman 3e62c21c49 Fix some issues with array type merging. (No visible difference,
because nothing uses the merged types yet.)

llvm-svn: 55161
2008-08-22 01:48:21 +00:00
Eli Friedman 777a6bb582 Minor const cleanup.
llvm-svn: 55160
2008-08-22 00:59:49 +00:00
Eli Friedman 47f7711e4b Rewrite type compatibility testing to do type merging rather than just
testing compatibility.  This is necessary for some constructs, like merging
redeclarations.

Also, there are some ObjC changes to make sure that 
typesAreCompatible(a,b) == typesAreCompatible(b,a).  I don't have any 
ObjC code beyond the testsuite, so please tell me if there are any cases 
where this doesn't behave as expected.

llvm-svn: 55158
2008-08-22 00:56:42 +00:00
Eli Friedman 24c0154b77 Initial implementation of floats in Expr::tryEvaluate; this doesn't
implement some things, like unary operators and casts, but it's enough
to fix PR2703 as filed.

llvm-svn: 55155
2008-08-22 00:06:13 +00:00
Zhongxing Xu 614f6a060d Modify comments.
llvm-svn: 55150
2008-08-21 23:00:21 +00:00
Zhongxing Xu d95495f601 Move the handling of DeclStmt from GRExprEngine to BasicStoreManager.
llvm-svn: 55144
2008-08-21 22:34:01 +00:00
Daniel Dunbar dec75f895e NeXT: Emit [meta]class protocol references.
Updated ObjCProtocolDecl::protocol_iterator to match that of
ObjCInterfaceDecl.

llvm-svn: 55143
2008-08-21 21:57:41 +00:00
Chris Lattner ea71438a93 add a simple check to warn people who type "=+" when they probably meant
"+=".

llvm-svn: 55131
2008-08-21 18:04:13 +00:00
Daniel Dunbar 22d82ed0e2 Preliminary support for Obj-C classes in NeXT runtime.
- Functional for simple cases but there are some glaring omissions
   (protocols, properties, and other language extensions).
 - The code needs a fair bit of cleaning.

llvm-svn: 55108
2008-08-21 04:36:09 +00:00
Eli Friedman 41d7e49e15 Remove duplicate define from Windows-x86 target.
llvm-svn: 55101
2008-08-21 01:56:54 +00:00
Eli Friedman c968a6ab8e Initial implementation of Windows x86 target; at the moment, the only
difference from generic x86 is the defines.  The rest is non-trivial to 
implement.

I'm not planning on adding any more targets myself; if there are any 
targets anyone is currently using that are missing, feel free to add 
them, or ask me to add them.

This concludes the work I'm planning for the TargetInfo 
implementations at the moment; all the other issues with TargetInfo require
some API changes, and I haven't really thought it through.  Some of the
remaining issues: allowing targets to define size_t and wchar_t properly,
adding some sort of __builtin_type_info intrinsic so we can finish clang's 
limits.h and float.h and get rid of a massive number of macro 
definitions, allowing target-specific command-line options, allowing
target-specific defaults for certain command-line options like
-fms-extensions, exposing vector alignment outside of the description 
string, exposing endianness outside of the description string, allowing 
targets to expose special bit-field layout requirements, exposing some 
sort of custom hook for call generation in CodeGen, and adding CPU 
selection to control defines like __SSE__.

llvm-svn: 55098
2008-08-21 01:40:19 +00:00
Eli Friedman ff594f24dd Add Linux x86-32 target.
llvm-svn: 55095
2008-08-21 00:24:02 +00:00
Eli Friedman 873f65afe8 First cut at OS detection, taking advantage of the new generic targets.
This approach allows adding OS-specific targets/defines/etc. without 
completely breaking unknown subtargets.  No new subtargets yet, although 
I plan to add x86-Linux soon.  Others can add targets that they use as 
needed; adding a new subtarget takes very little code.

Also does some fixups for description strings; a lot of them were 
unspecified.  I think all the ones I added are correct, but 
they're unverified; corrections are welcome.

llvm-svn: 55091
2008-08-21 00:13:15 +00:00
Eli Friedman b9e5bed4dd Class reorg for PPC; shouldn't be any visible changes unless I messed
up somehow.

This concludes the series of reorg patches for the target 
implementations.

llvm-svn: 55086
2008-08-20 23:11:40 +00:00
Eli Friedman 1be92d297a Fix a regression from my fix to PR2631. Fixes PR2692.
llvm-svn: 55083
2008-08-20 22:17:17 +00:00
Eli Friedman 002ad1274b Fix a minor crash-on-invalid.
llvm-svn: 55082
2008-08-20 22:07:34 +00:00
Daniel Dunbar 73a73f52fd Fix attributes on Obj-C interfaces & methods.
- Drop MethodAttrs parameter to ObjCMethodDecl
 - Call ProcessDeclAttributeList for interface & method decls.

llvm-svn: 55068
2008-08-20 18:02:42 +00:00
Ted Kremenek e5edbdd4ee Patch by Zhongxing Xu:
This patch moves some code in GRStateManager::RemoveDeadBindings() to EnvironmentManager::RemoveDeadBindings().

llvm-svn: 55064
2008-08-20 17:08:29 +00:00
Ted Kremenek eb38fde5e5 Patch by Zhongxing Xu: We should set back the modified ConstEq map.
llvm-svn: 55060
2008-08-20 16:59:15 +00:00
Eli Friedman f05b7728b3 Class reorg for ARM. Shouldn't be any visible changes.
llvm-svn: 55042
2008-08-20 07:44:10 +00:00
Eli Friedman da8f5a9bd8 Class hierarchy reorg for Sparc architecture. While I was there, I
cleaned it up a bit, including fixing the definition of va_list; this
shouldn't break anything, but anyone using Sparc should watch for 
regressions.

llvm-svn: 55041
2008-08-20 07:28:14 +00:00
Daniel Dunbar 94834d8883 Fix subtle bug introduced in r54852.
- UsualUnaryConversions takes an Expr *& and may modify its argument,
   this broke when it was refactored into Sema::CheckCastTypes. This
   meant that we were missing implicit casts in some places.
 - Seems pretty sad that this got through our tests.

llvm-svn: 55039
2008-08-20 03:55:42 +00:00
Ted Kremenek 821159e352 Re-enable deletion of AST nodes upon completion of ParseAST.
llvm-svn: 55038
2008-08-20 03:27:00 +00:00