Commit Graph

1447 Commits

Author SHA1 Message Date
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
Hans Wennborg
61760cece0 BumpPtrAllocator: remove 'no slabs allocated yet' check
We already handle the no-slabs case when checking whether the current slab
is large enough: if no slabs have been allocated, CurPtr and End are both 0.
alignPtr(0), will still be 0, and so "if (Ptr + Size <= End)" fails.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@215841 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-17 18:31:18 +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
c73a086233 Simplify memory ownership with std::unique_ptr.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@215567 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-13 18:59:01 +00:00
Rafael Espindola
d6448b21bf Simplify ownership with std::unique_ptr. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@215566 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-13 18:49:01 +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
Benjamin Foster
f58eecfbbb Test commit, remove trailing whitespace
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@215556 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-13 16:11:50 +00:00
Aaron Ballman
3c02eb1b96 Asserting that the call to chdir succeeds in this test. Fixes some -Wunused-result warnings.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@215539 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-13 11:17:41 +00:00
David Blaikie
8ebea0132d Fix -Wsign-compare warnings
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@215483 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-12 23:23:05 +00:00
Reid Kleckner
151f8cef74 APInt: Make self-move-assignment a no-op to fix stage3 clang-cl
It's not clear what the semantics of a self-move should be.  The
consensus appears to be that a self-move should leave the object in a
moved-from state, which is what our existing move assignment operator
does.

However, the MSVC 2013 STL will perform self-moves in some cases.  In
particular, when doing a std::stable_sort of an already sorted APSInt
vector of an appropriate size, one of the merge steps will self-move
half of the elements.

We don't notice this when building with MSVC, because MSVC will not
synthesize the move assignment operator for APSInt.  Presumably MSVC
does this because APInt, the base class, has user-declared special
members that implicitly delete move special members.  Instead, MSVC
selects the copy-assign operator, which defends against self-assignment.
Clang, on the other hand, selects the move-assign operator, and we get
garbage APInts.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@215478 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-12 22:01:39 +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
Rafael Espindola
93c1316b70 Fix expected windows result.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@215267 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-09 00:37:05 +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
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
Eric Christopher
aa5b9c0f6f Temporarily Revert "Nuke the old JIT." as it's not quite ready to
be deleted. This will be reapplied as soon as possible and before
the 3.6 branch date at any rate.

Approved by Jim Grosbach, Lang Hames, Rafael Espindola.

This reverts commits r215111, 215115, 215116, 215117, 215136.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@215154 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-07 22:02:54 +00:00
Rafael Espindola
7b232e2bb6 fix configure+make build
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@215116 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-07 14:38:49 +00:00
Rafael Espindola
875710a2fd Nuke the old JIT.
I am sure we will be finding bits and pieces of dead code for years to
come, but this is a good start.

Thanks to Lang Hames for making MCJIT a good replacement!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@215111 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-07 14:21:18 +00:00
Andrew Trick
e85047ea0a Fix SmallDenseMap assignment operator.
Self assignment would lead to buckets of garbage, causing quadratic probing to hang.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@214790 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-04 22:18:25 +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
1b23e26921 BitcodeTests: Fix LINK_COMPONENTS.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@214598 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-02 00:12:54 +00:00
Duncan P. N. Exon Smith
99a43c2c42 IR: Add Value::reverseUseList()
I'm going to use this to improve `verify-uselistorder`.  Part of PR5680.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@214594 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-01 23:28:49 +00:00
Duncan P. N. Exon Smith
cf8b959e8d BitcodeReader: Fix some BlockAddress forward reference corner cases
`BlockAddress`es are interesting in that they can reference basic blocks
from *outside* the block's function.  Since basic blocks are not global
values, this presents particular challenges for lazy parsing.

One corner case was found in PR11677 and fixed in r147425.  In that
case, a global variable references a block address.  It's necessary to
load the relevant function to resolve the forward reference before doing
anything with the module.

