Commit Graph

49 Commits

Author SHA1 Message Date
Dan Gohman 16f4bd8140 Don't bother checking canRead() before calling getMagicNumber();
getMagicNumber() does its own error checking.

llvm-svn: 104851
2010-05-27 17:12:23 +00:00
Jeffrey Yasskin 5908f1e27b Make Path use StringRef instead of std::string where possible.
llvm-svn: 91620
2009-12-17 21:02:39 +00:00
Chandler Carruth 083524ae5c Remove unused includes.
llvm-svn: 85074
2009-10-25 22:38:41 +00:00
Chris Lattner c521f54198 Prune #includes from llvm/Linker.h and llvm/System/Path.h,
forcing them down into various .cpp files.

This change also:
1. Renames TimeValue::toString() and Path::toString() to ::str()
   for similarity with the STL.
2. Removes all stream insertion support for sys::Path, forcing
   clients to call .str().
3. Removes a use of Config/alloca.h from bugpoint, using smallvector
   instead.
4. Weans llvm-db off <iostream>

sys::Path really needs to be gutted, but I don't have the desire to
do it at this point.

llvm-svn: 79869
2009-08-23 22:45:37 +00:00
Daniel Dunbar df555fd6f8 Improve sys::Path::makeAbsolute on Win32.
- Patch by Viktor Kutuzov!

 - Minor tweak by me to add llvm_unreachable calls on FIXMEd error paths.

llvm-svn: 75424
2009-07-12 20:23:56 +00:00
Torok Edwin c8afb09a3b Fix g++-4.4.0 warning, it was causing llvm-nm to fail on wrapped BC files:
Path.cpp:59: warning: case label value exceeds maximum value for type
magic[0] is a (signed) char, but some case values are unsigned (e.g. 0xde).
When magic[0] was 0xde, the switch has taken the default branch instead of case
0xde branch.
Apparently this was the behaviour with older versions of gcc too, but not with g++.
Now g++-4.4 behaves as gcc, and ignores unsigned case values out of range signed
range.

llvm-svn: 70038
2009-04-25 10:25:12 +00:00
Daniel Dunbar 3f48987069 Add sys::Path::makeAbsolute().
llvm-svn: 68663
2009-04-09 00:33:08 +00:00
Devang Patel bd06440440 Handle bitcode wrappers.
llvm-svn: 53924
2008-07-22 18:00:36 +00:00
Chris Lattner a660f4bb07 Add a little wrapper header that is put around bc files when emitting
bc files for modules with a target triple that indicates they are for
darwin.  The reader unconditionally handles this, and the writer could
turn this on for more targets if we care.

This change has two benefits for darwin:

1) it allows us to encode the cpu type of the file in an easy to read
   place that doesn't require decoding the bc file.
2) it works around a bug (IMO) in darwin's AR where it is incapable of
   handling files that are not a multiple of 8 bytes long.  BC files
   are only guaranteed to be multiples of 4 bytes long.

llvm-svn: 53275
2008-07-09 05:14:23 +00:00
Bill Wendling 3fdca23ee1 Cleanup for unitialized types. Patch by Jean-Daniel Dupas!
llvm-svn: 52775
2008-06-26 08:32:05 +00:00
Chris Lattner d4741e803f "An improved Mach-O file type detection for sys::IdentifyFileType()
This patch add supports for single architecture mach-o files (the current implementation only support Universal Binary), and solve the signature conflict between java class and Universal Binary magics.

Note that this function will always returned dynamic library for Universal Binaries (like the current implementation) because the binary type is not include in the file header."

Patch by Jean-Daniel Dupas!

llvm-svn: 52766
2008-06-26 05:17:18 +00:00
Argyrios Kyrtzidis 2cc0abf260 Fix the sys::Path::getSuffix() implementation.
llvm-svn: 52288
2008-06-15 15:15:19 +00:00
Bill Wendling 89c2e3babb Follow-up to the reverting of r51218. This puts the checks out-of-line. Because
they aren't in the header file, systems with a <string> header file that isn't
64-bit clean shouldn't warn if #including Path.h and specifying
-Wshorten-64-to-32.

