Commit Graph

2987 Commits

Author SHA1 Message Date
Yaron Keren
af34c3a995 Fix llvm::huge_valf multiple initializations with Visual C++.
llvm::huge_valf is defined in a header file, so it is initialized
multiple times in every compiled unit upon program startup.

With non-VC compilers huge_valf is set to a HUGE_VALF which the
compiler can probably optimize out.

With VC numeric_limits<float>::infinity() does not return a number
but a runtime structure member which therotically may change 
between calls so the compiler does not optimize out the 
initialization and it happens many times. It can be easily seen by 
placing a breakpoint on the initialization line.

This patch moves llvm::huge_valf initialization to a source file
instead of the header.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218567 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-27 14:41:29 +00:00
Yaron Keren
a51dbbd394 clang-format of ChangeStdinToBinary & ChangeStdoutToBinary.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218547 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-26 22:27:11 +00:00
David Majnemer
346056ffc0 Support: Remove undefined behavior from &raw_ostream::operator<<
Don't negate signed integer types in &raw_ostream::operator<<(const
FormattedNumber &FN).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218496 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-26 02:48:14 +00:00
Nick Kledzik
e93da60ac4 [Support] Add type-safe alternative to llvm::format()
llvm::format() is somewhat unsafe. The compiler does not check that integer
parameter size matches the %x or %d size and it does not complain when a 
StringRef is passed for a %s.  And correctly using a StringRef with format() is  
ugly because you have to convert it to a std::string then call c_str().
 
The cases where llvm::format() is useful is controlling how numbers and
strings are printed, especially when you want fixed width output.  This
patch adds some new formatting functions to raw_streams to format numbers
and StringRefs in a type safe manner. Some examples:

   OS << format_hex(255, 6)        => "0x00ff"
   OS << format_hex(255, 4)        => "0xff"
   OS << format_decimal(0, 5)      => "    0"
   OS << format_decimal(255, 5)    => "  255"
   OS << right_justify(Str, 5)     => "  foo"
   OS << left_justify(Str, 5)      => "foo  "



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218463 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-25 20:30:58 +00:00
Chris Bieneman
4bb780af42 Adding #ifdef around TermColorMutex based on feedback from Craig Topper.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218401 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-24 18:35:58 +00:00
NAKAMURA Takumi
bfb2b180bf Windows/Host.inc: Reformat the header to fit 80-col.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218374 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-24 04:45:14 +00:00
NAKAMURA Takumi
d968b05f4d Unix/Host.inc: Remove <cstdlib>. It has been unused for a long time.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218373 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-24 04:45:02 +00:00
NAKAMURA Takumi
4921f68311 Unix/Host.inc: Wrap a comment line in 80-col.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218371 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-24 04:44:50 +00:00
NAKAMURA Takumi
c44f94d681 Unix/Host.inc: Remove leading whitespace. It had been here since r56942!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218370 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-24 04:44:37 +00:00
NAKAMURA Takumi
66e6cd27a3 Windows/DynamicLibrary.inc: Remove 'extern "C"' in ELM_Callback.
'extern "C" static' is not accepted by g++-4.7. Rather to tweak, I just removed 'extern "C"', since it doesn't affect the ABI.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218290 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-23 01:09:46 +00:00
Chris Bieneman
f1a19cd9fc Converting terminalHasColors mutex to a global ManagedStatic to avoid the static destructor.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218283 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-22 22:39:20 +00:00
Yaron Keren
612d00a347 In this callback ModuleName includes the file path.
Comparing ModuleName to the file names listed will 
always fail. 

I wonder how this code ever worked and what its 
purpose was. Why exclude the msvc runtime DLLs
but not exclude all Windows system DLLs?

Anyhow, it does not function as intended.

clang-formatted as well.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218276 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-22 21:40:15 +00:00
Matt Arsenault
55dd199bd3 Add hsail and amdil64 to Triple
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218142 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-19 19:52:11 +00:00
Justin Bogner
0a277ea23d LineIterator: Provide a variant that keeps blank lines
It isn't always useful to skip blank lines, as evidenced by the
somewhat awkward use of line_iterator in llvm-cov. This adds a knob to
control whether or not to skip blanks.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217960 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-17 15:43:01 +00:00
Nick Kledzik
290c772b6c Fix identify_magic() with mach-o stub dylibs.
The wrong value was returned and the unittest did not cover the stub dylib case.




git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217933 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-17 00:53:44 +00:00
David Blaikie
ec182fe2e5 Fix memory leak in error paths in YAMLTraits by using unique_ptr
There's some other cleanup that could happen here, but this is at least
the mechanical transformation to unique_ptr.

Derived from a patch by Anton Yartsev.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217803 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-15 18:39:24 +00:00
JF Bastien
5223ff81f5 Add support for le64.
Summary:
le64 is a generic little-endian 64-bit processor, mimicking le32.

Depends on D5318.

Test Plan: make check-all

Reviewers: dschuff

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D5319

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217697 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-12 17:54:17 +00:00
Evgeniy Stepanov
6354451c6a Add CMake check for libatomic.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217666 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-12 11:08:59 +00:00
Rui Ueyama
cf9142d479 Support: Use llvm::COFF::BigObjMagic
Use llvm::COFF::BigObjMagic insetad of the string literal.
Also checks the version number.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217633 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-11 22:34:32 +00:00
Rui Ueyama
330c819d83 Support: improve identify_magic to recognize COFF bigobj
identify_magic recognized a COFF bigobj as an import library file.
This patch fixes that.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217627 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-11 21:09:57 +00:00
Rafael Espindola
8d230cd536 Misc cleanups to the FileSytem api.
The main difference is the removal of

