summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CodeGenModule.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Switched code from using hasAttr followed by getAttr to simply call getAttr ↵Aaron Ballman2013-12-191-2/+1
| | | | | | | | directly and check the resulting value. No functional changes intended. llvm-svn: 197652
* Replacing calls to getAttr with calls to hasAttr for clarity. No functional ↵Aaron Ballman2013-12-191-4/+4
| | | | | | change intended -- this only replaces Boolean uses of getAttr. llvm-svn: 197648
* ASTContext: Refactor implicit record creationAlp Toker2013-12-171-16/+2
| | | | | | | | Tidy up built-in record creation to reduce code duplication. Continuation of r197336. llvm-svn: 197452
* [ms-cxxabi] Fix linkage of dtor thunks for anonymous classesReid Kleckner2013-12-111-6/+8
| | | | | | | | | | We were mistakengly giving linkonce_odr linkage instead of internal linkage to the deleting and complete destructor thunks for classes in anonymous namespaces. Fixes PR17273. llvm-svn: 197060
* Save another call to GetAddrOfFunction.Rafael Espindola2013-12-091-6/+8
| | | | | | | Thread an optional GV down to EmitGlobalFunctionDefinition so that it can avoid the lookup when we already know the corresponding llvm global value. llvm-svn: 196789
* When we decide to output a deferred decl, remember the llvm GlobalValue.Rafael Espindola2013-12-091-23/+24
| | | | | | | | | We can reuse it to avoid a DenseMap+StringMap lookup to find if it was already emitted or not. This fixes a 2010 TODO. llvm-svn: 196785
* Avoid adding some decls to DeferredDeclsToEmit.Rafael Espindola2013-12-091-57/+66
| | | | | | | | Before this patch GetOrCreateLLVMFunction would add a decl to DeferredDeclsToEmit even when it was being called by the function trying to emit that decl. llvm-svn: 196753
* GlobalAlias::isDeclaration is always false. Remove dead code.Rafael Espindola2013-12-081-5/+0
| | | | llvm-svn: 196727
* Debug Info: Move the constant for Debug Info Version from Dwarf.h to Metadata.h.Manman Ren2013-12-021-1/+1
| | | | | | | Suggested by Eric. Paired commit with r196144. llvm-svn: 196145
* Expand comments for Debug Info Version.Manman Ren2013-12-021-1/+4
| | | | llvm-svn: 196143
* [CodeGen] If there is a function definition with duplicate mangled name, ↵Argyrios Kyrtzidis2013-11-231-0/+4
| | | | | | | | emit an error instead of asserting. rdar://15522601 & http://llvm.org/PR18031 llvm-svn: 195556
* Debug Info: add a "Debug Info Version" module flag to output the current debugManman Ren2013-11-221-0/+5
| | | | | | | | info version number. Will error out when modules have different version numbers. llvm-svn: 195495
* [-cxx-abi microsoft] Emit linkonce_odr definitions for declarations of ↵Hans Wennborg2013-11-211-0/+15
| | | | | | | | | | | | | | | static data members with inline initializers (PR17689) This makes Clang emit a linkonce_odr definition for 'val' in the code below, to be compatible with MSVC-compiled code: struct Foo { static const int val = 1; }; Differential Revision: http://llvm-reviews.chandlerc.com/D2233 llvm-svn: 195283
* Fix test failures after addrspacecast added.Matt Arsenault2013-11-151-4/+8
| | | | | | Bitcasts between address spaces are no longer allowed. llvm-svn: 194765
* [OpenCL] Make sure we put string literals in the constant address space.Joey Gouly2013-11-141-4/+9
| | | | llvm-svn: 194717
* Keep the old function order in CodeGenModule::applyReplacements.Rafael Espindola2013-11-121-2/+16
| | | | | | | | | | | | | | The original decls are created when used. The replacements are created at the end of the TU in reverse order. This makes the original order far better for testing. This is particularly important since the replacement logic could be used even when -mconstructor-aliases is not used, but that would make many tests hard to read. This is a fixed version of r194357 which handles replacing a destructor with another which is an alias to a third one. llvm-svn: 194452
* Revert "Keep the old function order in CodeGenModule::applyReplacements."Rafael Espindola2013-11-111-14/+2
| | | | | | | | This reverts commit r194357. Debugging a cast failure during bootstrap. llvm-svn: 194358
* Keep the old function order in CodeGenModule::applyReplacements.Rafael Espindola2013-11-101-2/+14
| | | | | | | | | | | The original decls are created when used. The replacements are created at the end of the TU in reverse order. This makes the original order far better for testing. This is particularly important since the replacement logic could be used even when -mconstructor-aliases is not used, but that would make many tests hard to read. llvm-svn: 194357
* Avoid double StringMap lookups. No functionality change.Benjamin Kramer2013-11-101-4/+4
| | | | llvm-svn: 194355
* Produce direct calls instead of alias to linkonce_odr functions.Rafael Espindola2013-11-051-0/+15
| | | | | | | This is a small optimization on linux, but should help more on windows where msvc only outputs one destructor if there would be two identical ones. llvm-svn: 194095
* C++1y sized deallocation: if we have a use, but not a definition, of a sizedRichard Smith2013-11-051-0/+6
| | | | | | | | | | | | | deallocation function (and the corresponding unsized deallocation function has been declared), emit a weak discardable definition of the function that forwards to the corresponding unsized deallocation. This allows a C++ standard library implementation to provide both a sized and an unsized deallocation function, where the unsized one does not just call the sized one, for instance by putting both in the same object file within an archive. llvm-svn: 194055
* New fix for pr17535.Rafael Espindola2013-10-221-0/+37
| | | | | | | | | | | | | | | | | | | This is a fixed version of r193161. In order to handle void foo() __attribute__((alias("bar"))); void bar() {} void zed() __attribute__((alias("foo"))); it is not enough to delay aliases to the end of the TU, we have to do two passes over them to find if they are defined or not. This can be implemented by producing alias as we go and just doing the second pass at the end. This has the advantage that other parts of clang that were expecting alias to be processed in order don't have to be changed. This patch also handles cyclic aliases. llvm-svn: 193188
* Revert "This patch causes clang to reject alias attributes that point to ↵Rafael Espindola2013-10-221-38/+1
| | | | | | | | | | | | | | | | undefined names. For example, with this patch we now reject" This reverts commit r193161. It broke void foo() __attribute__((alias("bar"))); void bar() {} void zed() __attribute__((alias("foo"))); Looks like we have to fix pr17639 first :-( llvm-svn: 193162
* This patch causes clang to reject alias attributes that point to undefinedRafael Espindola2013-10-221-1/+38
| | | | | | | | | | | | names. For example, with this patch we now reject void f1(void) __attribute__((alias("g1"))); This patch is implemented in CodeGen. It is quiet a bit simpler and more compatible with gcc than implementing it in Sema. The downside is that the errors only fire during -emit-llvm. llvm-svn: 193161
* Rename some functions for consistency.Rafael Espindola2013-10-171-1/+1
| | | | | | Every other function in Redeclarable.h was using Decl instead of Declaration. llvm-svn: 192900
* Emit a .ident saying that clang produced this file.Rafael Espindola2013-10-161-0/+15
| | | | | | Patch by Katya Romanova. llvm-svn: 192832
* TBAA: use the same format for scalar TBAA and struct-path aware TBAA.Manman Ren2013-10-081-4/+4
| | | | | | | | | | | | | | | | An updated version of r191586 with bug fix. Struct-path aware TBAA generates tags to specify the access path, while scalar TBAA only generates tags to scalar types. We should not generate a TBAA tag with null being the first field. When a TBAA type node is null, the tag should be null too. Make sure we don't decorate an instruction with a null TBAA tag. Added a testing case for the bug reported by Richard with -relaxed-aliasing and -fsanitizer=thread. llvm-svn: 192145
* Revert r191586 and r191695. They cause crashes when building withRichard Smith2013-10-011-4/+4
| | | | | | -relaxed-aliasing. llvm-svn: 191725
* TBAA: use the same format for scalar TBAA and struct-path aware TBAA.Manman Ren2013-09-271-4/+4
| | | | | | | Struct-path aware TBAA generates tags to specify the access path, while scalar TBAA only generates tags to scalar types. llvm-svn: 191586
* Do not emit duplicate global initializers for template static data members ↵David Blaikie2013-09-041-1/+6
| | | | | | | | | | | | | | | | | inside namespaces A quirk of AST representation leads to class template static data member definitions being visited twice during Clang IRGen resulting in duplicate (benign) initializers. Discovered while investigating a possibly-related debug info bug tickled by the duplicate emission of these members & their associated debug info. With thanks to Richard Smith for help investigating, understanding, and helping with the fix. llvm-svn: 189996
* Emit uuid globals as linkonce_odrReid Kleckner2013-09-031-1/+1
| | | | | | Patch by Nico Rieck! llvm-svn: 189860
* Use pop_back_val() instead of both back() and pop_back().Robert Wilhelm2013-08-231-2/+1
| | | | | | No functionality change intended. llvm-svn: 189112
* PR16933: Don't try to codegen things after we've seen errors.David Blaikie2013-08-191-14/+2
| | | | | | | | Refactor the underlying code a bit to remove unnecessary calls to "hasErrorOccurred" & make them consistently at all the entry points to the IRGen ASTConsumer. llvm-svn: 188707
* CodeGen: __uuidof should work even with an incomplete _GUID typeDavid Majnemer2013-08-151-36/+21
| | | | | | | | | | | | | | | | | | | | | | | | Summary: We would crash in CodeGen::CodeGenModule::EmitUuidofInitializer because our attempt to enter CodeGen::CodeGenModule::EmitConstantValue will be foiled: the type of the constant value is incomplete. Instead, create an unnamed type with the proper layout on all platforms. Punt the problem of wrongly defined struct _GUID types to the user. (It's impossible because the TU may never get to see the type and thus we can't verify that it is suitable.) This fixes PR16856. Reviewers: rsmith, rnk, thakis Reviewed By: rnk CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D1375 llvm-svn: 188481
* [-cxx-abi microsoft] Mangle __uuidof correctly into template parametersDavid Majnemer2013-08-131-11/+1
| | | | | | | | | | | | | | | | | | | | | | | Summary: It seems that __uuidof introduces a global extern "C" declaration of type __s_GUID. However, our implementation of __uuidof does not provide such a declaration and thus must open-code the mangling for __uuidof in template parameters. This allows us to codegen scoped COM pointers and other such things. This fixes PR16836. Depends on D1356. Reviewers: rnk, cdavis5x, rsmith Reviewed By: rnk CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D1357 llvm-svn: 188252
* Use new llvm::SpecialCaseList API in CodeGenModuleAlexey Samsonov2013-08-121-17/+15
| | | | llvm-svn: 188170
* [-cxx-abi microsoft] Mangle UUIDs correctly, stick them in the proper sectionDavid Majnemer2013-08-091-2/+3
| | | | | | Revert r188055 which reverted r188053. An unrelated change previously snuck in. llvm-svn: 188060
* Revert "[-cxx-abi microsoft] Mangle UUIDs correctly, stick them in the ↵David Majnemer2013-08-091-3/+2
| | | | | | | | | | proper section" This commit reverts r188053. It is breaking the build bots. llvm-svn: 188055
* [-cxx-abi microsoft] Mangle UUIDs correctly, stick them in the proper sectionDavid Majnemer2013-08-091-2/+3
| | | | | | | | | | | | We mangled them like: L___uuid_12345678-1234-1234-1234-123456789abc We should've mangled them like: __GUID_12345678_1234_1234_1234_123456789abc Furthermore, they are external symbols. llvm-svn: 188053
* Started implementing variable templates. Top level declarations should be ↵Larisse Voufo2013-08-061-1/+7
| | | | | | fully supported, up to some limitations documented as FIXMEs or TODO. Static data member templates work very partially. Static data member templates of class templates need particular attention... llvm-svn: 187762
* Emit the constructor for abstract classes when using -cxx-abi microsoft, ↵Timur Iskhodzhanov2013-08-041-1/+1
| | | | | | fixes PR16735 llvm-svn: 187709
* [ms-cxxabi] Emit linkonce complete dtors in TUs that need themReid Kleckner2013-07-221-1/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Based on Peter Collingbourne's destructor patches. Prior to this change, clang was considering ?1 to be the complete destructor and the base destructor, which was wrong. This lead to crashes when clang tried to emit two LLVM functions with the same name. In this ABI, TUs with non-inline dtors might not emit a complete destructor. They are emitted as inline thunks in TUs that need them, and they always delegate to the base dtors of the complete class and its virtual bases. This change uses the DeferredDecls machinery to emit complete dtors as needed. Currently in clang try body destructors can catch exceptions thrown by virtual base destructors. In the Microsoft C++ ABI, clang may not have the destructor definition, in which case clang won't wrap the virtual virtual base destructor calls in a try-catch. Diagnosing this in user code is TODO. Finally, for classes that don't use virtual inheritance, MSVC always calls the base destructor (?1) directly. This is a useful code size optimization that avoids emitting lots of extra thunks or aliases. Implementing it also means our existing tests continue to pass, and is consistent with MSVC's output. We can do the same for Itanium by tweaking GetAddrOfCXXDestructor, but it will require further testing. Reviewers: rjmccall CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D1066 llvm-svn: 186828
* Rename D to GD to match the type, which is GlobalDeclReid Kleckner2013-07-221-8/+10
| | | | | | Now we can save GD.getDecl() in D and shorten some casts. llvm-svn: 186826
* Tighten up the set of operator new/operator delete calls we're permitted toRichard Smith2013-07-211-0/+6
| | | | | | | | | optimize, to follow the permissions granted in N3664. Under those rules, only calls generated by new-expressions and delete-expressions are permitted to be optimized, and direct calls to ::operator new and ::operator delete must be treated as normal calls. llvm-svn: 186799
* Get rid of dead/useless code for block mangling.Eli Friedman2013-07-101-3/+0
| | | | llvm-svn: 185989
* Simplify linkage code for static local vars.Eli Friedman2013-07-011-5/+1
| | | | | | | | | The key insight here is that weak linkage for a static local variable should always mean linkonce_odr, because every file that needs it will generate a definition. We don't actually care about the precise linkage of the parent context. I feel a bit silly that I didn't realize this before. llvm-svn: 185381
* Fix mangling for block literals.Eli Friedman2013-07-011-4/+3
| | | | | | | | | | | | | | | Blocks, like lambdas, can be written in contexts which are required to be treated as the same under ODR. Unlike lambdas, it isn't possible to actually take the address of a block, so the mangling of the block itself doesn't matter. However, objects like static variables inside a block do need to be mangled in a consistent way. There are basically three components here. One, block literals need a consistent numbering. Two, objects/types inside a block literal need to be mangled using it. Three, objects/types inside a block literal need to have their linkage computed correctly. llvm-svn: 185372
* Restore r184205 and associated commits (after commit of r185290)Stephen Lin2013-06-301-0/+8
| | | | | | This allows clang to use the backend parameter attribute 'returned' when generating 'this'-returning constructors and destructors in ARM and MSVC C++ ABIs. llvm-svn: 185291
* Revert r184205 and associated patches while investigating issue with broken ↵Stephen Lin2013-06-191-8/+0
| | | | | | | | buildbot (possible interaction with LTO) <rdar://problem/14209661> llvm-svn: 184384
* Fix a warning. [-Wunused-variable]NAKAMURA Takumi2013-06-191-2/+2
| | | | llvm-svn: 184284
OpenPOWER on IntegriCloud