Commit Graph

1415 Commits

Author SHA1 Message Date
Justin Bogner 0c274aed23 unittests: Actually test reverse iterators in Path tests
This re-enables some #if 0'd code (since 2010) in the Path unittests
and makes at least a weak effort at testing sys::path's rbegin/rend.

This change was inspired by some test failures near uses of rbegin and
rend here:

    http://lab.llvm.org:8011/builders/clang-x86_64-linux-vg/builds/3209

The "valgrind was whining" comment looked promising in terms of a
simpler to debug case of the same errors. However, it appears that the
valgrind complaints the comment was referring to are distinct from the
ones in the frontend, since this updated test isn't complaining for me
under valgrind.

In any case, the disabled tests weren't helping anybody.

llvm-svn: 213125
2014-07-16 08:18:58 +00:00
Duncan P. N. Exon Smith f51601c856 ADT: Add MapVector::remove_if
Add a `MapVector::remove_if()` that erases items in bulk in linear time,
as opposed to quadratic time for repeated calls to `MapVector::erase()`.

llvm-svn: 213090
2014-07-15 20:24:56 +00:00
Duncan P. N. Exon Smith db88e31e1a ADT: Fix MapVector::erase()
Actually update the changed indexes in the map portion of `MapVector`
when erasing from the middle.  Add a unit test that checks for this.

Note that `MapVector::erase()` is a linear time operation (it was and
still is).  I'll commit a new method in a moment called
`MapVector::remove_if()` that deletes multiple entries in linear time,
which should be slightly less painful.

llvm-svn: 213084
2014-07-15 18:32:30 +00:00
Justin Bogner 759645ea89 Support: Fix option handling when using cl::Required with aliasopt
Until now, attempting to create an alias of a required option would
complain if the user supplied the alias, because the required option
didn't have a value. Similarly, if you said the alias was required,
then using the base option would complain that the alias wasn't
supplied. Lastly, if you put required on both, *neither* option would
work.

By changning alias to overload addOccurrence and setting cl::Required
on the original option, we can get this to behave in a more useful
way. I've also added a test and updated a user that was getting this
wrong.

llvm-svn: 212986
2014-07-14 20:53:57 +00:00
NAKAMURA Takumi 23b702c8de [CMake] Update libdeps.
llvm-svn: 212920
2014-07-14 05:01:53 +00:00
Argyrios Kyrtzidis 730abd2f4a Move the API and implementation of clang::driver::getARMCPUForMArch() to llvm::Triple::getARMCPUForArch().
Suggested by Eric Christopher.

llvm-svn: 212846
2014-07-11 21:44:54 +00:00
Alexey Samsonov b7dd329f2f 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.

llvm-svn: 212643
2014-07-09 19:40:08 +00:00
Aaron Ballman 586ee604b5 These should be EXPECT_TRUE, not EXPECT_FALSE. Amends r212415.
llvm-svn: 212419
2014-07-06 20:20:02 +00:00
Aaron Ballman e56fe8af86 Fixing compile errors related to changes with MemoryBuffer::getFile.
llvm-svn: 212415
2014-07-06 19:34:52 +00:00
Rafael Espindola adf21f2a56 Update the MemoryBuffer API to use ErrorOr.
llvm-svn: 212405
2014-07-06 17:43:13 +00:00
David Majnemer 45647d8f74 ADT: Add a drop_back() helper to ArrayRef
The slice(N, M) interface is powerful but not concise when wanting to
drop a few elements off of an ArrayRef, fix this by adding a drop_back
method.

llvm-svn: 212370
2014-07-05 06:12:30 +00:00
Rafael Espindola 97de474a36 Invert the MC -> Object dependency.
Now that we have a lib/MC/MCAnalysis, the dependency was there just because
of two helper classes. Move the two over to MC.

This will allow IRObjectFile to parse inline assembly.

llvm-svn: 212248
2014-07-03 02:01:39 +00:00
Rafael Espindola cbc5ac7a7e Move CFG building code to a new lib/MC/MCAnalysis library.
The new library is 150KB on a Release+Asserts build, so it is quiet a bit of
code that regular users of MC don't need to link with now.