std::error_code exists(const Twine &path, bool &result);

It was an horribly redundant interface since a file not existing is also a valid
error_code. Now we have an access function that returns just an error_code. This
is the only function that has to be implemented for Unix and Windows. The
functions can_write, exists and can_execute an now just wrappers.

One still has to be very careful using these function to avoid introducing
race conditions (Time of check to time of use).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217625 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-11 20:30:02 +00:00
Sanjay Patel
338692246d typo
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217597 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-11 15:41:01 +00:00
Ed Maste
53ee51fb15 Use armv6k default for FreeBSD/ARM
Patch by Andrew Turner.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217454 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-09 17:47:24 +00:00
Nick Lewycky
05ad06754c Check whether the iterator p == the end iterator before trying to dereference it. This is a speculative fix for a failure found on the valgrind buildbot triggered by a clang test.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217295 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-06 01:16:42 +00:00
Alexey Samsonov
14b2112e24 Fix right shift by 64 bits detected on CXX/lex/lex.literal/lex.ext/p4.cpp
test case on UBSan bootstrap bot.

This fixes the last failure of "check-clang" in UBSan bootstrap bot.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217294 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-06 00:41:19 +00:00
Frederic Riss
eeb0520463 Reapply "[dwarfdump] Add missing DW_LANG_Mips_Assembler case to LanguageString()"
This commit was reverted in r217183, but is OK to go in again now that its dependency is commited (as of r217186).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217231 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-05 07:21:40 +00:00
Matthew Gardiner
e80ca34c93 Removed white-space
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217230 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-05 07:17:15 +00:00
Matthew Gardiner
a1fddc5de2 Adding kalimba variants as Triple sub-architectures.
Reviewed in:

http://reviews.llvm.org/D5115



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217229 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-05 06:46:43 +00:00
Frederic Riss
a49caa5e3f [ dwarfdump ] Add symbolic dump of known DWARF attribute values.
Reviewed By: dblaikie

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D5187

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217186 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-04 19:39:20 +00:00
Frederic Riss
4b2e523613 Revert "[dwarfdump] Add missing DW_LANG_Mips_Assembler case to LanguageString()"
This reverts commit 93c7e6161e1adbd2c7ac81fa081823183035cb64.

This commit got approved first, but was dependant on another one going in (The one pretty printing attribute values). I'll reapply when the other one is in.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217183 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-04 18:55:46 +00:00
Frederic Riss
e4e2997f8b [dwarfdump] Add missing DW_LANG_Mips_Assembler case to LanguageString()
Reviewed By: dblaikie

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D5193

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217182 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-04 18:40:23 +00:00
Rafael Espindola
52fa0d066a Add writeFileWithSystemEncoding to LibLLVMSuppor.
This patch adds to LLVMSupport the capability of writing files with
international characters encoded in the current system encoding. This
is relevant for Windows, where we can either use UTF16 or the current
code page (the legacy Windows international characters). On UNIX, the
file is always saved in UTF8.

This will be used in a patch for clang to thoroughly support response
files creation when calling other tools, addressing PR15171. On
Windows, to correctly support internationalization, we need the
ability to write response files both in UTF16 or the current code
page, depending on the tool we will call. GCC for mingw, for instance,
requires files to be encoded in the current code page. MSVC tools
requires files to be encoded in UTF16.

Patch by Rafael Auler!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217068 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-03 20:02:00 +00:00
Chris Bieneman
b9053f6cbc Removing static initializer from Debug.cpp by converting to a ManagedStatic.
This is part of our larger effort to remove static initializers from LLVM libraries.

Reviewed by: chandlerc

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217053 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-03 17:50:14 +00:00
Chris Bieneman
16632ce4c7 Cleaning up remaining static initializers in Signals.inc
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216996 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-02 23:48:13 +00:00
David Blaikie
7b96c4919a unique_ptrify the result of SpecialCaseList::create
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216925 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-02 18:13:54 +00:00
David Blaikie
98f518c81a unique_ptrify FileOutputBuffer::FileOutputBuffer
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216921 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-02 17:49:23 +00:00
Andrea Di Biagio
ca514a41ea Revert: [APFloat] Fixed a bug in method 'fusedMultiplyAdd'.
This reverts revision 216913; the new test added at revision 216913
caused regression failures on a couple of buildbots.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216914 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-02 17:22:49 +00:00
Andrea Di Biagio
0b6ee9fd1c [APFloat] Fixed a bug in method 'fusedMultiplyAdd'.
When folding a fused multiply-add builtin call, make sure that we propagate the
correct result in the case where the addend is zero, and the two other operands
are finite non-zero.

Example:
  define double @test() {
    %1 = call double @llvm.fma.f64(double 7.0, double 8.0, double 0.0)
    ret double %1
  }

Before this patch, the instruction simplifier wrongly folded the builtin call
in function @test to constant 'double 7.0'.
With this patch, method 'fusedMultiplyAdd' correctly evaluates the multiply and
propagates the expected result (i.e. 56.0).

Added test fold-builtin-fma.ll with the reproducible from PR20832 plus extra
test cases to verify the behavior of method 'fusedMultiplyAdd' in the presence
of NaN/Inf operands.

