[PATCH] D114543: Extend the `uwtable` attribute with unwind table kind

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 1 17:34:15 PST 2022


MaskRay accepted this revision.
MaskRay added a comment.
This revision is now accepted and ready to land.

(Your patch was not uploaded via `arc diff`, therefore `arc patch D114543` has some merge conflicts to me.
I could still apply it with `curl -L 'https://reviews.llvm.org/D114543?download=1' | patch -p0`, though.)

Thanks for the update. LGTM.
There are some clang-format lints that should be fixed first.



================
Comment at: clang/test/CodeGen/uwtable-attr.c:9
+
+// This just tests that function and modules attribute react on the command-line options,
+// it does state the current behaviour makes sense in all cases (it does not).
----------------
The comment applying to the whole file is generally placed at the top, before all RUN lines.


================
Comment at: llvm/include/llvm/Support/CodeGen.h:74
+    None = 0,     ///< No unwind table requested
+    Sync = 1,     ///< "Synchronous" unwind tables
+    Async = 2,    ///< "Asynchronous" unwind tables (instr precise)
----------------
See the clang-format lint


================
Comment at: llvm/lib/AsmParser/LLParser.cpp:2017
+  else
+    return error(KindLoc, "expected unwind table kind");
+  Lex.Lex();
----------------
This diagnostic needs a test in test/Assembler/


================
Comment at: llvm/lib/AsmParser/LLParser.cpp:2019
+  Lex.Lex();
+  LocTy ParenLoc = Lex.getLoc();
+  if (!EatIfPresent(lltok::rparen))
----------------
The pattern can be simplified with `parseToken`.


================
Comment at: llvm/lib/Bitcode/Reader/BitcodeReader.cpp:1635
+          else if (Kind == Attribute::UWTable)
+           B.addUWTableAttr(UWTableKind(Record[++i]));
         } else if (Record[i] == 3 || Record[i] == 4) { // String attribute
----------------
clang-format lint


================
Comment at: llvm/lib/IR/Attributes.cpp:446
+    if (Kind != UWTableKind::None) {
+      return Kind == UWTableKind::Default
+                 ? "uwtable"
----------------
clang-format wraps the continuation lines in a strange way. Perhaps switch to this form:

```
if (Kind == UWTableKind::Default)
  return "uwtable";
return ...
```


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

https://reviews.llvm.org/D114543



More information about the llvm-commits mailing list