llvm-svn: 212209
2014-07-02 19:49:34 +00:00
Benjamin Kramer f2c4baf01b Remove unused typedef. GCC warns about this.
llvm-svn: 212105
2014-07-01 15:39:32 +00:00
Aaron Ballman 1c4a478c63 Reverting r211950 -- it did not help resolve the -Wcomment warnings triggered in GCC.
llvm-svn: 211953
2014-06-27 19:52:34 +00:00
Aaron Ballman 7f15ce03af Adding some trailing whitespace after a comment previously ending with \ to ensure that it isn't lexed as a multiline comment. This silences some -Wcomment warnings.
llvm-svn: 211950
2014-06-27 19:05:17 +00:00
Chandler Carruth 39cd216f8f 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.

llvm-svn: 211900
2014-06-27 15:13:01 +00:00
Alp Toker e69170a110 Revert "Introduce a string_ostream string builder facilty"
Temporarily back out commits r211749, r211752 and r211754.

llvm-svn: 211814
2014-06-26 22:52:05 +00:00
Alp Toker 614717388c 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.

llvm-svn: 211749
2014-06-26 00:00:48 +00:00
NAKAMURA Takumi 104e5f67e2 Revert r211287, "Remove support for LLVM runtime multi-threading."
libclang still requires it on cygming, lack of incomplete <mutex>.

llvm-svn: 211592
2014-06-24 13:36:31 +00:00
Duncan P. N. Exon Smith 7ef44be792 Support: Return ScaledNumbers::MaxScale from getQuotient()
Return MaxScale now that it's available.

llvm-svn: 211559
2014-06-24 00:26:08 +00:00
Duncan P. N. Exon Smith eceabc1f7d Support: Extract ScaledNumbers::getSum() and getDifference()
llvm-svn: 211553
2014-06-23 23:15:25 +00:00
Duncan P. N. Exon Smith 68a5ef1a63 Support: Return scale from ScaledNumbers::matchScales()
This will be convenient when extracting `ScaledNumbers::getSum()`.

llvm-svn: 211552
2014-06-23 23:14:51 +00:00
Duncan P. N. Exon Smith aa908fc991 Support: Extract ScaledNumbers::matchScale()
llvm-svn: 211531
2014-06-23 20:40:45 +00:00
David Blaikie 16a9eab399 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é

llvm-svn: 211525
2014-06-23 18:28:53 +00:00
Duncan P. N. Exon Smith 820c3ab3d9 Cleanup r211507
llvm-svn: 211521
2014-06-23 18:08:58 +00:00
Duncan P. N. Exon Smith 0067ff4678 Support: Extract ScaledNumbers::compare()
llvm-svn: 211507
2014-06-23 17:47:40 +00:00
Duncan P. N. Exon Smith 03c2bfc2ef Support: ScaledNumber: Fix inconsistent test names
llvm-svn: 211414
2014-06-20 22:36:09 +00:00
Duncan P. N. Exon Smith 818a8176ea Support: Write ScaledNumbers::getLg{,Floor,Ceiling}()
llvm-svn: 211413
2014-06-20 22:33:40 +00:00
Duncan P. N. Exon Smith 411840d963 Support: Write ScaledNumber::getQuotient() and getProduct()
llvm-svn: 211409
2014-06-20 21:47:47 +00:00
Duncan P. N. Exon Smith d4ea631fec Support: Mark end of namespaces
This convinces clang-format to leave a newline.

llvm-svn: 211406
2014-06-20 21:43:20 +00:00
Zachary Turner c04b892f93 Revert "Replace Execution Engine's mutex with std::recursive_mutex."
This reverts commit 1f502bd9d7d2c1f98ad93a09ffe435e11a95aedd, due to
GCC / MinGW's lack of support for C++11 threading.

It's possible this will go back in after we come up with a
reasonable solution.