This fixes PR20832.

Differential Revision: http://reviews.llvm.org/D5152


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216913 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-02 16:44:56 +00:00
Craig Topper
24ae56d4c9 Fix some cases where StringRef was being passed by const reference. Remove const from some other StringRefs since its implicitly const already.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216820 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-30 16:48:02 +00:00
Chris Bieneman
d814e38de8 Cleaning up static initializers in Signals.inc
Reviewed by: Chandlerc

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216704 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-29 01:05:16 +00:00
Chris Bieneman
77bf4f97bf Cleaning up static initializers in TimeValue.
Code reviewed by Chandlerc

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216703 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-29 01:05:12 +00:00
Rafael Espindola
1a7f705fba Return a std::unique_ptr when creating a new MemoryBuffer.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216583 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-27 20:03:13 +00:00
Rafael Espindola
34806d20dd yaml::Stream doesn't need to take ownership of the buffer.
In fact, most users were already using the StringRef version.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216575 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-27 19:03:22 +00:00
Zachary Turner
0927dab0be Revert "Limit the symbol search in DynamicLibrary to the module that was opened."
This reverts commit r216563, which breaks lli's dynamic symbol resolution.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216569 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-27 17:51:43 +00:00
Zachary Turner
70d2d3cd45 Limit the symbol search in DynamicLibrary to the module that was opened.
Differential Revision: http://reviews.llvm.org/D5030

Reviewed By: Reid Kleckner, Rafael Espindola

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216563 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-27 17:06:22 +00:00
Benjamin Kramer
ccce7032ae Add an explicit cast to pacify implicit boolean conversion warnings.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216539 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-27 11:47:52 +00:00
Craig Topper
3512034554 Simplify creation of a bunch of ArrayRefs by using None, makeArrayRef or just letting them be implicitly created.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216525 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-27 05:25:25 +00:00
Rafael Espindola
2292996e1a Pass a MemoryBufferRef when we can avoid taking ownership.
The attached patch simplifies a few interfaces that don't need to take
ownership of a buffer.

For example, both parseAssembly and parseBitcodeFile will parse the
entire buffer before returning. There is no need to take ownership.

Using a MemoryBufferRef makes it obvious in the type signature that
there is no ownership transfer.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216488 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-26 21:49:01 +00:00
Rafael Espindola
9be4884731 Merge TempDir and system_temp_directory.
We had two functions for finding the temp or cache directory. Each had a
different set of smarts about OS specific APIs.

With this patch system_temp_directory becomes the only way to do it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216460 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-26 14:47:52 +00:00
Dylan Noblesmith
ae65d0e330 Revert "Support/APFloat: unique_ptr-ify temp arrays"
This reverts commit rr216359.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216429 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-26 02:03:33 +00:00
Dylan Noblesmith
27dc1b8446 Revert "Support/Path: remove raw delete"
This reverts commit r216360.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216428 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-26 02:03:30 +00:00
Rafael Espindola
c33fe1b296 Fix bug in llvm::sys::argumentsFitWithinSystemLimits().
This patch fixes a subtle bug in the UNIX implementation of
llvm::sys::argumentsFitWithinSystemLimits() regarding the misuse of a static
variable. This bug causes our cached number that stores the system command line
maximum length to be halved after each call to the function. With a sufficient
number of calls to this function, it will eventually report any given command
line string to be over system limits.

Patch by Rafael Auler.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216415 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-25 22:53:21 +00:00
Rafael Espindola
749c73842d Refactor argument serialization logic when executing process. NFC.
This patch refactors the argument serialization logic used in the Execute
function, used to launch new Windows processes. There is a critical step that
joins char** arguments into a single string, building the command line used to
launch the new process, and the readability of this code is improved if this
part is refactored in its own helper function.

Patch by Rafael Auler!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216411 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-25 22:15:06 +00:00
Rafael Espindola
8c96862847 Modernize raw_fd_ostream's constructor a bit.
Take a StringRef instead of a "const char *".
Take a "std::error_code &" instead of a "std::string &" for error.

A create static method would be even better, but this patch is already a bit too
big.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216393 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-25 18:16:47 +00:00
Dylan Noblesmith
0acfd7f0a4 Support/Path: remove raw delete
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216360 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-25 00:58:13 +00:00
Dylan Noblesmith
0901b15d01 Support/APFloat: unique_ptr-ify temp arrays
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216359 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-25 00:58:10 +00:00
Dylan Noblesmith
389f13012f Support: add llvm::unique_lock
Based on the STL class of the same name, it guards a mutex
while also allowing it to be unlocked conditionally before
destruction.

This eliminates the last naked usages of mutexes in LLVM and
clang.

It also uncovered and fixed a bug in callExternalFunction()
when compiled without USE_LIBFFI, where the mutex would never
be unlocked if the end of the function was reached.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216338 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-23 23:07:14 +00:00
Dylan Noblesmith
d930a30833 Support: make LLVM Mutexes STL-compatible
Use lock/unlock() convention instead of acquire/release().

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216336 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-23 22:49:22 +00:00
Dylan Noblesmith
7e3e4311c5 Support/Unix: use ScopedLock wherever possible
Only one function remains a bit too complicated
for a simple mutex guard. No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216335 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-23 22:49:17 +00:00
Reid Kleckner
2e1bf78ad6 Fix PR17239 by changing the semantics of the RemainingArgsClass Option kind
This patch contains the LLVM side of the fix of PR17239.

