Merge pull request #78766 from tshortli/warnings

IRGen/Runtime: Suppress some warnings
This commit is contained in:
Allan Shortlidge
2025-01-21 00:19:29 -08:00
committed by GitHub
3 changed files with 9 additions and 22 deletions

View File

@@ -1035,28 +1035,6 @@ static llvm::MemoryEffects mergeMemoryEffects(ArrayRef<llvm::MemoryEffects> effe
return mergedEffects; return mergedEffects;
} }
namespace {
bool isStandardLibrary(const llvm::Module &M) {
if (auto *Flags = M.getNamedMetadata("swift.module.flags")) {
for (const auto *F : Flags->operands()) {
const auto *Key = dyn_cast_or_null<llvm::MDString>(F->getOperand(0));
if (!Key)
continue;
const auto *Value =
dyn_cast_or_null<llvm::ConstantAsMetadata>(F->getOperand(1));
if (!Value)
continue;
if (Key->getString() == "standard-library")
return cast<llvm::ConstantInt>(Value->getValue())->isOne();
}
}
return false;
}
}
llvm::FunctionType *swift::getRuntimeFnType(llvm::Module &Module, llvm::FunctionType *swift::getRuntimeFnType(llvm::Module &Module,
llvm::ArrayRef<llvm::Type*> retTypes, llvm::ArrayRef<llvm::Type*> retTypes,
llvm::ArrayRef<llvm::Type*> argTypes) { llvm::ArrayRef<llvm::Type*> argTypes) {

View File

@@ -439,6 +439,8 @@ namespace {
} // end anonymous namespace } // end anonymous namespace
namespace swift { namespace swift {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
struct StaticAssertGenericMetadataCacheEntryValueOffset { struct StaticAssertGenericMetadataCacheEntryValueOffset {
static_assert( static_assert(
offsetof(GenericCacheEntry, Value) == offsetof(GenericCacheEntry, Value) ==
@@ -446,6 +448,7 @@ namespace swift {
Value), Value),
"The generic metadata cache entry layout mismatch"); "The generic metadata cache entry layout mismatch");
}; };
#pragma clang diagnostic pop
} }
namespace { namespace {

View File

@@ -179,8 +179,11 @@ SWIFT_CC(swiftasync)
static void task_wait_throwing_resume_adapter(SWIFT_ASYNC_CONTEXT AsyncContext *_context) { static void task_wait_throwing_resume_adapter(SWIFT_ASYNC_CONTEXT AsyncContext *_context) {
auto context = static_cast<TaskFutureWaitAsyncContext *>(_context); auto context = static_cast<TaskFutureWaitAsyncContext *>(_context);
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wcast-function-type-mismatch"
auto resumeWithError = auto resumeWithError =
reinterpret_cast<AsyncVoidClosureEntryPoint *>(context->ResumeParent); reinterpret_cast<AsyncVoidClosureEntryPoint *>(context->ResumeParent);
#pragma clang diagnostic pop
return resumeWithError(context->Parent, context->errorResult); return resumeWithError(context->Parent, context->errorResult);
} }
@@ -212,7 +215,10 @@ void SWIFT_CC(swiftasync) swift::swift56override_swift_task_future_wait_throwing
waitingTask->ResumeTask = task_wait_throwing_resume_adapter; waitingTask->ResumeTask = task_wait_throwing_resume_adapter;
waitingTask->ResumeContext = callContext; waitingTask->ResumeContext = callContext;
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wcast-function-type-mismatch"
auto resumeFn = reinterpret_cast<TaskContinuationFunction *>(resumeFunction); auto resumeFn = reinterpret_cast<TaskContinuationFunction *>(resumeFunction);
#pragma clang diagnostic pop
// Wait on the future. // Wait on the future.
assert(task->isFuture()); assert(task->isFuture());