Commit Graph

52 Commits

Author SHA1 Message Date
Michael J. Spencer
7e7d01de9c System/Path: Add x86-64 COFF to IdentifyFileType.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@114037 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-15 23:04:14 +00:00
Michael J. Spencer
8a26f81889 System/Path: Add isObjectFile().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@114032 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-15 22:45:45 +00:00
Michael J. Spencer
4a295d301d Cleanup Whitespace.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112587 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-31 06:36:46 +00:00
Dan Gohman
130de9c0b4 Don't bother checking canRead() before calling getMagicNumber();
getMagicNumber() does its own error checking.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104851 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-27 17:12:23 +00:00
Jeffrey Yasskin
88cd3582b6 Make Path use StringRef instead of std::string where possible.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91620 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-17 21:02:39 +00:00
Chandler Carruth
18ad485bf5 Remove unused includes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85074 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-25 22:38:41 +00:00
Chris Lattner
74382b7c69 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.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79869 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-23 22:45:37 +00:00
Daniel Dunbar
a00e85c9b1 Improve sys::Path::makeAbsolute on Win32.
- Patch by Viktor Kutuzov!

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75424 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-12 20:23:56 +00:00
Torok Edwin
4cdc44c82c 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.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70038 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-25 10:25:12 +00:00
Daniel Dunbar
6ddf2c1930 Add sys::Path::makeAbsolute().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68663 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-09 00:33:08 +00:00
Devang Patel
54ce536a2d Handle bitcode wrappers.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53924 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-22 18:00:36 +00:00
Chris Lattner
6fa6a32e4e 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53275 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-09 05:14:23 +00:00
Bill Wendling
fc1fd54a34 Cleanup for unitialized types. Patch by Jean-Daniel Dupas!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52775 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-26 08:32:05 +00:00
Chris Lattner
6521549188 "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!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52766 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-26 05:17:18 +00:00
Argyrios Kyrtzidis
fc19988bcb Fix the sys::Path::getSuffix() implementation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52288 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-15 15:15:19 +00:00
Bill Wendling
40db5d4539 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51393 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-21 21:20:07 +00:00
Evan Cheng
34cd4a484e Fix more -Wshorten-64-to-32 warnings.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50659 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-05 18:30:58 +00:00
Ted Kremenek
9b01cc0ede Make getDirnameSep a static method (not part of Path's interface).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49354 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-07 22:01:32 +00:00
Ted Kremenek
cf55c8e221 Added method Path::getDirname().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49352 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-07 21:53:57 +00:00
Chris Lattner
e1b332a304 Add path separator support, patch by Sam Bishop.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47662 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-27 06:17:10 +00:00
Anton Korobeynikov
e18bc08fbc Add convenient helper to get suffix of the file
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47397 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-20 19:41:22 +00:00
Duncan Sands
f52e32aab0 Fix compile failures with g++-4.3.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45781 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-09 19:42:09 +00:00
Chris Lattner
4ee451de36 Remove attribution from file headers, per discussion on llvmdev.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45418 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-29 20:36:04 +00:00
Chris Lattner
ef361a638a remove obviously dead uses of IncludeFile.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45165 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-18 19:15:48 +00:00
Gabor Greif
e75ca3d809 eliminate residual cruft related to recognizing bytecode
files.
bitcode files are the only LLVM format left.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37945 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-06 13:38:17 +00:00
Chris Lattner
f283a5e53a pull some win32 code into common code, add bitcode identification support.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36846 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-06 05:32:21 +00:00
Chris Lattner
24eac6cb00 silence annoying gcc 4.3 warnings
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36681 91177308-0d34-0410-b5e6-96231b3b80d8
2007-05-03 18:15:56 +00:00
Chris Lattner
ade7592085 Hack to get sys::Path to recognize macho dylibs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35878 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-11 03:15:35 +00:00
Reid Spencer
947aa7de67 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35876 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-11 02:02:09 +00:00
Reid Spencer
410aa020a2 Make isDynamicLibrary detect more than just an ELF file.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35874 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-11 00:49:39 +00:00
Reid Spencer
8bb5fd17f9 For PR1302:
Implement recognition of COFF, ELF and Mach-O object/shared lib files.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35650 91177308-0d34-0410-b5e6-96231b3b80d8
2007-04-04 06:30:26 +00:00
Reid Spencer
23dd3327a0 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29288 91177308-0d34-0410-b5e6-96231b3b80d8
2006-07-26 16:55:39 +00:00
Chris Lattner
c67dc457ce Move << method out of line.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29062 91177308-0d34-0410-b5e6-96231b3b80d8
2006-07-07 18:11:32 +00:00
Reid Spencer
dd04df0ec3 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22349 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-07 23:21:43 +00:00
Reid Spencer
c7f083297c For PR495:
Change interface to Path class:
readable -> canRead
writable -> canWrite
executable -> canExecute

More (incremental) changes coming to close 495.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22345 91177308-0d34-0410-b5e6-96231b3b80d8
2005-07-07 18:21:42 +00:00
Misha Brukman
6b8a63ae58 Remove vim settings from source code; people should use llvm/utils/vim/vimrc
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21704 91177308-0d34-0410-b5e6-96231b3b80d8
2005-05-05 22:33:09 +00:00
Misha Brukman
f976c856fc Remove trailing whitespace
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21422 91177308-0d34-0410-b5e6-96231b3b80d8
2005-04-21 22:55:34 +00:00
Reid Spencer
bccc8abc79 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})


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19426 91177308-0d34-0410-b5e6-96231b3b80d8
2005-01-09 23:29:00 +00:00
Reid Spencer
dafe55f64b For PR351:
Use the LLVM_ON_UNIX and LLVM_ON_WIN32 #defines to include the implementation
instead of relying upon the "platform" link


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19132 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-24 06:29:17 +00:00
Jeff Cohen
ab68df02bc Fix VC++ compilation errors
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18953 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-15 04:08:15 +00:00
Reid Spencer
c29befb554 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18947 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-15 01:50:13 +00:00
Reid Spencer
79fc924957 Genericize implementation of GetDLLSuffix now that we have LTDL_SHLIB_EXT
available.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18904 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-13 18:41:28 +00:00
Reid Spencer
ccb23a13e9 For PR351: \
* Move generic isArchive method here from Unix/Path.cpp \
* Implement isDynamicLibrary \
* Implement FindLibrary for Linker


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18861 91177308-0d34-0410-b5e6-96231b3b80d8
2004-12-13 03:00:39 +00:00
Reid Spencer
a2a62210f2 Make sure IdentifyFileType is in the sys namespace.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17806 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-14 23:26:18 +00:00
Alkis Evlogimenos
98bc8ed49b Add missing include.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17799 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-14 22:37:42 +00:00
Reid Spencer
f37ce99c0a Implement IdentifyFileType function
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17776 91177308-0d34-0410-b5e6-96231b3b80d8
2004-11-14 22:05:32 +00:00
Reid Spencer
cbad701d0b Provide initial implementations of Memory and Process concepts for various
platforms.
Implement GetLLVMSuffix function for the Path concept.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16292 91177308-0d34-0410-b5e6-96231b3b80d8
2004-09-11 04:59:30 +00:00
Reid Spencer
36853b99a1 Correct the vim: specification
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16087 91177308-0d34-0410-b5e6-96231b3b80d8
2004-08-29 19:24:53 +00:00
Reid Spencer
8e66595512 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16078 91177308-0d34-0410-b5e6-96231b3b80d8
2004-08-29 05:24:01 +00:00
Reid Spencer
b89a2237ea Initial implementation of the Path operating system concept.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16048 91177308-0d34-0410-b5e6-96231b3b80d8
2004-08-25 06:20:07 +00:00