diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2022-02-05 20:07:43 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2022-06-04 11:59:26 +0000 |
commit | 67eec5325a1ab99d493fd7e0381d20aab19b286e (patch) | |
tree | b14fe1fa6cc55067c1deecc4adc75920d3630d12 /contrib/llvm-project/llvm/lib/IR/Attributes.cpp | |
parent | 390adc38fc112be360bd15499e5241bf4e675b6f (diff) | |
download | src-67eec5325a1ab99d493fd7e0381d20aab19b286e.tar.gz src-67eec5325a1ab99d493fd7e0381d20aab19b286e.zip |
Merge llvm-project main llvmorg-14-init-18294-gdb01b123d012
This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvmorg-14-init-18294-gdb01b123d012, the last commit before
the upstream release/14.x branch was created.
PR: 261742
MFC after: 2 weeks
(cherry picked from commit 1fd87a682ad7442327078e1eeb63edc4258f9815)
Diffstat (limited to 'contrib/llvm-project/llvm/lib/IR/Attributes.cpp')
-rw-r--r-- | contrib/llvm-project/llvm/lib/IR/Attributes.cpp | 50 |
1 files changed, 14 insertions, 36 deletions
diff --git a/contrib/llvm-project/llvm/lib/IR/Attributes.cpp b/contrib/llvm-project/llvm/lib/IR/Attributes.cpp index c92bacaee36d..43fde64c3734 100644 --- a/contrib/llvm-project/llvm/lib/IR/Attributes.cpp +++ b/contrib/llvm-project/llvm/lib/IR/Attributes.cpp @@ -23,7 +23,6 @@ #include "llvm/ADT/StringExtras.h" #include "llvm/ADT/StringRef.h" #include "llvm/ADT/StringSwitch.h" -#include "llvm/ADT/Twine.h" #include "llvm/Config/llvm-config.h" #include "llvm/IR/Function.h" #include "llvm/IR/LLVMContext.h" @@ -31,11 +30,9 @@ #include "llvm/Support/Compiler.h" #include "llvm/Support/Debug.h" #include "llvm/Support/ErrorHandling.h" -#include "llvm/Support/MathExtras.h" #include "llvm/Support/raw_ostream.h" #include <algorithm> #include <cassert> -#include <climits> #include <cstddef> #include <cstdint> #include <limits> @@ -390,26 +387,15 @@ std::string Attribute::getAsString(bool InAttrGrp) const { // align=4 // alignstack=8 // - if (hasAttribute(Attribute::Alignment)) { - std::string Result; - Result += "align"; - Result += (InAttrGrp) ? "=" : " "; - Result += utostr(getValueAsInt()); - return Result; - } + if (hasAttribute(Attribute::Alignment)) + return (InAttrGrp ? "align=" + Twine(getValueAsInt()) + : "align " + Twine(getValueAsInt())) + .str(); auto AttrWithBytesToString = [&](const char *Name) { - std::string Result; - Result += Name; - if (InAttrGrp) { - Result += "="; - Result += utostr(getValueAsInt()); - } else { - Result += "("; - Result += utostr(getValueAsInt()); - Result += ")"; - } - return Result; + return (InAttrGrp ? Name + ("=" + Twine(getValueAsInt())) + : Name + ("(" + Twine(getValueAsInt())) + ")") + .str(); }; if (hasAttribute(Attribute::StackAlignment)) @@ -426,26 +412,18 @@ std::string Attribute::getAsString(bool InAttrGrp) const { Optional<unsigned> NumElems; std::tie(ElemSize, NumElems) = getAllocSizeArgs(); - std::string Result = "allocsize("; - Result += utostr(ElemSize); - if (NumElems.hasValue()) { - Result += ','; - Result += utostr(*NumElems); - } - Result += ')'; - return Result; + return (NumElems + ? "allocsize(" + Twine(ElemSize) + "," + Twine(*NumElems) + ")" + : "allocsize(" + Twine(ElemSize) + ")") + .str(); } if (hasAttribute(Attribute::VScaleRange)) { unsigned MinValue = getVScaleRangeMin(); Optional<unsigned> MaxValue = getVScaleRangeMax(); - - std::string Result = "vscale_range("; - Result += utostr(MinValue); - Result += ','; - Result += utostr(MaxValue.getValueOr(0)); - Result += ')'; - return Result; + return ("vscale_range(" + Twine(MinValue) + "," + + Twine(MaxValue.getValueOr(0)) + ")") + .str(); } // Convert target-dependent attributes to strings of the form: |