Commit Graph

2604 Commits

Author SHA1 Message Date
Rafael Espindola 5c20ac0134 Simplify remove, create_directory and create_directories.
Before this patch they would take an boolean argument to say if the path
already existed. This was redundant with the returned error_code which is able
to represent that. This allowed for callers to incorrectly check only the
existed flag instead of first checking the error code.

Instead, pass in a boolean flag to say if the previous (non-)existence should be
an error or not.

Callers of the of the old simple versions are not affected. They still ignore
the previous (non-)existence as they did before.

llvm-svn: 201979
2014-02-23 13:56:14 +00:00
Rafael Espindola d724c28020 Use simpler form of llvm::sys::fs::remove.
llvm-svn: 201975
2014-02-23 13:37:37 +00:00
NAKAMURA Takumi af2c1130ee Simplify linking to system libraries
The LLVMSupport library implementation consolidates all dependencies on
system libraries.  Move the logic gathering system libraries out of
'cmake/modules/LLVM-Config.cmake' and into 'lib/Support/CMakeLists.txt'.
Use the target_link_libraries() command there to tell CMake about the
link dependencies of the LLVMSupport implementation.  CMake will
automatically propagate this to all targets that link LLVMSupport
directly or indirectly.

We still need to build knowledge of system library dependencies into
'llvm-config'.  Store the list of libraries needed in a property on
LLVMSupport and teach 'tools/llvm-config/CMakeLists.txt' to retrieve it
from there.

Drop all calls to 'link_system_libs' and 'get_system_libs' from our
CMake code.  Replace their implementations with a warning that explains
the calls are no longer necessary.  Also drop from 'LLVMConfig.cmake'
the HAVE_* and related variables that were published there only to allow
'get_system_libs' to run outside our build process.

Contributed by Brad King.

llvm-svn: 201969
2014-02-23 06:27:04 +00:00
Logan Chien dbed91ecb6 Don't inline get[S|U]LEB128Size() until they are proved to be hot.
llvm-svn: 201939
2014-02-22 15:39:39 +00:00
Michael J. Spencer 7a3a51053d [Support] Correctly handle zero length inputs to UTF conversion functions on Windows.
llvm-svn: 201811
2014-02-20 20:46:23 +00:00
Rafael Espindola b6f72b240f Use mkdir instead of stat+mkdir.
This is an optimistic version of create_diretories: it tries to create the
directory first and looks at the parent only if that fails.

Running strace on "mkdir -p" shows that it is pessimistic, calling mkdir on
every element of the path. We could implement that if needed.

In any case, with both strategies there is no reason to call stat, just check
the return of mkdir.

llvm-svn: 201347
2014-02-13 16:58:19 +00:00
Rafael Espindola b32292ddf7 Remove dead code.
llvm-svn: 201327
2014-02-13 13:45:45 +00:00
Rafael Espindola 9e7a638be1 Use simpler version of sys::fs::exists when possible.
llvm-svn: 201289
2014-02-13 04:00:35 +00:00
Reid Kleckner d59e2faae1 Rename Windows.h to WindowsSupport.h to avoid ambiguity
llvm-svn: 201258
2014-02-12 21:26:20 +00:00
David Fang 6860c819f4 _CS_DARWIN_USER macros available on darwin>=9. Thanks, Dave Odell!
llvm-svn: 201255
2014-02-12 21:02:12 +00:00
NAKAMURA Takumi 04d39d7a2d Windows/Path.inc: Move <shlobj.h> after "Windows.h" for some API available.
I found that swapping the order of some header files helped fix a
  build issue that we're seeing on mingw32. Without the swap, windows.h
  was being included before _WIN32_WINNT was being defined and the
  CreateHardLinkW function was #ifdef'd out.

  It looks like the header is mainly used to get the SHGetFolderPathW
  function, so I don't think that there'll be much fallout from the
  switch.

Suggested by Alex Crichton. Thanks!

llvm-svn: 201230
2014-02-12 11:50:22 +00:00
Dmitri Gribenko 70e6585f0c Remove TimeValue::toPosixTime() -- it is buggy, semantics are unclear, and its
only current user should be using toEpochTime() instead.

