Skip to content

Commit 8364c99

Browse files
committed
Merge branch 'users/meinersbur/flang_runtime' into users/meinersbur/flang_runtime_shared
2 parents 8672070 + ab5e2b9 commit 8364c99

File tree

153 files changed

+1229
-813
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

153 files changed

+1229
-813
lines changed

clang/cmake/caches/Fuchsia-stage2-instrumented.cmake

Lines changed: 0 additions & 44 deletions
This file was deleted.

clang/cmake/caches/Fuchsia.cmake

Lines changed: 23 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -126,16 +126,6 @@ else()
126126
set(LIBCXX_ENABLE_STATIC_ABI_LIBRARY ON CACHE BOOL "")
127127
set(LIBCXX_HARDENING_MODE "none" CACHE STRING "")
128128
set(LIBCXX_USE_COMPILER_RT ON CACHE BOOL "")
129-
set(COMPILER_RT_BUILD_LIBFUZZER OFF CACHE BOOL "")
130-
set(COMPILER_RT_BUILD_PROFILE ON CACHE BOOL "")
131-
set(COMPILER_RT_BUILD_SANITIZERS OFF CACHE BOOL "")
132-
set(COMPILER_RT_BUILD_XRAY OFF CACHE BOOL "")
133-
set(COMPILER_RT_USE_BUILTINS_LIBRARY ON CACHE BOOL "")
134-
set(COMPILER_RT_DEFAULT_TARGET_ONLY ON CACHE BOOL "")
135-
set(SANITIZER_CXX_ABI "libc++" CACHE STRING "")
136-
set(SANITIZER_CXX_ABI_INTREE ON CACHE BOOL "")
137-
set(SANITIZER_TEST_CXX "libc++" CACHE STRING "")
138-
set(SANITIZER_TEST_CXX_INTREE ON CACHE BOOL "")
139129
set(LLVM_ENABLE_RUNTIMES "compiler-rt;libcxx;libcxxabi;libunwind" CACHE STRING "")
140130
set(RUNTIMES_CMAKE_ARGS "-DCMAKE_OSX_DEPLOYMENT_TARGET=10.13;-DCMAKE_OSX_ARCHITECTURES=arm64|x86_64" CACHE STRING "")
141131
endif()
@@ -174,29 +164,34 @@ endif()
174164

175165
set(BOOTSTRAP_LLVM_ENABLE_LLD ON CACHE BOOL "")
176166
set(BOOTSTRAP_LLVM_ENABLE_LTO ON CACHE BOOL "")
177-
set(BOOTSTRAP_LLVM_BUILD_INSTRUMENTED ON CACHE BOOL "")
178167

179168
set(_FUCHSIA_BOOTSTRAP_TARGETS
180-
generate-profdata
181-
stage2
182-
stage2-toolchain-distribution
183-
stage2-install-toolchain-distribution
184-
stage2-install-toolchain-distribution-stripped
185-
stage2-install-toolchain-distribution-toolchain
186-
stage2-check-all
187-
stage2-check-lld
188-
stage2-check-llvm
189-
stage2-check-clang
190-
stage2-test-suite)
169+
check-all
170+
check-clang
171+
check-lld
172+
check-llvm
173+
check-polly
174+
llvm-config
175+
clang-test-depends
176+
lld-test-depends
177+
llvm-test-depends
178+
test-suite
179+
test-depends
180+
toolchain-distribution
181+
install-toolchain-distribution
182+
install-toolchain-distribution-stripped
183+
install-toolchain-distribution-toolchain
184+
clang)
191185

192186
if(FUCHSIA_ENABLE_LLDB)
193187
list(APPEND _FUCHSIA_ENABLE_PROJECTS lldb)
194188
list(APPEND _FUCHSIA_BOOTSTRAP_TARGETS
195-
stage2-check-lldb
196-
stage2-debugger-distribution
197-
stage2-install-debugger-distribution
198-
stage2-install-debugger-distribution-stripped
199-
stage2-install-debugger-distribution-toolchain)
189+
check-lldb
190+
lldb-test-depends
191+
debugger-distribution
192+
install-debugger-distribution
193+
install-debugger-distribution-stripped
194+
install-debugger-distribution-toolchain)
200195
endif()
201196

202197
set(LLVM_ENABLE_PROJECTS ${_FUCHSIA_ENABLE_PROJECTS} CACHE STRING "")
@@ -205,7 +200,6 @@ set(CLANG_BOOTSTRAP_TARGETS ${_FUCHSIA_BOOTSTRAP_TARGETS} CACHE STRING "")
205200
get_cmake_property(variableNames VARIABLES)
206201
foreach(variableName ${variableNames})
207202
if(variableName MATCHES "^STAGE2_")
208-
list(APPEND EXTRA_ARGS "-D${variableName}=${${variableName}}")
209203
string(REPLACE "STAGE2_" "" new_name ${variableName})
210204
string(REPLACE ";" "|" value "${${variableName}}")
211205
list(APPEND EXTRA_ARGS "-D${new_name}=${value}")
@@ -215,9 +209,6 @@ endforeach()
215209
# TODO: This is a temporary workaround until we figure out the right solution.
216210
set(BOOTSTRAP_LLVM_ENABLE_RUNTIMES "compiler-rt;libcxx;libcxxabi;libunwind" CACHE STRING "")
217211

218-
set(LLVM_BUILTIN_TARGETS "default" CACHE STRING "")
219-
set(LLVM_RUNTIME_TARGETS "default" CACHE STRING "")
220-
221212
# Setup the bootstrap build.
222213
set(CLANG_ENABLE_BOOTSTRAP ON CACHE BOOL "")
223214
set(CLANG_BOOTSTRAP_EXTRA_DEPS
@@ -226,5 +217,5 @@ set(CLANG_BOOTSTRAP_EXTRA_DEPS
226217
CACHE STRING "")
227218
set(CLANG_BOOTSTRAP_CMAKE_ARGS
228219
${EXTRA_ARGS}
229-
-C ${CMAKE_CURRENT_LIST_DIR}/Fuchsia-stage2-instrumented.cmake
220+
-C ${CMAKE_CURRENT_LIST_DIR}/Fuchsia-stage2.cmake
230221
CACHE STRING "")

clang/docs/ClangFormatStyleOptions.rst

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2182,6 +2182,24 @@ the configuration (without a prefix: ``Auto``).
21822182
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa);
21832183
}
21842184

2185+
.. _BinPackLongBracedList:
2186+
2187+
**BinPackLongBracedList** (``Boolean``) :versionbadge:`clang-format 21` :ref:`<BinPackLongBracedList>`
2188+
If ``BinPackLongBracedList`` is ``true`` it overrides
2189+
``BinPackArguments`` if there are 20 or more items in a braced
2190+
initializer list.
2191+
2192+
.. code-block:: c++
2193+
2194+
BinPackLongBracedList: false vs. BinPackLongBracedList: true
2195+
vector<int> x{ vector<int> x{1, 2, ...,
2196+
20, 21};
2197+
1,
2198+
2,
2199+
...,
2200+
20,
2201+
21};
2202+
21852203
.. _BinPackParameters:
21862204

21872205
**BinPackParameters** (``BinPackParametersStyle``) :versionbadge:`clang-format 3.7` :ref:`<BinPackParameters>`

clang/docs/ReleaseNotes.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,8 @@ Bug Fixes to C++ Support
151151
^^^^^^^^^^^^^^^^^^^^^^^^
152152

