Commit Graph

276 Commits

Author SHA1 Message Date
Mikhail Glushenkov
bd6e0323b9 appendSuffix: don't append a dot when the suffix is empty.
Additionally, move the implementation of appendSuffix to Path.cpp: it is
platform-independent.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118089 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-02 22:18:37 +00:00
Mikhail Glushenkov
9cd5971228 Make FindProgramByName return paths with slashes unmodified on Windows.
This makes its behaviour more consistent across platforms.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118048 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-02 20:32:39 +00:00
Mikhail Glushenkov
0f2ec15b9e 80-col violations.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118045 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-02 20:32:31 +00:00
Mikhail Glushenkov
f5a95ce0d4 Path: Add GetEXESuffix() to complement GetDLLSuffix().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118042 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-02 20:32:26 +00:00
Dan Gohman
e5f77cda25 Make Program::Wait differentiate execution failure due to the file
being not found from the file being not executable. 


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117664 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-29 16:54:25 +00:00
Mikhail Glushenkov
6d8ac5ac6d Reindent.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117538 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-28 08:25:44 +00:00
Mikhail Glushenkov
401b90a4bc 80-col violation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117443 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-27 09:09:10 +00:00
Mikhail Glushenkov
11d03f690e Remove try/catch(...) from Win32/Signals.inc.
catch(...) is used in Win32/Signals.inc for catching Win32 structured
exceptions, but according to [1], this is wrong.

We can't simply change try/catch to __try/__finally, since this syntax is not
supported by MinGW. We can use __try/__finally on MSVC and __try1/__except1
macros on MinGW [2], but I think that that solution obfuscates the code too
much.

The use of try/catch(...) in Signals.inc makes it impossible to link
MinGW-compiled libSystem with llvm-gcc compiled executables. I propose that we
just remove try/catch(...) from Signals.inc, since the meaning of the code won't
change.

[1] http://members.cox.net/doug_web/eh.htm
[2] http://article.gmane.org/gmane.comp.compilers.llvm.cvs/81315

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117442 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-27 09:09:04 +00:00
Duncan Sands
05897c8f26 ATTRIBUTE_UNUSED has been renamed to LLVM_ATTRIBUTE_UNUSED.
Rather than rename this instance, use the cast-to-void idiom
instead.  This will hopefully fix the windows buildbots.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117262 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-25 13:10:03 +00:00
NAKAMURA Takumi
2172f3cd97 Win32/Signals.inc: DontRemoveFileOnSignal(): Please acquire the CriticalSection.
It choked BugPoint on Mingw.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117083 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-22 01:23:50 +00:00
Mikhail Glushenkov
84ba14f6d0 Trailing whitespace.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117058 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-21 20:40:39 +00:00
Michael J. Spencer
9f608b1919 Use C++03...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@116927 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-20 16:00:45 +00:00
Michael J. Spencer
a9cf7b8443 System-Win32/Path: Fix incorrect assumption in isValid.
A recent commit to clang exposed a bug in the Win32 Path code. This is a
minimal fix for it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@116925 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-20 15:23:58 +00:00
NAKAMURA Takumi
f10c519249 Add ATTRIBUTE_UNUSED for -Asserts.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@116909 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-20 04:05:29 +00:00
NAKAMURA Takumi
5c0db76cf2 lib/System/Win32/ThreadLocal.inc: Suppress "unused" warning on -Asserts.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@116785 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-19 01:22:01 +00:00
NAKAMURA Takumi
a8bbe707dc lib/System/Win32/Signals.inc: Enable LLVM_DISABLE_CRT_DEBUG also on mingw.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115731 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-06 02:15:22 +00:00
Francois Pichet
3eddd98be3 Revert r114320(move file = copy + delete on Win32). r115040 is a better solution for the Win32 ACCESS_DENIED lit error.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115114 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-30 00:44:58 +00:00
Francois Pichet
345adbe572 Fix the "unable to rename temporary" lit test failing on Windows. rename is now copy + delete on Windows. Problem to be revisited for a permanent and clean solution.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@114320 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-20 04:03:07 +00:00
NAKAMURA Takumi
4cec6e2103 Move the declaration SetInformationJobObject() outside of namespace.
It is also workaround for PR7927.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@114175 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-17 11:14:18 +00:00
Dan Gohman
41154114f6 Add an interface for unregistering a file from the FilesToRemove list.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112705 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-01 14:17:34 +00:00
Michael J. Spencer
1211d43abf System: Fix getMagicNumber on windows.
getMagicNumber was treating the _binary_ data it read in as a
null terminated string. This resulted in the std::string
calculating the length, and causing an assert in other code that
assumed that the length it passed was the same as the length of
the string it would get back.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112586 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-31 06:36:33 +00:00
Michael J. Spencer
44edb0bd0c Don't cast Win32 FILETIME structs to int64. Patch by Dimitry Andric!
According to the Microsoft documentation here:
http://msdn.microsoft.com/en-us/library/ms724284%28VS.85%29.aspx

this cast used in lib/System/Win32/Path.inc:

__int64 ft = *reinterpret_cast<__int64*>(&fi.ftLastWriteTime);

