[PATCH] D144353: [lld][RISCV] Avoid error when encountering unrecognised ISA extensions/versions in RISC-V attributes

Alex Bradbury via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 24 08:25:51 PST 2023


asb marked 4 inline comments as done.
asb added a comment.

I'll post an updated version with the requested C++ unit tests shortly. I understood MaskRay's LGTM to be conditional on addressing those comments.



================
Comment at: llvm/lib/Support/RISCVISAInfo.cpp:545
+                               "extension lacks version in expected format");
+    unsigned long long MajorVersion, MinorVersion;
+    if (getAsUnsignedInteger(MinorVersionStr, 10, MinorVersion))
----------------
MaskRay wrote:
> `getExtensionVersion` uses `unsigned` instead of `unsigned long long`.
`unsigned long long` needs to be used for `StringRef::getAsUnsignedInteger`. Changing to `unsigned` gives:

```
/home/asb/llvm-project/llvm/lib/Support/RISCVISAInfo.cpp:552:9: error: no matching function for call to 'getAsUnsignedInteger'
    if (getAsUnsignedInteger(MinorVersionStr, 10, MinorVersion))
        ^~~~~~~~~~~~~~~~~~~~
/home/asb/llvm-project/llvm/include/llvm/ADT/StringRef.h:34:8: note: candidate function not viable: no known conversion from 'unsigned int' to 'unsigned long long &' for 3rd argument
  bool getAsUnsignedInteger(StringRef Str, unsigned Radix,
       ^
```


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D144353/new/

https://reviews.llvm.org/D144353



More information about the llvm-commits mailing list