Skip to content

Commit 3eb8a5a

Browse files
authored
[TypeSize] Inline conversion to uint64_t (NFC) (#157454)
After #156336 this cast operator has become trivial, so inline it into the header. This is a minor compile-time improvement.
1 parent ab898f3 commit 3eb8a5a

File tree

3 files changed

+9
-24
lines changed

3 files changed

+9
-24
lines changed

llvm/include/llvm/Support/TypeSize.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#define LLVM_SUPPORT_TYPESIZE_H
1717

1818
#include "llvm/Support/Compiler.h"
19+
#include "llvm/Support/ErrorHandling.h"
1920
#include "llvm/Support/MathExtras.h"
2021
#include "llvm/Support/raw_ostream.h"
2122

@@ -371,7 +372,14 @@ class TypeSize : public details::FixedOrScalableQuantity<TypeSize, uint64_t> {
371372
// else
372373
// bail out early for scalable vectors and use getFixedValue()
373374
// }
374-
LLVM_ABI operator ScalarTy() const;
375+
operator ScalarTy() const {
376+
if (isScalable()) {
377+
reportFatalInternalError(
378+
"Cannot implicitly convert a scalable size to a fixed-width size in "
379+
"`TypeSize::operator ScalarTy()`");
380+
}
381+
return getFixedValue();
382+
}
375383

376384
// Additional operators needed to avoid ambiguous parses
377385
// because of the implicit conversion hack.

llvm/lib/Support/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,6 @@ add_llvm_component_library(LLVMSupport
265265
ToolOutputFile.cpp
266266
TrieRawHashMap.cpp
267267
Twine.cpp
268-
TypeSize.cpp
269268
Unicode.cpp
270269
UnicodeCaseFold.cpp
271270
UnicodeNameToCodepoint.cpp

llvm/lib/Support/TypeSize.cpp

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

0 commit comments

Comments
 (0)