[PATCH] D29707: Fix improper microsoft-pure-definition warning on template class

2019-04-21 Thread Phabricator via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL358849: [Sema][MSVC] Fix bogus microsoft-pure-definition 
warning on member function of… (authored by brunoricci, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D29707?vs=87611=195999#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D29707

Files:
  cfe/trunk/lib/Sema/SemaDecl.cpp
  cfe/trunk/test/Parser/MicrosoftExtensions.cpp


Index: cfe/trunk/lib/Sema/SemaDecl.cpp
===
--- cfe/trunk/lib/Sema/SemaDecl.cpp
+++ cfe/trunk/lib/Sema/SemaDecl.cpp
@@ -13244,7 +13244,7 @@
 
 // MSVC permits the use of pure specifier (=0) on function definition,
 // defined at class scope, warn about this non-standard construct.
-if (getLangOpts().MicrosoftExt && FD->isPure() && FD->isCanonicalDecl())
+if (getLangOpts().MicrosoftExt && FD->isPure() && !FD->isOutOfLine())
   Diag(FD->getLocation(), diag::ext_pure_function_definition);
 
 if (!FD->isInvalidDecl()) {
Index: cfe/trunk/test/Parser/MicrosoftExtensions.cpp
===
--- cfe/trunk/test/Parser/MicrosoftExtensions.cpp
+++ cfe/trunk/test/Parser/MicrosoftExtensions.cpp
@@ -288,6 +288,18 @@
   virtual ~pure_virtual_dtor_inline() = 0 { }// expected-warning {{function 
definition with pure-specifier is a Microsoft extension}}
 };
 
+template struct pure_virtual_dtor_template {
+  virtual ~pure_virtual_dtor_template() = 0;
+};
+template 
pure_virtual_dtor_template::~pure_virtual_dtor_template() {}
+template struct pure_virtual_dtor_template;
+
+template struct pure_virtual_dtor_template_inline {
+virtual ~pure_virtual_dtor_template_inline() = 0 {}
+// expected-warning@-1 2{{function definition with pure-specifier is a 
Microsoft extension}}
+};
+template struct pure_virtual_dtor_template_inline;
+// expected-note@-1 {{in instantiation of member function}}
 
 int main () {
   // Necessary to force instantiation in -fdelayed-template-parsing mode.


Index: cfe/trunk/lib/Sema/SemaDecl.cpp
===
--- cfe/trunk/lib/Sema/SemaDecl.cpp
+++ cfe/trunk/lib/Sema/SemaDecl.cpp
@@ -13244,7 +13244,7 @@
 
 // MSVC permits the use of pure specifier (=0) on function definition,
 // defined at class scope, warn about this non-standard construct.
-if (getLangOpts().MicrosoftExt && FD->isPure() && FD->isCanonicalDecl())
+if (getLangOpts().MicrosoftExt && FD->isPure() && !FD->isOutOfLine())
   Diag(FD->getLocation(), diag::ext_pure_function_definition);
 
 if (!FD->isInvalidDecl()) {
Index: cfe/trunk/test/Parser/MicrosoftExtensions.cpp
===
--- cfe/trunk/test/Parser/MicrosoftExtensions.cpp
+++ cfe/trunk/test/Parser/MicrosoftExtensions.cpp
@@ -288,6 +288,18 @@
   virtual ~pure_virtual_dtor_inline() = 0 { }// expected-warning {{function definition with pure-specifier is a Microsoft extension}}
 };
 
+template struct pure_virtual_dtor_template {
+  virtual ~pure_virtual_dtor_template() = 0;
+};
+template pure_virtual_dtor_template::~pure_virtual_dtor_template() {}
+template struct pure_virtual_dtor_template;
+
+template struct pure_virtual_dtor_template_inline {
+virtual ~pure_virtual_dtor_template_inline() = 0 {}
+// expected-warning@-1 2{{function definition with pure-specifier is a Microsoft extension}}
+};
+template struct pure_virtual_dtor_template_inline;
+// expected-note@-1 {{in instantiation of member function}}
 
 int main () {
   // Necessary to force instantiation in -fdelayed-template-parsing mode.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D29707: Fix improper microsoft-pure-definition warning on template class

2019-04-21 Thread Bruno Ricci via Phabricator via cfe-commits
riccibruno accepted this revision.
riccibruno added a comment.
This revision is now accepted and ready to land.

This looks reasonable to me (although I think that the test should be in 
`SemaCXX/` and not in `Parser/`, but the test for the non-template case is 
already in `Parser/` so ok).


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

https://reviews.llvm.org/D29707



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D29707: Fix improper microsoft-pure-definition warning on template class

2019-04-20 Thread Jack Adrian Zappa via Phabricator via cfe-commits
adrianh.bsc added a comment.

Just wondering if this will be fixed soon. It's kinda annoying.


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

https://reviews.llvm.org/D29707



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D29707: Fix improper microsoft-pure-definition warning on template class

2017-02-08 Thread Rudy Pons via Phabricator via cfe-commits
Ilod created this revision.

Clang emits a warning when using pure specifier =0 in function definition at 
class scope, which is a MS-specific construct, when using -fms-extensions.
However, to detect this, it was using FD->isCanonicalDecl() on function 
declaration, which was also detecting out-of-class definition of member 
functions of template class.
This fix it by instead of !FD->isOutOfLine() to detect the places where we must 
emit the warning.
This will fix https://llvm.org/bugs/show_bug.cgi?id=21334


https://reviews.llvm.org/D29707

Files:
  lib/Sema/SemaDecl.cpp
  test/Parser/MicrosoftExtensions.cpp


Index: test/Parser/MicrosoftExtensions.cpp
===
--- test/Parser/MicrosoftExtensions.cpp
+++ test/Parser/MicrosoftExtensions.cpp
@@ -290,6 +290,17 @@
   virtual ~pure_virtual_dtor_inline() = 0 { }// expected-warning {{function 
definition with pure-specifier is a Microsoft extension}}
 };
 
