1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-20 19:42:54 +02:00
Commit Graph

36 Commits

Author SHA1 Message Date
Eugene Zelenko
c35b5b5fe7 [ADT] Partial re-commit of r303383. Fix some Clang-tidy modernize-use-using and Include What You Use warnings; other minor fixes (NFC).
llvm-svn: 305419
2017-06-14 21:42:24 +00:00
Adam Nemet
ee90d5e61d Revert "[ADT] Fix some Clang-tidy modernize-use-using warnings; other minor fixes (NFC)."
This reverts commit r303383.

This breaks the modules-enabled macOS build with:

lib/Support/LockFileManager.cpp:86:7: error: declaration of 'gethostuuid' must be imported from module 'Darwin.POSIX.unistd' before it is required

llvm-svn: 303402
2017-05-19 02:56:37 +00:00
Eugene Zelenko
7351729728 [ADT] Fix some Clang-tidy modernize-use-using warnings; other minor fixes (NFC).
llvm-svn: 303383
2017-05-18 21:27:11 +00:00
Justin Lebar
a85ddd324a Remove LLVM_CONSTEXPR.
Summary: With MSVC 2013 and GCC < 4.8 gone, we can use the "constexpr" keyword.

Reviewers: bkramer, mehdi_amini

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D25901

llvm-svn: 284947
2016-10-23 19:39:16 +00:00
Tim Shen
5026b80249 [ADT] Add relation operators for Optional
Summary: Make Optional's behavior the same as the coming std::optional.

Reviewers: dblaikie

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D23178

llvm-svn: 278397
2016-08-11 20:10:15 +00:00
David Blaikie
bdabca9432 Allow Optionals to be compared to None
This is something like nullopt in std::experimental::optional. Optional
could already be constructed from None, so this seems like an obvious
extension from there.

I have a use in a future patch for Clang, though it may not go that
way/end up used - so this seemed worth committing now regardless.

llvm-svn: 245518
2015-08-19 23:07:27 +00:00
Alexander Kornienko
f993659b8f Revert r240137 (Fixed/added namespace ending comments using clang-tidy. NFC)
Apparently, the style needs to be agreed upon first.

llvm-svn: 240390
2015-06-23 09:49:53 +00:00
Alexander Kornienko
40cb19d802 Fixed/added namespace ending comments using clang-tidy. NFC
The patch is generated using this command:

tools/clang/tools/extra/clang-tidy/tool/run-clang-tidy.py -fix \
  -checks=-*,llvm-namespace-comment -header-filter='llvm/.*|clang/.*' \
  llvm/lib/


Thanks to Eugene Kosov for the original patch!

llvm-svn: 240137
2015-06-19 15:57:42 +00:00
Aaron Ballman
0e19b5d670 Removing LLVM_EXPLICIT, as MSVC 2012 was the last reason for requiring the macro. NFC; LLVM edition.
llvm-svn: 229335
2015-02-15 22:00:20 +00:00
Benjamin Kramer
c1b3bb4e32 Remove LLVM_HAS_VARIADIC_TEMPLATES and all the faux variadic workarounds guarded by it.
We no longer support compilers without variadic template support.

llvm-svn: 229324
2015-02-15 19:34:28 +00:00
Jordan Rose
9f866eaf0a Add an emplace(...) method to llvm::Optional<T>.
This can be used for in-place initialization of non-moveable types.
For compilers that don't support variadic templates, only up to four
arguments are supported. We can always add more, of course, but this
should be good enough until we move to a later MSVC that has full
support for variadic templates.

Inspired by std::experimental::optional from the "Library Fundamentals" C++ TS.
Reviewed by David Blaikie.

llvm-svn: 218732
2014-10-01 02:12:35 +00:00
Aaron Ballman
4f811bbdbf Fixing the build for compilers which do not yet have support for constexpr functions, NFC.
llvm-svn: 218622
2014-09-29 20:27:01 +00:00
Jordan Rose
546768112a Add getValueOr to llvm::Optional<T>.
This takes a single argument convertible to T, and
- if the Optional has a value, returns the existing value,
- otherwise, constructs a T from the argument and returns that.

Inspired by std::experimental::optional from the "Library Fundamentals" C++ TS.

llvm-svn: 218618
2014-09-29 18:56:08 +00:00
Jordan Rose
8e86d4e854 Add "typedef T value_type;" to llvm::Optional<T>.
Inspired by std::experimental::optional from the "Library Fundamentals" C++ TS.

llvm-svn: 218617
2014-09-29 18:56:05 +00:00
Chandler Carruth
df9f7f4aec [C++11] Remove the R-value reference #if usage from the ADT and Support
libraries. It is now always 1 in LLVM builds.

llvm-svn: 202580
2014-03-01 09:27:28 +00:00
Chandler Carruth
87f14b4eec 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
Rafael Espindola
8a0ed6dcd6 Cleanup the simplify_type implementation.
As far as simplify_type is concerned, there are 3 kinds of smart pointers:

* const correct: A 'const MyPtr<int> &' produces a 'const int*'. A
'MyPtr<int> &' produces a 'int *'.
* always const: Even a 'MyPtr<int> &' produces a 'const int*'.
* no const: Even a 'const MyPtr<int> &' produces a 'int*'.

