Commit Graph

2467 Commits

Author SHA1 Message Date
Rui Ueyama 829c4392e1 Recognize 0x0000 as a COFF file magic.
Summary:
Some machine-type-neutral object files containing only undefined symbols
actually do exist in the Windows standard library. Need to recognize them
as COFF files.

Reviewers: Bigcheese

CC: llvm-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D2164

llvm-svn: 194734
2013-11-14 22:09:08 +00:00
NAKAMURA Takumi 5b94d28141 yaml::Input::mapTag(): Don't use StringRef to hold return type of std::string.
llvm-svn: 194681
2013-11-14 07:08:56 +00:00
NAKAMURA Takumi 9439c528fe Whitespace.
llvm-svn: 194680
2013-11-14 07:08:49 +00:00
Nick Kledzik dd34f77cbd Add dyn_cast<> support to YAML I/O's IO class
llvm-svn: 194655
2013-11-14 02:38:07 +00:00
Nick Kledzik 1e6033ca33 Add simple support for tags in YAML I/O
llvm-svn: 194644
2013-11-14 00:59:59 +00:00
Benjamin Kramer 505d2408a1 Make sure LLVMLoadLibraryPermanently gets an extern "C" symbol.
Otherwise it's impossible to use it. Also don't include C++ headers in
a C header.

llvm-svn: 194581
2013-11-13 15:35:13 +00:00
Peter Zotov 62fdeb8e3b Add newline at EOF in DynamicLibrary.cpp
llvm-svn: 194144
2013-11-06 11:12:46 +00:00
Peter Zotov 671fe2ee58 [llvm-c] Specify explicit namespace in LLVMLoadLibraryPermanently
Presence of using namespace llvm depended on several #ifdef's, and
this broke the build on mswin32.

llvm-svn: 194142
2013-11-06 09:45:58 +00:00
Peter Zotov 34ddbf1a7e [llvm-c] Expose LLVMLoadLibraryPermanently
Original patch by Chris Wailes

llvm-svn: 194139
2013-11-06 09:21:31 +00:00
Benjamin Kramer d114def3d6 X86: Add a description for AMD bdver3 aka Steamroller.
This is just bdver2 + FSGSBase.

llvm-svn: 193984
2013-11-04 10:29:20 +00:00
Filip Pizlo c10ca90324 Make the pretty stack trace be an opt-in, rather than opt-out, facility. Enable pretty
stack traces by default if you use PrettyStackTraceProgram, so that existing LLVM-based 
tools will continue to get it without any changes.

llvm-svn: 193971
2013-11-04 02:22:25 +00:00
Filip Pizlo 9f50ccd1a3 When LLVM is embedded in a larger application, it's not OK for LLVM to intercept crashes. LLVM already has
the ability to disable this functionality.  This patch exposes it via the C API.

llvm-svn: 193937
2013-11-03 00:29:47 +00:00
Nuno Lopes 14d4b0cdb2 [ConstantRange] improve my previous patch per Nick suggestion
llvm-svn: 193795
2013-10-31 19:53:53 +00:00
Rafael Espindola aca9739a1a Rules adjustments in order to build on DragonFly BSD.
Patch by Robin Hahling.

llvm-svn: 193750
2013-10-31 14:35:00 +00:00
Richard Sandiford f834ea19db [SystemZ] Automatically detect zEC12 and z196 hosts
As on other hosts, the CPU identification instruction is priveleged,
so we need to look through /proc/cpuinfo.  I copied the PowerPC way of
handling "generic".

Several tests were implicitly assuming z10 and so failed on z196.

llvm-svn: 193742
2013-10-31 12:14:17 +00:00
Rui Ueyama 00e24e48b6 Add {start,end}with_lower methods to StringRef.
startswith_lower is ocassionally useful and I think worth adding.
endwith_lower is added for completeness.

Differential Revision: http://llvm-reviews.chandlerc.com/D2041

llvm-svn: 193706
2013-10-30 18:32:26 +00:00
Nuno Lopes 1112eca0af make ConstantRange::signExtend() optimal
the case [x, INT_MIN) was not handled optimally

llvm-svn: 193694
2013-10-30 15:36:50 +00:00
Nuno Lopes 8a24152048 simplify ConstantRange::getSetSize()
llvm-svn: 193523
2013-10-28 16:52:38 +00:00
Rafael Espindola 1d19c8f03a Change MemoryBuffer::getFile to take a Twine.
llvm-svn: 193429
2013-10-25 19:06:52 +00:00
John Thompson 6cd5bd4a3d Reverting my r193344 checkin due to build breakage.
llvm-svn: 193350
2013-10-24 14:52:56 +00:00
John Thompson e38e57206f Added std::string as a built-in type for mapping.
llvm-svn: 193344
2013-10-24 13:36:58 +00:00
Alp Toker acf49f31b6 Fix the -Werror -Wpedantic clang selfhost build
This is a stopgap fix for cast warnings introduced in r192864.

A proper fix should be investigated by the author when possible.

llvm-svn: 193160
2013-10-22 12:30:55 +00:00
Michael J. Spencer e71f0475df Can we move to C++11 already?
llvm-svn: 193007
2013-10-18 23:07:01 +00:00
Michael J. Spencer c064a9abff [Support][YAML] Add support for accessing tags and tag handle substitution.
llvm-svn: 193004
2013-10-18 22:38:04 +00:00
Alp Toker 42235db0e9 Fix a conversion warning in the mingw32 build
gcc diagnoses this:
  warning: converting to non-pointer type 'unsigned int' from NULL

Also remove an empty statement.

No change in functionality.

llvm-svn: 192955
2013-10-18 07:53:25 +00:00
Alp Toker 153675b718 Fix initialization order warning in mingw32 build
No change in functionality.

llvm-svn: 192953
2013-10-18 07:09:58 +00:00
Filip Pizlo a535b14157 Expose install_fatal_error_handler() through the C API.
I expose the API with some caveats:

- The C++ API involves a traditional void* opaque pointer for the fatal 
error callback.  The C API doesn’t do this.  I don’t think that the void* 
opaque pointer makes any sense since this is a global callback - there will 
only be one of them.  So if you need to pass some data to your callback, 
just put it in a global variable.

- The bindings will ignore the gen_crash_diag boolean.  I ignore it because 
(1) I don’t know what it does, (2) it’s not documented AFAIK, and (3) I 
couldn’t imagine any use for it.  I made the gut call that it probably 
wasn’t important enough to expose through the C API.

llvm-svn: 192864
2013-10-17 01:38:28 +00:00
Rui Ueyama 50a86e125a Fix a bug in Windows resource file detection.
The magic bytes should not include the trailing NUL byte.

llvm-svn: 192769
2013-10-16 03:29:49 +00:00
Rui Ueyama fc149a69cf Path: Recognize Windows compiled resource file.
Some background: One can pass compiled resource files (.res files) directly
to the linker on Windows. If a resource file is given, the linker will run
"cvtres" command in background to convert the resource file to a COFF file
to link it.

What I'm trying to do with this patch is to make the linker to recognize
the resource file by file magic, so that it can run cvtres command.

Differential Revision: http://llvm-reviews.chandlerc.com/D1943

llvm-svn: 192742
2013-10-15 22:45:38 +00:00
David Majnemer 93fdc3fabf Windows: Fix a typo in an assert
llvm-svn: 192564
2013-10-14 01:17:32 +00:00
David Majnemer 7af18578f8 Windows: Don't bother with pinning Kernel32.dll
We don't delay load it so it shouldn't be going anywhere.

llvm-svn: 192561
2013-10-14 00:06:58 +00:00
David Majnemer a5732844a6 Windows: Use GetModuleHandleEx instead of LoadLibrary
We were using an anti-pattern of:
 - LoadLibrary
 - GetProcAddress
 - FreeLibrary

This is problematic because of several reasons:
 - We are holding on to pointers into a library we just unloaded.
 - Calling LoadLibrary results in an increase in the reference count of
   the library in question and any libraries that it depends on and
   so-on and so-forth.  This is none too quick.

Instead, use GetModuleHandleEx with GET_MODULE_HANDLE_EX_FLAG_PIN.  This
is done because because we didn't bring the reference for the library
into existence and therefor shouldn't count on it being around later.

llvm-svn: 192550
2013-10-13 10:34:21 +00:00
Will Dietz 981af0021b Add missing #include's to cctype when using isdigit/alpha/etc.
llvm-svn: 192519
2013-10-12 00:55:57 +00:00
Rafael Espindola 9ab9fe91fb Fix build on Solaris 11.
Patch by Vladimir Voskresensky. The erros were:

Path.inc:274:3: error: ‘Dl_info’ was not declared in this scope
...

and

usr/include/spawn.h:52:14: error: expected ‘,’ or ‘...’ before ‘argv’

llvm-svn: 192185
2013-10-08 16:12:58 +00:00
David Majnemer f07777c80b Windows: Avoiding resizing, use uninitialized data() instead
This is ever-so faster but more importantly matches what we have elsewhere.