153153
- Clang is now better at keeping track of friend function template instance contexts. (#GH55509)
154+
- The initialization kind of elements of structured bindings
155+
direct-list-initialized from an array is corrected to direct-initialization.
154156

155157
Bug Fixes to AST Handling
156158
^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -237,6 +239,8 @@ clang-format
237239
------------
238240

239241
- Adds ``BreakBeforeTemplateCloser`` option.
242+
- Adds ``BinPackLongBracedList`` option to override bin packing options in
243+
long (20 item or more) braced list initializer lists.
240244

241245
libclang
242246
--------

clang/include/clang/Format/Format.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1212,6 +1212,22 @@ struct FormatStyle {
12121212
/// \version 3.7
12131213
bool BinPackArguments;
12141214

1215+
/// If ``BinPackLongBracedList`` is ``true`` it overrides
1216+
/// ``BinPackArguments`` if there are 20 or more items in a braced
1217+
/// initializer list.
1218+
/// \code
1219+
/// BinPackLongBracedList: false vs. BinPackLongBracedList: true
1220+
/// vector<int> x{ vector<int> x{1, 2, ...,
1221+
/// 20, 21};
1222+
/// 1,
1223+
/// 2,
1224+
/// ...,
1225+
/// 20,
1226+
/// 21};
1227+
/// \endcode
1228+
/// \version 21
1229+
bool BinPackLongBracedList;
1230+
12151231
/// Different way to try to fit all parameters on a line.
12161232
enum BinPackParametersStyle : int8_t {
12171233
/// Bin-pack parameters.
@@ -5266,6 +5282,7 @@ struct FormatStyle {
52665282
R.AlwaysBreakBeforeMultilineStrings &&
52675283
AttributeMacros == R.AttributeMacros &&
52685284
BinPackArguments == R.BinPackArguments &&
5285+
BinPackLongBracedList == R.BinPackLongBracedList &&
52695286
BinPackParameters == R.BinPackParameters &&
52705287
BitFieldColonSpacing == R.BitFieldColonSpacing &&
52715288
BracedInitializerIndentWidth == R.BracedInitializerIndentWidth &&

clang/lib/CodeGen/Address.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -197,10 +197,7 @@ class Address {
197197

198198
/// Return the type of the pointer value.
199199
llvm::PointerType *getType() const {
200-
return llvm::PointerType::get(
201-
ElementType,
202-
llvm::cast<llvm::PointerType>(Pointer.getPointer()->getType())
203-
->getAddressSpace());
200+
return llvm::cast<llvm::PointerType>(Pointer.getPointer()->getType());
204201
}
205202

206203
/// Return the type of the values stored in this address.

clang/lib/CodeGen/CGBlocks.cpp

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1097,31 +1097,10 @@ llvm::Type *CodeGenModule::getBlockDescriptorType() {
10971097
if (BlockDescriptorType)
10981098
return BlockDescriptorType;
10991099

1100-
llvm::Type *UnsignedLongTy =
1101-
getTypes().ConvertType(getContext().UnsignedLongTy);
1102-
1103-
// struct __block_descriptor {
1104-
// unsigned long reserved;
1105-
// unsigned long block_size;
1106-
//
1107-
// // later, the following will be added
1108-
//
1109-
// struct {
1110-
// void (*copyHelper)();
1111-
// void (*copyHelper)();
1112-
// } helpers; // !!! optional
1113-
//
1114-
// const char *signature; // the block signature
1115-
// const char *layout; // reserved
1116-
// };
1117-
BlockDescriptorType = llvm::StructType::create(
1118-
"struct.__block_descriptor", UnsignedLongTy, UnsignedLongTy);
1119-
1120-
// Now form a pointer to that.
11211100
unsigned AddrSpace = 0;
11221101
if (getLangOpts().OpenCL)
11231102
AddrSpace = getContext().getTargetAddressSpace(LangAS::opencl_constant);
1124-
BlockDescriptorType = llvm::PointerType::get(BlockDescriptorType, AddrSpace);
1103+
BlockDescriptorType = llvm::PointerType::get(getLLVMContext(), AddrSpace);
11251104
return BlockDescriptorType;
11261105
}
11271106

clang/lib/CodeGen/CGDecl.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2870,15 +2870,12 @@ void CodeGenModule::EmitOMPAllocateDecl(const OMPAllocateDecl *D) {
28702870

28712871
// We can also keep the existing global if the address space is what we
28722872
// expect it to be, if not, it is replaced.
2873-
QualType ASTTy = VD->getType();
28742873
clang::LangAS GVAS = GetGlobalVarAddressSpace(VD);
28752874
auto TargetAS = getContext().getTargetAddressSpace(GVAS);
28762875
if (Entry->getType()->getAddressSpace() == TargetAS)
28772876
continue;
28782877

2879-
// Make a new global with the correct type / address space.
2880-
llvm::Type *Ty = getTypes().ConvertTypeForMem(ASTTy);
2881-
llvm::PointerType *PTy = llvm::PointerType::get(Ty, TargetAS);
2878+
llvm::PointerType *PTy = llvm::PointerType::get(getLLVMContext(), TargetAS);
28822879

28832880
// Replace all uses of the old global with a cast. Since we mutate the type
28842881
// in place we neeed an intermediate that takes the spot of the old entry
@@ -2891,8 +2888,7 @@ void CodeGenModule::EmitOMPAllocateDecl(const OMPAllocateDecl *D) {
28912888

28922889
Entry->mutateType(PTy);
28932890
llvm::Constant *NewPtrForOldDecl =
2894-
llvm::ConstantExpr::getPointerBitCastOrAddrSpaceCast(
2895-
Entry, DummyGV->getType());
2891+
llvm::ConstantExpr::getAddrSpaceCast(Entry, DummyGV->getType());
28962892

28972893
// Now we have a casted version of the changed global, the dummy can be
28982894
// replaced and deleted.

clang/lib/CodeGen/CGDeclCXX.cpp

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -345,10 +345,7 @@ void CodeGenFunction::registerGlobalDtorWithLLVM(const VarDecl &VD,
345345

346346
void CodeGenFunction::registerGlobalDtorWithAtExit(llvm::Constant *dtorStub) {
347347
// extern "C" int atexit(void (*f)(void));
348-
assert(dtorStub->getType() ==
349-
llvm::PointerType::get(
350-
llvm::FunctionType::get(CGM.VoidTy, false),
351-
dtorStub->getType()->getPointerAddressSpace()) &&
348+
assert(dtorStub->getType()->isPointerTy() &&
352349
"Argument to atexit has a wrong type.");
353350

354351
llvm::FunctionType *atexitTy =
@@ -372,10 +369,7 @@ CodeGenFunction::unregisterGlobalDtorWithUnAtExit(llvm::Constant *dtorStub) {
372369
// value is returned.
373370
//
374371
// extern "C" int unatexit(void (*f)(void));
375-
assert(dtorStub->getType() ==
376-
llvm::PointerType::get(
377-
llvm::FunctionType::get(CGM.VoidTy, false),
378-
dtorStub->getType()->getPointerAddressSpace()) &&
372+
assert(dtorStub->getType()->isPointerTy() &&
379373
"Argument to unatexit has a wrong type.");
380374

381375
llvm::FunctionType *unatexitTy =

clang/lib/CodeGen/CGExpr.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -872,7 +872,7 @@ void CodeGenFunction::EmitTypeCheck(TypeCheckKind TCK, SourceLocation Loc,
872872
llvm::Value *TypeHash =
873873
llvm::ConstantInt::get(Int64Ty, xxh3_64bits(Out.str()));
874874

875-
llvm::Type *VPtrTy = llvm::PointerType::get(IntPtrTy, 0);
875+
llvm::Type *VPtrTy = llvm::PointerType::get(getLLVMContext(), 0);
876876
Address VPtrAddr(Ptr, IntPtrTy, getPointerAlign());
877877
llvm::Value *VPtrVal = GetVTablePtr(VPtrAddr, VPtrTy,
878878
Ty->getAsCXXRecordDecl(),
@@ -3054,7 +3054,7 @@ LValue CodeGenFunction::EmitDeclRefLValue(const DeclRefExpr *E) {
30543054
getContext().getDeclAlign(VD));
30553055
llvm::Type *VarTy = getTypes().ConvertTypeForMem(VD->getType());
30563056
auto *PTy = llvm::PointerType::get(
3057-
VarTy, getTypes().getTargetAddressSpace(VD->getType()));
3057+
getLLVMContext(), getTypes().getTargetAddressSpace(VD->getType()));
30583058
Addr = Builder.CreatePointerBitCastOrAddrSpaceCast(Addr, PTy, VarTy);
30593059
} else {
30603060
// Should we be using the alignment of the constant pointer we emitted?

clang/lib/CodeGen/CGObjCMac.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5717,7 +5717,7 @@ ObjCCommonTypesHelper::ObjCCommonTypesHelper(CodeGen::CodeGenModule &cgm)
57175717
IntTy = CGM.IntTy;
57185718
LongTy = cast<llvm::IntegerType>(Types.ConvertType(Ctx.LongTy));
57195719
Int8PtrTy = CGM.Int8PtrTy;
5720-
Int8PtrProgramASTy = llvm::PointerType::get(CGM.Int8Ty, ProgramAS);
5720+
Int8PtrProgramASTy = llvm::PointerType::get(CGM.getLLVMContext(), ProgramAS);
57215721
Int8PtrPtrTy = CGM.Int8PtrPtrTy;
57225722

57235723
// arm64 targets use "int" ivar offset variables. All others,

clang/lib/CodeGen/CodeGenModule.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4432,7 +4432,7 @@ void CodeGenModule::emitCPUDispatchDefinition(GlobalDecl GD) {
44324432
GlobalDecl ResolverGD;
44334433
if (getTarget().supportsIFunc()) {
44344434
ResolverType = llvm::FunctionType::get(
4435-
llvm::PointerType::get(DeclTy,
4435+
llvm::PointerType::get(getLLVMContext(),
44364436
getTypes().getTargetAddressSpace(FD->getType())),
44374437
false);
44384438
}
@@ -4604,8 +4604,8 @@ llvm::Constant *CodeGenModule::GetOrCreateMultiVersionResolver(GlobalDecl GD) {
46044604
// cpu_dispatch will be emitted in this translation unit.
46054605
if (ShouldReturnIFunc) {
46064606
unsigned AS = getTypes().getTargetAddressSpace(FD->getType());
4607-
llvm::Type *ResolverType =
4608-
llvm::FunctionType::get(llvm::PointerType::get(DeclTy, AS), false);
4607+
llvm::Type *ResolverType = llvm::FunctionType::get(
4608+
llvm::PointerType::get(getLLVMContext(), AS), false);
46094609
llvm::Constant *Resolver = GetOrCreateLLVMFunction(
46104610
MangledName + ".resolver", ResolverType, GlobalDecl{},
46114611
/*ForVTable=*/false);

clang/lib/CodeGen/Targets/AArch64.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -843,7 +843,7 @@ RValue AArch64ABIInfo::EmitAAPCSVAArg(Address VAListAddr, QualType Ty,
843843

844844
llvm::Type *BaseTy = CGF.ConvertType(Ty);
845845
if (IsIndirect)
846-
BaseTy = llvm::PointerType::getUnqual(BaseTy);
846+
BaseTy = llvm::PointerType::getUnqual(BaseTy->getContext());
847847
else if (AI.getCoerceToType())
848848
BaseTy = AI.getCoerceToType();
849849

@@ -961,7 +961,7 @@ RValue AArch64ABIInfo::EmitAAPCSVAArg(Address VAListAddr, QualType Ty,
961961
if (IsIndirect) {
962962
// If it's been passed indirectly (actually a struct), whatever we find from
963963
// stored registers or on the stack will actually be a struct **.
964-
MemTy = llvm::PointerType::getUnqual(MemTy);
964+
MemTy = llvm::PointerType::getUnqual(MemTy->getContext());
965965
}
966966

967967
const Type *Base = nullptr;

0 commit comments

Comments
 (0)