llvm-svn: 211401
2014-06-20 21:07:14 +00:00
David Blaikie 7c8d13911a Fix some -Wsign-compare fallout from changing container count member functions to return unsigned instead of bool.
llvm-svn: 211393
2014-06-20 19:54:13 +00:00
Duncan P. N. Exon Smith 2800a3770d Support: Clean up getRounded() tests
llvm-svn: 211337
2014-06-20 02:31:07 +00:00
Duncan P. N. Exon Smith e9e44cd189 Support: Write ScaledNumbers::getAdjusted()
llvm-svn: 211336
2014-06-20 02:31:03 +00:00
Duncan P. N. Exon Smith 9c62dd583b Support: Write ScaledNumbers::getRounded()
Start extracting helper functions out of -block-freq's `UnsignedFloat`
into `Support/ScaledNumber.h` with the eventual goal of moving and
renaming the class to `ScaledNumber`.

The bike shed about names is still being painted, but I'm going with
this for now.

llvm-svn: 211333
2014-06-20 01:30:43 +00:00
Rafael Espindola 393b2b594f 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

llvm-svn: 211328
2014-06-20 00:23:03 +00:00
David Blaikie 37700dc057 Add StringMap::insert(pair) consistent with the standard associative container concept.
Patch by Agustín Bergé.

llvm-svn: 211309
2014-06-19 20:08:56 +00:00
Zachary Turner 9c9710eaf4 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

llvm-svn: 211287
2014-06-19 18:18:23 +00:00
Alp Toker 0b346e6be7 Remove OwningPtr.h and associated tests
llvm::OwningPtr is superseded by std::unique_ptr.

llvm-svn: 211259
2014-06-19 07:25:18 +00:00
Nikola Smiljanic 89e561a63e PR10140 - StringPool's PooledStringPtr has non-const operator== causing bad OR-result.
Mark conversion operator explicit and const qualify comparison operators.

llvm-svn: 211244
2014-06-19 00:26:49 +00:00
Zachary Turner 62ce4e88fd Replace Execution Engine's mutex with std::recursive_mutex.
This change has a bit of a trickle down effect due to the fact that
there are a number of derived implementations of ExecutionEngine,
and that the mutex is not tightly encapsulated so is used by other
classes directly.

Reviewed by: rnk

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

llvm-svn: 211214
2014-06-18 20:17:35 +00:00
Dmitri Gribenko ebdd0a52e1 ConvertUTF tests: remove uses of initializer lists to restore compatibility
with MSVC

llvm-svn: 211093
2014-06-17 09:33:24 +00:00
Zachary Turner b07f1e1fdd Fix build breakage caused by change to ValueMapTest.
llvm-svn: 211083
2014-06-17 00:38:40 +00:00
Zachary Turner 814a49385c Expose ValueMap's mutex type as a typedef instead of a sys::Mutex.
This enables static polymorphism of the mutex type, which is
necessary in order to replace the standard mutex implementation
with a different type.

llvm-svn: 211080
2014-06-17 00:17:38 +00:00
Zachary Turner ccbf3d01f0 Revert r211066, 211067, 211068, 211069, 211070.
These were committed accidentally from the wrong branch before having
a review sign-off.

llvm-svn: 211072
2014-06-16 22:49:41 +00:00
Zachary Turner 0f2c641f86 Remove some more code out into a separate CL.
llvm-svn: 211067
2014-06-16 22:40:17 +00:00
Dmitri Gribenko 1089db0ee6 Support/ConvertUTF: implement U+FFFD insertion according to the recommendation
given in the Unicode spec

That is, replace every maximal subpart of an ill-formed subsequence with one
U+FFFD.

llvm-svn: 211015
2014-06-16 11:09:46 +00:00
Artyom Skrobov e2d6008d2e Adding llvm::sys::swapByteOrder() for the common use-case of byte-swapping a value in place
llvm-svn: 210976
2014-06-14 12:52:55 +00:00
Artyom Skrobov ef5e867f16 Renaming SwapByteOrder() to getSwappedBytes()
The next commit will add swapByteOrder(), acting in-place

llvm-svn: 210973
2014-06-14 11:36:01 +00:00