[PATCH] D43095: Make attribute-target on a Definition-after-use update the LLVM attributes

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Feb 11 06:06:56 PST 2018


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

This looks reasonable to me, but you should wait a few days to commit in case someone more into CodeGen has comments.

Your choice on updating the code you factored into a function; those changes are just style nits.



================
Comment at: lib/CodeGen/CodeGenModule.cpp:1258
+  std::vector<std::string> Features;
+  const FunctionDecl *FD = dyn_cast_or_null<FunctionDecl>(D);
+  FD = FD ? FD->getMostRecentDecl() : FD;
----------------
Could use `const auto *` here.


================
Comment at: lib/CodeGen/CodeGenModule.cpp:1266-1268
+    for (llvm::StringMap<bool>::const_iterator it = FeatureMap.begin(),
+                                               ie = FeatureMap.end();
+         it != ie; ++it)
----------------
Could switch this to a range-base for loop?


================
Comment at: lib/CodeGen/CodeGenModule.cpp:1275
+    // the function.
+    const auto *TD = FD->getAttr<TargetAttr>();
+    TargetAttr::ParsedTargetAttr ParsedAttr = TD->parse();
----------------
Could hoist this out of the `if` statement so we don't do a has/get operation.


Repository:
  rC Clang

https://reviews.llvm.org/D43095





More information about the cfe-commits mailing list