SILGen: ban getSILArgumentConvention

This function will give the wrong convention in SILGen when
using -enable-sil-opaque-values. In particular, it will say
arguments are indirect when they are not.
This commit is contained in:
Kavon Farvardin
2025-11-19 14:24:49 -08:00
parent 5e9fba115a
commit 199156b307
8 changed files with 34 additions and 9 deletions

View File

@@ -31,6 +31,7 @@
#define SWIFT_SIL_FUNCTIONCONVENTIONS_H
#include "swift/AST/Types.h"
#include "swift/Basic/AccessControls.h"
#include "swift/SIL/SILArgumentConvention.h"
#include "swift/SIL/SILType.h"
#include "llvm/Support/ErrorHandling.h"
@@ -526,11 +527,9 @@ public:
- getNumIndirectSILErrorResults()];
}
/// WARNING: Do not use this from SILGen!
/// Use methods such as `isSILIndirect` or query the ParameterInfo instead.
///
/// Return the SIL argument convention of apply/entry argument at
/// the given argument index.
SWIFT_UNAVAILABLE_IN_SILGEN_MSG("Use methods such as `isSILIndirect` or query the ParameterInfo instead.")
SILArgumentConvention getSILArgumentConvention(unsigned index) const;
/// Return the SIL type of the apply/entry argument at the given index.

View File

@@ -0,0 +1,17 @@
//
// Created by Kavon Farvardin on 11/19/25.
//
#ifndef SWIFT_SILGENUTILS_H
#define SWIFT_SILGENUTILS_H
#include "swift/SIL/SILValue.h"
namespace swift {
// Unsafe access may have invalid storage (e.g. a RawPointer).
bool isPossibleUnsafeAccessInvalidStorage(SILValue access, SILFunction *F);
} // namespace swift
#endif // SWIFT_SILGENUTILS_H