[PATCH] D68379: FunctionDecl::isThisDeclarationADefinition is useless in ProcessDeclAttribute

Guillaume Chatelet via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 3 02:13:09 PDT 2019


gchatelet created this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

This is for illustration purposes and not to be submitted


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D68379

Files:
  clang/lib/Sema/SemaDeclAttr.cpp


Index: clang/lib/Sema/SemaDeclAttr.cpp
===================================================================
--- clang/lib/Sema/SemaDeclAttr.cpp
+++ clang/lib/Sema/SemaDeclAttr.cpp
@@ -1798,12 +1798,12 @@
   if (!S.checkStringLiteralArgumentAttr(AL, 0, Str))
     return;
 
-  // Aliases should be on declarations, not definitions.
-  const auto *FD = cast<FunctionDecl>(D);
-  if (FD->isThisDeclarationADefinition()) {
-    S.Diag(AL.getLoc(), diag::err_alias_is_definition) << FD << 1;
-    return;
-  }
+  // // Aliases should be on declarations, not definitions.
+  // const auto *FD = cast<FunctionDecl>(D);
+  // if (FD->isThisDeclarationADefinition()) {
+  //   S.Diag(AL.getLoc(), diag::err_alias_is_definition) << FD << 1;
+  //   return;
+  // }
 
   D->addAttr(::new (S.Context) IFuncAttr(S.Context, AL, Str));
 }
@@ -1823,10 +1823,10 @@
 
   // Aliases should be on declarations, not definitions.
   if (const auto *FD = dyn_cast<FunctionDecl>(D)) {
-    if (FD->isThisDeclarationADefinition()) {
-      S.Diag(AL.getLoc(), diag::err_alias_is_definition) << FD << 0;
-      return;
-    }
+    // if (FD->isThisDeclarationADefinition()) {
+    //   S.Diag(AL.getLoc(), diag::err_alias_is_definition) << FD << 0;
+    //   return;
+    // }
   } else {
     const auto *VD = cast<VarDecl>(D);
     if (VD->isThisDeclarationADefinition() && VD->isExternallyVisible()) {
@@ -5628,10 +5628,10 @@
   }
 
   auto *FD = cast<FunctionDecl>(D);
-  if (FD->isThisDeclarationADefinition()) {
-    S.Diag(D->getLocation(), diag::err_alias_is_definition) << FD << 0;
-    return;
-  }
+  // if (FD->isThisDeclarationADefinition()) {
+  //   S.Diag(D->getLocation(), diag::err_alias_is_definition) << FD << 0;
+  //   return;
+  // }
 
   StringRef Str;
   SourceLocation ArgLoc;
@@ -5650,10 +5650,10 @@
   }
 
   auto *FD = cast<FunctionDecl>(D);
-  if (FD->isThisDeclarationADefinition()) {
-    S.Diag(D->getLocation(), diag::err_alias_is_definition) << FD << 0;
-    return;
-  }
+  // if (FD->isThisDeclarationADefinition()) {
+  //   S.Diag(D->getLocation(), diag::err_alias_is_definition) << FD << 0;
+  //   return;
+  // }
 
   StringRef Str;
   SourceLocation ArgLoc;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D68379.222979.patch
Type: text/x-patch
Size: 2174 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20191003/32b12605/attachment.bin>


More information about the cfe-commits mailing list