llvm-svn: 201136
2014-02-11 09:11:18 +00:00
Aaron Ballman 07e7618e95 Using the helper API for random number generation.
llvm-svn: 201125
2014-02-11 03:40:14 +00:00
Aaron Ballman 3f5e8b8dc1 Hopefully fixing the MinGW 32 build, which was broken by r200767. Not using rand_s() since MinGW does not have an implementation for it, but instead using the underlying CryptGenRandom APIs.
llvm-svn: 201124
2014-02-11 02:47:33 +00:00
NAKAMURA Takumi 2f96171cb0 [CMake] LLVMSupport should be responsible to provide system_libs.
llvm-svn: 201077
2014-02-10 10:52:19 +00:00
Alexander Kornienko d772d72140 Fix an invalid check for duplicate option categories.
An intermediate solution until the problems with analyzer plugins linking with
llvm/Support and causing assertions due to duplicate GeneralCategory are solved.

llvm-svn: 200981
2014-02-07 17:42:30 +00:00
Benjamin Kramer 6128d00052 Try to unbreak the mingw32 build.
llvm-svn: 200973
2014-02-07 12:05:36 +00:00
Rafael Espindola 0bca63a33a Revert "Fix an invalid check for duplicate option categories."
This reverts commit r200853.

It was causing clang/Analysis/checker-plugins.c to crash.

llvm-svn: 200858
2014-02-05 17:49:31 +00:00
Alexander Kornienko e88421b6f7 Fix an invalid check for duplicate option categories.
Summary:
The check performed in the comparator is invalid, as some STL
implementations enforce strict weak ordering by calling the comparator with the
same value. This check was also in a wrong place: the assertion would only fire
when -help was used. The new check is performed each time the category is
registered (we are not going to have thousands of them, so it's fine to do it in
O(N^2)).

Reviewers: jordan_rose

Reviewed By: jordan_rose

CC: cfe-commits, alexmc

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

llvm-svn: 200853
2014-02-05 16:56:37 +00:00
Todd Fiala 4ccfe392ed Fix configure to find arc4random via header files.
ISSUE:

On Ubuntu 12.04 LTS, arc4random is provided by libbsd.so, which is a
transitive dependency of libedit. If a system had libedit on it that
was implemented in terms of libbsd.so, then the arc4random test,
previously implemented as a linker test, would succeed with -ledit.
However, on Ubuntu this would also require a #include <bsd/stdlib.h>.
This caused a build breakage on configure-based Ubuntu 12.04 with
libedit installed.

FIX:

This fix changes configure to test for arc4random by searching for it
in the standard header files. On Ubuntu 12.04, this test now properly
fails to find arc4random as it is not defined in the default header
locations. It also tweaks the #define names to match the output of the
header check command, which is slightly different than the linker
function check #defines.

I tested the following scenarios:

(1) Ubuntu 12.04 without the libedit package [did not find arc4random,
as expected]

(2) Ubuntu 12.04 with libedit package [properly did not find
arc4random, as expected]

(3) Ubuntu 12.04 with most recent libedit, custom built, and not
dependent on libbsd.so [properly did not find arc4random, as
expected].

(4) FreeBSD 10.0B1 [properly found arc4random, as expected]

llvm-svn: 200819
2014-02-05 05:04:36 +00:00
Aaron Ballman 7844073402 Implemented support for Process::GetRandomNumber on Windows.
Patch thanks to Stephan Tolksdorf!

llvm-svn: 200767
2014-02-04 14:49:21 +00:00
Aaron Ballman 42f6622b28 Undef'ing _WIN32_IE to silence an MSVC warning about redefining a macro value.
No functional change intended.

llvm-svn: 200704
2014-02-03 17:20:26 +00:00
Chandler Carruth 173bd7ed2e Rename the non-templated base class of SmallPtrSet to
'SmallPtrSetImplBase'. This more closely matches the organization of
SmallVector and should allow introducing a SmallPtrSetImpl which serves
the same purpose as SmallVectorImpl: isolating the element type from the
particular small size chosen. This in turn allows a lot of
simplification of APIs by not coding them against a specific small size
which is rarely needed.

llvm-svn: 200687
2014-02-03 11:24:18 +00:00
Peter Collingbourne ad141abd63 Hopefully fix mingw32 bots.
For some reason this symbolic constant isn't defined in some versions of mingw32.

