<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Consolas;
panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman",serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
p.MsoPlainText, li.MsoPlainText, div.MsoPlainText
{mso-style-priority:99;
mso-style-link:"Plain Text Char";
margin:0in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
pre
{mso-style-priority:99;
mso-style-link:"HTML Preformatted Char";
margin:0in;
margin-bottom:.0001pt;
font-size:10.0pt;
font-family:"Courier New";}
span.HTMLPreformattedChar
{mso-style-name:"HTML Preformatted Char";
mso-style-priority:99;
mso-style-link:"HTML Preformatted";
font-family:Consolas;}
span.hoenzb
{mso-style-name:hoenzb;}
span.EmailStyle20
{mso-style-type:personal;
font-family:"Calibri",sans-serif;
color:#1F497D;}
span.EmailStyle21
{mso-style-type:personal-reply;
font-family:"Calibri",sans-serif;
color:#1F497D;}
span.PlainTextChar
{mso-style-name:"Plain Text Char";
mso-style-priority:99;
mso-style-link:"Plain Text";
font-family:"Calibri",sans-serif;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoPlainText"><span style="color:#1F497D">Fixed in: r277206 after review in
</span><a href="https://reviews.llvm.org/D22970">https://reviews.llvm.org/D22970</a><o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><a name="_MailEndCompose"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"><o:p> </o:p></span></a></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><a name="_____replyseparator"></a><b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">From:</span></b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"> Keane, Erich
<br>
<b>Sent:</b> Friday, July 29, 2016 11:58 AM<br>
<b>To:</b> 'Andrey Bokhanko' <andreybokhanko@gmail.com>; Mike Aizatsky <aizatsky@google.com><br>
<b>Cc:</b> cfe-commits <cfe-commits@lists.llvm.org><br>
<b>Subject:</b> RE: r277134 - [GCC] Support for __final specifier<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">Sure, looking into it now.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">From:</span></b><span style="font-size:11.0pt;font-family:"Calibri",sans-serif"> Andrey Bokhanko [</span><a href="mailto:andreybokhanko@gmail.com"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">mailto:andreybokhanko@gmail.com</span></a><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">]
<br>
<b>Sent:</b> Friday, July 29, 2016 11:57 AM<br>
<b>To:</b> Mike Aizatsky <</span><a href="mailto:aizatsky@google.com"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">aizatsky@google.com</span></a><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">>; Keane, Erich <</span><a href="mailto:erich.keane@intel.com"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">erich.keane@intel.com</span></a><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">><br>
<b>Cc:</b> cfe-commits <</span><a href="mailto:cfe-commits@lists.llvm.org"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">cfe-commits@lists.llvm.org</span></a><span style="font-size:11.0pt;font-family:"Calibri",sans-serif">><br>
<b>Subject:</b> Re: r277134 - [GCC] Support for __final specifier<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt">Mike,<o:p></o:p></p>
</div>
<p class="MsoNormal" style="margin-bottom:12.0pt">Thanks for letting me know.<o:p></o:p></p>
</div>
<p class="MsoNormal" style="margin-bottom:12.0pt">I committed a patch authored by Erich (CCed); Erich, could you, please, investigate?<o:p></o:p></p>
</div>
<p class="MsoNormal">Yours,<o:p></o:p></p>
</div>
<p class="MsoNormal" style="margin-bottom:12.0pt">Andrey<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">On Fri, Jul 29, 2016 at 9:35 PM, Mike Aizatsky <<a href="mailto:aizatsky@google.com" target="_blank">aizatsky@google.com</a>> wrote:<o:p></o:p></p>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-top:5.0pt;margin-right:0in;margin-bottom:5.0pt">
<div>
<p class="MsoNormal">Andrey,<o:p></o:p></p>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">This change breaks the bot:<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal"><a href="http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fast/builds/15093" target="_blank">http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fast/builds/15093</a><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<pre><span style="font-size:13.5pt">==15371==WARNING: MemorySanitizer: use-of-uninitialized-value<o:p></o:p></span></pre>
<pre><span style="font-size:13.5pt"> #0 0x733784d in clang::Parser::ParseOptionalCXX11VirtSpecifierSeq(clang::VirtSpecifiers&, bool, clang::SourceLocation) /mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/tools/clang/lib/Parse/ParseDeclCXX.cpp:2050:9<o:p></o:p></span></pre>
<pre><span style="font-size:13.5pt"> #1 0x7337d55 in clang::Parser::ParseCXXMemberDeclaratorBeforeInitializer(clang::Declarator&, clang::VirtSpecifiers&, clang::ActionResult<clang::Expr*, true>&, clang::Parser::LateParsedAttrList&) /mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/tools/clang/lib/Parse/ParseDeclCXX.cpp:2119:5<o:p></o:p></span></pre>
<pre><span style="font-size:13.5pt"> #2 0x733d2b9 in clang::Parser::ParseCXXClassMemberDeclaration(clang::AccessSpecifier, clang::AttributeList*, clang::Parser::ParsedTemplateInfo const&, clang::ParsingDeclRAIIObject*) /mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/tools/clang/lib/Parse/ParseDeclCXX.cpp:2475:7<o:p></o:p></span></pre>
<pre><span style="font-size:13.5pt"> #3 0x73441a7 in clang::Parser::ParseCXXClassMemberDeclarationWithPragmas(clang::AccessSpecifier&, clang::Parser::ParsedAttributesWithRange&, clang::TypeSpecifierType, clang::Decl*) /mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/tools/clang/lib/Parse/ParseDeclCXX.cpp:2943:10<o:p></o:p></span></pre>
<pre><span style="font-size:13.5pt"> #4 0x733264c in clang::Parser::ParseCXXMemberSpecification(clang::SourceLocation, clang::SourceLocation, clang::Parser::ParsedAttributesWithRange&, unsigned int, clang::Decl*) /mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/tools/clang/lib/Parse/ParseDeclCXX.cpp:3113:7<o:p></o:p></span></pre>
<pre><span style="font-size:13.5pt"> #5 0x732b9c4 in clang::Parser::ParseClassSpecifier(clang::tok::TokenKind, clang::SourceLocation, clang::DeclSpec&, clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier, bool, clang::Parser::DeclSpecContext, clang::Parser::ParsedAttributesWithRange&) /mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/tools/clang/lib/Parse/ParseDeclCXX.cpp:1775:7<o:p></o:p></span></pre>
<pre><span style="font-size:13.5pt"> #6 0x72cb42c in clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&, clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier, clang::Parser::DeclSpecContext, clang::Parser::LateParsedAttrList*) /mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/tools/clang/lib/Parse/ParseDecl.cpp:3413:7<o:p></o:p></span></pre>
<pre><span style="font-size:13.5pt"> #7 0x7474138 in clang::Parser::ParseSingleDeclarationAfterTemplate(unsigned int, clang::Parser::ParsedTemplateInfo const&, clang::ParsingDeclRAIIObject&, clang::SourceLocation&, clang::AccessSpecifier, clang::AttributeList*) /mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/tools/clang/lib/Parse/ParseTemplate.cpp:207:3<o:p></o:p></span></pre>
<pre><span style="font-size:13.5pt"> #8 0x7472b4d in clang::Parser::ParseTemplateDeclarationOrSpecialization(unsigned int, clang::SourceLocation&, clang::AccessSpecifier, clang::AttributeList*) /mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/tools/clang/lib/Parse/ParseTemplate.cpp:152:10<o:p></o:p></span></pre>
<pre><span style="font-size:13.5pt"> #9 0x747159a in clang::Parser::ParseDeclarationStartingWithTemplate(unsigned int, clang::SourceLocation&, clang::AccessSpecifier, clang::AttributeList*) /mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/tools/clang/lib/Parse/ParseTemplate.cpp:38:10<o:p></o:p></span></pre>
<pre><span style="font-size:13.5pt"> #10 0x72c86ed in clang::Parser::ParseDeclaration(unsigned int, clang::SourceLocation&, clang::Parser::ParsedAttributesWithRange&) /mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/tools/clang/lib/Parse/ParseDecl.cpp:1492:18<o:p></o:p></span></pre>
<pre><span style="font-size:13.5pt"> #11 0x72819fd in clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&, clang::ParsingDeclSpec*) /mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/tools/clang/lib/Parse/Parser.cpp:749:14<o:p></o:p></span></pre>
<pre><span style="font-size:13.5pt"> #12 0x7318897 in clang::Parser::ParseInnerNamespace(std::__1::vector<clang::SourceLocation, std::__1::allocator<clang::SourceLocation> >&, std::__1::vector<clang::IdentifierInfo*, std::__1::allocator<clang::IdentifierInfo*> >&, std::__1::vector<clang::SourceLocation, std::__1::allocator<clang::SourceLocation> >&, unsigned int, clang::SourceLocation&, clang::ParsedAttributes&, clang::BalancedDelimiterTracker&) /mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/tools/clang/lib/Parse/ParseDeclCXX.cpp:221:7<o:p></o:p></span></pre>
<pre><span style="font-size:13.5pt"> #13 0x731722e in clang::Parser::ParseNamespace(unsigned int, clang::SourceLocation&, clang::SourceLocation) /mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/tools/clang/lib/Parse/ParseDeclCXX.cpp:195:3<o:p></o:p></span></pre>
<pre><span style="font-size:13.5pt"> #14 0x72c8955 in clang::Parser::ParseDeclaration(unsigned int, clang::SourceLocation&, clang::Parser::ParsedAttributesWithRange&) /mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/tools/clang/lib/Parse/ParseDecl.cpp:1505:12<o:p></o:p></span></pre>
<pre><span style="font-size:13.5pt"> #15 0x72819fd in clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&, clang::ParsingDeclSpec*) /mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/tools/clang/lib/Parse/Parser.cpp:749:14<o:p></o:p></span></pre>
<pre><span style="font-size:13.5pt"> #16 0x7281027 in clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&) /mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/tools/clang/lib/Parse/Parser.cpp:594:12<o:p></o:p></span></pre>
<pre><span style="font-size:13.5pt"> #17 0x7272931 in clang::ParseAST(clang::Sema&, bool, bool) /mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/tools/clang/lib/Parse/ParseAST.cpp:160:17<o:p></o:p></span></pre>
<pre><span style="font-size:13.5pt"> #18 0x59e5c47 in clang::FrontendAction::Execute() /mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/tools/clang/lib/Frontend/FrontendAction.cpp:458:8<o:p></o:p></span></pre>
<pre><span style="font-size:13.5pt"> #19 0x593dfcb in clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) /mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/tools/clang/lib/Frontend/CompilerInstance.cpp:868:11<o:p></o:p></span></pre>
<pre><span style="font-size:13.5pt"> #20 0x5bfcc50 in clang::ExecuteCompilerInvocation(clang::CompilerInstance*) /mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/tools/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:241:25<o:p></o:p></span></pre>
<pre><span style="font-size:13.5pt"> #21 0x8a0d65 in cc1_main(llvm::ArrayRef<char const*>, char const*, void*) /mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/tools/clang/tools/driver/cc1_main.cpp:116:13<o:p></o:p></span></pre>
<pre><span style="font-size:13.5pt"> #22 0x89ba9a in ExecuteCC1Tool /mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/tools/clang/tools/driver/driver.cpp:299:12<o:p></o:p></span></pre>
<pre><span style="font-size:13.5pt"> #23 0x89ba9a in main /mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/tools/clang/tools/driver/driver.cpp:380<o:p></o:p></span></pre>
<pre><span style="font-size:13.5pt"> #24 0x7f7d81406f44 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21f44)<o:p></o:p></span></pre>
<pre><span style="font-size:13.5pt"> #25 0x80dded in _start (/mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm_build_msan/bin/clang-3.9+0x80dded)<o:p></o:p></span></pre>
<pre><span style="font-size:13.5pt"><o:p> </o:p></span></pre>
<pre><span style="font-size:13.5pt">SUMMARY: MemorySanitizer: use-of-uninitialized-value /mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/tools/clang/lib/Parse/ParseDeclCXX.cpp:2050:9 in clang::Parser::ParseOptionalCXX11VirtSpecifierSeq(clang::VirtSpecifiers&, bool, clang::SourceLocation)<o:p></o:p></span></pre>
<pre><span style="font-size:13.5pt">Exiting<o:p></o:p></span></pre>
<pre><span style="font-size:13.5pt"><o:p> </o:p></span></pre>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div>
<p class="MsoNormal">On Fri, Jul 29, 2016 at 3:50 AM Andrey Bokhanko via cfe-commits <<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a>> wrote:<o:p></o:p></p>
</div>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-top:5.0pt;margin-right:0in;margin-bottom:5.0pt">
<p class="MsoNormal">Author: asbokhan<br>
Date: Fri Jul 29 05:42:48 2016<br>
New Revision: 277134<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=277134&view=rev" target="_blank">
http://llvm.org/viewvc/llvm-project?rev=277134&view=rev</a><br>
Log:<br>
[GCC] Support for __final specifier<br>
<br>
As reported in bug 28473, GCC supports "final" functionality in pre-C++11 code using the __final keyword. Clang currently supports the "final" keyword in accordance with the C++11 specification, however it ALSO supports it in pre-C++11 mode, with a warning.<br>
<br>
This patch adds the "__final" keyword for compatibility with GCC in GCC Keywords mode (so it is enabled with existing flags), and issues a warning on its usage (suggesting switching to the C++11 keyword). This patch also adds a regression test for the functionality
described. I believe this patch has minimal impact, as it simply adds a new keyword for existing behavior.<br>
<br>
This has been validated with check-clang to avoid regressions. Patch is created in reference to revisions 276665.<br>
<br>
Patch by Erich Keane.<br>
<br>
Differential Revision: <a href="https://reviews.llvm.org/D22919" target="_blank">
https://reviews.llvm.org/D22919</a><br>
<br>
Added:<br>
cfe/trunk/test/Parser/gcc-__final-compatibility.cpp<br>
Modified:<br>
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td<br>
cfe/trunk/include/clang/Parse/Parser.h<br>
cfe/trunk/include/clang/Sema/DeclSpec.h<br>
cfe/trunk/lib/Parse/ParseDeclCXX.cpp<br>
cfe/trunk/lib/Sema/DeclSpec.cpp<br>
<br>
Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=277134&r1=277133&r2=277134&view=diff" target="_blank">
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=277134&r1=277133&r2=277134&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)<br>
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Fri Jul 29 05:42:48 2016<br>
@@ -8652,4 +8652,8 @@ def warn_block_literal_qualifiers_on_omi<br>
"'%0' qualifier on omitted return type %1 has no effect">,<br>
InGroup<IgnoredQualifiers>;<br>
<br>
+def ext_warn_gnu_final : ExtWarn<<br>
+ "__final is a GNU extension, consider using C++11 final">,<br>
+ InGroup<GccCompat>;<br>
+<br>
} // end of sema component.<br>
<br>
Modified: cfe/trunk/include/clang/Parse/Parser.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Parse/Parser.h?rev=277134&r1=277133&r2=277134&view=diff" target="_blank">
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Parse/Parser.h?rev=277134&r1=277133&r2=277134&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/include/clang/Parse/Parser.h (original)<br>
+++ cfe/trunk/include/clang/Parse/Parser.h Fri Jul 29 05:42:48 2016<br>
@@ -143,6 +143,7 @@ class Parser : public CodeCompletionHand<br>
<br>
/// C++0x contextual keywords.<br>
mutable IdentifierInfo *Ident_final;<br>
+ mutable IdentifierInfo *Ident_GNU_final;<br>
mutable IdentifierInfo *Ident_override;<br>
<br>
// C++ type trait keywords that can be reverted to identifiers and still be<br>
<br>
Modified: cfe/trunk/include/clang/Sema/DeclSpec.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/DeclSpec.h?rev=277134&r1=277133&r2=277134&view=diff" target="_blank">
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/DeclSpec.h?rev=277134&r1=277133&r2=277134&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/include/clang/Sema/DeclSpec.h (original)<br>
+++ cfe/trunk/include/clang/Sema/DeclSpec.h Fri Jul 29 05:42:48 2016<br>
@@ -2399,7 +2399,9 @@ public:<br>
VS_None = 0,<br>
VS_Override = 1,<br>
VS_Final = 2,<br>
- VS_Sealed = 4<br>
+ VS_Sealed = 4,<br>
+ // Represents the __final keyword, which is legal for gcc in pre-C++11 mode.<br>
+ VS_GNU_Final = 8<br>
};<br>
<br>
VirtSpecifiers() : Specifiers(0), LastSpecifier(VS_None) { }<br>
@@ -2412,7 +2414,7 @@ public:<br>
bool isOverrideSpecified() const { return Specifiers & VS_Override; }<br>
SourceLocation getOverrideLoc() const { return VS_overrideLoc; }<br>
<br>
- bool isFinalSpecified() const { return Specifiers & (VS_Final | VS_Sealed); }<br>
+ bool isFinalSpecified() const { return Specifiers & (VS_Final | VS_Sealed | VS_GNU_Final); }<br>
bool isFinalSpelledSealed() const { return Specifiers & VS_Sealed; }<br>
SourceLocation getFinalLoc() const { return VS_finalLoc; }<br>
<br>
<br>
Modified: cfe/trunk/lib/Parse/ParseDeclCXX.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDeclCXX.cpp?rev=277134&r1=277133&r2=277134&view=diff" target="_blank">
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDeclCXX.cpp?rev=277134&r1=277133&r2=277134&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/lib/Parse/ParseDeclCXX.cpp (original)<br>
+++ cfe/trunk/lib/Parse/ParseDeclCXX.cpp Fri Jul 29 05:42:48 2016<br>
@@ -2005,6 +2005,7 @@ void Parser::HandleMemberFunctionDeclDel<br>
/// virt-specifier:<br>
/// override<br>
/// final<br>
+/// __final<br>
VirtSpecifiers::Specifier Parser::isCXX11VirtSpecifier(const Token &Tok) const {<br>
if (!getLangOpts().CPlusPlus || Tok.isNot(tok::identifier))<br>
return VirtSpecifiers::VS_None;<br>
@@ -2014,6 +2015,8 @@ VirtSpecifiers::Specifier Parser::isCXX1<br>
// Initialize the contextual keywords.<br>
if (!Ident_final) {<br>
Ident_final = &PP.getIdentifierTable().get("final");<br>
+ if (getLangOpts().GNUKeywords)<br>
+ Ident_GNU_final = &PP.getIdentifierTable().get("__final");<br>
if (getLangOpts().MicrosoftExt)<br>
Ident_sealed = &PP.getIdentifierTable().get("sealed");<br>
Ident_override = &PP.getIdentifierTable().get("override");<br>
@@ -2028,6 +2031,9 @@ VirtSpecifiers::Specifier Parser::isCXX1<br>
if (II == Ident_final)<br>
return VirtSpecifiers::VS_Final;<br>
<br>
+ if (II == Ident_GNU_final)<br>
+ return VirtSpecifiers::VS_GNU_Final;<br>
+<br>
return VirtSpecifiers::VS_None;<br>
}<br>
<br>
@@ -2067,6 +2073,8 @@ void Parser::ParseOptionalCXX11VirtSpeci<br>
<< VirtSpecifiers::getSpecifierName(Specifier);<br>
} else if (Specifier == VirtSpecifiers::VS_Sealed) {<br>
Diag(Tok.getLocation(), diag::ext_ms_sealed_keyword);<br>
+ } else if (Specifier == VirtSpecifiers::VS_GNU_Final) {<br>
+ Diag(Tok.getLocation(), diag::ext_warn_gnu_final);<br>
} else {<br>
Diag(Tok.getLocation(),<br>
getLangOpts().CPlusPlus11<br>
@@ -2083,6 +2091,7 @@ void Parser::ParseOptionalCXX11VirtSpeci<br>
bool Parser::isCXX11FinalKeyword() const {<br>
VirtSpecifiers::Specifier Specifier = isCXX11VirtSpecifier();<br>
return Specifier == VirtSpecifiers::VS_Final ||<br>
+ Specifier == VirtSpecifiers::VS_GNU_Final ||<br>
Specifier == VirtSpecifiers::VS_Sealed;<br>
}<br>
<br>
@@ -2996,6 +3005,7 @@ void Parser::ParseCXXMemberSpecification<br>
if (getLangOpts().CPlusPlus && Tok.is(tok::identifier)) {<br>
VirtSpecifiers::Specifier Specifier = isCXX11VirtSpecifier(Tok);<br>
assert((Specifier == VirtSpecifiers::VS_Final ||<br>
+ Specifier == VirtSpecifiers::VS_GNU_Final ||<br>
Specifier == VirtSpecifiers::VS_Sealed) &&<br>
"not a class definition");<br>
FinalLoc = ConsumeToken();<br>
@@ -3011,6 +3021,8 @@ void Parser::ParseCXXMemberSpecification<br>
<< VirtSpecifiers::getSpecifierName(Specifier);<br>
else if (Specifier == VirtSpecifiers::VS_Sealed)<br>
Diag(FinalLoc, diag::ext_ms_sealed_keyword);<br>
+ else if (Specifier == VirtSpecifiers::VS_GNU_Final)<br>
+ Diag(FinalLoc, diag::ext_warn_gnu_final);<br>
<br>
// Parse any C++11 attributes after 'final' keyword.<br>
// These attributes are not allowed to appear here,<br>
<br>
Modified: cfe/trunk/lib/Sema/DeclSpec.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/DeclSpec.cpp?rev=277134&r1=277133&r2=277134&view=diff" target="_blank">
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/DeclSpec.cpp?rev=277134&r1=277133&r2=277134&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/lib/Sema/DeclSpec.cpp (original)<br>
+++ cfe/trunk/lib/Sema/DeclSpec.cpp Fri Jul 29 05:42:48 2016<br>
@@ -1299,6 +1299,7 @@ bool VirtSpecifiers::SetSpecifier(Specif<br>
switch (VS) {<br>
default: llvm_unreachable("Unknown specifier!");<br>
case VS_Override: VS_overrideLoc = Loc; break;<br>
+ case VS_GNU_Final:<br>
case VS_Sealed:<br>
case VS_Final: VS_finalLoc = Loc; break;<br>
}<br>
@@ -1311,6 +1312,7 @@ const char *VirtSpecifiers::getSpecifier<br>
default: llvm_unreachable("Unknown specifier");<br>
case VS_Override: return "override";<br>
case VS_Final: return "final";<br>
+ case VS_GNU_Final: return "__final";<br>
case VS_Sealed: return "sealed";<br>
}<br>
}<br>
<br>
Added: cfe/trunk/test/Parser/gcc-__final-compatibility.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/gcc-__final-compatibility.cpp?rev=277134&view=auto" target="_blank">
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/gcc-__final-compatibility.cpp?rev=277134&view=auto</a><br>
==============================================================================<br>
--- cfe/trunk/test/Parser/gcc-__final-compatibility.cpp (added)<br>
+++ cfe/trunk/test/Parser/gcc-__final-compatibility.cpp Fri Jul 29 05:42:48 2016<br>
@@ -0,0 +1,9 @@<br>
+// RUN: %clang_cc1 -std=c++98 -fgnu-keywords -fsyntax-only -verify %s<br>
+// RUN: %clang_cc1 -std=c++11 -fgnu-keywords -fsyntax-only -verify %s<br>
+<br>
+struct B {<br>
+ virtual void g();<br>
+};<br>
+struct D __final : B { // expected-warning {{__final is a GNU extension, consider using C++11 final}}<br>
+ virtual void g() __final; // expected-warning {{__final is a GNU extension, consider using C++11 final}}<br>
+};<br>
<br>
<br>
_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits</a><o:p></o:p></p>
</blockquote>
</div>
</div>
</div>
<div>
<p class="MsoNormal"><span style="color:#888888">-- <o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="color:#888888">Mike<br>
Sent from phone<o:p></o:p></span></p>
</div>
</blockquote>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</div>
</body>
</html>