This bug that happens because the /link (clang-cl.exe argument) is
marked as "consume all remaining arguments". However, when inside a
response file, /link should only consume all remaining arguments inside
the response file where it is located, not the entire command line after
expansion.

My patch will change the semantics of the RemainingArgsClass kind to
always consume only until the end of the response file when the option
originally came from a response file. There are only two options in this
class: dash dash (--) and /link.

Reviewed By: rnk

Differential Revision: http://reviews.llvm.org/D4899

Patch by Rafael Auler!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216280 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-22 19:29:17 +00:00
David Blaikie
95ca0fb247 Explicitly pass ownership of the MemoryBuffer to AddNewSourceBuffer using std::unique_ptr
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216223 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-21 20:44:56 +00:00
Craig Topper
e88b796285 Remove custom implementations of max/min in StringRef that was originally added to work an old gcc bug. I believe its been fixed by now.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216156 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-21 04:31:10 +00:00
Alexey Samsonov
242320399f Fix undefined behavior (left shift by 64 bits) in ScaledNumber::toString().
This bug is reported by UBSan.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216116 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-20 18:30:07 +00:00
Craig Topper
78832c6e7d Fix an off by 1 bug that prevented SmallPtrSet from using all of its 'small' capacity. Then fix the early return in the move constructor that prevented 'small' moves from clearing the NumElements in the moved from object. The directed test missed this because it was always testing large moves due to the off by 1 bug.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216044 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-20 04:41:36 +00:00
Rafael Espindola
548f2b6e8f Don't own the buffer in object::Binary.
Owning the buffer is somewhat inflexible. Some Binaries have sub Binaries
(like Archive) and we had to create dummy buffers just to handle that. It is
also a bad fit for IRObjectFile where the Module wants to own the buffer too.

Keeping this ownership would make supporting IR inside native objects
particularly painful.

This patch focuses in lib/Object. If something elsewhere used to own an Binary,
now it also owns a MemoryBuffer.

This patch introduces a few new types.

* MemoryBufferRef. This is just a pair of StringRefs for the data and name.
  This is to MemoryBuffer as StringRef is to std::string.
* OwningBinary. A combination of Binary and a MemoryBuffer. This is needed
  for convenience functions that take a filename and return both the
  buffer and the Binary using that buffer.

The C api now uses OwningBinary to avoid any change in semantics. I will start
a new thread to see if we want to change it and how.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216002 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-19 18:44:46 +00:00
Rafael Espindola
b5a6adc30a Convert an ownership comment with std::uinque_ptr.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@215855 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-17 22:20:33 +00:00
Sean Silva
855d60236a Revert "[Support] Promote cl::StringSaver to a separate utility"
This reverts commit r215784 / 3f8a26f6fe.

LLD has 3 StringSaver's, one of which takes a lock when saving the
string... Need to investigate more closely.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@215790 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-15 23:39:01 +00:00
Sean Silva
3f8a26f6fe [Support] Promote cl::StringSaver to a separate utility
This class is generally useful.

In breaking it out, the primary change is that it has been made
non-virtual. It seems like being abstract led to there being 3 different
(2 in llvm + 1 in clang) concrete implementations which disagreed about
the ownership of the saved strings (see the manual call to free() in the
unittest StrDupSaver; yes this is different from the CommandLine.cpp
StrDupSaver which owns the stored strings; which is different from
Clang's StringSetSaver which just holds a reference to a
std::set<std::string> which owns the strings).

I've identified 2 other places in the
codebase that are open-coding this pattern:

  memcpy(Alloc.Allocate<char>(strlen(S)+1), S, strlen(S)+1)

I'll be switching them over. They are
* llvm::sys::Process::GetArgumentVector
* The StringAllocator member of YAMLIO's Input class
This also will allow simplifying Clang's driver.cpp quite a bit.

Let me know if there are any other places that could benefit from
StringSaver. I'm also thinking of adding a saveStringRef member for
getting a stable StringRef.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@215784 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-15 23:18:33 +00:00
Rafael Espindola
1c9caced63 Delete support for AuroraUX.
auroraux.org is not resolving.

I will add this to the release notes as soon as I figure out where to put the
3.6 release notes :-)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@215645 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-14 15:15:09 +00:00
Benjamin Kramer
00e08fcaa0 Canonicalize header guards into a common format.
Add header guards to files that were missing guards. Remove #endif comments
as they don't seem common in LLVM (we can easily add them back if we decide
they're useful)

Changes made by clang-tidy with minor tweaks.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@215558 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-13 16:26:38 +00:00
Saleem Abdulrasool
f96cd1aeb5 ADT: remove MinGW32 and Cygwin OSType enum
Remove the MinGW32 and Cygwin types from the OSType enumeration.  These values
are represented via environments of Windows.  It is a source of confusion and
needlessly clutters the code.  The cost of doing this is that we must sink the
check for them into the normalization code path along with the spelling.