By inspection, I found (and have fixed here) two other cases:

  - An instruction from one function references a block address from
    another function, and only the first function is lazily loaded.

    I fixed this the same way as PR11677: by eagerly loading the
    referenced function.

  - A function whose block address is taken is dematerialized, leaving
    invalid references to it.

    I fixed this by refusing to dematerialize functions whose block
    addresses are taken (if you have to load it, you can't unload it).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@214559 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-01 21:11:34 +00:00
Duncan P. N. Exon Smith
fc15e8a60f Try to fix configure+make after r214556
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@214558 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-01 21:06:59 +00:00
Duncan P. N. Exon Smith
2e9b60aea8 Rewrite BitReaderTest, NFC
Rewrite the single unit test in `BitReaderTest` so that it's easier to
add more tests.

  - Parse from an assembly string rather than using API.
  - Use more helper functions.
  - Use a separate context for the module on the other side.

Aside from relying on the assembly parser, there's no functionality
change intended.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@214556 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-01 21:01:04 +00:00
Manman Ren
807538b567 [Debug Info] add DISubroutineType and its creation takes DITypeArray.
DITypeArray is an array of DITypeRef, at its creation, we will create
DITypeRef (i.e use the identifier if the type node has an identifier).

This is the last patch to unique the type array of a subroutine type.

rdar://17628609


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@214132 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-28 22:24:06 +00:00
Chandler Carruth
8e704b16f1 [ADT] Add a remarkbly useful little helper routine to ArrayRef for
checking whether the ArrayRef is equal to an explicit list of arguments.

This is particularly easy to implement even without variadic templates
because ArrayRef happens to be homogeneously typed. As a consequence we
can use a "clever" wrapper type and default arguments to capture in
a single method many arguments as well as *how many* arguments the user
specified.

Thanks to Dave Blaikie for helping me pull together this little helper.
Suggestions for how to improve or generalize it are of course welcome.
I'll be using it immediately in my follow-up patch. =D

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@214041 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-27 01:11:19 +00:00
NAKAMURA Takumi
e0b5c10bf6 IR/UseTest.cpp: Avoid std::to_string() to appease mingw32 bot.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@213994 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-26 00:45:30 +00:00
Duncan P. N. Exon Smith
cf3794498e Fix r213824 on windows
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@213866 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-24 15:16:23 +00:00
Hal Finkel
2c7c54c86c AA metadata refactoring (introduce AAMDNodes)
In order to enable the preservation of noalias function parameter information
after inlining, and the representation of block-level __restrict__ pointer
information (etc.), additional kinds of aliasing metadata will be introduced.
This metadata needs to be carried around in AliasAnalysis::Location objects
(and MMOs at the SDAG level), and so we need to generalize the current scheme
(which is hard-coded to just one TBAA MDNode*).

This commit introduces only the necessary refactoring to allow for the
introduction of other aliasing metadata types, but does not actually introduce
any (that will come in a follow-up commit). What it does introduce is a new
AAMDNodes structure to hold all of the aliasing metadata nodes associated with
a particular memory-accessing instruction, and uses that structure instead of
the raw MDNode* in AliasAnalysis::Location, etc.

No functionality change intended.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@213859 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-24 12:16:19 +00:00
NAKAMURA Takumi
0fe305de89 [CMake] LineEditorTests: Add Support to link_components.
Even if LLVMSupport is added in add_unittests, LLVMSupport may be here as consistency.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@213854 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-24 11:44:33 +00:00
Duncan P. N. Exon Smith
5092384bd3 IR: Add Value::sortUseList()
Add `Value::sortUseList()`, templated on the comparison function to use.

The sort is an iterative merge sort that uses a binomial vector of
already-merged lists to limit the size overhead to `O(1)`.

This is part of PR5680.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@213824 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-24 00:53:19 +00:00
Justin Bogner
8fa83afb83 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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@213125 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-16 08:18:58 +00:00
Duncan P. N. Exon Smith
c12ce2b661 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()`.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@213090 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-15 20:24:56 +00:00
Duncan P. N. Exon Smith
d9ebc5991b 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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@213084 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-15 18:32:30 +00:00
Justin Bogner
f66fc53bc7 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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@212986 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-14 20:53:57 +00:00
NAKAMURA Takumi
a84c1fb652 [CMake] Update libdeps.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@212920 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-14 05:01:53 +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
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
Aaron Ballman
c789ae2345 These should be EXPECT_TRUE, not EXPECT_FALSE. Amends r212415.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@212419 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-06 20:20:02 +00:00
Aaron Ballman
d08df5a1c5 Fixing compile errors related to changes with MemoryBuffer::getFile.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@212415 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-06 19:34:52 +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
David Majnemer
38dbb0292d 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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@212370 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-05 06:12:30 +00:00
Rafael Espindola
7413fefb8b 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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@212248 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-03 02:01:39 +00:00
Rafael Espindola
cca08872b0 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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@212209 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-02 19:49:34 +00:00
Benjamin Kramer
58d452b75a Remove unused typedef. GCC warns about this.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@212105 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-01 15:39:32 +00:00
Aaron Ballman
fbab8b6758 Reverting r211950 -- it did not help resolve the -Wcomment warnings triggered in GCC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211953 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-27 19:52:34 +00:00
Aaron Ballman
704fa86de5 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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211950 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-27 19:05:17 +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