should not be done.  The documentation says: "Do not cast a pointer to a
FILETIME structure to either a ULARGE_INTEGER* or __int64* value because
it can cause alignment faults on 64-bit Windows."

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112376 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-28 16:39:32 +00:00
Owen Anderson
826c148aa5 Add an erase() method to llvm::ThreadLocal.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@109686 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-28 22:49:43 +00:00
Duncan Sands
3472766f9e Convert some tab stops into spaces.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108130 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-12 08:16:59 +00:00
Chris Lattner
a6c04ee4c8 Path::isRootDirectory is unimplemented on Unix and not used,
remove it, fixing PR6909.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108125 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-12 04:39:07 +00:00
Daniel Dunbar
fb89e08413 Add llvm::sys::RunInterruptHandlers(), which runs the registered SIGINT cleanup
stuff.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103333 91177308-0d34-0410-b5e6-96231b3b80d8
2010-05-08 02:10:34 +00:00
Torok Edwin
61633368cf AddSignalHandler was not releasing the critical section on win32.
Patch from Gianluigi Tiesi!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100003 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-31 12:07:16 +00:00
Anton Korobeynikov
81244298ea Properly quote the quotes :) during cmdline construction on Windows.
Otherwise, e.g. in the invocation like clang -DFOO=\"bar\" FOO macro
got the bar value, not "bar".

Patch by Alexander Esilevich!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99763 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-28 15:07:02 +00:00
Kovarththanan Rajaratnam
16ceb3aaf7 Remove superfluous NULL assignment
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98350 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-12 14:17:24 +00:00
Douglas Gregor
21569cddc1 Add llvm::Program::ChangeStderrToBinary().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94743 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-28 06:42:08 +00:00
Anton Korobeynikov
f4b6d88cda Remove spurious semicolon.
Patch by Diego Iastrubni!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93450 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-14 20:19:51 +00:00
Daniel Dunbar
1edcafe10f Fix Win32 Path.inc for API update.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91706 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-18 19:59:48 +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
Edward O'Callaghan
e49a8e4db9 API change Path::isSpecialFile to Path::isRegularFile, improve semantics in regards to comments from 89765 post review.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89848 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-25 06:32:19 +00:00
Edward O'Callaghan
d41e944501 Provide Path::isSpecialFile interface for PR5568.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89765 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-24 15:19:10 +00:00
Benjamin Kramer
e9684c682a Path::createDirectoryOnDisk should ignore existing directories on win32 too.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86132 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-05 14:32:40 +00:00
Chandler Carruth
8b67f774e9 Move DataTypes.h to include/llvm/System, update all users. This breaks the last
direct inclusion edge from System to Support.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85086 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-26 01:35:46 +00:00
Daniel Dunbar
43fa15b451 ... missed hiding a variable for MSVC only.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82552 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-22 16:10:35 +00:00
Daniel Dunbar
3be2d12bde Hide MSVC specific CRT interaction behind _MSC_VER.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82551 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-22 15:58:35 +00:00
Mikhail Glushenkov
92d32367ef Remove the GetProcessId() call from Win32/Program.inc, take 2.
GetProcessId() was introduced only in Windows XP, and we want to support earlier
versions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82548 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-22 15:40:32 +00:00
Daniel Dunbar
df3388492b Add a magic LLVM_DISABLE_CRT_DEBUG environment variable which we check in RegisterHandler and use to disable the Win32 crash dialogs. These are a major blocker to any kind of automated testing.
Also, tweak the 'lit' test runner to set this variable unconditionally.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82537 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-22 09:50:28 +00:00
Daniel Dunbar
57d6903dea Revert "Get rid of GetProcessId in Win32/Program.inc.", this breaks
ExecuteAndWait.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82522 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-22 04:44:56 +00:00
Mikhail Glushenkov
6db0e3a981 Get rid of GetProcessId in Win32/Program.inc.
GetProcessId was introduced only in XP. As a bonus, this change makes Program
objects copyable, since Program is now basically a PID.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81826 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-15 03:39:45 +00:00
Dan Gohman
ec080467f5 Fix llvm-extract's "writing bitcode to a terminal" warning, which wasn't
working. To support this, add an is_displayed() function to raw_ostream,
and generalize Process::StandardOutIsDisplayed and friends in order to
support it.

Also, call RemoveFileOnSignal before creating a file instead of after, so
that the file isn't left behind if the program is interrupted between when
the file is created and RemoveFileOnSignal is called.

While here, add a -S to llvm-extract and port it to IRReader so that it
supports assembly input.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81568 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-11 20:46:33 +00:00
Mikhail Glushenkov
8add26934a Check that the 'kill' call succeeded.
Thanks to Duncan Sands for spotting this.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81328 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-09 09:51:47 +00:00
Mikhail Glushenkov
c22675b542 Const-correctness.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81249 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-08 19:51:39 +00:00
Mikhail Glushenkov
edf8e48c21 Get rid of the Pid_ member in the Program class.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81247 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-08 19:50:55 +00:00
Mikhail Glushenkov
a607202a68 Add a Kill() function to the Program class.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81246 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-08 19:50:27 +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
Chris Lattner
a79eefd4f8 improve win32 path support, patch by Baptiste Lepilleur!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78823 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-12 17:47:06 +00:00