summaryrefslogtreecommitdiff
path: root/lib/CodeGen/CodeGenModule.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* InstrProf: Fix a misuse of the FunctionDecl API when generating coverageJustin Bogner2015-07-281-1/+1
| | | | | | | | | | | This was calling FD->hasBody(), meaning "Does the function that this decl refers to have a body?", rather than FD->doesThisDeclarationHaveABody(), meaning "Is this decl a non-deleted definition?". We might want to consider renaming these APIs :/ git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@243360 91177308-0d34-0410-b5e6-96231b3b80d8
* LLVM API Change: the Module always owns the DataLayoutMehdi Amini2015-07-241-4/+3
| | | | | | From: Mehdi Amini <mehdi.amini@apple.com> git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@243115 91177308-0d34-0410-b5e6-96231b3b80d8
* [OpenMP] Add TLS-based implementation for threadprivate directive.Samuel Antao2015-07-131-0/+5
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@242080 91177308-0d34-0410-b5e6-96231b3b80d8
* Debug Info: Emit debug info for @import declarations.Adrian Prantl2015-06-301-0/+2
| | | | | | | | | This allows a module-aware debugger such as LLDB to import the currently visible modules before dropping into the expression evaluator. rdar://problem/20965932 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@241084 91177308-0d34-0410-b5e6-96231b3b80d8
* [CodeGen] Tweak isTriviallyRecursive furtherDavid Majnemer2015-06-301-6/+1
| | | | | | | | | | | | | | | | isTriviallyRecursive is a hack used to bridge a gap between the expectations that source code assumes and the semantics that LLVM IR can provide. Specifically, asm labels on functions are treated as an explicit name for a GlobalObject in Clang but treated like an output-processing step in GCC. Tweak this hack a little further to emit calls to library functions instead of emitting an incorrect definition. The definition in question would have available_externally linkage (this is OK) but result in a call to itself which will either result in an infinite loop or stack overflow. This fixes PR23964. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@241043 91177308-0d34-0410-b5e6-96231b3b80d8
* Pass HeaderSearchOptions and PreprocessorOptions into CodeGenModule.Adrian Prantl2015-06-301-8/+11
| | | | | | | In order to produce debug info for clang modules CGDebugInfo it needs access to macros passed on the command line and the isysroot. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@241035 91177308-0d34-0410-b5e6-96231b3b80d8
* [CodeGen] Restrict isTriviallyRecursive to predefined lib functions ↵David Majnemer2015-06-251-2/+7
| | | | | | | | | | | forwarding to lib functions isTriviallyRecursive is only supposed to guard functions part of the implementation. This fixes PR23953. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@240735 91177308-0d34-0410-b5e6-96231b3b80d8
* Display profile file name when emitting a file not found diagnostic.Diego Novillo2015-06-251-2/+3
| | | | | | | | | When a profile file cannot be opened, we used to display just the error message but not the name of the profile the compiler was trying to open. This will become useful in the next set of patches that introduce GCC-compatible flags to specify profiles. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@240715 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r240270 ("Fixed/added namespace ending comments using clang-tidy").Alexander Kornienko2015-06-221-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@240353 91177308-0d34-0410-b5e6-96231b3b80d8
* Fixed/added namespace ending comments using clang-tidy. NFCAlexander Kornienko2015-06-221-1/+1
| | | | | | | | | | | | | | The patch is generated using this command: $ tools/extra/clang-tidy/tool/run-clang-tidy.py -fix \ -checks=-*,llvm-namespace-comment -header-filter='llvm/.*|clang/.*' \ work/llvm/tools/clang To reduce churn, not touching namespaces spanning less than 10 lines. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@240270 91177308-0d34-0410-b5e6-96231b3b80d8
* [ASan] Initial support for Kernel AddressSanitizerAlexander Potapenko2015-06-191-2/+3
| | | | | | | | | | This patch adds initial support for the -fsanitize=kernel-address flag to Clang. Right now it's quite restricted: only out-of-line instrumentation is supported, globals are not instrumented, some GCC kasan flags are not supported. Using this patch I am able to build and boot the KASan tree with LLVMLinux patches from github.com/ramosian-glider/kasan/tree/kasan_llvmlinux. To disable KASan instrumentation for a certain function attribute((no_sanitize("kernel-address"))) can be used. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@240131 91177308-0d34-0410-b5e6-96231b3b80d8
* CodeGen: Factor out some of the bitset entry creation code. NFC.Peter Collingbourne2015-06-171-0/+14
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@239927 91177308-0d34-0410-b5e6-96231b3b80d8
* C++11 rangify several loops.Yaron Keren2015-06-111-36/+21
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@239528 91177308-0d34-0410-b5e6-96231b3b80d8
* Rename the single non-style conformant function in TargetCodeGenInfoEric Christopher2015-06-051-1/+1
| | | | | | and update all callers. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@239193 91177308-0d34-0410-b5e6-96231b3b80d8
* Replace push_back(Constructor(foo)) with emplace_back(foo) for non-trivial typesBenjamin Kramer2015-05-291-2/+2
| | | | | | | | | | | | | | | | | | | | If the type isn't trivially moveable emplace can skip a potentially expensive move. It also saves a couple of characters. Call sites were found with the ASTMatcher + some semi-automated cleanup. memberCallExpr( argumentCountIs(1), callee(methodDecl(hasName("push_back"))), on(hasType(recordDecl(has(namedDecl(hasName("emplace_back")))))), hasArgument(0, bindTemporaryExpr( hasType(recordDecl(hasNonTrivialDestructor())), has(constructExpr()))), unless(isInTemplateInstantiation())) No functional change intended. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@238601 91177308-0d34-0410-b5e6-96231b3b80d8
* Get the dll storage class right for structors of classes exported/imported ↵Hans Wennborg2015-05-281-13/+20
| | | | | | | | | via explicit instantiation (PR23667) This is a follow-up to r238266. It turned out structors are codegened through a different path, and didn't get the storage class set in EmitGlobalFunctionDefinition. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@238443 91177308-0d34-0410-b5e6-96231b3b80d8
* Use Intrinsic::ID instead of unsigned. NFC.Pete Cooper2015-05-201-3/+2
| | | | | | This is after LLVM r237810 which made Function::getIntrinsicID() return an Intrinsic::ID. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@237811 91177308-0d34-0410-b5e6-96231b3b80d8
* [modules] Add local submodule visibility support for declarations.Richard Smith2015-05-151-1/+1
| | | | | | | | | | | | | With this change, enabling -fmodules-local-submodule-visibility results in name visibility rules being applied to submodules of the current module in addition to imported modules (that is, names no longer "leak" between submodules of the same top-level module). This also makes it much safer to textually include a non-modular library into a module: each submodule that textually includes that library will get its own "copy" of that library, and so the library becomes visible no matter which including submodule you import. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@237473 91177308-0d34-0410-b5e6-96231b3b80d8
* Implement no_sanitize attribute.Peter Collingbourne2015-05-151-17/+0
| | | | | | Differential Revision: http://reviews.llvm.org/D9631 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@237463 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r236879, "Do not emit thunks with available_externally linkage in ↵NAKAMURA Takumi2015-05-091-12/+11
| | | | | | | | comdats" It broke pecoff, at least i686-cygwin. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@236937 91177308-0d34-0410-b5e6-96231b3b80d8
* Do not emit thunks with available_externally linkage in comdatsDerek Schuff2015-05-081-11/+12
| | | | | | | | | | | | | | Functions with available_externally linkage will not be emitted to object files (they will just be undefined symbols), so it does not make sense to put them in comdats. Creates a second overload of maybeSetTrivialComdat that uses the GlobalObject instead of the Decl, and uses that in several places that had the faulty logic. Differential Revision: http://reviews.llvm.org/D9580 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@236879 91177308-0d34-0410-b5e6-96231b3b80d8
* [cuda] Include GPU binary into host object file and generate init/deinit code.Artem Belevich2015-05-071-1/+7
| | | | | | | | | | | | - added -fcuda-include-gpubinary option to incorporate results of device-side compilation into host-side one. - generate code to register GPU binaries and associated kernels with CUDA runtime and clean-up on exit. - added test case for init/deinit code generation. Differential Revision: http://reviews.llvm.org/D9507 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@236765 91177308-0d34-0410-b5e6-96231b3b80d8
* [opaque pointer type] Correctly pass the pointee type when creating a GEP ↵David Blaikie2015-05-071-1/+2
| | | | | | constant expression git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@236751 91177308-0d34-0410-b5e6-96231b3b80d8
* [opaque pointer type] update for LLVM API changeDavid Blaikie2015-04-291-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@236161 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert code changes made under r235976.Bradley Smith2015-04-291-17/+0
| | | | | | | | | | This issue was fixed elsewhere in r235396 in a more general way, hence these changes no longer do anything. Keep the testcase however, to ensure that we don't regress this for ARM. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@236104 91177308-0d34-0410-b5e6-96231b3b80d8
* [ARM/AArch64] Enforce alignment for bitfielded structsBradley Smith2015-04-281-0/+17
| | | | | | | | | | | When creating a global variable with a type of a struct with bitfields, we must forcibly set the alignment of the global from the RecordDecl. We must do this so that the proper bitfield alignment makes its way down to LLVM, since clang will mangle the bitfields into one large type. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@235976 91177308-0d34-0410-b5e6-96231b3b80d8
* [cuda] treat file scope __asm as __host__ and ignore it during device-side ↵Artem Belevich2015-04-271-0/+3
| | | | | | | | | | | | | | | | compilation. Currently clang emits file-scope asm during *both* host and device compilation modes which is usually a wrong thing to do. There's no way to attach any attribute to an __asm statement, so there's no way to differentiate between host-side and device-side file-scope asm. This patch makes clang to match nvcc behavior and emit file-scope-asm only during host-side compilation. Differential Revision: http://reviews.llvm.org/D9270 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@235905 91177308-0d34-0410-b5e6-96231b3b80d8
* Provide alignment info on LLVM external symbolsUlrich Weigand2015-04-211-0/+2
| | | | | | | | | | | | | | | | | | | Code in CodeGenModule::GetOrCreateLLVMGlobal that sets up GlobalValue object for LLVM external symbols has this comment: // FIXME: This code is overly simple and should be merged with other global // handling. One part does seems to be "overly simple" currently is that this code never sets any alignment info on the GlobalValue, so that the emitted IR does not have any align attribute on external globals. This can lead to unnecessarily inefficient code generation. This patch adds a GV->setAlignment call to set alignment info. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@235396 91177308-0d34-0410-b5e6-96231b3b80d8
* Don't crash when a selectany symbol would get common linkageNico Weber2015-04-151-2/+7
| | | | | | | | | | | | | | | | | Things can't both be in comdats and have common linkage, so never give things in comdats common linkage. Common linkage is only used in .c files, and the only thing that can trigger a comdat in c is selectany from what I can tell. Fixes PR23243. Also address an over-the-shoulder review comment from rnk by moving the hasAttr<SelectAnyAttr>() in Decl.cpp around a bit. It only makes a minor difference for selectany on global variables, so it goes well with the rest of this patch. http://reviews.llvm.org/D9042 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@235053 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "[CodeGen] Fix crash with duplicated mangled name."Renato Golin2015-04-151-9/+8
| | | | | | | | | This reverts commit r234767, as it was breaking all ARM buildbots for two days and the assert is not in the code, making it difficult to spot the error, which would keep the bots red for a few more days. New errors were silently introduced because of this bug, and we don't want this to escalate. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@234983 91177308-0d34-0410-b5e6-96231b3b80d8
* Change range-based for-loops to be -Wrange-loop-analysis clean.Richard Trieu2015-04-151-1/+1
| | | | | | | No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@234964 91177308-0d34-0410-b5e6-96231b3b80d8
* [CodeGen] Fix crash with duplicated mangled name.Argyrios Kyrtzidis2015-04-131-8/+9
| | | | | | Patch by Yunzhong Gao! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@234767 91177308-0d34-0410-b5e6-96231b3b80d8
* Don't crash when passing a non-existent file to -fprofile-instr-use=.Nico Weber2015-04-061-2/+2
| | | | | | | Fixes a regression from r229434. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@234141 91177308-0d34-0410-b5e6-96231b3b80d8
* clang-format my last commitDavid Blaikie2015-04-051-16/+13
| | | | | | (sorry, keep forgetting that) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@234129 91177308-0d34-0410-b5e6-96231b3b80d8
* [opaque pointer type] More GEP API migrationsDavid Blaikie2015-04-051-9/+8
| | | | | | | Looks like the VTable code in particular will need some work to pass around the pointee type explicitly. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@234128 91177308-0d34-0410-b5e6-96231b3b80d8
* [opaque pointer type] Update for GEP API changes in LLVMDavid Blaikie2015-04-021-5/+6
| | | | | | | | | | Now the GEP constant utility functions require the type to be explicitly passed (since eventually the pointer type will be opaque and not convey the required type information). For now callers can still pass nullptr (though none were needed here in Clang, which is nice) if convenienc/necessary, but eventually that will be disallowed as well. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@233937 91177308-0d34-0410-b5e6-96231b3b80d8
* DebugInfo: Use new LLVM API for DebugLocDuncan P. N. Exon Smith2015-03-301-1/+1
| | | | | | | Use the new API for `DebugLoc` added in r233573 before the old one disappears. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@233589 91177308-0d34-0410-b5e6-96231b3b80d8
* [MS ABI] Rework .xdata HandlerType emissionDavid Majnemer2015-03-291-3/+3
| | | | | | | | | | Utilizing IMAGEREL relocations for synthetic IR constructs isn't valuable, just clutter. While we are here, simplify HandlerType names by making the numeric value for the 'adjective' part of the mangled name instead of appending '.const', etc. The old scheme made for very long global names and leads to wordy things like '.std_bad_alloc' git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@233503 91177308-0d34-0410-b5e6-96231b3b80d8
* C++14: Disable sized deallocation by default due to ABI breakageReid Kleckner2015-03-201-10/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are no widely deployed standard libraries providing sized deallocation functions, so we have to punt and ask the user if they want us to use sized deallocation. In the future, when such libraries are deployed, we can teach the driver to detect them and enable this feature. N3536 claimed that a weak thunk from sized to unsized deallocation could be emitted to avoid breaking backwards compatibility with standard libraries not providing sized deallocation. However, this approach and other variations don't work in practice. With the weak function approach, the thunk has to have default visibility in order to ensure that it is overridden by other DSOs providing sized deallocation. Weak, default visibility symbols are particularly expensive on MachO, so John McCall was considering disabling this feature by default on Darwin. It also changes behavior ELF linking behavior, causing certain otherwise unreferenced object files from an archive to be pulled into the link. Our second approach was to use an extern_weak function declaration and do an inline conditional branch at the deletion call site. This doesn't work because extern_weak only works on MachO if you have some archive providing the default value of the extern_weak symbol. Arranging to provide such an archive has the same challenges as providing the symbol in the standard library. Not to mention that extern_weak doesn't really work on COFF. Reviewers: rsmith, rjmccall Differential Revision: http://reviews.llvm.org/D8467 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@232788 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove .CUDAIsDevice flags from CodeGenOpts as it's alreadyArtem Belevich2015-03-191-2/+2
| | | | | | | | available in LangOpts. Differential Revision: http://reviews.llvm.org/D8385 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@232749 91177308-0d34-0410-b5e6-96231b3b80d8
* MS ABI: Don't try to emit VF/VB-Tables for extern class templatesDavid Majnemer2015-03-181-1/+2
| | | | | | | | | There will be an explicit template instantiation in another translation unit which will provide the definition of the VF/VB-Tables. This fixes PR22932. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@232680 91177308-0d34-0410-b5e6-96231b3b80d8
* [OPENMP] Fix crash on code emitting if errors are found.Alexey Bataev2015-03-181-0/+2
| | | | | | | | Codegen for threadprivate variables (and in some other cases) may cause crash of the compiler if some diagnostic is produced later. This happens because some of the autogenerated globals are not removed from InternalVars StringMap when llvm::Module is reset. Differential Revision: http://reviews.llvm.org/D8360 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@232610 91177308-0d34-0410-b5e6-96231b3b80d8
* MS ABI: Emit HandlerMap entries for C++ catchDavid Majnemer2015-03-171-2/+4
| | | | | | | | | | | | | The HandlerMap describes, to the runtime, what sort of catches surround the try. In principle, this structure has to be emitted by the backend because only it knows the layout of the stack (the runtime needs to know where on the stack the destination of a copy lives, etc.) but there is some C++ specific information that the backend can't reason about. Stick this information in special LLVM globals with the relevant "const", "volatile", "reference" info mangled into the name. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@232538 91177308-0d34-0410-b5e6-96231b3b80d8
* WIPDavid Majnemer2015-03-171-1/+5
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@232537 91177308-0d34-0410-b5e6-96231b3b80d8
* MS ABI: Don't use qualified pointee types for 'catch' EH TypeDescriptorsDavid Majnemer2015-03-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Qualifiers are located next to the TypeDescriptor in order to properly ensure that a pointer type can only be caught by a more qualified catch handler. This means that a catch handler of type 'const int *' requires an RTTI object for 'int *'. We got this correct for 'throw' but not for 'catch'. N.B. We don't currently have the means to store the qualifiers because LLVM's EH strategy is tailored to the Itanium scheme. The Itanium ABI stores qualifiers inside the type descriptor in such a way that the manner of qualification is stored in addition to the pointee type's descriptor. Perhaps the best way of modeling this for the MS ABI is using an aggregate type to bundle the qualifiers with the descriptor? This is tricky because we want to make it clear to the optimization passes which catch handlers invalidate other handlers. My current thoughts on a design for this is along the lines of: { { TypeDescriptor* TD, i32 QualifierFlags }, i32 MiscFlags } The idea is that the inner most aggregate is all that is needed to communicate that one catch handler might supercede another. The 'MiscFlags' field would be used to hold the bitpattern for the notion that the 'catch' handler does not need to invoke a copy-constructor because we are catching by reference. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@232318 91177308-0d34-0410-b5e6-96231b3b80d8
* Simplify.Joerg Sonnenberger2015-03-131-9/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@232130 91177308-0d34-0410-b5e6-96231b3b80d8
* [OPENMP] Rename methods of OpenMPRuntime class. NFC. Alexey Bataev2015-02-251-4/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@230470 91177308-0d34-0410-b5e6-96231b3b80d8
* CodeGen: Weak reference temporaries belong in a COMDATDavid Majnemer2015-02-191-0/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@229902 91177308-0d34-0410-b5e6-96231b3b80d8
* CodeGen: static constexpr data members should have a linkonce_odr initDavid Majnemer2015-02-191-4/+13
| | | | | | | | | Classes can be defined in multiple translation units. This means that the static constexpr data members should have identical initializers in all translation units. Implement this by giving the reference temporary linkonce_odr linkage. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@229900 91177308-0d34-0410-b5e6-96231b3b80d8
* Change representation of member function pointers for MIPS targetsZoran Jovanovic2015-02-181-0/+1
| | | | | | | Differential Revision: http://reviews.llvm.org/D7148 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@229680 91177308-0d34-0410-b5e6-96231b3b80d8