llvm-svn: 51393
2008-05-21 21:20:07 +00:00
Evan Cheng 86cb31862f Fix more -Wshorten-64-to-32 warnings.
llvm-svn: 50659
2008-05-05 18:30:58 +00:00
Ted Kremenek a518bb79b1 Make getDirnameSep a static method (not part of Path's interface).
llvm-svn: 49354
2008-04-07 22:01:32 +00:00
Ted Kremenek c042bf1db5 Added method Path::getDirname().
llvm-svn: 49352
2008-04-07 21:53:57 +00:00
Chris Lattner 6fca938971 Add path separator support, patch by Sam Bishop.
llvm-svn: 47662
2008-02-27 06:17:10 +00:00
Anton Korobeynikov 1872ad9888 Add convenient helper to get suffix of the file
llvm-svn: 47397
2008-02-20 19:41:22 +00:00
Duncan Sands 48f22f0b80 Fix compile failures with g++-4.3.
llvm-svn: 45781
2008-01-09 19:42:09 +00:00
Chris Lattner f3ebc3f3d2 Remove attribution from file headers, per discussion on llvmdev.
llvm-svn: 45418
2007-12-29 20:36:04 +00:00
Chris Lattner 5f47cae3ce remove obviously dead uses of IncludeFile.
llvm-svn: 45165
2007-12-18 19:15:48 +00:00
Gabor Greif 3d3fc3296e eliminate residual cruft related to recognizing bytecode
files.
bitcode files are the only LLVM format left.

llvm-svn: 37945
2007-07-06 13:38:17 +00:00
Chris Lattner 4a4499b69e pull some win32 code into common code, add bitcode identification support.
llvm-svn: 36846
2007-05-06 05:32:21 +00:00
Chris Lattner 7de1ebae4a silence annoying gcc 4.3 warnings
llvm-svn: 36681
2007-05-03 18:15:56 +00:00
Chris Lattner 098ea183b8 Hack to get sys::Path to recognize macho dylibs.
llvm-svn: 35878
2007-04-11 03:15:35 +00:00
Reid Spencer d3f622e0d5 Teach sys::Path how to recognize different kinds of object files for ELF
and Mach-O systems. Additionally, correct the Mach-O logic code to look at
byte 12 not byte 15. Hopefully this fixes the llvm-ld warning on Darwin.

llvm-svn: 35876
2007-04-11 02:02:09 +00:00
Reid Spencer ccd4d2c8e4 Make isDynamicLibrary detect more than just an ELF file.
llvm-svn: 35874
2007-04-11 00:49:39 +00:00
Reid Spencer 4ef4c46c35 For PR1302:
Implement recognition of COFF, ELF and Mach-O object/shared lib files.

llvm-svn: 35650
2007-04-04 06:30:26 +00:00
Reid Spencer 082e2a7821 For PR780:
Put the rest of lib/System into LinkAllVMCore.h. This makes all of
lib/System available to programs that #include LinkALlVMCore.h so that
loadable modules linked into those programs can depend on all of lib/System
being available.

llvm-svn: 29288
2006-07-26 16:55:39 +00:00
Chris Lattner 9d9cd793a9 Move << method out of line.
llvm-svn: 29062
2006-07-07 18:11:32 +00:00
Reid Spencer c9c0473fa5 For PR495:
Get rid of the difference between file paths and directory paths. The Path
class now simply stores a path that can refer to either a file or a
directory. This required various changes in the implementation and interface
of the class with the corresponding impact to its users. Doxygen comments were
also updated to reflect these changes. Interface changes are:

appendDirectory -> appendComponent
appendFile -> appendComponent
elideDirectory -> eraseComponent
elideFile -> eraseComponent
elideSuffix -> eraseSuffix
renameFile -> rename
setDirectory -> set
setFile -> set

Changes pass Dejagnu and llvm-test/SingleSource tests.

llvm-svn: 22349
2005-07-07 23:21:43 +00:00
Reid Spencer 5b891e9847 For PR495:
Change interface to Path class:
readable -> canRead
writable -> canWrite
executable -> canExecute

More (incremental) changes coming to close 495.

llvm-svn: 22345
2005-07-07 18:21:42 +00:00
Misha Brukman 291f6b7223 Remove vim settings from source code; people should use llvm/utils/vim/vimrc
llvm-svn: 21704
2005-05-05 22:33:09 +00:00
Misha Brukman 10468d8a3c Remove trailing whitespace
llvm-svn: 21422
2005-04-21 22:55:34 +00:00
Reid Spencer c892a0db9f Rename Unix/*.cpp and Win32/*.cpp to have a *.inc suffix so that the silly
gdb debugger doesn't get confused on which file it is reading (the one in
lib/System or the one in lib/System/{Win32,Unix})

llvm-svn: 19426
2005-01-09 23:29:00 +00:00
Reid Spencer 328ee53573 For PR351:
Use the LLVM_ON_UNIX and LLVM_ON_WIN32 #defines to include the implementation
instead of relying upon the "platform" link

llvm-svn: 19132
2004-12-24 06:29:17 +00:00
Jeff Cohen e408341854 Fix VC++ compilation errors
llvm-svn: 18953
2004-12-15 04:08:15 +00:00
Reid Spencer f66d93239e For PR351:
* Fix implementation and documentation about LLVMGCCDIR/bytecode-libs
* Add the makeUnique method, replacement for getUniqueFilename in Support.
* Add the sys::CopyFile function, replacement for CopyFile in Support.
* Move GetLLVMConfigDir() into generic code area since its generic.

llvm-svn: 18947
2004-12-15 01:50:13 +00:00
Reid Spencer e05ab4a1ec Genericize implementation of GetDLLSuffix now that we have LTDL_SHLIB_EXT
available.

llvm-svn: 18904
2004-12-13 18:41:28 +00:00
Reid Spencer 66b8182866 For PR351: \
* Move generic isArchive method here from Unix/Path.cpp \
* Implement isDynamicLibrary \
* Implement FindLibrary for Linker

llvm-svn: 18861
2004-12-13 03:00:39 +00:00
Reid Spencer 6881623775 Make sure IdentifyFileType is in the sys namespace.
llvm-svn: 17806
2004-11-14 23:26:18 +00:00
Alkis Evlogimenos 55117fa471 Add missing include.
llvm-svn: 17799
2004-11-14 22:37:42 +00:00
Reid Spencer 0d0d07e0f0 Implement IdentifyFileType function
llvm-svn: 17776
2004-11-14 22:05:32 +00:00
Reid Spencer 566ac28f35 Provide initial implementations of Memory and Process concepts for various
platforms.
Implement GetLLVMSuffix function for the Path concept.

llvm-svn: 16292
2004-09-11 04:59:30 +00:00
Reid Spencer bb5301eebf Correct the vim: specification
llvm-svn: 16087
2004-08-29 19:24:53 +00:00
Reid Spencer 6df221d50a Revise the design of the Path concept per peer review. Too many changes to
note individually but these essence of it is to not derive from
std::string, clarify the interface, and provide better documentation.
There is now also (untested) implementations for AIX, Darwin, and SunOS.

llvm-svn: 16078
2004-08-29 05:24:01 +00:00
Reid Spencer 814ba578ba Initial implementation of the Path operating system concept.
llvm-svn: 16048
2004-08-25 06:20:07 +00:00
Reid Spencer bd2642e7e8 Remove lib/System contents until a satisfactory solution can be
provided.

llvm-svn: 15816
2004-08-16 07:08:38 +00:00
Reid Spencer bc51b928d6 Initial implementations of the ErrorCode and Path concepts for Linux.
llvm-svn: 15763
2004-08-15 08:14:33 +00:00