summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CodeGenModule.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [Modules] Update to reflect the move of CallSite into the IR library inChandler Carruth2014-03-041-1/+1
| | | | | | LLVM r202816. llvm-svn: 202817
* DebugInfo: Emit only the declaration of a class template that has an ↵David Blaikie2014-03-031-1/+9
| | | | | | | | | | | | | | | | | | | | | | | explicit instantiation declaration (& always emit such a type when there's an explicit instantiation definition) We should only have this optimization fire when the explicit instantiation definition would cause at least one member function to be emitted, thus ensuring that even a compiler not performing this optimization would still emit the full type information elsewhere. But we should also pessimize output still by always emitting the definition when the explicit instantiation definition appears so that at some point in the future we can depend on that information even when no code had to be emitted in that TU. (this shouldn't happen very often, since people mostly use explicit spec decl/defs to reduce code size - but perhaps one day they could use it to explicitly reduce debug info size too) This was worth about 2% for Clang and LLVM - so not a huge win, but a win. It looks really great for simple STL programs (include <string> and just declare a string - 14k -> 1.4k of .dwo) llvm-svn: 202769
* Attr: Remove ForceInlineDavid Majnemer2014-02-251-4/+2
| | | | | | | | | | The __forceinline keyword's semantics are now recast as AlwaysInline and the kw___forceinline token has its language mode set for KEYMS. This preserves the semantics of the previous implementation but with less duplication of code. llvm-svn: 202131
* Exposing the noduplicate attribute within Clang, which marks functions so ↵Aaron Ballman2014-02-221-0/+2
| | | | | | | | that the optimizer does not duplicate code. Patch thanks to Marcello Maggioni! llvm-svn: 201941
* DebugInfo: imported_decl/using declarations at namespace scopeDavid Blaikie2014-02-151-1/+4
| | | | llvm-svn: 201470
* XCore target: add section information.Robert Lytton2014-02-111-0/+6
| | | | | | | | Xcore target ABI requires const data that is externally visible to be handled differently if it has C-language linkage rather than C++ language linkage. llvm-svn: 201142
* [stackprotector] Add command line option -fstack-protector-strongJosh Magee2014-02-111-0/+2
| | | | | | | | | | This option has the following effects: * It adds the sspstrong IR attribute to each function within the CU. * It defines the macro __SSP_STRONG__ with the value of 2. Differential Revision: http://llvm-reviews.chandlerc.com/D2717 llvm-svn: 201120
* Remove the -fhidden-weak-vtables -cc1 option. It was dead,John McCall2014-02-081-67/+0
| | | | | | gross, and increasingly replaced through other mechanisms. llvm-svn: 201011
* [ms-cxxabi] Fix cast when structor replacement is an aliasReid Kleckner2014-02-031-4/+8
| | | | llvm-svn: 200711
* Enforce safe usage of DiagnosticsEngine::getCustomDiagID()Alp Toker2014-01-261-3/+3
| | | | | | | | | | | | | | | | Replace the last incorrect uses and templatize the function to require a compile-time constant string preventing further misuse. The diagnostic formatter expects well-formed input and has undefined behaviour with arbitrary input or crafted user strings in source files. Accepting user input would also have caused unbounded generation of new diagnostic IDs which can be problematic in long-running sessions or language bindings. This completes the work to fix several incorrect callers that passed user input or raw messages to the diagnostics engine where a constant format string was expected. llvm-svn: 200132
* Use private linkage for utf-16 objc strings too.Rafael Espindola2014-01-211-9/+2
| | | | llvm-svn: 199709
* Now that r199688 avoids the real issue, use private linkage for objc strings.Rafael Espindola2014-01-211-5/+2
| | | | llvm-svn: 199705
* Give explicit sections for string constants used in NSStrings.Rafael Espindola2014-01-201-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Without them they can be merged with non unnamed_addr constants during LTO. The resulting constant is not unnamed_addr and goes in a different section, which causes ld64 to crash. A testcase that would crash before: * file1.mm: void g(id notification) { [notification valueForKey:@"name"]; } * file2.cpp: extern const char js_name_str[] = "name"; * file3.cpp extern bool JS_GetProperty(const char *name); extern const char js_name_str[]; bool js_ReportUncaughtException() { JS_GetProperty(js_name_str); } run clang file1.mm -o file1.o -c -w -emit-llvm clang file2.cpp -o file2.o -c -w -emit-llvm clang file3.cpp -o file3.o -c -w ld -dylib -o XUL file1.o file2.o file3.o -undefined dynamic_lookup. llvm-svn: 199688
* Simplify further.Rafael Espindola2014-01-201-7/+5
| | | | | | Thanks to David Blaikie for the push. llvm-svn: 199685
* Remove virtual methods that were added in 2009 and still had 1 implementation.Rafael Espindola2014-01-201-7/+9
| | | | llvm-svn: 199665
* Update CodeGen to use DLL storage class for dllimport/dllexportNico Rieck2014-01-141-9/+17
| | | | | | | With the old linkage types removed, set the linkage to external for both dllimport and dllexport to reflect what's currently supported. llvm-svn: 199220
* Remove unused include.Rafael Espindola2014-01-071-1/+0
| | | | llvm-svn: 198692
* Sort all the #include lines with LLVM's utils/sort_includes.py whichChandler Carruth2014-01-071-1/+1
| | | | | | | encodes the canonical rules for LLVM's style. I noticed this had drifted quite a bit when cleaning up LLVM, so wanted to clean up Clang as well. llvm-svn: 198686
* CodeGen: Initial instrumentation based PGO implementationJustin Bogner2014-01-061-1/+10
| | | | llvm-svn: 198640
* Tidy up CGCXXABI creationAlp Toker2013-12-281-5/+4
| | | | | | | | | | 'create' functions conventionally return a pointer, not a reference. Also use an OwningPtr to get replace the delete of a reference member. No functional change. llvm-svn: 198126
* 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
OpenPOWER on IntegriCloud