llvm-svn: 200605
2014-02-01 02:42:20 +00:00
Peter Collingbourne f7d4101156 Introduce llvm::sys::path::home_directory.
This will be used by the line editor library to derive a default path to
the history file.

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

llvm-svn: 200594
2014-01-31 23:46:06 +00:00
Jordan Rose c25b0c7e12 [CommandLine] Aliases require an value if their target requires a value.
This can still be overridden by explicitly setting a value requirement on the
alias option, but by default it should be the same.

PR18649

llvm-svn: 200407
2014-01-29 18:54:17 +00:00
Mark Seaborn efe919ff8a Remove unnecessary call to pthread_mutexattr_setpshared()
The default value of this attribute is PTHREAD_PROCESS_PRIVATE, so
there's no point in calling pthread_mutexattr_setpshared() to set
that.

See: http://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_mutexattr_getpshared.html

This removes some ifdefs that tend to need to be extended for other
platforms (e.g. for NaCl).

Note that this call was in the first implementation of Mutex, added in
r22403, so it doesn't appear to have been added in response to a
performance problem.

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

llvm-svn: 200360
2014-01-29 00:20:44 +00:00
Mark Seaborn 8d5b0e2f8f Fix the "#ifndef HAVE_SYS_WAIT_H" code path in Program.inc to compile
Without this fix, WaitResult is not defined.

llvm-svn: 200259
2014-01-27 22:53:07 +00:00
Alp Toker 17d4e98e73 Roll back the ConstStringRef change for now
There are a couple of interesting things here that we want to check over
(particularly the expecting asserts in StringRef) and get right for general use
in ADT so hold back on this one. For clang we have a workable templated
solution to use in the meanwhile.

This reverts commit r200187.

llvm-svn: 200194
2014-01-27 05:24:39 +00:00
Alp Toker 042f41b047 StringRef: Extend constexpr capabilities and introduce ConstStringRef
(1) Add llvm_expect(), an asserting macro that can be evaluated as a constexpr
    expression as well as a runtime assert or compiler hint in release builds. This
    technique can be used to construct functions that are both unevaluated and
    compiled depending on usage.

(2) Update StringRef using llvm_expect() to preserve runtime assertions while
    extending the same checks to static asserts in C++11 builds that support the
    feature.

(3) Introduce ConstStringRef, a strong subclass of StringRef that references
    compile-time constant strings. It's convertible to, but not from, ordinary
    StringRef and thus can be used to add compile-time safety to various interfaces
    in LLVM and clang that only accept fixed inputs such as diagnostic format
    strings that tend to get misused.

llvm-svn: 200187
2014-01-27 04:07:17 +00:00
Alp Toker cb40291100 Fix known typos
Sweep the codebase for common typos. Includes some changes to visible function
names that were misspelt.

llvm-svn: 200018
2014-01-24 17:20:08 +00:00
David Woodhouse 71d15edaf3 [x86] Support i386-*-*-code16 triple for emitting 16-bit code
llvm-svn: 199648
2014-01-20 12:02:25 +00:00
NAKAMURA Takumi 6acf320a99 [CMake] llvm_process_sources: Introduce a parameter, ADDITIONAL_HEADERS.
ADDITIONAL_HEADERS is intended to add header files for IDEs as hint.

For example:
  add_llvm_library(LLVMSupport
    Host.cpp
    ADDITIONAL_HEADERS
      Unix/Host.inc
      Windows/Host.inc
    )

llvm-svn: 199639
2014-01-20 10:20:23 +00:00
Saleem Abdulrasool 196c3212ba ARM: update build attributes for ABI r2.09
Update names for the names as per the current ABI errata.  Mark deprecated tags
as such.

llvm-svn: 199576
2014-01-19 08:25:35 +00:00
Saleem Abdulrasool 278a9f4336 Move ARM build attributes into Support
This moves the ARM build attributes definitions and support routines into the
Support library.  The support routines simply permit the conversion of the value
to and from a string representation.

The movement is prompted in order to permit access to the constants and string
representations from readobj in order to facilitate decoding of the attributes
section.

