Skip to content

Commit 96cd0dd

Browse files
[clang] Migrate away from a soft-deprecated constructor of APInt (NFC) (llvm#166127)
We have: /// Once all uses of this constructor are migrated to other constructors, /// consider marking this overload ""= delete" to prevent calls from being /// incorrectly bound to the APInt(unsigned, uint64_t, bool) constructor. LLVM_ABI APInt(unsigned numBits, unsigned numWords, const uint64_t bigVal[]); This patch migrates away from this soft-deprecated constructor.
1 parent 25ed923 commit 96cd0dd

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

clang/include/clang/AST/APNumericStorage.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,8 @@ class APNumericStorage {
4141
llvm::APInt getIntValue() const {
4242
unsigned NumWords = llvm::APInt::getNumWords(BitWidth);
4343
if (NumWords > 1)
44-
return llvm::APInt(BitWidth, NumWords, pVal);
45-
else
46-
return llvm::APInt(BitWidth, VAL);
44+
return llvm::APInt(BitWidth, llvm::ArrayRef(pVal, NumWords));
45+
return llvm::APInt(BitWidth, VAL);
4746
}
4847
void setIntValue(const ASTContext &C, const llvm::APInt &Val);
4948
};

clang/include/clang/AST/AbstractBasicReader.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ class DataStreamBasicReader : public BasicReaderBase<Impl> {
173173
llvm::SmallVector<uint64_t, 4> data;
174174
for (uint32_t i = 0; i != numWords; ++i)
175175
data.push_back(asImpl().readUInt64());
176-
return llvm::APInt(bitWidth, numWords, &data[0]);
176+
return llvm::APInt(bitWidth, data);
177177
}
178178

179179
llvm::FixedPointSemantics readFixedPointSemantics() {

clang/lib/AST/ByteCode/Floating.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ class Floating final {
4545
if (singleWord())
4646
return APFloat(getSemantics(), APInt(BitWidth, Val));
4747
unsigned NumWords = numWords();
48-
return APFloat(getSemantics(), APInt(BitWidth, NumWords, Memory));
48+
return APFloat(getSemantics(),
49+
APInt(BitWidth, llvm::ArrayRef(Memory, NumWords)));
4950
}
5051

5152
public:

clang/lib/AST/ByteCode/IntegralAP.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ template <bool Signed> class IntegralAP final {
6363
if (singleWord())
6464
return APInt(BitWidth, Val, Signed);
6565
unsigned NumWords = llvm::APInt::getNumWords(BitWidth);
66-
return llvm::APInt(BitWidth, NumWords, Memory);
66+
return llvm::APInt(BitWidth, llvm::ArrayRef(Memory, NumWords));
6767
}
6868

6969
public:

0 commit comments

Comments
 (0)