+template struct pure_virtual_dtor_template {
+  virtual ~pure_virtual_dtor_template() = 0;
+};
+template 
pure_virtual_dtor_template::~pure_virtual_dtor_template() { }
+template struct pure_virtual_dtor_template;
+
+template struct pure_virtual_dtor_template_inline {
+virtual ~pure_virtual_dtor_template_inline() = 0 { }// expected-warning 
{{function definition with pure-specifier is a Microsoft extension}} 
expected-warning {{function definition with pure-specifier is a Microsoft 
extension}}
+};
+template struct pure_virtual_dtor_template_inline;// expected-note {{in 
instantiation of member function}}
+
 
 int main () {
   // Necessary to force instantiation in -fdelayed-template-parsing mode.
Index: lib/Sema/SemaDecl.cpp
===
--- lib/Sema/SemaDecl.cpp
+++ lib/Sema/SemaDecl.cpp
@@ -12025,7 +12025,7 @@
 
 // MSVC permits the use of pure specifier (=0) on function definition,
 // defined at class scope, warn about this non-standard construct.
-if (getLangOpts().MicrosoftExt && FD->isPure() && FD->isCanonicalDecl())
+if (getLangOpts().MicrosoftExt && FD->isPure() && !FD->isOutOfLine())
   Diag(FD->getLocation(), diag::ext_pure_function_definition);
 
 if (!FD->isInvalidDecl()) {


Index: test/Parser/MicrosoftExtensions.cpp
===
--- test/Parser/MicrosoftExtensions.cpp
+++ test/Parser/MicrosoftExtensions.cpp
@@ -290,6 +290,17 @@
   virtual ~pure_virtual_dtor_inline() = 0 { }// expected-warning {{function definition with pure-specifier is a Microsoft extension}}
 };
 
+template struct pure_virtual_dtor_template {
+  virtual ~pure_virtual_dtor_template() = 0;
+};
+template pure_virtual_dtor_template::~pure_virtual_dtor_template() { }
+template struct pure_virtual_dtor_template;
+
+template struct pure_virtual_dtor_template_inline {
+virtual ~pure_virtual_dtor_template_inline() = 0 { }// expected-warning {{function definition with pure-specifier is a Microsoft extension}} expected-warning {{function definition with pure-specifier is a Microsoft extension}}
+};
+template struct pure_virtual_dtor_template_inline;// expected-note {{in instantiation of member function}}
+
 
 int main () {
   // Necessary to force instantiation in -fdelayed-template-parsing mode.
Index: lib/Sema/SemaDecl.cpp
===
--- lib/Sema/SemaDecl.cpp
+++ lib/Sema/SemaDecl.cpp
@@ -12025,7 +12025,7 @@
 
 // MSVC permits the use of pure specifier (=0) on function definition,
 // defined at class scope, warn about this non-standard construct.
-if (getLangOpts().MicrosoftExt && FD->isPure() && FD->isCanonicalDecl())
+if (getLangOpts().MicrosoftExt && FD->isPure() && !FD->isOutOfLine())
   Diag(FD->getLocation(), diag::ext_pure_function_definition);
 
 if (!FD->isInvalidDecl()) {
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits