summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CodeGenModule.h
Commit message (Collapse)AuthorAgeFilesLines
...
* Implement -Wframe-larger-than backend diagnosticAlp Toker2014-06-051-4/+7
| | | | | | | | | | | | | | | | | | Add driver and frontend support for the GCC -Wframe-larger-than=bytes warning. This is the first GCC-compatible backend diagnostic built around LLVM's reporting feature. This commit adds infrastructure to perform reverse lookup from mangled names emitted after LLVM IR generation. We use that to resolve precise locations and originating AST functions, lambdas or block declarations to produce seamless codegen-guided diagnostics. An associated change, StringMap now maintains unique mangled name strings instead of allocating copies. This is a net memory saving in C++ and a small hit for C where we no longer reuse IdentifierInfo storage, pending further optimisation. llvm-svn: 210293
* Remove the overload of GetAddrOfConstantString methodAlexey Samsonov2014-06-041-16/+2
| | | | llvm-svn: 210214
* Refactor and generalize GetAddrOfConstantString and ↵Alexey Samsonov2014-06-041-0/+3
| | | | | | | | | | | | | GetAddrOfConstantStringFromLiteral. Share mode code between these functions and re-structure them in a way which shows how similar they actually are. The latter function works well with literals of multi-byte chars and does a GlobalVariable name mangling (if global strings are non-writable). No functionality change. llvm-svn: 210212
* Eliminate redundant MangleBuffer classAlp Toker2014-06-031-3/+1
| | | | | | | | | The only remaining user didn't actually use the non-dynamic storage facility this class provides. The std::string is transitional and likely to be StringRefized shortly. llvm-svn: 210058
* Don't dllimport/export destructor variants implemented by thunks.Hans Wennborg2014-05-281-2/+1
| | | | | | | | | | | | MSVC doesn't export these functions, so trying to import them doesnt' work. Also, don't let any dll attributes on the CXXDestructorDecl influence the thunk's linkage -- they should always be linkonce_odr. This takes care of the FIXME's for this in Nico's tests. Differential Revision: http://reviews.llvm.org/D3930 llvm-svn: 209706
* Use comdats to avoid double initialization of weak dataReid Kleckner2014-05-231-3/+15
| | | | | | | | | | | | | | | | | Initializers of global data that can appear multiple TUs (static data members of class templates or __declspec(selectany) data) are now in a comdat group keyed on the global variable being initialized. On non-Windows platforms, this is a code size and startup time optimization. On Windows, this is necessary for ABI compatibility with MSVC. Fixes PR16959. Reviewers: rsmith Differential Revision: http://reviews.llvm.org/D3811 llvm-svn: 209555
* [MS-ABI] Implements MS-compatible RTTIWarren Hunt2014-05-231-2/+11
| | | | | | | | | | | | | Enables the emission of MS-compatible RTTI data structures for use with typeid, dynamic_cast and exceptions. Does not implement dynamic_cast or exceptions. As an artiface, typeid works in some cases but proper support an testing will coming in a subsequent patch. majnemer has fuzzed the results. Test cases included. Differential Revision: http://reviews.llvm.org/D3833 llvm-svn: 209523
* Don't set unnamed_addr in CreateRuntimeVariable.Rafael Espindola2014-05-221-2/+1
| | | | | | | | | | | | | This was fairly broken. For example, @__dso_handle would or would not get an unnamed_addr depending on how many global destructors were used in a translation unit. The consensus was that not every runtime variable is unnamed_addr and that __dso_handle handle should not be, so just don't add unnamed_addr in CreateRuntimeVariable. llvm-svn: 209484
* [C++11] Use 'nullptr'. CodeGen edition.Craig Topper2014-05-211-23/+25
| | | | llvm-svn: 209272
* Rename CodeGenModule::getLLVMLinkageforDeclarator -> getLLVMLinkageForDeclaratorHans Wennborg2014-05-141-1/+1
| | | | | | No functionality change. llvm-svn: 208808
* Update for llvm API change.Rafael Espindola2014-05-131-1/+1
| | | | llvm-svn: 208717
* Don't repeat function name in comment.Rafael Espindola2014-05-091-192/+149
| | | | llvm-svn: 208387
* Don't indent in namespaces.Rafael Espindola2014-05-091-108/+105
| | | | llvm-svn: 208384
* Cleanup setFunctionDefinitionAttributes.Rafael Espindola2014-05-081-3/+3
| | | | | | Use more specific type, update comments and name style. llvm-svn: 208328
* Use more specific type.Rafael Espindola2014-05-081-2/+2
| | | | llvm-svn: 208321
* [OPENMP] Initial codegen for '#pragma omp parallel'Alexey Bataev2014-05-061-0/+9
| | | | llvm-svn: 208077
* Fix pr19653.Rafael Espindola2014-05-051-0/+2
| | | | | | Warn if an alias requests a section other than the aliasee section. llvm-svn: 207997
* CodeGen: Fix linkage of reference temporariesDavid Majnemer2014-04-281-5/+10
| | | | | | | | | | | | | | | Summary: A reference temporary should inherit the linkage of the variable it initializes. Otherwise, we may hit cases where a reference temporary wouldn't have the same value in all translation units. Reviewers: rsmith Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D3515 llvm-svn: 207451
* CodeGen: Use LLVM's InstrProfReader in -fprofile-instr-use=Justin Bogner2014-04-181-9/+4
| | | | | | | | | Update clang to use the InstrProfReader from LLVM to read instrumentation based profile data. This also switches us from the naive text format to the binary format, since that's what's implemented in the reader. llvm-svn: 206658
* CodeGen: Emit warnings for out of date profile data during PGOJustin Bogner2014-04-151-0/+14
| | | | | | | | | This adds a warning that triggers when profile data doesn't match for the source that's being compiled with -fprofile-instr-use=. This fires only once per translation unit, as warning on every mismatched function would be quite noisy. llvm-svn: 206322
* ObjC: allow targets to decide when to use stret for blocks.Tim Northover2014-03-291-0/+4
| | | | | | | This was originally part of the ARM64 patch, but seems semantically separate. llvm-svn: 205097
* MS ABI: Eliminate Duplicate StringsDavid Majnemer2014-03-241-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | COFF doesn't have mergeable sections so LLVM/clang's normal tactics for string deduplication will not have any effect. To remedy this we place each string inside it's own section and mark the section as IMAGE_COMDAT_SELECT_ANY. However, we can only do this if the string has an external name that we can generate from it's contents. To be compatible with MSVC, we must use their scheme. Otherwise identical strings in translation units from clang may not be deduplicated with translation units in MSVC. This fixes PR18248. N.B. We will not attempt to do anything with a string literal which is not of type 'char' or 'wchar_t' because their compiler does not support unicode string literals as of this date. Further, we avoid doing this if either -fwritable-strings or -fsanitize=address are present. This reverts commit r204596. llvm-svn: 204675
* Revert r204562,204566,204586,204587 as they broke ASan on WindowsTimur Iskhodzhanov2014-03-241-4/+1
| | | | llvm-svn: 204596
* MS ABI: Eliminate Duplicate StringsDavid Majnemer2014-03-231-1/+4
| | | | | | | | | | | | | | | | | | | | | COFF doesn't have mergeable sections so LLVM/clang's normal tactics for string deduplication will not have any effect. To remedy this we place each string inside it's own section and mark the section as IMAGE_COMDAT_SELECT_ANY. However, we can only do this if the string has an external name that we can generate from it's contents. To be compatible with MSVC, we must use their scheme. Otherwise identical strings in translation units from clang may not be deduplicated with translation units in MSVC. This fixes PR18248. N.B. We will not attempt to do anything with a string literal which is not of type 'char' or 'wchar_t' because their compiler does not support unicode string literals as of this date. llvm-svn: 204562
* Revert "CodeGen: Use a binary format for instrumentation based profiling"Justin Bogner2014-03-121-4/+4
| | | | | | | | | I've clearly done something wrong with how to get this to link correctly. Reverting for now. This reverts commit r203711. llvm-svn: 203712
* CodeGen: Use a binary format for instrumentation based profilingJustin Bogner2014-03-121-4/+4
| | | | | | | | This updates CodeGenPGO to use the ProfileDataReader introduced to llvm in r203703 and the new API for writing out the profile introduced to compiler-rt in r203710. llvm-svn: 203711
* Replace OwningPtr with std::unique_ptr.Ahmed Charles2014-03-071-2/+2
| | | | | | This compiles cleanly with lldb/lld/clang-tools-extra/llvm. llvm-svn: 203279
* Use llvm.compiler.used instead of llvm.used for objc symbols.Rafael Espindola2014-03-061-7/+8
| | | | | | | | | | | | | LLVM currently has a hack (shouldEmitUsedDirectiveFor) that causes it to not print no_dead_strip for symbols starting with 'l' or 'L'. These are exactly the ones that the clang's objc codegen is producing. The net result, is that it is equivalent to llvm.compiler.used. The need for putting the private symbol in llvm.compiler.used should be clear (the objc runtime uses them). The reason for also putting the weak symbols in it is for LTO: ld64 will not ask us to preserve the it. llvm-svn: 203172
* [Modules] Update to reflect ValueHandle moving to the IR library in LLVMChandler Carruth2014-03-041-1/+1
| | | | | | r202821. llvm-svn: 202822
* [C++11] Simplify compare operators with std::tie.Benjamin Kramer2014-03-031-4/+2
| | | | | | No functionality change. llvm-svn: 202755
* Remove the -fhidden-weak-vtables -cc1 option. It was dead,John McCall2014-02-081-15/+0
| | | | | | gross, and increasingly replaced through other mechanisms. llvm-svn: 201011
* CodeGen: Initial instrumentation based PGO implementationJustin Bogner2014-01-061-1/+7
| | | | llvm-svn: 198640
* Tidy up CGCXXABI creationAlp Toker2013-12-281-2/+2
| | | | | | | | | | '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
* Save another call to GetAddrOfFunction.Rafael Espindola2013-12-091-2/+2
| | | | | | | 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-1/+11
| | | | | | | | | 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-11/+12
| | | | | | | | 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
* ubsan: Only emit constants for filenames and type descriptors once.Will Dietz2013-11-081-0/+10
| | | | | | | | Produces neater IR in significantly less time. (~18% faster -O0 compile time for sqlite3 with -fsanitize=undefined) llvm-svn: 194231
* Produce direct calls instead of alias to linkonce_odr functions.Rafael Espindola2013-11-051-0/+6
| | | | | | | 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
* Fix vbtable indices when a class shares the vbptr with a non-virtual baseTimur Iskhodzhanov2013-11-051-4/+4
| | | | llvm-svn: 194082
* Use aliases for more constructors and destructors.Rafael Espindola2013-11-041-1/+2
| | | | | | | | | | | | | | | | With this patch we produce alias for cases like template<typename T> struct foobar { foobar() { } }; template struct foobar<void>; We just have to be careful to produce the same aliases in every TU because of comdats. llvm-svn: 194000
* New fix for pr17535.Rafael Espindola2013-10-221-0/+6
| | | | | | | | | | | | | | | | | | | 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-1/+0
| | | | | | | | | | | | | | | | 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-0/+1
| | | | | | | | | | | | 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
* Emit a .ident saying that clang produced this file.Rafael Espindola2013-10-161-0/+3
| | | | | | Patch by Katya Romanova. llvm-svn: 192832
* Code cleanup: rename VTableContext to ItaniumVTableContext, VTableBuilder to ↵Timur Iskhodzhanov2013-10-091-1/+3
| | | | | | ItaniumVTableBuilder and clang-format code around llvm-svn: 192288
* Abstract out the emission of vtables, add basic support for vtable emission ↵Timur Iskhodzhanov2013-09-271-5/+4
| | | | | | | | when using -cxx-abi microsoft Reviewed at http://llvm-reviews.chandlerc.com/D1532 llvm-svn: 191523
* Abstract out virtual calls and virtual function prologue code generation; ↵Timur Iskhodzhanov2013-08-211-0/+5
| | | | | | implement them for -cxx-abi microsoft llvm-svn: 188870
* PR16933: Don't try to codegen things after we've seen errors.David Blaikie2013-08-191-8/+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
* Use new llvm::SpecialCaseList API in CodeGenModuleAlexey Samsonov2013-08-121-2/+2
| | | | llvm-svn: 188170
* Emit the constructor for abstract classes when using -cxx-abi microsoft, ↵Timur Iskhodzhanov2013-08-041-4/+0
| | | | | | fixes PR16735 llvm-svn: 187709
OpenPOWER on IntegriCloud