summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CodeGenModule.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* PR9214: Convert Metadata API to use ArrayRef.Jay Foad2011-04-211-2/+2
| | | | llvm-svn: 129929
* ADT/Triple: Switch to using .isOSDarwin() predicate.Daniel Dunbar2011-04-191-1/+1
| | | | llvm-svn: 129823
* IRgen/Obj-C: Emit CFStrings and NSStrings with the alignment of the char type,Daniel Dunbar2011-04-121-0/+6
| | | | | | | | | | there is no reason to align them higher. - This roughly matches llvm-gcc's r126913. - It is an open question whether or not we should do this for cstring's in general (code size vs optimization potential), for now we just match llvm-gcc until someone wants to run some experiments. llvm-svn: 129410
* Template static data members can have weak_odr linkage, not justJohn McCall2011-04-121-3/+1
| | | | | | | | weak linkage. Also, fix a problem where global weak variables with non-trivial initializers were getting guard variables, or at least were checking for them and then crashing. llvm-svn: 129342
* Ignore indirect field declarations. Fixes PR9570.John McCall2011-04-121-0/+5
| | | | llvm-svn: 129337
* After some discussion with Doug, we decided that it made a lot more senseJohn McCall2011-04-121-48/+0
| | | | | | | | | for __unknown_anytype resolution to destructively modify the AST. So that's what it does now, which significantly simplifies some of the implementation. Normal member calls work pretty cleanly now, and I added support for propagating unknown-ness through &. llvm-svn: 129331
* fix indentationChris Lattner2011-04-091-7/+6
| | | | llvm-svn: 129202
* Basic, untested implementation for an "unknown any" type requested by LLDB.John McCall2011-04-071-1/+49
| | | | | | | | | | | | The idea is that you can create a VarDecl with an unknown type, or a FunctionDecl with an unknown return type, and it will still be valid to access that object as long as you explicitly cast it at every use. I'm still going back and forth about how I want to test this effectively, but I wanted to go ahead and provide a skeletal implementation for the LLDB folks' benefit and because it also improves some diagnostic goodness for placeholder expressions. llvm-svn: 129065
* If this is an intrinsic function, set the function's attributes to the ↵Peter Collingbourne2011-04-061-0/+7
| | | | | | intrinsic's attributes. llvm-svn: 129000
* On Mac OS X, the presence of an 'availability' attribute for thatDouglas Gregor2011-03-261-1/+1
| | | | | | | | | platform implies default visibility. To achieve these, refactor our lookup of explicit visibility so that we search for both an explicit VisibilityAttr and an appropriate AvailabilityAttr, favoring the VisibilityAttr if it is present. llvm-svn: 128336
* Update type cache when a type is completed.Devang Patel2011-03-231-0/+7
| | | | | | Radar 9168773 llvm-svn: 128150
* Implement a new 'availability' attribute, that allows one to specifyDouglas Gregor2011-03-231-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | which versions of an OS provide a certain facility. For example, void foo() __attribute__((availability(macosx,introduced=10.2,deprecated=10.4,obsoleted=10.6))); says that the function "foo" was introduced in 10.2, deprecated in 10.4, and completely obsoleted in 10.6. This attribute ties in with the deployment targets (e.g., -mmacosx-version-min=10.1 specifies that we want to deploy back to Mac OS X 10.1). There are several concrete behaviors that this attribute enables, as illustrated with the function foo() above: - If we choose a deployment target >= Mac OS X 10.4, uses of "foo" will result in a deprecation warning, as if we had placed attribute((deprecated)) on it (but with a better diagnostic) - If we choose a deployment target >= Mac OS X 10.6, uses of "foo" will result in an "unavailable" warning (in C)/error (in C++), as if we had placed attribute((unavailable)) on it - If we choose a deployment target prior to 10.2, foo() is weak-imported (if it is a kind of entity that can be weak imported), as if we had placed the weak_import attribute on it. Naturally, there can be multiple availability attributes on a declaration, for different platforms; only the current platform matters when checking availability attributes. The only platforms this attribute currently works for are "ios" and "macosx", since we already have -mxxxx-version-min flags for them and we have experience there with macro tricks translating down to the deprecated/unavailable/weak_import attributes. The end goal is to open this up to other platforms, and even extension to other "platforms" that are really libraries (say, through a #pragma clang define_system), but that hasn't yet been designed and we may want to shake out more issues with this narrower problem first. Addresses <rdar://problem/6690412>. As a drive-by bug-fix, if an entity is both deprecated and unavailable, we only emit the "unavailable" diagnostic. llvm-svn: 128127
* Simplify Mac runtime selection - it's the factory function's job to select ↵David Chisnall2011-03-221-10/+2
| | | | | | which class to produce, not CodeGenModule's. llvm-svn: 128109
* The emission of an Objective-C++'s class .cxx_destruct method should beJohn McCall2011-03-221-17/+28
| | | | | | | conditioned on whether it has any destructible ivars, not on whether it has any non-trivial class-object initializers. llvm-svn: 128074
* Add support for language-specific address spaces. On top of that,Peter Collingbourne2011-03-181-2/+3
| | | | | | | | | add support for the OpenCL __private, __local, __constant and __global address spaces, as well as the __read_only, _read_write and __write_only image access specifiers. Patch originally by ARM; language-specific address space support by myself. llvm-svn: 127915
* The Darwin kernel does not provide useful guard variable support.John McCall2011-03-181-0/+5
| | | | | | | | Issue this as an IR-gen error; it's not really worthwhile doing this "right", i.e. in Sema, because IR gen knows a lot of tricks beyond what the constant evaluator knows. llvm-svn: 127854
* Remove code that was intentionally generating bad code on the GNU runtime ↵David Chisnall2011-03-171-1/+1
| | | | | | for no reason (failing to emit .cxx_constructor / .cxx_destructor methods). llvm-svn: 127806
* Switch from internal to linker_private linkage, it is sufficient to please ↵Rafael Espindola2011-03-141-1/+1
| | | | | | the new linker. llvm-svn: 127622
* Fix link of libxul with LTO and the linker in xcode4. It is not clear if thisRafael Espindola2011-03-141-1/+4
| | | | | | | is working around a bug in ld or if the new linker has a reasonable reason for wanting the string constant to be linker visible. llvm-svn: 127594
* Fix three of the four places where I left breadcrumbs to avoid unnecessaryJohn McCall2011-03-091-3/+5
| | | | | | recomputation. llvm-svn: 127322
* Use the "undergoes default argument promotion" bit on parameters toJohn McCall2011-03-091-1/+6
| | | | | | | | | | simplify the logic of initializing function parameters so that we don't need both a variable declaration and a type in FunctionArgList. This also means that we need to propagate the CGFunctionInfo down in a lot of places rather than recalculating it from the FAL. There's more we can do to eliminate redundancy here, and I've left FIXMEs behind to do it. llvm-svn: 127314
* DebugInfo can be enabled or disabled at function level (e.g. using an ↵Devang Patel2011-03-071-2/+2
| | | | | | attribute). However, at module level it is determined by command line option and the state of command line option does not change during compilation. Make this layering explicit and fix accidental cases where the code generator was checking whether module has debug info enabled instead of checking whether debug info is enabled for this function or not. llvm-svn: 127165
* Do not emit stop point for CXXDefaultArgExpr. It results in suboptimial user ↵Devang Patel2011-03-071-1/+1
| | | | | | | | | | | | | experience. 21 int main() { 22 A a; For example, here user would expect to stop at line 22, even if A's constructor leads to a call through CXXDefaultArgExpr. This fixes ostream-defined.exp regression from gdb testsuite. llvm-svn: 127164
* StringRefify.Benjamin Kramer2011-03-051-8/+9
| | | | llvm-svn: 127082
* Reorganize the emission of local variables.John McCall2011-02-221-0/+2
| | | | llvm-svn: 126189
* Warn about code that uses variables and functions with internal linkageJohn McCall2011-02-191-1/+1
| | | | | | | | | | | | | | without defining them. This should be an error, but I'm paranoid about "uses" that end up not actually requiring a definition. I'll revisit later. Also, teach IR generation to not set internal linkage on variable declarations, just for safety's sake. Doing so produces an invalid module if the variable is not ultimately defined. Also, fix several places in the test suite where we were using internal functions without definitions. llvm-svn: 126016
* Assorted cleanup:John McCall2011-02-151-1/+11
| | | | | | | | | - Have CGM precompute a number of commonly-used types - Have CGF copy that during initialization instead of recomputing them - Use TBAA info when initializing a parameter variable - Refactor the scalar ++/-- code llvm-svn: 125562
* Use raw_svector_ostream in more places in the mangler.Rafael Espindola2011-02-101-8/+12
| | | | llvm-svn: 125321
* When IRgen refers to a function declaration that is not a definition,Douglas Gregor2011-02-091-2/+2
| | | | | | | | | | and we later find the definition, make sure that we add the definition (not the declaration) to the list of deferred definitions to emit. Fixes PR8864. Thanks to Nick Lewycky for testing this patch out llvm-svn: 125157
* Reorganize CodeGen{Function,Module} to eliminate the unfortunateJohn McCall2011-02-081-11/+13
| | | | | | | | Block{Function,Module} base class. Minor other refactorings. Fixed a few address-space bugs while I was there. llvm-svn: 125085
* Re-land r124768, with a fix for PR9130.Anders Carlsson2011-02-051-8/+14
| | | | | | We now emit everything except unused implicit virtual member functions when building the vtable. llvm-svn: 124935
* minor refactoring of -fapple-kext stuff.Fariborz Jahanian2011-02-041-8/+6
| | | | llvm-svn: 124837
* What was I thinking?Fariborz Jahanian2011-02-041-3/+1
| | | | llvm-svn: 124835
* -fapple-kext cannot have 'weak' visibility in thisFariborz Jahanian2011-02-041-15/+32
| | | | | | abi. llvm-svn: 124834
* Revert 124768.Rafael Espindola2011-02-031-15/+8
| | | | | | | This reopens PR99114, but that one at least can be avoided with an #include. PR9130 cannot. llvm-svn: 124780
* Don't try to mark virtual members referenced for classes where the key functionAnders Carlsson2011-02-031-8/+15
| | | | | | | | | | | is not defined in the current translation unit. Doing so lead to compile errors such as PR9114. Instead, when CodeGen is building the vtable, don't try to emit a definition for functions that aren't marked used in the current translation unit. Fixes PR9114. llvm-svn: 124768
* Revert 124633. The linker has been told how to merge available_externally.Rafael Espindola2011-02-011-1/+2
| | | | llvm-svn: 124651
* Set visibility for available_externally globals. This is important for two ↵Rafael Espindola2011-02-011-2/+1
| | | | | | | | | | reasons: * llvm-link would complains about mismatched visibility * If we produce a relocation with an available_externally, it is good to know that it is hidden. llvm-svn: 124633
* When building with optimizations, emit vtables where the key is not in the Anders Carlsson2011-01-301-0/+6
| | | | | | | | | | | | | | | | | | | | | | | current translation unit as available_externally. This helps devirtualize the second example in PR3100, comment 18: struct S { S() {}; virtual void xyzzy(); }; inline void foo(S *s) { s->xyzzy(); } void bar() { S s; foo(&s); } This involved four major changes: 1. In DefineUsedVTables, always mark virtual member functions as referenced for non-template classes and class template specializations. 2. In CodeGenVTables::ShouldEmitVTableInThisTU return true if optimizations are enabled, even if the key function is not implemented in this translation unit. We don't ever do this for code compiled with -fapple-kext, because we don't ever want to devirtualize virtual member function calls in that case. 3. Give the correct linkage for vtables where the key function is not defined. 4. Update the linkage for RTTI structures when necessary. llvm-svn: 124565
* Move GetLLVMVisibility to CodeGenModule.Anders Carlsson2011-01-291-11/+0
| | | | llvm-svn: 124550
* Add RTTIBuilder::GetAddrOfTypeName which uses the newly added ↵Anders Carlsson2011-01-291-0/+4
| | | | | | | | CreateOrReplaceCXXRuntimeVariable. Set the visibility for typeinfo names. llvm-svn: 124548
* Change CodeGenModule::setTypeVisibility to take a TypeVisibilityKind enum ↵Anders Carlsson2011-01-291-2/+3
| | | | | | instead of an "IsForRTTI" flag. llvm-svn: 124546
* Replace an isa/cast with a dyn_cast.Anders Carlsson2011-01-291-2/+2
| | | | llvm-svn: 124542
* Get rid of an unneeded parameter from setGlobalVisibility.Anders Carlsson2011-01-291-7/+5
| | | | llvm-svn: 124541
* Use CGM.CreateOrReplaceCXXRuntimeVariable in CGVTables.cppAnders Carlsson2011-01-291-1/+1
| | | | llvm-svn: 124538
* Add a new function, to be used by CGRTTI, CGVTables and CGVTT (which each ↵Anders Carlsson2011-01-291-0/+39
| | | | | | has their own copy of this code). llvm-svn: 124537
* Replace a literal '8' with getCharWidth().Ken Dyck2011-01-291-2/+3
| | | | llvm-svn: 124536
* Remove IsDefinition from CodeGenModule::setTypeVisibility; it is always true.Anders Carlsson2011-01-291-3/+2
| | | | llvm-svn: 124529
* Mark VTables and RTTI data linkonce_odr instead of weak_odr, with the ↵Anders Carlsson2011-01-241-6/+10
| | | | | | | | exception of explicit template instantiations, which have to be weak_odr. This fixes PR6996. llvm-svn: 124089
* Use a FunctionType::get overload that doesn't require an empty vector.Benjamin Kramer2011-01-221-5/+2
| | | | llvm-svn: 124029
OpenPOWER on IntegriCloud