summaryrefslogtreecommitdiff
path: root/lib/CodeGen/CodeGenModule.cpp
Commit message (Collapse)AuthorAge
* CodeGen: Improve warnings about uninstrumented files when profilingJustin Bogner2014-06-26
| | | | | | | | | Improve the warning when building with -fprofile-instr-use and a file appears not to have been profiled at all. This keys on whether a function is defined in the main file or not to avoid false negatives when one includes a header with functions that have been profiled. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211760 91177308-0d34-0410-b5e6-96231b3b80d8
* CodeGen: Remove a stray tab character (NFC)Justin Bogner2014-06-23
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211528 91177308-0d34-0410-b5e6-96231b3b80d8
* Add module flags metadata to record the settings for enum and wchar widthOliver Stannard2014-06-20
| | | | | | | | | Add module flags metadata to record the settings for enum and wchar width, to allow correct ARM build attribute generation git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211354 91177308-0d34-0410-b5e6-96231b3b80d8
* Replace llvm::error_code with std::error_code.Rafael Espindola2014-06-12
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@210780 91177308-0d34-0410-b5e6-96231b3b80d8
* CodeGen: Correct linkage of thread_local for OS XDavid Majnemer2014-06-11
| | | | | | | | | | | | | The backing store of thread local variables is internal for OS X and all accesses must go through the thread wrapper. However, individual TUs may have inlined through the thread wrapper. To fix this, give the thread wrapper functions WeakAnyLinkage. This prevents them from getting inlined into call-sites. This fixes PR19989. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@210632 91177308-0d34-0410-b5e6-96231b3b80d8
* [C++11] Use 'nullptr'.Craig Topper2014-06-09
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@210448 91177308-0d34-0410-b5e6-96231b3b80d8
* Implement -Wframe-larger-than backend diagnosticAlp Toker2014-06-05
| | | | | | | | | | | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@210293 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove the overload of GetAddrOfConstantString methodAlexey Samsonov2014-06-04
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@210214 91177308-0d34-0410-b5e6-96231b3b80d8
* Refactor and generalize GetAddrOfConstantString and ↵Alexey Samsonov2014-06-04
| | | | | | | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@210212 91177308-0d34-0410-b5e6-96231b3b80d8
* This cast is not necessary any more (llvm api change).Rafael Espindola2014-06-04
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@210206 91177308-0d34-0410-b5e6-96231b3b80d8
* Update for llvm API change.Rafael Espindola2014-06-03
| | | | | | Aliases in llvm now hold an arbitrary expression. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@210063 91177308-0d34-0410-b5e6-96231b3b80d8
* Eliminate redundant MangleBuffer classAlp Toker2014-06-03
| | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@210058 91177308-0d34-0410-b5e6-96231b3b80d8
* MS ABI: Emit static data members with proper linkageNico Rieck2014-05-29
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@209826 91177308-0d34-0410-b5e6-96231b3b80d8
* [ASan] Hoist blacklisting globals from init-order checking to Clang.Alexey Samsonov2014-05-29
| | | | | | | | | | Clang knows about the sanitizer blacklist and it makes no sense to add global to the list of llvm.asan.dynamically_initialized_globals if it will be blacklisted in the instrumentation pass anyway. Instead, we should do as much blacklisting as possible (if not all) in the frontend. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@209789 91177308-0d34-0410-b5e6-96231b3b80d8
* Don't dllimport/export destructor variants implemented by thunks.Hans Wennborg2014-05-28
| | | | | | | | | | | | 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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@209706 91177308-0d34-0410-b5e6-96231b3b80d8
* Use comdats to avoid double initialization of weak dataReid Kleckner2014-05-23
| | | | | | | | | | | | | | | | | 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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@209555 91177308-0d34-0410-b5e6-96231b3b80d8
* Don't set unnamed_addr in CreateRuntimeVariable.Rafael Espindola2014-05-22
| | | | | | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@209484 91177308-0d34-0410-b5e6-96231b3b80d8
* [C++11] Use 'nullptr'. CodeGen edition.Craig Topper2014-05-21
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@209272 91177308-0d34-0410-b5e6-96231b3b80d8
* Demote the "Debug Info Version" module flag to llvm::Module::WarningAdrian Prantl2014-05-19
| | | | | | | | | behavior on mismatch. The AutoUpgrader will drop incompatible debug info any way and also emit a warning diagnostic for it. rdar://problem/16926122 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@209182 91177308-0d34-0410-b5e6-96231b3b80d8
* Update for llvm api change.Rafael Espindola2014-05-17
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@209077 91177308-0d34-0410-b5e6-96231b3b80d8
* Update for llvm api change.Rafael Espindola2014-05-17
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@209074 91177308-0d34-0410-b5e6-96231b3b80d8
* Use getAliasee instead of getAliasedGlobal.Rafael Espindola2014-05-16
| | | | | | No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@209038 91177308-0d34-0410-b5e6-96231b3b80d8
* Update for llvm api change.Rafael Espindola2014-05-16
| | | | | | | | | | Now that llvm cannot represent alias cycles, we have to diagnose erros just before trying to close the cycle. This degrades the errors a bit. The real solution is what it was before: if we want to provide good errors for these cases, we have to be able to find a clang level decl given a mangled name and produce the error from Sema. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@209008 91177308-0d34-0410-b5e6-96231b3b80d8
* Update for llvm API change.Rafael Espindola2014-05-16
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@208984 91177308-0d34-0410-b5e6-96231b3b80d8
* Allow dllimport/dllexport on inline functions and adjust the linkage.Hans Wennborg2014-05-15
| | | | | | | | This is a step towards handling these attributes on classes (PR11170). Differential Revision: http://reviews.llvm.org/D3772 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@208925 91177308-0d34-0410-b5e6-96231b3b80d8
* Rename CodeGenModule::getLLVMLinkageforDeclarator -> getLLVMLinkageForDeclaratorHans Wennborg2014-05-14
| | | | | | No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@208808 91177308-0d34-0410-b5e6-96231b3b80d8
* Update for llvm API change.Rafael Espindola2014-05-13
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@208717 91177308-0d34-0410-b5e6-96231b3b80d8
* Pacify bots again - turns out my checkout was slightly polluted when I was ↵James Molloy2014-05-09
| | | | | | reverting a olista01s change, and this pollution made it upstream during the revert checkin :/ Sorryemacs -nw lib/CodeGen/CodeGenModule.cpp git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@208426 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r208417 (olista01 'ARM: HFAs must be passed in consecutive ↵James Molloy2014-05-09
| | | | | | registers'). This is a followon commit from r208413 which broke the LLVM bots. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@208422 91177308-0d34-0410-b5e6-96231b3b80d8
* Use auto to avoid duplicating the type.Rafael Espindola2014-05-09
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@208374 91177308-0d34-0410-b5e6-96231b3b80d8
* Cleanup setFunctionDefinitionAttributes.Rafael Espindola2014-05-08
| | | | | | Use more specific type, update comments and name style. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@208328 91177308-0d34-0410-b5e6-96231b3b80d8
* Small simplification: Reduce the use of cast<>.Rafael Espindola2014-05-08
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@208320 91177308-0d34-0410-b5e6-96231b3b80d8
* [OPENMP] Initial codegen for '#pragma omp parallel'Alexey Bataev2014-05-06
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@208077 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix pr19653.Rafael Espindola2014-05-05
| | | | | | Warn if an alias requests a section other than the aliasee section. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207997 91177308-0d34-0410-b5e6-96231b3b80d8
* Small refactoring, no functionality change.Rafael Espindola2014-05-05
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207991 91177308-0d34-0410-b5e6-96231b3b80d8
* XCore target: fix bug in dereferencing null pointer.Robert Lytton2014-05-02
| | | | | | Also add basic cpp ABI tests where they differ from C ABI output. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207834 91177308-0d34-0410-b5e6-96231b3b80d8
* XCore target: Add TypeString meta data to IR output.Robert Lytton2014-05-02
| | | | | | | This includes the addition of the virtual function: TargetCodeGenInfo::EmitTargetMD() git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207832 91177308-0d34-0410-b5e6-96231b3b80d8
* AST: Mangle reference temporaries reliablyDavid Majnemer2014-05-01
| | | | | | | | | | | | | | | Summary: Previously, we would generate a single name for all reference temporaries and allow LLVM to rename them for us. Instead, number the reference temporaries as we build them in Sema. Reviewers: rsmith Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D3554 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207776 91177308-0d34-0410-b5e6-96231b3b80d8
* CodeGen: Reference temporaries inherit visibilityDavid Majnemer2014-04-29
| | | | | | | Reference temporaries inherited many properties from the variable that they correspond to but visibility wasn't one of them. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207496 91177308-0d34-0410-b5e6-96231b3b80d8
* CodeGen: Fix linkage of reference temporariesDavid Majnemer2014-04-28
| | | | | | | | | | | | | | | 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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207451 91177308-0d34-0410-b5e6-96231b3b80d8
* CodeGen: Cleanup variable linkage calculationDavid Majnemer2014-04-25
| | | | | | | | | | Almost all linkage calculation for VarDecls occured inside of GetLLVMLinkageVarDefinition except for static data members. Centralize the logic so that it can be more readily reused. No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207241 91177308-0d34-0410-b5e6-96231b3b80d8
* CodeGen: Refactor linkage/visibility calculationDavid Majnemer2014-04-25
| | | | | | | | | | It turns out that linkage and visibility have rather similar logic for both functions and non-variable globals. Split the calculation out so that both sides may share this code. No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207239 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove some empty statementsAlp Toker2014-04-19
| | | | | | Cleanup only. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@206709 91177308-0d34-0410-b5e6-96231b3b80d8
* CodeGen: Use LLVM's InstrProfReader in -fprofile-instr-use=Justin Bogner2014-04-18
| | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@206658 91177308-0d34-0410-b5e6-96231b3b80d8
* CodeGen: Emit warnings for out of date profile data during PGOJustin Bogner2014-04-15
| | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@206322 91177308-0d34-0410-b5e6-96231b3b80d8
* CodeGen: Move PGO initialization into Release()Justin Bogner2014-04-10
| | | | | | | | Emitting the PGO initialization in EmitGlobalFunctionDefinition is inefficient, since this only has an effect once per module. We move this to Release() with the rest of the once-per-module logic. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@205977 91177308-0d34-0410-b5e6-96231b3b80d8
* CodeGen: Clean up CommonLinkage calculationDavid Majnemer2014-04-10
| | | | | | No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@205972 91177308-0d34-0410-b5e6-96231b3b80d8
* CodeGen: Emit some functions as weak_odr under -fms-compatibilityDavid Majnemer2014-04-02
| | | | | | | | | | | | | | | | | | | Summary: MSVC always emits inline functions marked with the extern storage class specifier. The result is something similar to the opposite of __attribute__((gnu_inline)). This extension is also available in C. This fixes PR19264. Reviewers: rnk, rsmith CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D3207 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@205485 91177308-0d34-0410-b5e6-96231b3b80d8
* Disable this-return optimizations when targeting iOS 5 and earlier.Bob Wilson2014-04-01
| | | | | | | | | | | | | | | | Clang implements the part of the ARM ABI saying that certain functions (e.g., constructors and destructors) return "this", but Apple's version of gcc and llvm-gcc did not. The libstdc++ dylib on iOS 5 was built with llvm-gcc, which means that clang cannot safely assume that code from the C++ runtime will correctly follow the ABI. It is also possible to run into this problem when linking with other libraries built with gcc or llvm-gcc. Even though there is no way to reliably detect that situation, it is most likely to come up when targeting older versions of iOS. Disabling the optimization for any code targeting iOS 5 solves the libstdc++ problem and has a reasonably good chance of fixing the issue for other older libraries as well. <rdar://problem/16377159> git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@205272 91177308-0d34-0410-b5e6-96231b3b80d8
* Implement the 'optnone' attribute, which suppresses most optimizationsPaul Robinson2014-03-31
| | | | | | | on a function. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@205255 91177308-0d34-0410-b5e6-96231b3b80d8