Commit Graph

231 Commits

Author SHA1 Message Date
Douglas Gregor 89c8e000cf Fix handling of C99 "extern inline" semantics when dealing with
multiple declarations of the function. Should fix PR3989 and
<rdar://problem/6818429>.

llvm-svn: 69905
2009-04-23 18:22:55 +00:00
Douglas Gregor 29bd76fd04 Eliminate the three SmallVectors in ObjCImplDecl (for instance
methods, class methods, and property implementations) and instead
place all of these entities into the DeclContext.

This eliminates more linear walks when looking for class or instance
methods and should make PCH (de-)serialization of ObjCDecls trivial
(and lazy).

llvm-svn: 69849
2009-04-23 01:02:12 +00:00
Daniel Dunbar 7d4e1c5e4a Don't convert interface types (to structs) as part of CodeGenTypes.
- This has pros and cons, but for now the pros seem to significantly
   outway the con.

The con is that we will always need to cast in the runtime
implementation to a struct type, if we wish to access an interface
directly.

The pros are:
 - Avoid the cost of generating types which are used. Most
   manipulation of Objective-C objects is done through messages, and
   only the implementation of a class will directly access
   memory. Previously, we would convert the type even if it only
   appear as a function parameter, for example.

 - We don't need to worry about incomplete types, and
   UpdateCompletedType for interfaces is gone.

 - It becomes easier to narrow the interface to the shadow struct for
   Objective-C interfaces (so it can be eliminated).

Currently the runtimes still use the CodeGenTypes machinery to
generate the LLVM structure they need via ConvertTagDecl, but this can
eventually be replaced.

llvm-svn: 69797
2009-04-22 10:28:39 +00:00
Chris Lattner f8dc07369a Fix some mishandling of the attr(gnu_inline) mode when used with
extern.  Previously we would warn about it and ignore the attribute.
This is incorrect, it should be handled as a c89 "extern inline" 
function.  Many thanks to Matthieu Castet for pointing this out and
beating me over the head until I got it.

PR3988: extern inline function are not externally visible
llvm-svn: 69756
2009-04-22 00:03:30 +00:00
Douglas Gregor fa9ab53d95 Fix emission of static tentative definitions referenced from other static functions
llvm-svn: 69699
2009-04-21 19:28:58 +00:00
Douglas Gregor beecd58e21 Explictly track tentative definitions within Sema, then hand those
tentative definitions off to the ASTConsumer at the end of the
translation unit. 

Eliminate CodeGen's internal tracking of tentative definitions, and
instead hook into ASTConsumer::CompleteTentativeDefinition. Also,
tweak the definition-deferal logic for C++, where there are no
tentative definitions.

Fixes <rdar://problem/6808352>, and will make it much easier for
precompiled headers to cope with tentative definitions in the future.

llvm-svn: 69681
2009-04-21 17:11:58 +00:00
Chris Lattner ddf6ca0355 the __gnuc_inline__ attribute is actually named __gnu_inline__,
PR4023

llvm-svn: 69618
2009-04-20 19:12:28 +00:00
Eli Friedman 4f856744e5 PR3853: Add CodeGen support for __thread.
llvm-svn: 69545
2009-04-19 21:05:03 +00:00
Chris Lattner 5f65cc8215 silence a warning, it isn't clear what the right answer is here,
will talk to steve.

llvm-svn: 69519
2009-04-19 06:59:18 +00:00
Douglas Gregor e3dcb2ddd1 FunctionDecl::getBody() is getting an ASTContext argument for use in
lazy PCH deserialization. Propagate that argument wherever it needs to
be. No functionality change, except that I've tightened up a few PCH
tests in preparation.

llvm-svn: 69406
2009-04-18 00:02:19 +00:00
Anders Carlsson eaa28f7e18 Add support for generating (very basic) C++ destructors. These aren't called by anything yet.
llvm-svn: 69343
2009-04-17 01:58:57 +00:00
Daniel Dunbar c3e7cff6d3 Attributes on block functions were not being set.
- <rdar://problem/6800351> clang not producing correct large struct
   return code for Blocks

llvm-svn: 69337
2009-04-17 00:48:04 +00:00
Daniel Dunbar 426b5cf16a Ensure that the most recent declaration of a tentative definition wins
when generating a common definition.