Addresses PR20592.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@215303 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-09 23:12:20 +00:00
Eric Christopher
895fcbe7a1 Fix typo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@215266 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-09 00:26:27 +00:00
Rafael Espindola
cea3043216 Fix the windows build.
Sorry for the noise.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@215249 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-08 22:09:31 +00:00
Eric Christopher
2f58085b57 Reword comment slightly.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@215248 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-08 22:09:00 +00:00
Rafael Espindola
d6039e045f Remove dead code. Fixes pr20544.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@215243 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-08 21:35:52 +00:00
Rafael Espindola
a7c6b3a57a Convert from Windows to Unix paths in sys::path::native.
Part of pr20544. Test to follow in a second.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@215241 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-08 21:29:34 +00:00
Rafael Espindola
82acfbfe86 Fix bug 20125 - clang-format segfaults on bad config.
The problem was in unchecked dyn_cast inside of Input::createHNodes.
Patch by Roman Kashitsyn!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@215205 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-08 13:58:00 +00:00
Richard Smith
c00ae93432 Remove Support/IncludeFile.h and its only user. This is actively harmful, since
it breaks the modules builds (where CallGraph.h can be quite reasonably
transitively included by an unimported portion of a module, and CallGraph.cpp
not linked in), and appears to have been entirely redundant since PR780 was
fixed back in 2008.

If this breaks anything, please revert; I have only tested this with a single
configuration, and it's possible that this is still somehow fixing something
(though I doubt it, since no other similar file uses this mechanism any more).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@215142 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-07 20:41:17 +00:00
Yaron Keren
6d48faf334 getNewMemBuffer memsets the buffer to zeros,
the caller don't have to initialize it.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@214994 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-06 20:59:09 +00:00
Justin Bogner
981eb59138 Path: Stop claiming path::const_iterator is bidirectional
path::const_iterator claims that it's a bidirectional iterator, but it
doesn't satisfy all of the contracts for a bidirectional iterator.
For example, n3376 24.2.5 p6 says "If a and b are both dereferenceable,
then a == b if and only if *a and *b are bound to the same object",
but this doesn't work with how we stash and recreate Components.

This means that our use of reverse_iterator on this type is invalid
and leads to many of the valgrind errors we're hitting, as explained
by Tilmann Scheller here:

    http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20140728/228654.html

Instead, we admit that path::const_iterator is only an input_iterator,
and implement a second input_iterator for path::reverse_iterator (by
changing const_iterator::operator-- to reverse_iterator::operator++).
All of the uses of this just traverse once over the path in one
direction or the other anyway.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@214737 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-04 17:36:41 +00:00
NAKAMURA Takumi
499befab31 MemoryBuffer: Don't use mmap when FileSize is multiple of 4k on Cygwin.
On Cygwin, getpagesize() returns 64k(AllocationGranularity).

In r214580, the size of X86GenInstrInfo.inc became 1499136.

FIXME: We should reorganize again getPageSize() on Win32.
MapFile allocates address along AllocationGranularity but view is mapped by physical page.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@214681 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-04 01:43:37 +00:00
Rafael Espindola
9aa0b5e11e Remove some calls to std::move.
Instead of moving out the data in a ErrorOr<std::unique_ptr<Foo>>, get
a reference to it.

Thanks to David Blaikie for the suggestion.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@214516 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-01 14:31:55 +00:00
Rafael Espindola
a5e6ff6f7e Remove dead code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@213963 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-25 19:06:39 +00:00
Hans Wennborg
dee5e2cf7f Windows: Don't wildcard expand /? or -?
Even if there's a file called c:\a, we want /? to be preserved as
an option, not expanded to a filename.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@213894 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-24 21:09:45 +00:00
Tim Northover
8b6257629a AArch64: remove "arm64_be" support in favour of "aarch64_be".
There really is no arm64_be: it was a useful fiction to test big-endian support
while both backends existed in parallel, but now the only platform that uses
the name (iOS) doesn't have a big-endian variant, let alone one called
"arm64_be".

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@213748 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-23 12:58:11 +00:00
Tim Northover
9231148e69 AArch64: remove arm64 triple enumerator.
Having both Triple::arm64 and Triple::aarch64 is extremely confusing, and
invites bugs where only one is checked. In reality, the only legitimate
difference between the two (arm64 usually means iOS) is also present in the OS
part of the triple and that's what should be checked.

We still parse the "arm64" triple, just canonicalise it to Triple::aarch64, so
there aren't any LLVM-side test changes.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@213743 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-23 12:32:47 +00:00
David Blaikie
ec31a302b7 Remove uses of the redundant ".reset(nullptr)" of unique_ptr, in favor of ".reset()"
It's also possible to just write "= nullptr", but there's some question
of whether that's as readable, so I leave it up to authors to pick which
they prefer for now. If we want to discuss standardizing on one or the
other, we can do that at some point in the future.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@213438 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-19 01:05:11 +00:00
Daniel Sanders
a11bf68f6c Add MIPS Technologies to the vendors in llvm::Triple.
This is a prerequisite for checking for 'mti' and 'img' in a consistent way in
clang. Previously 'img' could use Triple::getVendor() but 'mti' could only use
Triple::getVendorName().



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@213381 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-18 14:28:19 +00:00
Renato Golin
03ac7db89d Refactor ARM subarchitecture parsing
Re-commit of a patch to rework the triple parsing on ARM to a more sane
model.

Patch by Gabor Ballabas.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@213367 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-18 12:00:48 +00:00
Alp Toker
3cf9f37312 Drop the udis86 wrapper from llvm::sys
This optional dependency on the udis86 library was added some time back to aid
JIT development, but doesn't make much sense to link into LLVM binaries these
days.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@213300 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-17 20:05:29 +00:00
Hans Wennborg
c636a42d4a Typo: exists -> exits
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@213290 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-17 18:33:44 +00:00
Yi Kong
ad591b341b Fix the prefix for arm64 triple
Triple.cpp still returns "arm64" as prefix for arm64 triple, causing Clang not
being able to select the correct GCCBuiltin IR.

