[llvm] [XCOFF]refactor isFunction, NFC (PR #72232)

via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 14 06:49:56 PST 2023


================
@@ -299,7 +299,11 @@ Expected<SymbolRef::Type>
 XCOFFObjectFile::getSymbolType(DataRefImpl Symb) const {
   XCOFFSymbolRef XCOFFSym = toSymbolRef(Symb);
 
-  if (XCOFFSym.isFunction())
+  Expected<bool> IsFunction = XCOFFSym.isFunction();
+  if (Error E = IsFunction.takeError())
+    return std::move(E);
----------------
diggerlin wrote:

we do not need to introduce a new variable `E`,  please change to  
```
if (!IsFunction) 
    return IsFunction.takeError();
```

https://github.com/llvm/llvm-project/pull/72232


More information about the llvm-commits mailing list