llvm-svn: 69287
2009-04-16 15:34:14 +00:00
Daniel Dunbar 7dd749e6fd Defer generation of tentative definitions.
- PR3980.

 - <rdar://problem/6762287> [irgen] crash when generating tentative
   definition of incomplete structure

 - This also avoids creating common definitions for things which are
   later overwritten.

 - XFAIL'ed external-defs.c, it isn't completing types properly yet.

llvm-svn: 69231
2009-04-15 22:08:45 +00:00
Anders Carlsson f747524819 Start attempting to generate code for C++ ctors.
llvm-svn: 69168
2009-04-15 15:55:24 +00:00
Daniel Dunbar 346892aafc Comment fix.
llvm-svn: 69091
2009-04-14 22:41:13 +00:00
Chris Lattner bae0e68930 Fix PR3988: extern inline functions get strong symbol definitions in
C99 mode.  This is a regression from an earlier patch of mine.

This also simplifies the linkage enums a bit.

llvm-svn: 69069
2009-04-14 20:25:53 +00:00
Chris Lattner 02e987f3e8 implement codegen support for __attribute((__gnuc_inline__)),
pulling some attribute munging stuff into GetLinkageForFunction.

This should fix PR3986

llvm-svn: 69045
2009-04-14 16:44:36 +00:00
Daniel Dunbar 389325715b Refactor how attributes are set on values.
- Pull out SetCommonAttributes, which handles the things common to
   aliases, methods, functions, and variables.

 - Pull out SetLLVMFunctionAttributesForDefinition, which handles the
   LLVM attributes which we only want to apply to a definition (like
   noinline and alwaysinline).

 - Kill SetGVDeclarationAttributes (inlined into SetFunctionAttributes
   and specialized).

 - Kill SetFunctionAttributesForDefinition (inlined into sole caller).

 - Inline SetGVDefinitionAttributes into SetMethodAttributes and
   specialize.

 - Rename SetGVDefinitionAttributes to SetFunctionDefinitionAttributes.

This is supposed to be a no functionality change commit, but I may
have made a mistake.

llvm-svn: 69036
2009-04-14 08:05:55 +00:00
Daniel Dunbar 81a3f1bdf3 Split SetGlobalValueAttributes into definition/declaration halves.
- No functionality change.

llvm-svn: 69035
2009-04-14 07:19:20 +00:00
Daniel Dunbar aeddffc99d Rename (one) SetFunctionAttributes to SetLLVMFunctionAttributes to
disambiguate it.
 - No functionality change.

llvm-svn: 69034
2009-04-14 07:08:30 +00:00
Daniel Dunbar 64a41cb39e Reduce indentation, no functionality change.
llvm-svn: 69033
2009-04-14 07:02:17 +00:00
Chris Lattner 92028dad66 defer emission of always_inline, extern_inline, and inline functions (when
not in c89 mode).

llvm-svn: 69032
2009-04-14 06:44:48 +00:00
Chris Lattner 169a5c963f give always_inline functions internal linkage. If they cannot be
inlined for some reason, then we don't want a strong or even weak
definition.

llvm-svn: 69031
2009-04-14 06:32:05 +00:00
Chris Lattner 256c9507c8 set the linkage of an inline function according to its language rules.
llvm-svn: 69030
2009-04-14 06:27:57 +00:00
Daniel Dunbar 29eff88fc8 Add a comment on SetGlobalValueAttributes.
llvm-svn: 69029
2009-04-14 06:19:49 +00:00
Chris Lattner 3e031f4121 add a new enum type for linkage, no functionality change.
llvm-svn: 69028
2009-04-14 06:04:17 +00:00
Daniel Dunbar f5f359fb73 Clean up handling of visibility.
llvm-svn: 69027
2009-04-14 06:00:08 +00:00
Chris Lattner 73920ce565 reduce indentation, no functionality change.
llvm-svn: 69026
2009-04-14 05:33:52 +00:00
Chris Lattner 6a0f907a5e do not set visibility on "private" or "available externally" linkage objects.
llvm-svn: 69025
2009-04-14 05:27:13 +00:00
Daniel Dunbar 4184ac847f Update to use hasAttr() instead of getAttr().
- No functionality change.

llvm-svn: 68987
2009-04-13 21:08:27 +00:00
Steve Naroff fb46e8658c Move/update recent FIXME (wrt UTF-8 checking for ObjC @-strings).
llvm-svn: 68982
2009-04-13 20:26:29 +00:00
Steve Naroff 84073ec51f Fixed crasher in <rdar://problem/6780904> [irgen] Assertion failed: (Result == conversionOK && "UTF-8 to UTF-16 conversion failed"), function GetAddrOfConstantCFString, file CodeGenModule.cpp, line 1063.
Still a diagnostic related FIXME (will discuss with Daniel/Fariborz offline).

