aboutsummaryrefslogtreecommitdiff
path: root/llvm/unittests/Linker/LinkModulesTest.cpp
AgeCommit message (Collapse)AuthorFilesLines
2016-02-12Delete the deprecated LLVMLinkModules.Rafael Espindola1-24/+0
llvm-svn: 260683
2015-12-18Reorganize the C API headers to improve build times.Eric Christopher1-0/+1
Type specific declarations have been moved to Type.h and error handling routines have been moved to ErrorHandling.h. Both are included in Core.h so nothing should change for projects directly including the headers, but transitive dependencies may be affected. llvm-svn: 255965
2015-12-16Change linkInModule to take a std::unique_ptr.Rafael Espindola1-8/+36
Passing in a std::unique_ptr should help find errors when the module is used after being linked into another module. llvm-svn: 255842
2015-12-14Use diagnostic handler in the LLVMContextRafael Espindola1-6/+13
This patch converts code that has access to a LLVMContext to not take a diagnostic handler. This has a few advantages * It is easier to use a consistent diagnostic handler in a single program. * Less clutter since we are not passing a handler around. It does make it a bit awkward to implement some C APIs that return a diagnostic string. I will propose new versions of these APIs and deprecate the current ones. llvm-svn: 255571
2015-12-04Always pass a diagnostic handler to the linker.Rafael Espindola1-3/+5
Before this patch the diagnostic handler was optional. If it was not passed, the one in the LLVMContext was used. That is probably not a pattern we want to follow. If each area has an optional callback, there is a sea of callbacks and it is hard to follow which one is called. Doing this also found cases where the callback is a nice addition, like testing that no errors or warnings are reported. The other option is to always use the diagnostic handler in the LLVMContext. That has a few problems * To implement the C API we would have to set the diag handler and then set it back to the original value. * Code that creates the context might be far away from code that wants the diagnostics. I do have a patch that implements the second option and will send that as an RFC. llvm-svn: 254777
2015-12-01Use references now that it is natural to do so.Rafael Espindola1-6/+5
The linker never takes ownership of a module or changes which module it is refering to, making it natural to use references. llvm-svn: 254449
2015-10-20unittests: Remove implicit ilist iterator conversions, NFCDuncan P. N. Exon Smith1-1/+1
llvm-svn: 250843
2015-08-03Linker: Move distinct MDNodes instead of cloningDuncan P. N. Exon Smith1-0/+74
Instead of cloning distinct `MDNode`s when linking in a module, just move them over. The module linker destroys the source module, so the old node would otherwise just be leaked on the context. Create the new node in place. This also reduces the number of cloned uniqued nodes (since it's less likely their operands have changed). This mapping strategy is only correct when we're discarding the source, so the linker turns it on via a ValueMapper flag, `RF_MoveDistinctMDs`. There's nothing observable in terms of `llvm-link` output here: the linked module should be semantically identical. I'll be adding more 'distinct' nodes to the debug info metadata graph in order to break uniquing cycles, so the benefits of this will partly come in future commits. However, we should get some gains immediately, since we have a fair number of 'distinct' `DILocation`s being linked in. llvm-svn: 243883
2015-06-15[LinkerTest] Use LLVMDisposeMessage to free error string.Benjamin Kramer1-1/+1
LLVMDisposeMessage is just a thing wrapper around free at the moment, but it's the proper API to use here. llvm-svn: 239731
2015-06-13[LinkerTest] Don't leak error string.Benjamin Kramer1-0/+1
llvm-svn: 239673
2015-06-12Fix returning error message in LLVMLinkModulesEli Bendersky1-0/+40
On error, the temporary output stream wouldn't be flushed and therefore the caller would see an empty error message. Patch by Antoine Pitrou Differential Revision: http://reviews.llvm.org/D10241 llvm-svn: 239646
2015-04-11Use 'override/final' instead of 'virtual' for overridden methodsAlexander Kornienko1-2/+2
The patch is generated using clang-tidy misc-use-override check. This command was used: tools/clang/tools/extra/clang-tidy/tool/run-clang-tidy.py \ -checks='-*,misc-use-override' -header-filter='llvm|clang' \ -j=32 -fix -format http://reviews.llvm.org/D8925 llvm-svn: 234679
2015-03-24Opaque Pointer Types: GEP API migrations to specify the gep type explicitlyDavid Blaikie1-2/+3
The changes to InstCombine (& SCEV) do seem a bit silly - it doesn't make anything obviously better to have the caller access the pointers element type (the thing I'm trying to remove) than the GEP itself, but it's a helpful migration step. This will allow me to more obviously lock down GEP (& Load, etc) API usage, then fix all the code that accesses pointer element types except the places that need to be removed (most of the InstCombines) anyway - at which point I'll need to just remove all that code because it won't be meaningful anymore (there will be no pointer types, so no bitcasts to combine) SCEV looks like it'll need some restructuring - we'll have to do a bit more work for GEP canonicalization, since it'll depend on how it's used if we can even manage to canonicalize it to a non-ugly GEP. I guess we can do some fun stuff like voting (do 2 out of 3 load from the GEP with a certain type that gives a pretty GEP? Does every typed use of the GEP use either a specific type or a generic type (i8*, etc)?) llvm-svn: 233131
2015-01-14[cleanup] Re-sort all the #include lines in LLVM usingChandler Carruth1-1/+1
utils/sort_includes.py. I clearly haven't done this in a while, so more changed than usual. This even uncovered a missing include from the InstrProf library that I've added. No functionality changed here, just mechanical cleanup of the include order. llvm-svn: 225974
2014-11-17Factor common code it Linker::init.Rafael Espindola1-0/+20
The TypeFinder was not being used in one of the constructors. llvm-svn: 222172
2014-10-28Remove the PreserveSource linker mode.Rafael Espindola1-11/+15
I noticed that it was untested, and forcing it on caused some tests to fail: LLVM :: Linker/metadata-a.ll LLVM :: Linker/prefixdata.ll LLVM :: Linker/type-unique-odr-a.ll LLVM :: Linker/type-unique-simple-a.ll LLVM :: Linker/type-unique-simple2-a.ll LLVM :: Linker/type-unique-simple2.ll LLVM :: Linker/type-unique-type-array-a.ll LLVM :: Linker/unnamed-addr1-a.ll LLVM :: Linker/visibility1.ll If it is to be resurrected, it has to be fixed and we should probably have a -preserve-source command line option in llvm-mc and run tests with and without it. llvm-svn: 220741
2014-10-25Update the error handling of lib/Linker.Rafael Espindola1-3/+3
Instead of passing a std::string&, use the new diagnostic infrastructure. llvm-svn: 220608
2014-06-08[C++11] Use 'nullptr'.Craig Topper1-5/+5
llvm-svn: 210442
2014-04-29LinkModulesTest.cpp: Reformat.NAKAMURA Takumi1-20/+13
llvm-svn: 207537
2014-04-29LinkModulesTest.cpp: Use test-specific Ctx instead of getGlobalContext(). ↵NAKAMURA Takumi1-4/+2
The global context might not be free'd. [vg_leak] llvm-svn: 207535
2014-03-06Replace OwningPtr<T> with std::unique_ptr<T>.Ahmed Charles1-1/+1
This compiles with no changes to clang/lld/lldb with MSVC and includes overloads to various functions which are used by those projects and llvm which have OwningPtr's as parameters. This should allow out of tree projects some time to move. There are also no changes to libs/Target, which should help out of tree targets have time to move, if necessary. llvm-svn: 203083
2014-03-06[Layering] Sink Linker.h into a Linker subdirectory to make itChandler Carruth1-1/+1
consistent with every other sub-library header in LLVM. llvm-svn: 203065
2014-03-04[cleanup] Re-sort all the includes with utils/sort_includes.py.Chandler Carruth1-1/+1
llvm-svn: 202811
2014-01-16Reapply r194218 with fix:Bill Wendling1-0/+165
Move copying of global initializers below the cloning of functions. The BlockAddress doesn't have access to the correct basic blocks until the functions have been cloned. This causes the BlockAddress to point to the old values. Just wait until the functions have been cloned before copying the initializers. PR13163 llvm-svn: 199354
2013-11-09Revert "Move copying of global initializers below the cloning of functions."Adrian Prantl1-131/+0
This would cause internal symbols that are only referenced by global initializers to be removed. This reverts commit 194219. llvm-svn: 194304
2013-11-09Revert "Run clang-format on file."Adrian Prantl1-9/+14
This reverts commit 194219. llvm-svn: 194303
2013-11-07Run clang-format on file.Bill Wendling1-14/+9
llvm-svn: 194219
2013-11-07Move copying of global initializers below the cloning of functions.Bill Wendling1-0/+131
The BlockAddress doesn't have access to the correct basic blocks until the functions have been cloned. This causes the BlockAddress to point to the old values. Just wait until the functions have been cloned before copying the initializers. PR13163 llvm-svn: 194218