aboutsummaryrefslogtreecommitdiff
path: root/clang
diff options
context:
space:
mode:
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>2020-12-02 15:33:08 -0800
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>2020-12-04 12:34:49 -0800
commitd10f9863a5ac1cb681af07719650c44b48f289ce (patch)
tree5f5a324474b874d32726f3607937d25a60daf046 /clang
parentfa4c3f70ff0768a270b0620dc6d158ed1205ec4e (diff)
downloadllvm-d10f9863a5ac1cb681af07719650c44b48f289ce.zip
llvm-d10f9863a5ac1cb681af07719650c44b48f289ce.tar.gz
llvm-d10f9863a5ac1cb681af07719650c44b48f289ce.tar.bz2
ADT: Migrate users of AlignedCharArrayUnion to std::aligned_union_t, NFC
Prepare to delete `AlignedCharArrayUnion` by migrating its users over to `std::aligned_union_t`. I will delete `AlignedCharArrayUnion` and its tests in a follow-up commit so that it's easier to revert in isolation in case some downstream wants to keep using it. Differential Revision: https://reviews.llvm.org/D92516
Diffstat (limited to 'clang')
-rw-r--r--clang/include/clang/AST/APValue.h9
-rw-r--r--clang/include/clang/AST/ASTContext.h1
-rw-r--r--clang/include/clang/AST/ASTTypeTraits.h7
-rw-r--r--clang/include/clang/AST/ParentMapContext.h2
-rw-r--r--clang/include/clang/Frontend/PrecompiledPreamble.h3
-rw-r--r--clang/include/clang/Sema/Overload.h1
-rw-r--r--clang/lib/DirectoryWatcher/linux/DirectoryWatcher-linux.cpp1
-rw-r--r--clang/lib/DirectoryWatcher/windows/DirectoryWatcher-windows.cpp1
-rw-r--r--clang/lib/Lex/PPDirectives.cpp1
9 files changed, 10 insertions, 16 deletions
diff --git a/clang/include/clang/AST/APValue.h b/clang/include/clang/AST/APValue.h
index eded348..d6a33c1 100644
--- a/clang/include/clang/AST/APValue.h
+++ b/clang/include/clang/AST/APValue.h
@@ -20,7 +20,7 @@
#include "llvm/ADT/FoldingSet.h"
#include "llvm/ADT/PointerIntPair.h"
#include "llvm/ADT/PointerUnion.h"
-#include "llvm/Support/AlignOf.h"
+#include <type_traits>
namespace clang {
class AddrLabelExpr;
@@ -286,9 +286,10 @@ private:
struct MemberPointerData;
// We ensure elsewhere that Data is big enough for LV and MemberPointerData.
- typedef llvm::AlignedCharArrayUnion<void *, APSInt, APFloat, ComplexAPSInt,
- ComplexAPFloat, Vec, Arr, StructData,
- UnionData, AddrLabelDiffData> DataType;
+ typedef std::aligned_union_t<1, void *, APSInt, APFloat, ComplexAPSInt,
+ ComplexAPFloat, Vec, Arr, StructData, UnionData,
+ AddrLabelDiffData>
+ DataType;
static const size_t DataSize = sizeof(DataType);
DataType Data;
diff --git a/clang/include/clang/AST/ASTContext.h b/clang/include/clang/AST/ASTContext.h
index 8c09302..7d58b42 100644
--- a/clang/include/clang/AST/ASTContext.h
+++ b/clang/include/clang/AST/ASTContext.h
@@ -57,7 +57,6 @@
#include "llvm/ADT/TinyPtrVector.h"
#include "llvm/ADT/Triple.h"
#include "llvm/ADT/iterator_range.h"
-#include "llvm/Support/AlignOf.h"
#include "llvm/Support/Allocator.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/Compiler.h"
diff --git a/clang/include/clang/AST/ASTTypeTraits.h b/clang/include/clang/AST/ASTTypeTraits.h
index 8791e41b..ea3da8d 100644
--- a/clang/include/clang/AST/ASTTypeTraits.h
+++ b/clang/include/clang/AST/ASTTypeTraits.h
@@ -22,7 +22,7 @@
#include "clang/AST/TypeLoc.h"
#include "clang/Basic/LLVM.h"
#include "llvm/ADT/DenseMapInfo.h"
-#include "llvm/Support/AlignOf.h"
+#include <type_traits>
namespace llvm {
@@ -456,9 +456,8 @@ private:
/// \c QualTypes, \c NestedNameSpecifierLocs, \c TypeLocs,
/// \c TemplateArguments and \c TemplateArgumentLocs on the other hand do not
/// have storage or unique pointers and thus need to be stored by value.
- llvm::AlignedCharArrayUnion<const void *, TemplateArgument,
- TemplateArgumentLoc, NestedNameSpecifierLoc,
- QualType, TypeLoc>
+ std::aligned_union_t<1, const void *, TemplateArgument, TemplateArgumentLoc,
+ NestedNameSpecifierLoc, QualType, TypeLoc>
Storage;
};
diff --git a/clang/include/clang/AST/ParentMapContext.h b/clang/include/clang/AST/ParentMapContext.h
index a041238..a157906 100644
--- a/clang/include/clang/AST/ParentMapContext.h
+++ b/clang/include/clang/AST/ParentMapContext.h
@@ -89,7 +89,7 @@ public:
/// Container for either a single DynTypedNode or for an ArrayRef to
/// DynTypedNode. For use with ParentMap.
class DynTypedNodeList {
- llvm::AlignedCharArrayUnion<DynTypedNode, ArrayRef<DynTypedNode>> Storage;
+ std::aligned_union_t<1, DynTypedNode, ArrayRef<DynTypedNode>> Storage;
bool IsSingleNode;
public:
diff --git a/clang/include/clang/Frontend/PrecompiledPreamble.h b/clang/include/clang/Frontend/PrecompiledPreamble.h
index cea39bf..1f76831 100644
--- a/clang/include/clang/Frontend/PrecompiledPreamble.h
+++ b/clang/include/clang/Frontend/PrecompiledPreamble.h
@@ -17,7 +17,6 @@
#include "clang/Lex/Preprocessor.h"
#include "llvm/ADT/IntrusiveRefCntPtr.h"
#include "llvm/ADT/StringRef.h"
-#include "llvm/Support/AlignOf.h"
#include "llvm/Support/MD5.h"
#include <cstddef>
#include <memory>
@@ -198,7 +197,7 @@ private:
private:
Kind StorageKind = Kind::Empty;
- llvm::AlignedCharArrayUnion<TempPCHFile, InMemoryPreamble> Storage = {};
+ std::aligned_union_t<1, TempPCHFile, InMemoryPreamble> Storage = {};
};
/// Data used to determine if a file used in the preamble has been changed.
diff --git a/clang/include/clang/Sema/Overload.h b/clang/include/clang/Sema/Overload.h
index 5be6a61..3c87dfc 100644
--- a/clang/include/clang/Sema/Overload.h
+++ b/clang/include/clang/Sema/Overload.h
@@ -31,7 +31,6 @@
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h"
-#include "llvm/Support/AlignOf.h"
#include "llvm/Support/Allocator.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/ErrorHandling.h"
diff --git a/clang/lib/DirectoryWatcher/linux/DirectoryWatcher-linux.cpp b/clang/lib/DirectoryWatcher/linux/DirectoryWatcher-linux.cpp
index 176d6d6..401a0eb 100644
--- a/clang/lib/DirectoryWatcher/linux/DirectoryWatcher-linux.cpp
+++ b/clang/lib/DirectoryWatcher/linux/DirectoryWatcher-linux.cpp
@@ -11,7 +11,6 @@
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/ScopeExit.h"
-#include "llvm/Support/AlignOf.h"
#include "llvm/Support/Errno.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/Path.h"
diff --git a/clang/lib/DirectoryWatcher/windows/DirectoryWatcher-windows.cpp b/clang/lib/DirectoryWatcher/windows/DirectoryWatcher-windows.cpp
index 25cbcf5..ba96289 100644
--- a/clang/lib/DirectoryWatcher/windows/DirectoryWatcher-windows.cpp
+++ b/clang/lib/DirectoryWatcher/windows/DirectoryWatcher-windows.cpp
@@ -14,7 +14,6 @@
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/ScopeExit.h"
-#include "llvm/Support/AlignOf.h"
#include "llvm/Support/Errno.h"
#include "llvm/Support/Mutex.h"
#include "llvm/Support/Path.h"
diff --git a/clang/lib/Lex/PPDirectives.cpp b/clang/lib/Lex/PPDirectives.cpp
index d6b03d8..0280afd 100644
--- a/clang/lib/Lex/PPDirectives.cpp
+++ b/clang/lib/Lex/PPDirectives.cpp
@@ -39,7 +39,6 @@
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/StringSwitch.h"
#include "llvm/ADT/StringRef.h"
-#include "llvm/Support/AlignOf.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/Path.h"
#include <algorithm>