llvm-svn: 68975
2009-04-13 19:08:08 +00:00
Daniel Dunbar d272cca527 Internal variables could mistakenly have "hidden" visibility when
their emission was deferred.
 - <rdar://problem/6775234> variables with internal linkage should not
   be exposed with -fvisibility=hidden.

llvm-svn: 68818
2009-04-10 20:26:50 +00:00
Chris Lattner 5286e774ee reject codegen of __thread variables as unimplemented, rdar://6775265
llvm-svn: 68755
2009-04-10 00:35:59 +00:00
Douglas Gregor bcced4ec31 Propagate the ASTContext to various AST traversal and lookup functions.
No functionality change (really).

llvm-svn: 68726
2009-04-09 21:40:53 +00:00
Anders Carlsson 80f97ab08f Add a destination type argument to EmitConstantExpr. This will be used for when the destination has a reference type. (No functionality change yet)
llvm-svn: 68593
2009-04-08 04:48:15 +00:00
Daniel Dunbar ea10ab668f Visibility attributes should only be set on definition.
llvm-svn: 68561
2009-04-07 22:36:33 +00:00
Daniel Dunbar 15894b791b Various fixes to symbols used for Obj-C x86_64 metadata.
- Changed method names to match gcc (categories names still aren't
   mangled in).

 - Expose correct name for class and metadata symbols (although
   -fvisibility=hidden isn't yet correct).

 - Remove several things from llvm.used that didn't need to be there
   (I suspect this can still be trimmed).

 - Don't use asm-prefix extension for _objc_empty_{cache,vtable} (not
   needed).

 - Hide EH type class info with -fvisibility=hidden

 - Change setGlobal[Option]Visibility to not change the visibility of
   functions with internal linkage.

llvm-svn: 68510
2009-04-07 05:48:37 +00:00
Anders Carlsson 468fa6366b Add some basic support for generating C++ member functions.
llvm-svn: 68425
2009-04-04 20:47:02 +00:00
Anton Korobeynikov c847824e8e Basic support for regparm codegen
llvm-svn: 68414
2009-04-04 00:49:24 +00:00
Steve Naroff 55a719835d Add a comment/FIXME so Eli can sleep better:-))
llvm-svn: 68379
2009-04-03 09:44:50 +00:00
Fariborz Jahanian befc9dfbff Implement -fvisibility.
llvm-svn: 68369
2009-04-03 03:28:57 +00:00
Daniel Dunbar fd6cfcffa2 Add target hook for setting symbol prefix and section of unicode
string literals.

llvm-svn: 68363
2009-04-03 00:57:44 +00:00
Anders Carlsson cbaeb9e633 Emit code for linkage specifications.
llvm-svn: 68300
2009-04-02 05:55:18 +00:00
Steve Naroff 8d816d6cb5 CodeGenModule::GetAddrOfConstantCFString():
- Finish up support for converting UTF8->UTF16 to support ObjC @"string" constants.

Remove warning from CheckObjCString.

As the FIXME in the test case indicates, I still have a bug to work out (apparently with \u handling).

llvm-svn: 68245
2009-04-01 21:16:31 +00:00
Steve Naroff 29cae66bde Add ConvertUTF module from http://www.unicode.org/Public/PROGRAMS/CVTUTF.
#ifdef'd out the 5 conversion routines that we don't currently need.

Still need a bit more work in GetAddrOfConstantCFString(). Added a FIXME to indicate this.

Expect to remove the FIXME today...

llvm-svn: 68208
2009-04-01 15:50:34 +00:00
Steve Naroff e14b368fa9 More "prep" work for handling UTF16 CFString.
Patch by Jean-Daniel Dupas. Thanks!

llvm-svn: 68203
2009-04-01 13:55:36 +00:00
Chris Lattner d18136a644 fix the two xfails I added with a previous patch by making ObjC interface
types get completed when their definition is seen if previously laid out by
the code generator.

llvm-svn: 68177
2009-04-01 02:36:43 +00:00
Chris Lattner 6483908957 move trivial forwarding function inline.
llvm-svn: 68176
2009-04-01 02:08:13 +00:00