[PATCH] D60385: FileCheck [5/12]: Introduce regular numeric variables

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 11 12:46:03 PDT 2019


arsenm added inline comments.


================
Comment at: llvm/include/llvm/Support/FileCheck.h:68-72
+  /// Whether variable is defined and thus Value is set.
+  bool Defined;
+
+  /// Value of numeric variable if defined.
   uint64_t Value;
----------------
It seems like you're just recreating Optional here, and then figure out how to return it later. You can just use Optional<uint64_t> as the member


================
Comment at: llvm/include/llvm/Support/FileCheck.h:252
+  /// for a given variable is recorded in this table.
+  StringMap<std::shared_ptr<FileCheckNumExprVar>> GlobalNumericVariableTable;
+
----------------
unique_ptr?


================
Comment at: llvm/lib/Support/FileCheck.cpp:27-51
+/// Return value of this numeric variable.
+llvm::Optional<uint64_t> FileCheckNumExprVar::getValue() const {
+  if (!Defined)
+    return llvm::None;
+  return Value;
+}
+
----------------
This can go away if you just use Optional as the member


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D60385





More information about the llvm-commits mailing list