This patch changes the value to correct prefix "aarch64". Regression test will
be added in the coming patch.

Differential Revision: http://reviews.llvm.org/D4516


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@213240 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-17 09:43:27 +00:00
Hans Wennborg
b464ec0536 Perform wildcard expansion in Process::GetArgumentVector on Windows (PR17098)
On Windows, wildcard expansion isn't performed by the shell, but left to the
program itself. The common way to do this is to link with setargv.obj, which
performs the expansion on argc/argv before main is entered. However, we don't
use argv in Clang on Windows, but instead call GetCommandLineW so we can handle
unicode arguments. This means we have to do wildcard expansion ourselves.

A test case will be added on the Clang side.

Differential Revision: http://reviews.llvm.org/D4529

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@213114 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-16 00:52:11 +00:00
Alp Toker
9988c292f1 Fix a -Wunused-local-typedefs warning
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@213002 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-14 22:46:45 +00:00
Justin Bogner
497ba6c273 Support: Use a range-based for
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@212973 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-14 19:24:13 +00:00
Argyrios Kyrtzidis
41a6ddb277 Move the API and implementation of clang::driver::getARMCPUForMArch() to llvm::Triple::getARMCPUForArch().
Suggested by Eric Christopher.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@212846 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-11 21:44:54 +00:00
Alp Toker
1736df6ae0 Simplify the raw_svector_ostream tweak from r212816
The memcpy() and overlap helps didn't help much with timings, so clean up the change.

The difference at this point is that we now leave growth of the storage buffer
up to SmallVector's implementation:

 -   OS.reserve(OS.capacity() * 2);
 +   OS.reserve(OS.size() + 64);

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@212837 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-11 18:23:08 +00:00
Alp Toker
81bc6fb854 raw_svector_ostream: grow and reserve atomically
Including the scratch buffer size in the initial reservation eliminates the
subsequent malloc+move operation and offers a healthier constant growth with
less memory wastage.

When doing this, take care to avoid invalidating the source buffer.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@212816 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-11 14:02:04 +00:00
Eric Christopher
b5a006e88f Add the CSR company and the Kalimba DSP processor to Triple.
Patch by Matthew Gardiner with fixes by me.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@212745 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-10 17:26:54 +00:00
Peter Collingbourne
141d3e3015 Remove move assignment operator to appease older GCCs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@212682 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-10 04:39:40 +00:00
Peter Collingbourne
ac37f731e7 Explicitly define move constructor and move assignment operator to appease MSVC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@212679 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-10 04:29:06 +00:00
Peter Collingbourne
0f29cefbc2 SpecialCaseList: use std::unique_ptr.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@212678 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-10 03:55:02 +00:00
Alexey Samsonov
3e51f754ad Decouple llvm::SpecialCaseList text representation and its LLVM IR semantics.
Turn llvm::SpecialCaseList into a simple class that parses text files in
a specified format and knows nothing about LLVM IR. Move this class into
LLVMSupport library. Implement two users of this class:
  * DFSanABIList in DFSan instrumentation pass.
  * SanitizerBlacklist in Clang CodeGen library.
The latter will be modified to use actual source-level information from frontend
(source file names) instead of unstable LLVM IR things (LLVM Module identifier).

Remove dependency edge from ClangCodeGen/ClangDriver to LLVMTransformUtils.

No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@212643 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-09 19:40:08 +00:00
Daniel Sanders
6a6556695e Add Imagination Technologies to the vendors in llvm::Triple
Summary: This is a pre-requisite for supporting the mips-img-linux-gnu triple in clang.

Differential Revision: http://reviews.llvm.org/D4435


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@212626 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-09 16:03:10 +00:00
Dmitri Gribenko
7b39c067ac SourceMgr: consistently use 'unsigned' for the memory buffer ID type
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@212595 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-09 08:30:15 +00:00
Benjamin Kramer
e63aae5b75 Fix some Twine locals.
Two of those are use after frees. Found by clang-tidy, fixed by me.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@212537 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-08 14:55:06 +00:00
Renato Golin
aebcee661e Revert "Refactor ARM subarchitecture parsing"
This reverts commit 7b4a688246.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@212521 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-08 10:06:16 +00:00
Renato Golin
7b4a688246 Refactor ARM subarchitecture parsing
According to a FIXME in ARMMCTargetDesc.cpp the ARM version parsing should be
in the Triple helper class.

Patch by: Gabor Ballabas

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@212479 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-07 20:01:11 +00:00
Rafael Espindola
7cba2a973f Update the MemoryBuffer API to use ErrorOr.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@212405 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-06 17:43:13 +00:00
Alp Toker
1508c82095 SourceMgr: make valid buffer IDs start from one
Use 0 for the invalid buffer instead of -1/~0 and switch to unsigned
representation to enable more idiomatic usage.

