[PATCH] D20503: [AVR] Add AVRMCExpr

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Fri May 20 18:28:01 PDT 2016


arsenm added inline comments.

================
Comment at: lib/Target/AVR/MCTargetDesc/AVRMCExpr.cpp:23
@@ +22,3 @@
+const struct ModifierEntry {
+  char const *Spelling;
+  AVRMCExpr::VariantKind VariantKind;
----------------
const char* const?

================
Comment at: lib/Target/AVR/MCTargetDesc/AVRMCExpr.cpp:44-49
@@ +43,8 @@
+
+  if (isNegated())
+    OS << "-";
+
+  OS << getName() << "(";
+  getSubExpr()->print(OS, MAI);
+  OS << ')';
+}
----------------
Single quote around single chars

================
Comment at: lib/Target/AVR/MCTargetDesc/AVRMCExpr.cpp:64-65
@@ +63,4 @@
+    return true;
+  } else {
+    return false;
+  }
----------------
No return after else

================
Comment at: lib/Target/AVR/MCTargetDesc/AVRMCExpr.cpp:168
@@ +167,3 @@
+
+char const *AVRMCExpr::getName() const {
+  const auto &Modifier = std::find_if(
----------------
const char?

================
Comment at: lib/Target/AVR/MCTargetDesc/AVRMCExpr.cpp:176
@@ +175,3 @@
+  }
+  return 0;
+}
----------------
nullptr

================
Comment at: lib/Target/AVR/MCTargetDesc/AVRMCExpr.cpp:180-182
@@ +179,5 @@
+AVRMCExpr::VariantKind AVRMCExpr::getKindByName(StringRef Name) {
+  const auto &Modifier = std::find_if(
+      std::begin(ModifierNames), std::end(ModifierNames),
+      [&Name](ModifierEntry const &Mod) { return Mod.Spelling == Name; });
+
----------------
There's an llvm::find_if which takes a range instead of the separate iterators


http://reviews.llvm.org/D20503





More information about the llvm-commits mailing list