llvm-svn: 199575
2014-01-19 08:25:27 +00:00
NAKAMURA Takumi 4961f7a888 raw_fd_ostream: Don't change STDERR to O_BINARY, or w*printf() (in assert()) would barf wide chars after llvm::errs().
llvm-svn: 199057
2014-01-12 16:14:24 +00:00
NAKAMURA Takumi 79addb8d8f raw_stream formatter: [Win32] Use std::signbit() if available, instead of _fpclass().
FIXME: It should be generic to C++11. For now, it is dedicated to mingw-w64.
llvm-svn: 199052
2014-01-12 14:44:46 +00:00
Rafael Espindola 81e7fd011f Use the simpler version of sys::fs::remove when possible.
llvm-svn: 198958
2014-01-10 21:40:29 +00:00
Rafael Espindola 78dcc03c37 Remove remove_all. A compiler has no need for recursively deleting a directory.
llvm-svn: 198955
2014-01-10 20:36:42 +00:00
Chandler Carruth 10b0915f85 Try to fix the windows build. The comments in other files don't seem to
be quite accurate. =]

llvm-svn: 198690
2014-01-07 12:37:13 +00:00
Chandler Carruth 8a8cd2bab9 Re-sort all of the includes with ./utils/sort_includes.py so that
subsequent changes are easier to review. About to fix some layering
issues, and wanted to separate out the necessary churn.

Also comment and sink the include of "Windows.h" in three .inc files to
match the usage in Memory.inc.

llvm-svn: 198685
2014-01-07 11:48:04 +00:00
David Blaikie 7a2380486c Make llvm::Regex non-copyable but movable.
Based on a patch by Maciej Piechotka.

llvm-svn: 198334
2014-01-02 19:04:59 +00:00
Alp Toker 1bcdd6ae02 Silence g++ 4.9 build issue
lib/Support/ThreadLocal.cpp:53:15: error: typedef 'SIZE_TOO_BIG' locally defined but not used [-Werror=unused-local-typedefs]
   typedef int SIZE_TOO_BIG[sizeof(pthread_key_t) <= sizeof(data) ? 1 : -1];

Done the C++11 way, switching on and using LLVM_STATIC_ASSERT() instead of LLVM_ATTRIBUTE_UNUSED.

llvm-svn: 198255
2013-12-31 03:16:55 +00:00
Chandler Carruth 87c3a0cfa6 Use two variables here rather than reusing (and abusing) one. This is
much more clear to me. I meant to make this change before committing the
original patch, but forgot to merge it in. Sorry.

llvm-svn: 198069
2013-12-27 04:44:35 +00:00
Chandler Carruth f8c5281c87 Introduce a simple line-by-line iterator type into the Support library.
This is an iterator which you can build around a MemoryBuffer. It will
iterate through the non-empty, non-comment lines of the buffer as
a forward iterator. It should be small and reasonably fast (although it
could be made much faster if anyone cares, I don't really...).

This will be used to more simply support the text-based sample
profile file format, and is largely based on the original patch by
Diego. I've re-worked the style of it and separated it from the work of
producing a MemoryBuffer from a file which both simplifies the interface
and makes it easier to test.

The style of the API follows the C++ standard naming conventions to fit
in better with iterators in general, much like the Path and FileSystem
interfaces follow standard-based naming conventions.

llvm-svn: 198068
2013-12-27 04:28:57 +00:00
Benjamin Kramer 2151e63c71 Dwarf: Fix a copy-paste bug.
This tag isn't emitted by any compiler at the moment. PR18306.

llvm-svn: 197877
2013-12-22 10:23:23 +00:00
Kai Nacke b38bf9626a Add support for krait cpu in llvm::sys::getHostCPUName()
Recently, support for krait cpu was added. This commit extends getHostCPUName()
to return krait as cpu for the APQ8064 (a Krait 300).

llvm-svn: 197792
2013-12-20 09:24:13 +00:00
Hans Wennborg fabf8bfdea Make sys::ThreadLocal<> zero-initialized on non-thread builds (PR18205)
According to the docs, ThreadLocal<>::get() should return NULL
if no object has been set. This patch makes that the case also for non-thread
builds and adds a very basic unit test to check it.

(This was causing PR18205 because PrettyStackTraceHead didn't get zero-
initialized and we'd crash trying to read past the end of that list. We didn't
notice this so much on Linux since we'd crash after printing all the entries,
but on Mac we print into a SmallString, and would crash before printing that.)

llvm-svn: 197718
2013-12-19 20:32:44 +00:00
Adrian Prantl 31631e4a47 Pull in a couple of new constants from the upcoming DWARF 5 standard.
llvm-svn: 197611
2013-12-18 21:48:14 +00:00
Quentin Colombet 382b135d92 Revert r197438 and r197447 until we figure out how to avoid circular dependency at link time
llvm-svn: 197451
2013-12-17 01:19:59 +00:00
Quentin Colombet 0caf4fef47 [LLVM Diagnostic Capabilities] Remove useless includes from
DiagnosticPrinter.cpp.
These was creating a link time dependencies of IR on CodeGen and Analysis.

Part of <rdar://problem/15515174>

llvm-svn: 197447
2013-12-17 00:56:19 +00:00
Quentin Colombet 66673f4075 Add warning capabilities in LLVM.
The patch adds a new LLVMContext::diagnose that can be used to communicate to
the front-end, if any, that something of interest happened.
The diagnostics are supported by a new abstraction, the DiagnosticInfo class.
The base class contains the following information:
- The kind of the report: What this is about.
- The severity of the report: How bad this is.

This patch also adds 2 classes:
- DiagnosticInfoInlineAsm: For inline asm reporting. Basically, this diagnostic
will be used to switch to the new diagnostic API for LLVMContext::emitError.
- DiagnosticStackSize: For stack size reporting. Comes as a replacement of the
hard coded warning in PEI.

This patch also features dynamic diagnostic identifiers. In other words plugins
can use this infrastructure for their own diagnostics (for more details, see
getNextAvailablePluginDiagnosticKind).

This patch introduces a new DiagnosticHandlerTy and a new DiagnosticContext in
the LLVMContext that should be set by the front-end to be able to map these
diagnostics in its own system.

http://llvm-reviews.chandlerc.com/D2376
<rdar://problem/15515174>

llvm-svn: 197438
2013-12-16 23:22:51 +00:00
Joerg Sonnenberger 8fe41b7319 Recognize EABIHF as environment and use it for RTAPI + VFP.
llvm-svn: 197405
2013-12-16 18:51:28 +00:00
Reid Kleckner 86a8e1e0e4 MemoryBuffer: Increase the alignment of small file buffers to 16
This was manifesting as an LLVM_ASSUME_ALIGNED() failure in an ELF debug
info test when building LLVM with clang in the Microsoft C++ ABI.

llvm-svn: 197401
2013-12-16 18:18:12 +00:00
Michael Gottesman 8f17dccdcb [block-freq] Add a right shift to BlockFrequency that saturates at 1.
llvm-svn: 197302
2013-12-14 02:24:22 +00:00
Michael Gottesman 8c79ee409a [block-freq] Remove old BlockFrequency entry frequency and printing code.
llvm-svn: 197297
2013-12-14 00:57:18 +00:00
Michael Gottesman e1fad2b560 Remove APInt::extractBit since it is already implemented via operator[]. Change tests for extractBit to test operator[].
llvm-svn: 197277
2013-12-13 22:00:19 +00:00
Michael Gottesman 4497d963fb [block-freq] Add the APInt method extractBit.
llvm-svn: 197271
2013-12-13 20:47:34 +00:00
Rafael Espindola dfc1470d2d Fix pr18235.
The cpp backend is not a reasonable fallback for a missing target. It is a
very special backend, so it is reasonable to use it only if explicitly
requested.

While at it, simplify the interface a bit.

llvm-svn: 197241
2013-12-13 16:05:32 +00:00
Rafael Espindola b75ea019ea Fix Typo.
llvm-svn: 197168
2013-12-12 16:17:40 +00:00
Rafael Espindola 1f58e4dc11 Convert the other getHostByName implementations to StringRef.
llvm-svn: 197166
2013-12-12 16:10:48 +00:00
Rafael Espindola 74f444cde5 Return a StringRef from getHostCPUName.
llvm-svn: 197158
2013-12-12 15:45:32 +00:00
Alp Toker d0d1a74ac9 Add missing escape characters to the new Regex::escape() function
The old AddFixedStringToRegEx() it was based on got away with this for the
longest time, but the problem became easy to spot after the cleanup in r197096.

Also add a quick unit test to cover regex escaping.

llvm-svn: 197121
2013-12-12 02:51:58 +00:00
Hans Wennborg 6f4f77b7e9 Expose FileCheck's AddFixedStringToRegEx as Regex::escape
Both FileCheck and clang's -verify need to escape strings for regexes,
so let's expose this as a utility in the Regex class.

llvm-svn: 197096
2013-12-12 00:06:41 +00:00
Alp Toker b30f01ee42 Build fix for Android NDK which has neither futimes nor futimens
Based on a patch by Neil Henning!

llvm-svn: 197045
2013-12-11 15:42:33 +00:00
Tim Northover 3e8df696ea Darwin: update default iOS version to 5.0
Defaulting to iOS 3.0 when LLVM has to guess the version is no longer a useful
option and can give surprising results (like tail calls being disabled).

5.0 seems like a reasonable compromise as a platform that's still interesting
to some people.

rdar://problem/15567348

llvm-svn: 196912
2013-12-10 11:53:16 +00:00
Sylvestre Ledru 21e67472c2 Improve the detection of the path
Summary:
When clang is used under GNU/Linux in a chroot without /proc mount, it falls
back on the BSD method. However, since the buf variable is used twice
and fails with snprintf to produce the correct path.

When called as relatived (ie ./clang), it was failing with:
 "" -cc1 [...] -x c++ x.cc
error: unable to execute command: Executable "" doesn't exist!


I also took the opportunity to simply the code (the first arg of test_dir
was useless).

Reviewers: rafael

Reviewed By: rafael

CC: cfe-commits

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

llvm-svn: 196791
2013-12-09 16:27:00 +00:00
Justin Bogner 67ae9912a6 Support: Fix handling of args that begin with @ but aren't files
Command line arguments that begin with @ but aren't a path to an
existing file currently cause later @file arguments to be ignored.

Correctly skip over these arguments instead of trying to read a
non-existent file 20 times and giving up.

Since the problem manifests in the clang driver, the test is in that
repository.

Fixes rdar://problem/15590906

llvm-svn: 196620
2013-12-06 22:56:19 +00:00
Alp Toker f907b891da Correct word hyphenations
This patch tries to avoid unrelated changes other than fixing a few
hyphen-related ambiguities and contractions in nearby lines.

llvm-svn: 196471
2013-12-05 05:44:44 +00:00
Reid Kleckner 7c5fdaf1c8 Return true on success in cl::ExpandResponseFiles
This fixes a logic bug pointed out by Juraj Ivancic.

No behavior change because none of the in-tree clients of
cl::ExpandResponseFiles check the return value.  In this case, the
@prefixed arguments are left in the command line.  Downstream command
line processing has the opportunity to emit errors about it, so this
isn't that bad.

llvm-svn: 196306
2013-12-03 19:13:18 +00:00
Chandler Carruth 480f5d265a Lift self-copy protection up to the header file and add self-move
protection to the same layer.

This is in line with Howard's advice on how best to handle self-move
assignment as he explained on SO[1]. It also ensures that implementing
swap with move assignment continues to work in the case of self-swap.

[1]: http://stackoverflow.com/questions/9322174/move-assignment-operator-and-if-this-rhs

llvm-svn: 195705
2013-11-26 00:54:44 +00:00
Chandler Carruth 2664317b66 Fix a self-memcpy which only breaks under Valgrind's memcpy
implementation. Silliness, but it'll be a trivial performance
optimization. This should clear up a failure on the vg_leak bot.

llvm-svn: 195704
2013-11-26 00:44:36 +00:00
Benjamin Kramer 583b00e60a Make helper function static.
llvm-svn: 195650
2013-11-25 15:40:24 +00:00
Tim Northover 89ccb616bd X86: enable AVX2 under Haswell native compilation
Patch by Adam Strzelecki

llvm-svn: 195632
2013-11-25 09:52:59 +00:00
Nick Kledzik 4761c60eef revert r194655
llvm-svn: 195285
2013-11-21 00:20:10 +00:00
Chandler Carruth c74010df48 Make the moved-from SmallPtrSet be a valid, empty, small-state object.
Enhance the tests to actually require moves in C++11 mode, in addition
to testing the moved-from state. Further enhance the tests to cover
copy-assignment into a moved-from object and moving a large-state
object. (Note that we can't really test small-state vs. large-state as
that isn't an observable property of the API really.) This should finish
addressing review on r195239.

llvm-svn: 195261
2013-11-20 18:29:56 +00:00
Chandler Carruth 55758e9691 Give SmallPtrSet move semantics when we have R-value references.
Somehow, this ADT got missed which is moderately terrifying considering
the efficiency of move for it.

The code to implement move semantics for it is pretty horrible
currently but was written to reasonably closely match the rest of the
code. Unittests that cover both copying and moving (at a basic level)
added.

llvm-svn: 195239
2013-11-20 11:14:33 +00:00
John Thompson 48e018a314 YAML I/O - Added default trait support for std:string. Making another attempt at this, this time doing a clean build on Linux, and running the LLVM, clang, and extra tests, to try to make sure there's no problems.
llvm-svn: 195134
2013-11-19 17:28:21 +00:00
Juergen Ributzka d12ccbd343 [weak vtables] Remove a bunch of weak vtables
This patch removes most of the trivial cases of weak vtables by pinning them to
a single object file. The memory leaks in this version have been fixed. Thanks
Alexey for pointing them out.

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

Reviewed by Andy

llvm-svn: 195064
2013-11-19 00:57:56 +00:00
Aaron Ballman 69c55edb18 Checking for a return value with FormatMessage; if the call fails, there's no guarantee that the buffer will be non-null.
llvm-svn: 195019
2013-11-18 17:43:22 +00:00
Aaron Ballman 5de2378f7e Fixing a possible memory leak from a failing realloc() call.
llvm-svn: 195018
2013-11-18 17:33:32 +00:00
Alexander Kornienko 681e37cbf6 Recover gracefully when deserializing invalid YAML input.
Fixes http://llvm.org/PR16221, http://llvm.org/PR15927
Phabricator: http://llvm-reviews.chandlerc.com/D1236

Patch by Andrew Tulloch!

llvm-svn: 195016
2013-11-18 15:50:04 +00:00
Alexey Samsonov 49109a279c Revert r194865 and r194874.
This change is incorrect. If you delete virtual destructor of both a base class
and a subclass, then the following code:
  Base *foo = new Child();
  delete foo;
will not cause the destructor for members of Child class. As a result, I observe
plently of memory leaks. Notable examples I investigated are:
ObjectBuffer and ObjectBufferStream, AttributeImpl and StringSAttributeImpl.

llvm-svn: 194997
2013-11-18 09:31:53 +00:00
Michael Gottesman 4d078a3d6f [block-freq] Add BlockFrequency::scale that returns a remainder from the division and make the private scale in BlockFrequency more performant.
This change is the first in a series of changes improving LLVM's Block
Frequency propogation implementation to not lose probability mass in
branchy code when propogating block frequency information from a basic
block to its successors. This patch is a simple infrastructure
improvement that does not actually modify the block frequency
algorithm. The specific changes are:

1. Changes the division algorithm used when scaling block frequencies by
branch probabilities to a short division algorithm. This gives us the
remainder for free as well as provides a nice speed boost. When I
benched the old routine and the new routine on a Sandy Bridge iMac with
disabled turbo mode performing 8192 iterations on an array of length
32768, I saw ~600% increase in speed in mean/median performance.

2. Exposes a scale method that returns a remainder. This is important so
we can ensure that when we scale a block frequency by some branch
probability BP = N/D, the remainder from the division by D can be
retrieved and propagated to other children to ensure no probability mass
is lost (more to come on this).

llvm-svn: 194950
2013-11-17 03:25:24 +00:00
Jim Grosbach 664d148a92 X86: Encode the 'h' cpu subtype in the MachO header for x86.
llvm-svn: 194906
2013-11-16 00:52:57 +00:00
Juergen Ributzka dbedae89b9 [weak vtables] Remove a bunch of weak vtables
This patch removes most of the trivial cases of weak vtables by pinning them to
a single object file.

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

Reviewed by Andy

llvm-svn: 194865
2013-11-15 22:34:48 +00:00
Rui Ueyama e448f9e418 Path: Recognize COFF import library file magic.
Summary: Make identify_magic to recognize COFF import file.

Reviewers: Bigcheese

CC: llvm-commits

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

llvm-svn: 194852
2013-11-15 21:22:02 +00:00
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