Also introduce a trivial SourceMgr::getMainFileID() instead of hard-coding 0/1
to identify the main file.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@212398 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-06 10:33:31 +00:00
Alp Toker
25b7acf34f Remove obsolete function TargetRegistry::getClosestTargetForJIT()
This was kept around "for compatibility through 2.6" in 2009 and is not used or
tested.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@212095 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-01 10:47:13 +00:00
Ehsan Akhgari
eb73cf671b Refactor the code in clang to find a file in a PATH like environment variable into a helper function
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@212057 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-30 19:54:20 +00:00
Alp Toker
a0d04ac9f1 Fix 'platform-specific' hyphenations
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@212056 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-30 18:57:16 +00:00
Alp Toker
46e17cae55 Build fix for systems without futimes/futimens
Some versions of Android don't have futimes/futimens and this code wasn't
updated during the recent errc refactoring.

Patch by Luqman Aden!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@212055 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-30 18:57:04 +00:00
Julien Lerouge
86ebb340ef lldb can interrupt waitpid, so EINTR shouldn't be an error. This fixes the case
where there is no timeout. In the case where there is a timeout though, the
code is still wrong since it doesn't check that the alarm really went off.

Without this patch, I cannot debug a program that forks itself using
sys::ExecuteAndWait with lldb.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211918 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-27 18:02:54 +00:00
Chandler Carruth
39ea80cc56 Re-apply r211287: Remove support for LLVM runtime multi-threading.
I'll fix the problems in libclang and other projects in ways that don't
require <mutex> until we sort out the cygwin situation.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211900 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-27 15:13:01 +00:00
Alp Toker
8dd8d5c2b2 Revert "Introduce a string_ostream string builder facilty"
Temporarily back out commits r211749, r211752 and r211754.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211814 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-26 22:52:05 +00:00
Will Schmidt
842549dfa6 Add support for ppc64/power8 as a host
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211781 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-26 13:37:03 +00:00
Alp Toker
2559070422 Introduce a string_ostream string builder facilty
string_ostream is a safe and efficient string builder that combines opaque
stack storage with a built-in ostream interface.

small_string_ostream<bytes> additionally permits an explicit stack storage size
other than the default 128 bytes to be provided. Beyond that, storage is
transferred to the heap.

This convenient class can be used in most places an
std::string+raw_string_ostream pair or SmallString<>+raw_svector_ostream pair
would previously have been used, in order to guarantee consistent access
without byte truncation.

The patch also converts much of LLVM to use the new facility. These changes
include several probable bug fixes for truncated output, a programming error
that's no longer possible with the new interface.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211749 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-26 00:00:48 +00:00
Argyrios Kyrtzidis
ce6e7c7a59 For CrashRecoveryContext::RunSafelyOnThread, propagate Darwin's PRIO_DARWIN_BG to the new thread if it is
set on the calling thread.

This allows libclang's indexing threads to propagate their priority to the clang module building threads.

rdar://17459872


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211747 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-25 23:54:50 +00:00
JF Bastien
b4840d7a4d Random Number Generator (llvm)
Provides an abstraction for a random number generator (RNG) that produces a stream of pseudo-random numbers.
The current implementation uses C++11 facilities and is therefore not cryptographically secure.

The RNG is salted with the text of the current command line invocation.
In addition, a user may specify a seed (reproducible builds).

In clang, the seed can be set via

-frandom-seed=X
In the back end, the seed can be set via

-rng-seed=X
This is the llvm part of the patch.
clang part: D3391

URL: http://reviews.llvm.org/D3390
Author: yln

