Before this patch, clang would emit a (module-)forward declaration for template instantiations that are not anchored by an explicit template instantiation, but still are guaranteed to be available in an imported module. Unfortunately detecting the owning module doesn't reliably work when local submodule visibility is enabled and the template is inside a cross-module namespace. This make clang debuggable again with -gmodules and LSV enabled. rdar://problem/41552377 llvm-svn: 345109
46 lines
847 B
C++
46 lines
847 B
C++
#ifndef ADT
|
|
#define ADT
|
|
|
|
#ifdef WITH_NAMESPACE
|
|
namespace llvm {
|
|
#endif
|
|
template <unsigned Alignment, unsigned Size>
|
|
struct AlignedCharArray {
|
|
alignas(Alignment) char buffer[Size];
|
|
};
|
|
|
|
template <typename T1>
|
|
class AlignerImpl {
|
|
T1 t1;
|
|
};
|
|
|
|
template <typename T1>
|
|
union SizerImpl {
|
|
char arr1[sizeof(T1)];
|
|
};
|
|
|
|
template <typename T1>
|
|
struct AlignedCharArrayUnion
|
|
: AlignedCharArray<alignof(AlignerImpl<T1>), sizeof(SizerImpl<T1>)> {};
|
|
|
|
template <typename T, unsigned N>
|
|
struct SmallVectorStorage {
|
|
AlignedCharArrayUnion<T> InlineElts[N];
|
|
};
|
|
template <typename T, unsigned N>
|
|
class SmallVector : SmallVectorStorage<T, N> {};
|
|
|
|
template <typename T>
|
|
struct OptionalStorage {
|
|
AlignedCharArrayUnion<T> storage;
|
|
};
|
|
template <typename T>
|
|
class Optional {
|
|
OptionalStorage<T> Storage;
|
|
};
|
|
|
|
#ifdef WITH_NAMESPACE
|
|
} // namespace llvm
|
|
#endif
|
|
#endif
|