This patch then does the following:

* Removes the unused specializations. Since they are unused, it is hard
to know which kind should be implemented.
* Make sure we don't drop const.
* Fix the default forwarding so that const correct pointer only need
one specialization.
* Simplifies the existing specializations.

llvm-svn: 178147
2013-03-27 16:43:11 +00:00
Benjamin Kramer
941a16e288 An Optional<T> is pod-like if the inner type is.
llvm-svn: 175908
2013-02-22 18:58:26 +00:00
David Blaikie
117a44bd1a Add move ctor/assignment to Optional<T>
Code review feedback for r175580 by Jordan Rose.

llvm-svn: 175729
2013-02-21 07:55:39 +00:00
David Blaikie
6739305653 Make Optional<T>'s operator bool 'explicit' in C++11
Provides a general way to add 'explicit' for conversion operators (a no-op when
compiling as C++98).

llvm-svn: 175723
2013-02-21 06:05:57 +00:00
NAKAMURA Takumi
398640076e ADT/Optional.h: Appease msvc. It reapplies r175626.
llvm-svn: 175710
2013-02-21 02:32:25 +00:00
David Blaikie
7c7579badf Provide a "None" value for convenience when using Optional<T>()
This implementation of NoneType/None does have some holes but I haven't
found one that doesn't - open to improvement.

llvm-svn: 175696
2013-02-21 00:27:28 +00:00
NAKAMURA Takumi
70d86d9cce Revert r175626, "ADT/Optional.h: Appease msvc."
Sorry, I didn't cover +Asserts, by accident. :(

llvm-svn: 175633
2013-02-20 15:52:44 +00:00
NAKAMURA Takumi
90a8a0605d Whitespace.
llvm-svn: 175627
2013-02-20 15:12:32 +00:00
NAKAMURA Takumi
db16fe6b25 ADT/Optional.h: Appease msvc.
llvm-svn: 175626
2013-02-20 15:12:24 +00:00
David Blaikie
05260669b1 Rename llvm::Optional<T>::Reset to 'reset' as per LLVM naming conventions.
Code review feedback on r175580 from Jordan Rose.

llvm-svn: 175595
2013-02-20 06:25:36 +00:00
David Blaikie
cbe2e7eb6b Allow llvm::Optional to work with types without default constructors.
This generalizes Optional to require less from the T type by using aligned
storage for backing & placement new/deleting the T into it when necessary.

Also includes unit tests.

llvm-svn: 175580
2013-02-20 00:26:04 +00:00
Jakub Staszak
f1ea1a7f37 Fix include guards so they exactly match file names.
llvm-svn: 172025
2013-01-10 00:45:19 +00:00
Argyrios Kyrtzidis
f2a855cbd7 Use a bool instead of a bitfield in llvm/ADT/Optional.
Fixes Valgrind failures and removes bitwise operations that don't provide any benefit.
Valgrind failures reported by NAKAMURA Takumi.

llvm-svn: 171413
2013-01-02 21:19:08 +00:00
Chandler Carruth
5286042938 Switch LLVM_USE_RVALUE_REFERENCES to LLVM_HAS_RVALUE_REFERENCES.
Rationale:
1) This was the name in the comment block. ;]
2) It matches Clang's __has_feature naming convention.
3) It matches other compiler-feature-test conventions.

Sorry for the noise. =]

I've also switch the comment block to use a \brief tag and not duplicate
the name.

llvm-svn: 168996
2012-11-30 11:45:22 +00:00
Chandler Carruth
f51f128d85 Separate out the tests for whether the compiler suports R-value
references from whether it supports an R-value reference *this. No
version of GCC today supports the latter, which breaks GCC C++11
compiles of LLVM and Clang now.

Also add doxygen comments clarifying what's going on here, and update
the usage in Optional. I'll update the usages in Clang next.

llvm-svn: 168993
2012-11-30 11:04:18 +00:00
Jordan Rose
f630d777a3 Add a new C++11 compatibility macro, LLVM_LVALUE_FUNCTION.
This expands to '&', and is intended to be used when an /optional/ rvalue
override is available.

Before:
  void foo() const { ... }

After:
  void foo() const LLVM_LVALUE_FUNCTION { ... }
  void foo() && { ... }

This is used to allow moving the contents of an Optional.

llvm-svn: 168963
2012-11-30 00:38:53 +00:00
Jordan Rose
2d1d4bb52f Fix case for include of Compiler.h.
llvm-svn: 166243
2012-10-18 22:36:01 +00:00
Jordan Rose
8f3fa09912 Add a T&& constructor to llvm::Optional.
This allows llvm::Optional to be used with movable-but-not-copyable types.
While LLVM itself is still C++03, there's no reason why tools built on
top of it can't use C++11 features.

llvm-svn: 166241
2012-10-18 22:22:55 +00:00
Douglas Gregor
cd73e97a29 Poison the relational operators ==, !=, <, <=, >=, > on llvm::Optional
objects, since they'll end up using the implicit conversion to "bool"
and causing some very "fun" surprises.

llvm-svn: 125380
2011-02-11 18:13:20 +00:00
Ted Kremenek
90babe9f35 Move 'Optional' class from Clang to LLVM/ADT.
llvm-svn: 100889
2010-04-09 20:25:54 +00:00