I'm landing this for the second time, it broke Windows bots the first time around.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211705 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-25 15:21:42 +00:00
Rafael Espindola
95be6a7c3d Don't leak a file descriptor.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211699 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-25 14:35:59 +00:00
Logan Chien
3c26b95512 Code cleanup.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211697 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-25 13:46:17 +00:00
Alp Toker
f36a43dbba Use SourceMgr::getMemoryBuffer() in a couple of places
Cleanup only.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211656 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-25 00:41:15 +00:00
Daniel Sanders
d3aaad2d26 Revert: r211588 - [mips] Use __clear_cache builtin instead of cacheflush() in Unix Memory::InvalidateInstructionCache()
Buildbot reports a test failure on the llvm-mips-linux builder and blames r211588.
Although it doesn't appear in the blamelist, it seems it could also be r211587
(because it's committed to compiler-rt?) since they were tested together.

Reverting the most likely suspect (r211588) to confirm one way or the other.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211594 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-24 13:53:56 +00:00
NAKAMURA Takumi
cdde33ebaa Revert r211287, "Remove support for LLVM runtime multi-threading."
libclang still requires it on cygming, lack of incomplete <mutex>.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211592 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-24 13:36:31 +00:00
Daniel Sanders
2523346594 [mips] Use __clear_cache builtin instead of cacheflush() in Unix Memory::InvalidateInstructionCache()
MIPS64 Android bionic has removed cacheflush(). Use __clear_cache() instead for 32-bit and 64-bit MIPS

Patch by Duane Sand <Duane.Sand@imgtec.com>



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211588 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-24 12:26:49 +00:00
Duncan P. N. Exon Smith
856361cb06 Support: Move class ScaledNumber
ScaledNumber has been cleaned up enough to pull out of BFI now.  Still
work to do there (tests for shifting, bloated printing code, etc.), but
it seems clean enough for its new home.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211562 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-24 00:38:09 +00:00
David Blaikie
9dd6fee485 Recommit 211309 (StringMap::insert), reverted in 211328 due to issues with private, but non-deleted, move members.
Certain versions of GCC (~4.7) couldn't handle the SFINAE on access
control, but with "= delete" (hidden behind a macro for portability)
this issue is worked around/addressed.

Patch by Agustín Bergé

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211525 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-23 18:28:53 +00:00
Duncan P. N. Exon Smith
18a301e578 Support: Extract ScaledNumbers::compare()
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211507 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-23 17:47:40 +00:00
Zachary Turner
9222a2375f Fix the MinGW builder. Apparently std::call_once and
std::recursive_mutex are not available on MinGW and breaks the
builder.  Revert to using a function local static and sys::Mutex
just to get the tree green until we figure out a better solution.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211424 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-21 00:24:51 +00:00
Duncan P. N. Exon Smith
67291098a6 Support: Write ScaledNumber::getQuotient() and getProduct()
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211409 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-20 21:47:47 +00:00
Hans Wennborg
caa2bd600c Fix .cpp files claiming to be header files
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211334 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-20 01:36:00 +00:00
Rafael Espindola
6fda71e05e Revert "Add StringMap::insert(pair) consistent with the standard associative container concept."
This reverts commit r211309.

It looks like it broke some bots:

http://lab.llvm.org:8011/builders/clang-x86_64-ubuntu-gdb-75/builds/15563/steps/compile/logs/stdio

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211328 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-20 00:23:03 +00:00
David Blaikie
4110a7ac7a Add StringMap::insert(pair) consistent with the standard associative container concept.
Patch by Agustín Bergé.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211309 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-19 20:08:56 +00:00
Justin Bogner
f21de942f3 Support: Add llvm::sys::fs::copy_file
A function to copy one file's contents to another.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211302 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-19 19:35:39 +00:00
David Blaikie
f25c2015b3 Remove use of removed function, llvm_stop_multithreading
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211291 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-19 18:26:28 +00:00
Zachary Turner
a4d0ff9cd1 Remove support for LLVM runtime multi-threading.
After a number of previous small iterations, the functions
llvm_start_multithreaded() and llvm_stop_multithreaded() have
been reduced essentially to no-ops.  This change removes them
entirely.

Reviewed by: rnk, dblaikie

Differential Revision: http://reviews.llvm.org/D4216

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211287 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-19 18:18:23 +00:00
Zachary Turner
761f33167f Kill the LLVM global lock.
This patch removes the LLVM global lock, and updates all existing
users of the global lock to use their own mutex.    None of the
existing users of the global lock were protecting code that was
mutually exclusive with any of the other users of the global
lock, so its purpose was not being met.

Reviewed by: rnk

Differential Revision: http://reviews.llvm.org/D4142

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211277 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-19 16:17:42 +00:00
Alp Toker
c28beb254d CommandLine: bail out when options get multiply registered
These errors are strictly unrecoverable and indicate serious issues such as
conflicting option names or an incorrectly linked LLVM distribution.

With this change, the errors actually get detected so tests don't pass
silently.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211260 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-19 07:25:25 +00:00
JF Bastien
02b4e6e7ab Revert "Random Number Generator (llvm)"
This reverts commit cccba093090d127e0b6d17473b14c264c14c5259.

It causes build breakage.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211146 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-18 06:33:23 +00:00
JF Bastien
1d04a2324c Random Number Generator (llvm)
Summary:
Provides an abstraction for a random number generator (RNG) that produces a stream of pseudo-random numbers.
The current implementation uses C++11 facilities and is therefore not cryptographically secure.

The RNG is salted with the text of the current command line invocation.
In addition, a user may specify a seed (reproducible builds).

In clang, the seed can be set via
  -frandom-seed=X
In the back end, the seed can be set via
  -rng-seed=X

This is the llvm part of the patch.
clang part: D3391

Reviewers: ahomescu, rinon, nicholas, jfb

Reviewed By: jfb

Subscribers: jfb, perl

Differential Revision: http://reviews.llvm.org/D3390

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211145 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-18 06:23:25 +00:00
Rafael Espindola
476fd7c3e9 Merge lib/Support/WindowsError.cpp into ib/Support/ErrorHandling.cpp.
The OSX ranlib warns on files with no symbols, and lib/Support/WindowsError.cpp
was empty when building on non-windows.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211118 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-17 18:06:45 +00:00
Justin Bogner
feacf82180 Support: Inject LLVM_VERSION_INFO into the Support library
Mimic r116632 in passing LLVM_VERSION_INFO from the Makefile build
system to the build. This improves the -version output of tools that
use llvm::cl under the configure+make system.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211091 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-17 06:52:47 +00:00
Justin Bogner
d0dbed10d5 tools: Add a space between package version and LLVM_VERSION_INFO
This reads a little strangely. Add a space to clean it up.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211090 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-17 06:52:41 +00:00
Jordan Rose
4e23baa945 Add an overload for SourceMgr::PrintMessage that takes an existing diagnostic.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211087 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-17 02:15:40 +00:00
Jordan Rose
ecb1c3aa8c Modernize doc comments for SourceMgr.
No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211086 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-17 02:15:36 +00:00
Zachary Turner
5ea46694d0 Revert r211066, 211067, 211068, 211069, 211070.
These were committed accidentally from the wrong branch before having
a review sign-off.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211072 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-16 22:49:41 +00:00
Zachary Turner
9020dc35dc Kill the LLVM global lock.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211069 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-16 22:40:42 +00:00
Zachary Turner
497b7bb3e3 Remove some code churn.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211068 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-16 22:40:29 +00:00