- Dec 06, 2016
-
-
Stephan T. Lavavej authored
[libcxx] [test] D27269: Fix MSVC x64 warning C4267 "conversion from 'size_t' to 'int' [or 'unsigned int'], possible loss of data", part 3/4. test/std/containers/sequences/vector.bool/copy.pass.cpp test/std/containers/sequences/vector.bool/copy_alloc.pass.cpp test/std/containers/sequences/vector/vector.cons/copy.pass.cpp test/std/containers/sequences/vector/vector.cons/copy_alloc.pass.cpp Change "unsigned s = x.size();" to "typename C::size_type s = x.size();" because that's what it returns. test/std/strings/basic.string/string.cons/pointer_alloc.pass.cpp Include <cstddef>, then change "unsigned n = T::length(s);" to "std::size_t n = T::length(s);" because that's what char_traits returns. test/std/strings/basic.string/string.cons/substr.pass.cpp Change unsigned to typename S::size_type because that's what str.size() returns. test/std/utilities/template.bitset/bitset.cons/ull_ctor.pass.cpp This was needlessly truncating std::size_t to unsigned. It's being used to compare and initialize std::size_t. llvm-svn: 288753
-
Stephan T. Lavavej authored
[libcxx] [test] D27268: Fix MSVC x64 warning C4267 "conversion from 'size_t' to 'int' [or 'unsigned int'], possible loss of data", part 2/4. Use static_cast<int> when storing size_t in int (or passing size_t to int). Also, remove a spurious semicolon in test/support/archetypes.hpp. test/support/count_new.hpp Additionally, change data members (and parameters) to size_t. llvm-svn: 288752
-
Stephan T. Lavavej authored
[libcxx] [test] D27267: Fix MSVC x64 warning C4267 "conversion from 'size_t' to 'int' [or 'unsigned int'], possible loss of data", part 1/4. Replace "int n = str_.size();" with "int n = static_cast<int>(str_.size());". int is the correct type to use, because we're eventually calling "base::pbump(n+1);" where base is std::basic_streambuf. N4606 27.6.3.3.3 [streambuf.put.area]/4 declares: "void pbump(int n);" llvm-svn: 288751
-
Stephan T. Lavavej authored
llvm-svn: 288750
-
Stephan T. Lavavej authored
Various changes: test/std/algorithms/alg.sorting/alg.merge/inplace_merge.pass.cpp This is comparing value_type to unsigned. value_type is sometimes int and sometimes struct S (implicitly constructible from int). static_cast<value_type>(unsigned) silences the warning and doesn't do anything bad (as the values in question are small). test/std/algorithms/alg.sorting/alg.nth.element/nth_element_comp.pass.cpp This is comparing an int remote-element to size_t. The values in question are small and non-negative, so either type is fine. I think that converting int to size_t is marginally better here than the reverse. test/std/containers/sequences/deque/deque.cons/size.pass.cpp DefaultOnly::count is int (and non-negative). When comparing to unsigned, use static_cast<unsigned>. test/std/strings/basic.string/string.access/index.pass.cpp We're comparing char to '0' through '9', but formed with the type size_t. Add static_cast<char>. test/std/utilities/template.bitset/bitset.cons/ull_ctor.pass.cpp Include <cstddef> for pedantic correctness (this test was already mentioning std::size_t). "v[i] == (i & 1)" was comparing bool to size_t. Saying "v[i] == ((i & 1) != 0)" smashes the RHS to bool. llvm-svn: 288749
-
Stephan T. Lavavej authored
Change "unsigned n = 0;" to "int n = 0;". It's being compared to int elements and ptrdiff_t distances. test/std/containers/sequences/forwardlist/forwardlist.cons/move.pass.cpp This one's a little special, but not really. "*i == n" is comparing MoveOnly to n. MoveOnly is implicitly constructible from int, so int is the correct type to use here. llvm-svn: 288748
-
Stephan T. Lavavej authored
Add static_cast<int>. In these cases, the values are guaranteed to be small-ish, and they're being compared to int elements. test/std/containers/sequences/deque/deque.capacity/access.pass.cpp Use int instead of unsigned to iterate from 0 to 10. llvm-svn: 288747
-
Stephan T. Lavavej authored
Add static_cast<std::size_t> to more comparisons. (Performed manually, unlike part 8/12.) Also, include <cstddef> when it wasn't already being included. llvm-svn: 288746
-
Stephan T. Lavavej authored
Add static_cast<std::size_t> when comparing distance() to size(). These replacements were performed programmatically with regex_replace(): const vector<pair<regex, string>> reg_fmt = { { regex(R"(assert\((\w+)\.size\(\) == std::distance\((\w+, \w+)\)\))"), "assert($1.size() == static_cast<std::size_t>(std::distance($2)))" }, { regex(R"(assert\(distance\((\w+\.begin\(\), \w+\.end\(\))\) == (\w+)\.size\(\)\))"), "assert(static_cast<std::size_t>(distance($1)) == $2.size())" }, { regex(R"(assert\(std::distance\((\w+\.\w*begin\(\), \w+\.\w*end\(\))\) == (\w+)\.size\(\)\))"), "assert(static_cast<std::size_t>(std::distance($1)) == $2.size())" }, }; Also, include <cstddef> when it wasn't already being included. llvm-svn: 288745
-
Matt Arsenault authored
The structured CFG is just an aid to inserting exec mask modification instructions, once that is done we don't really need it anymore. We also do not analyze blocks with terminators that modify exec, so this should only be impacting true branches. llvm-svn: 288744
-
Eric Fiselier authored
llvm-svn: 288743
-
Bob Haarman authored
revert inadvertedly introduced build break Summary: r288722 introduced a build break due some code that should not have been part of the commit. This change removes the offending code. Reviewers: davide, ruiu Differential Revision: https://reviews.llvm.org/D27435 llvm-svn: 288742
-
Richard Smith authored
Recover better from an incompatible .pcm file being provided by -fmodule-file=. We try to include the headers of the module textually in this case, still enforcing the modules semantic rules. In order to make that work, we need to still track that we're entering and leaving the module. Also, if the module was also marked as unavailable (perhaps because it was missing a file), we shouldn't mark the module unavailable -- we don't need the module to be complete if we're going to enter it textually. llvm-svn: 288741
-
Richard Trieu authored
llvm-svn: 288740
-
Richard Smith authored
llvm-svn: 288738
-
Richard Smith authored
import can't appear here" diagnostic if an already-visible module is textually entered (because we have the module map but not the AST file) within a function/namespace scope. llvm-svn: 288737
-
Eric Fiselier authored
The Clang modules implementation breaks enough that libc++ needs an easy way to enable/disable using modules on the Zorg builders. Editing Zorg itself requires a buildmaster restart which only happens weekly. This patch allows LIBCXX_USE_MODULES to be used to enable/disable the feature, allowing the buildslave to disable it as need be. llvm-svn: 288736
-
Eric Fiselier authored
llvm-svn: 288735
-
Weiming Zhao authored
clang -target arm deprecated-asm.s -c deprecated-asm.s:30:9: warning: use of SP or PC in the list is deprecated stmia r4!, {r12-r14} We have to have an option what can disable it. Patched by Yin Ma! Reviewers: joey, echristo, weimingz Subscribers: llvm-commits, aemerson Differential Revision: https://reviews.llvm.org/D27219 llvm-svn: 288734
-
Eric Fiselier authored
llvm-svn: 288733
-
Richard Trieu authored
New default warning that triggers when an unsigned zero is used in a call to std::max. For unsigned values, zero is the minimum value, so any call to std::max is always equal to the other value. A common pattern was to take the max of zero and the difference of two unsigned values, not taking into account that unsigned values wrap around below zero. This warning also emits a note with a fixit hint to remove the zero and call to std::max. llvm-svn: 288732
-
Kostya Serebryany authored
[libFuzzer] refactor the code to allow collecting features in different ways. Also initialize a couple of Fuzzer:: members that might have been used uninitialized :( llvm-svn: 288731
-
Eric Fiselier authored
llvm-svn: 288730
-
Serge Rogatch authored
Summary: Currently test XRay-aarch64-linux::patching-unpatching.cc sometimes passes, sometimes fails. This is an attempt to fix it by handling better the situations when both `__arm__` and `__aarch64__` are defined. Reviewers: dberris, rengolin Subscribers: llvm-commits, iid_iunknown, aemerson, rengolin, dberris Differential Revision: https://reviews.llvm.org/D27421 llvm-svn: 288729
-
Eric Fiselier authored
This patch overhalls the libc++ test format/configuration in order to fully support modules. By "fully support" I mean get almost all of the tests passing. The main hurdle for doing this is handling tests that `#define _LIBCPP_FOO` macros to test a different configuration. This patch deals with these tests in the following ways: 1. For tests that define single `_LIBCPP_ABI_FOO` macros have been annotated with `// MODULES_DEFINES: _LIBCPP_ABI_FOO`. This allows the test suite to define the macro on the command line so it uses a different set of modules. 2. Tests for libc++'s debug mode (which define custom `_LIBCPP_ASSERT`) are automatically detected by the test suite and are compiled and run with modules disabled. This patch also cleans up how the `CXXCompiler` helper class handles enabling/disabling language features. NOTE: This patch uses `LIT` features which were only committed to LLVM today. If this patch breaks running the libc++ tests you probably need to update LLVM. llvm-svn: 288728
-
Tim Northover authored
The function used to finish off PHIs by adding the relevant basic blocks can fail if we're aborting and still don't actually have the needed MachineBasicBlocks. So avoid trying in that case. llvm-svn: 288727
-
Mike Aizatsky authored
llvm-svn: 288726
-
Davide Italiano authored
There are two cases handled here: 1) a branch on undef 2) a switch with an undef condition. Both cases are currently handled by ResolvedUndefsIn. If we have a branch on undef, we force its value to false (which is trivially foldable). If we have a switch on undef, we force to the first constant (which is also foldable). llvm-svn: 288725
-
- Dec 05, 2016
-
-
Davide Italiano authored
llvm-svn: 288724
-
Florian Hahn authored
Summary: x86 is not a valid arch for target triples, but x86_64 and i386 are. Reviewers: rengolin, silvas Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D26960 llvm-svn: 288723
-
Bob Haarman authored
Summary: The code we use to read PDBs assumed that streams we ask it to read exist, and would read memory outside a vector and crash if this wasn't the case. This would, for example, cause llvm-pdbdump to crash on PDBs generated by lld. This patch handles such cases more gracefully: the PDB reading code in LLVM now reports errors when asked to get a stream that is not present, and llvm-pdbdump will report missing streams and continue processing streams that are present. Reviewers: ruiu, zturner Subscribers: thakis, amccarth Differential Revision: https://reviews.llvm.org/D27325 llvm-svn: 288722
-
Saleem Abdulrasool authored
When emitting RTTI for EH only, we would mark the locally defined (LinkOnceODR) RTTI definition as dllimport, which is incorrect. Ensure that if we are generating the type information for EH only, it is marked as LinkOnceODR and we do not make it dllimport. llvm-svn: 288721
-
Tim Northover authored
When the entry block was empty after arg lowering, we were always placing constants at the end. This is probably hamrless while translating the same block, but horribly wrong once its terminator has been translated. So switch to inserting at the beginning. llvm-svn: 288720
-
Rafael Espindola authored
This test only needs to test the Type (SharedObject), the address of the first PT_LOAD and the presence of PT_DYNAMIC. llvm-svn: 288719
-
Matt Arsenault authored
llvm-svn: 288718
-
Tim Northover authored
llvm-svn: 288717
-
Rafael Espindola authored
It only needs to find how many are local. llvm-svn: 288716
-
Matt Arsenault authored
Fix return before else, check types for selecting fltSemantics, refactor immediate checks. llvm-svn: 288715
-
Eugene Zelenko authored
[IR] Fix some Clang-tidy modernize-use-equals-delete and Include What You Use warnings; other minor fixes (NFC). Also remove obsolete comment from CommandLine.h spotted by Malcolm Parsons. llvm-svn: 288714
-
Tim Northover authored
llvm-svn: 288713
-