[PATCH] D46115: [ASTImporter] properly import SrcLoc of Attr

Rafael Stahl via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue May 8 00:54:07 PDT 2018


r.stahl added inline comments.


================
Comment at: include/clang/AST/ASTImporter.h:137
+    ///
+    /// \returns the equivalent attribute in the "to" context, or NULL if an
+    /// error occurred.
----------------
a.sidorin wrote:
> nullptr
I tried to stay consistent with the other descriptions. Will be removed anyway (see below).


================
Comment at: lib/AST/ASTImporter.cpp:2650
+  for (const auto *A : D->attrs())
+    ToIndirectField->addAttr(Importer.Import(const_cast<Attr *>(A)));
 
----------------
a.sidorin wrote:
> Could we just remove 'const' qualifier from `A` to avoid `const_cast`? (Same below)
I made the interface const instead.


================
Comment at: lib/AST/ASTImporter.cpp:6547
+Attr *ASTImporter::Import(Attr *FromAttr) {
+  if (!FromAttr)
+    return nullptr;
----------------
a.sidorin wrote:
> Is it possible to get into a situation where a nullptr attribute is imported?
I looked at the Decl variant and thought it should act similarly, but as far as I can tell, null attributes should not exist.


https://reviews.llvm.org/D46115





More information about the cfe-commits mailing list