llvm-svn: 192137
2013-10-07 21:57:07 +00:00
Richard Mitton 0aafb58aca Formally added an explicit enum for DWARF TLS support. No functionality change.
llvm-svn: 192118
2013-10-07 18:39:18 +00:00
NAKAMURA Takumi c59b1cae49 Windows/Process.inc: Fix for +Asserts. &Buf[0] is not guaranteed if size is zero.
llvm-svn: 192103
2013-10-07 15:33:30 +00:00
David Majnemer 17a44966be Windows: Be more explicit with Win32 APIs
This addresses several issues in a similar vein:
 - Use the Unicode APIs when possible, running nm on clang shows that we
   only use Unicode APIs except for FormatMessage, CreateSemaphore, and
   GetModuleHandle.  AFAICT, the latter two are coming from MinGW and
   not LLVM itself.
 - Make getMainExecutable more resilient.  It previously considered
   return values of zero from ::GetModuleFileNameA to be acceptable.

llvm-svn: 192096
2013-10-07 09:52:36 +00:00
David Majnemer 61eae2e30c Revert "Revert "Windows: Add support for unicode command lines""
This reverts commit r192070 which reverted r192069, I forgot to
regenerate the configure scripts.

llvm-svn: 192079
2013-10-07 01:00:07 +00:00
David Majnemer f636cf422e Revert "Windows: Add support for unicode command lines"
This is causing MinGW bots to fail.
This reverts commit r192069.

llvm-svn: 192070
2013-10-06 20:44:34 +00:00
David Majnemer 80bea0c315 Windows: Add support for unicode command lines
Summary:
The MSVCRT deliberately sends main() code-page specific characters.
This isn't too useful to LLVM as we end up converting the arguments to
UTF-16 and subsequently attempt to use the result as, for example, a
file name.  Instead, we need to have the ability to access the Unicode
command line and transform it to UTF-8.

This has the distinct advantage over using the MSVC-specific wmain()
function as our entry point because:
 - It doesn't work on cygwin.
 - It only work on MinGW with caveats and only then on certain versions.
 - We get to keep our entry point as main(). :)

N.B.  This patch includes fixes to other parts of lib/Support/Windows
s.t. we would be able to take advantage of getting the Unicode paths.
E.G.  clang spawning clang -cc1 would want to give it Unicode arguments.

Reviewers: aaron.ballman, Bigcheese, rnk, ruiu

Reviewed By: rnk

CC: llvm-commits, ygao

Differential Revision: http://llvm-reviews.chandlerc.com/D1834

llvm-svn: 192069
2013-10-06 20:25:49 +00:00
Benjamin Kramer 8f5d425160 raw_fd_ostream: Be more verbose about the reason when opening a file fails.
llvm-svn: 191911
2013-10-03 16:59:14 +00:00
Tareq A. Siraj d88b9832c8 Add non-blocking Wait() for launched processes
- New ProcessInfo class to encapsulate information about child processes.
- Generalized the Wait() to support non-blocking wait on child processes.
- ExecuteNoWait() now returns a ProcessInfo object with information about
  the launched child. Users will be able to use this object to
  perform non-blocking wait.
- ExecuteNoWait() now accepts an ExecutionFailed param that tells if execution
  failed or not.

These changes will allow users to implement basic process parallel
tools.

Differential Revision: http://llvm-reviews.chandlerc.com/D1728

llvm-svn: 191763
2013-10-01 14:28:18 +00:00
Rafael Espindola 44fee4e0eb Remove several unused variables.
Patch by Alp Toker.

llvm-svn: 191757
2013-10-01 13:32:03 +00:00
Dmitri Gribenko 78fe2ba3ba SourceMgr diagnotics printing: fix a bug where printing a fixit for a source
range that includes a tab character will cause out-of-bounds access to the
fixit string.

llvm-svn: 191563
2013-09-27 21:24:36 +00:00
Dmitri Gribenko 8f944628ac Make SourceMgr::PrintMessage() testable and add unit tests
llvm-svn: 191558
2013-09-27 21:09:25 +00:00
Benjamin Kramer 8817cca5ce Provide basic type safety for array_pod_sort comparators.
This makes using array_pod_sort significantly safer. The implementation relies
on function pointer casting but that should be safe as we're dealing with void*
here.

llvm-svn: 191175
2013-09-22 14:09:50 +00:00
David Blaikie efd0bcb70f DebugInfo: GDBIndexEntry*String conversion functions now return const char* for easy llvm::formating
This was previously invoking UB by passing a user-defined type to
format. Thanks to Jordan Rose for pointing this out.

llvm-svn: 191060
2013-09-20 00:33:15 +00:00
David Blaikie d0a869d0bf DebugInfo: Improve IR annotation comments for GNU pubthings.
llvm-svn: 191043
2013-09-19 22:19:37 +00:00
David Blaikie 8dec407649 Unshift the GDB index/GNU pubnames constants modified in r191025
Based on code review feedback from Eric Christopher, unshifting these
constants as they can appear in the gdb_index itself, shifted a further
24 bits. This means that keeping them preshifted is a bit inflexible, so
let's not do that.

Given the motivation, wrap up some nicer enums, more type safety, and
some utility functions.

llvm-svn: 191035
2013-09-19 20:40:26 +00:00