[PATCH] D110810: [clang][ASTImporter] Simplify code of attribute import [NFC].

Balázs Benics via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 1 01:31:56 PDT 2021


steakhal added a subscriber: aaron.ballman.
steakhal added inline comments.


================
Comment at: clang/lib/AST/ASTImporter.cpp:8530-8531
 
+  // Get the result of the previous import attempt (can be used only once).
+  llvm::Expected<Attr *> getResult() {
+    if (Err)
----------------
If it can be used only once, we should mark this function as an `r-value` function.
There is a similar macro already defined as `LLVM_LVALUE_FUNCTION`.

Later, when you would actually call this function, you need to `std::move()` the object, signifying that the original object gets destroyed in the process.

@aaron.ballman Do you think we need to define `LLVM_RVALUE_FUNCTION` or we can simply use the `&&` in the function declaration?
I've seen that you tried to substitute all `LLVM_LVALUE_FUNCTION` macros in the past. What's the status on this?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110810



More information about the cfe-commits mailing list