<div dir="ltr">Ah, sorry I just saw 333501 and this already passed on the bot. All green again. Thanks for the quick patch, sorry for the noise.<div><br></div><div>-Mike</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, May 29, 2018 at 9:33 PM, Mike Edwards <span dir="ltr"><<a href="mailto:mike@sqlby.me" target="_blank">mike@sqlby.me</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi Peter,<div>Would you please have a look at:</div><div><a href="http://green.lab.llvm.org/green/job/clang-stage1-cmake-RA-incremental/48945/" target="_blank">http://green.lab.llvm.org/<wbr>green/job/clang-stage1-cmake-<wbr>RA-incremental/48945/</a><br></div><div><br></div><div>It looks like this commit cause a test failure on the Green Dragon Incremental Builder.</div><div><br></div><div>Thanks,</div><div>Mike</div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Tue, May 29, 2018 at 8:40 PM, Peter Collingbourne via cfe-commits <span dir="ltr"><<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: pcc<br>
Date: Tue May 29 20:40:04 2018<br>
New Revision: 333498<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=333498&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject?rev=333498&view=rev</a><br>
Log:<br>
Sema: Add a flag for rejecting member pointers with incomplete base types.<br>
<br>
Codebases that need to be compatible with the Microsoft ABI can pass<br>
this flag to avoid issues caused by the lack of a fixed ABI for<br>
incomplete member pointers.<br>
<br>
Differential Revision: <a href="https://reviews.llvm.org/D47503" rel="noreferrer" target="_blank">https://reviews.llvm.org/D4750<wbr>3</a><br>
<br>
Added:<br>
cfe/trunk/test/Driver/complete<wbr>-member-pointers.cpp<br>
cfe/trunk/test/SemaCXX/complet<wbr>e-member-pointers.cpp<br>
Modified:<br>
cfe/trunk/include/clang/Basic/<wbr>DiagnosticSemaKinds.td<br>
cfe/trunk/include/clang/Basic/<wbr>LangOptions.def<br>
cfe/trunk/include/clang/Driver<wbr>/Options.td<br>
cfe/trunk/lib/Driver/ToolChain<wbr>s/Clang.cpp<br>
cfe/trunk/lib/Frontend/Compile<wbr>rInvocation.cpp<br>
cfe/trunk/lib/Sema/SemaType.cp<wbr>p<br>
<br>
Modified: cfe/trunk/include/clang/Basic/<wbr>DiagnosticSemaKinds.td<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=333498&r1=333497&r2=333498&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/cfe/trunk/include/clang/<wbr>Basic/DiagnosticSemaKinds.td?<wbr>rev=333498&r1=333497&r2=<wbr>333498&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/include/clang/Basic/<wbr>DiagnosticSemaKinds.td (original)<br>
+++ cfe/trunk/include/clang/Basic/<wbr>DiagnosticSemaKinds.td Tue May 29 20:40:04 2018<br>
@@ -6350,6 +6350,8 @@ def err_bad_memptr_rhs : Error<<br>
def err_bad_memptr_lhs : Error<<br>
"left hand operand to %0 must be a %select{|pointer to }1class "<br>
"compatible with the right hand operand, but is %2">;<br>
+def err_memptr_incomplete : Error<<br>
+ "member pointer has incomplete base type %0">;<br>
def warn_exception_caught_by_earli<wbr>er_handler : Warning<<br>
"exception of type %0 will be caught by earlier handler">,<br>
InGroup<Exceptions>;<br>
<br>
Modified: cfe/trunk/include/clang/Basic/<wbr>LangOptions.def<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/LangOptions.def?rev=333498&r1=333497&r2=333498&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/cfe/trunk/include/clang/<wbr>Basic/LangOptions.def?rev=<wbr>333498&r1=333497&r2=333498&<wbr>view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/include/clang/Basic/<wbr>LangOptions.def (original)<br>
+++ cfe/trunk/include/clang/Basic/<wbr>LangOptions.def Tue May 29 20:40:04 2018<br>
@@ -247,6 +247,10 @@ ENUM_LANGOPT(AddressSpaceMapMa<wbr>ngling , A<br>
LANGOPT(IncludeDefaultHeader, 1, 0, "Include default header file for OpenCL")<br>
BENIGN_LANGOPT(DelayedTemplat<wbr>eParsing , 1, 0, "delayed template parsing")<br>
LANGOPT(BlocksRuntimeOptional , 1, 0, "optional blocks runtime")<br>
+LANGOPT(<br>
+ CompleteMemberPointers, 1, 0,<br>
+ "Require member pointer base types to be complete at the point where the "<br>
+ "type's inheritance model would be determined under the Microsoft ABI")<br>
<br>
ENUM_LANGOPT(GC, GCMode, 2, NonGC, "Objective-C Garbage Collection mode")<br>
ENUM_LANGOPT(ValueVisibilityM<wbr>ode, Visibility, 3, DefaultVisibility,<br>
<br>
Modified: cfe/trunk/include/clang/Driver<wbr>/Options.td<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=333498&r1=333497&r2=333498&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/cfe/trunk/include/clang/<wbr>Driver/Options.td?rev=333498&<wbr>r1=333497&r2=333498&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/include/clang/Driver<wbr>/Options.td (original)<br>
+++ cfe/trunk/include/clang/Driver<wbr>/Options.td Tue May 29 20:40:04 2018<br>
@@ -782,6 +782,12 @@ def fcomment_block_commands : CommaJoine<br>
def fparse_all_comments : Flag<["-"], "fparse-all-comments">, Group<f_clang_Group>, Flags<[CC1Option]>;<br>
def fcommon : Flag<["-"], "fcommon">, Group<f_Group>;<br>
def fcompile_resource_EQ : Joined<["-"], "fcompile-resource=">, Group<f_Group>;<br>
+def fcomplete_member_pointers : Flag<["-"], "fcomplete-member-pointers">, Group<f_clang_Group>,<br>
+ Flags<[CoreOption, CC1Option]>,<br>
+ HelpText<"Require member pointer base types to be complete if they would be significant under the Microsoft ABI">;<br>
+def fno_complete_member_pointers : Flag<["-"], "fno-complete-member-pointers"<wbr>>, Group<f_clang_Group>,<br>
+ Flags<[CoreOption]>,<br>
+ HelpText<"Do not require member pointer base types to be complete if they would be significant under the Microsoft ABI">;<br>
def fconstant_cfstrings : Flag<["-"], "fconstant-cfstrings">, Group<f_Group>;<br>
def fconstant_string_class_EQ : Joined<["-"], "fconstant-string-class=">, Group<f_Group>;<br>
def fconstexpr_depth_EQ : Joined<["-"], "fconstexpr-depth=">, Group<f_Group>;<br>
<br>
Modified: cfe/trunk/lib/Driver/ToolChain<wbr>s/Clang.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Clang.cpp?rev=333498&r1=333497&r2=333498&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/cfe/trunk/lib/Driver/Too<wbr>lChains/Clang.cpp?rev=333498&<wbr>r1=333497&r2=333498&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/lib/Driver/ToolChain<wbr>s/Clang.cpp (original)<br>
+++ cfe/trunk/lib/Driver/ToolChain<wbr>s/Clang.cpp Tue May 29 20:40:04 2018<br>
@@ -4784,6 +4784,10 @@ void Clang::ConstructJob(Compilatio<wbr>n &C,<br>
CmdArgs.push_back("-fforce-en<wbr>able-int128");<br>
}<br>
<br>
+ if (Args.hasFlag(options::OPT_fco<wbr>mplete_member_pointers,<br>
+ options::OPT_fno_complete_mem<wbr>ber_pointers, false))<br>
+ CmdArgs.push_back("-fcomplete-<wbr>member-pointers");<br>
+<br>
// Finally add the compile command to the compilation.<br>
if (Args.hasArg(options::OPT__SLA<wbr>SH_fallback) &&<br>
Output.getType() == types::TY_Object &&<br>
<br>
Modified: cfe/trunk/lib/Frontend/Compile<wbr>rInvocation.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=333498&r1=333497&r2=333498&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/cfe/trunk/lib/Frontend/<wbr>CompilerInvocation.cpp?rev=<wbr>333498&r1=333497&r2=333498&<wbr>view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/lib/Frontend/Compile<wbr>rInvocation.cpp (original)<br>
+++ cfe/trunk/lib/Frontend/Compile<wbr>rInvocation.cpp Tue May 29 20:40:04 2018<br>
@@ -2754,6 +2754,8 @@ static void ParseLangArgs(LangOptions &O<br>
<< A->getAsString(Args) << A->getValue();<br>
}<br>
}<br>
+<br>
+ Opts.CompleteMemberPointers = Args.hasArg(OPT_fcomplete_memb<wbr>er_pointers);<br>
}<br>
<br>
static bool isStrictlyPreprocessorAction(f<wbr>rontend::ActionKind Action) {<br>
<br>
Modified: cfe/trunk/lib/Sema/SemaType.cp<wbr>p<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaType.cpp?rev=333498&r1=333497&r2=333498&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/cfe/trunk/lib/Sema/SemaT<wbr>ype.cpp?rev=333498&r1=333497&<wbr>r2=333498&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/lib/Sema/SemaType.cp<wbr>p (original)<br>
+++ cfe/trunk/lib/Sema/SemaType.cp<wbr>p Tue May 29 20:40:04 2018<br>
@@ -7585,11 +7585,17 @@ bool Sema::RequireCompleteTypeImpl(<wbr>Sourc<br>
// assert(!T->isDependentType() &&<br>
// "Can't ask whether a dependent type is complete");<br>
<br>
- // We lock in the inheritance model once somebody has asked us to ensure<br>
- // that a pointer-to-member type is complete.<br>
- if (Context.getTargetInfo().getCX<wbr>XABI().isMicrosoft()) {<br>
- if (const MemberPointerType *MPTy = T->getAs<MemberPointerType>()) {<br>
- if (!MPTy->getClass()->isDependen<wbr>tType()) {<br>
+ if (const MemberPointerType *MPTy = T->getAs<MemberPointerType>()) {<br>
+ if (!MPTy->getClass()->isDependen<wbr>tType()) {<br>
+ if (getLangOpts().CompleteMemberP<wbr>ointers &&<br>
+ !MPTy->getClass()->getAsCXXRec<wbr>ordDecl()->isBeingDefined() &&<br>
+ RequireCompleteType(Loc, QualType(MPTy->getClass(), 0),<br>
+ diag::err_memptr_incomplete))<br>
+ return true;<br>
+<br>
+ // We lock in the inheritance model once somebody has asked us to ensure<br>
+ // that a pointer-to-member type is complete.<br>
+ if (Context.getTargetInfo().getCX<wbr>XABI().isMicrosoft()) {<br>
(void)isCompleteType(Loc, QualType(MPTy->getClass(), 0));<br>
assignInheritanceModel(*this, MPTy->getMostRecentCXXRecordDe<wbr>cl());<br>
}<br>
<br>
Added: cfe/trunk/test/Driver/complete<wbr>-member-pointers.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/complete-member-pointers.cpp?rev=333498&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/cfe/trunk/test/Driver/co<wbr>mplete-member-pointers.cpp?rev<wbr>=333498&view=auto</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/test/Driver/complete<wbr>-member-pointers.cpp (added)<br>
+++ cfe/trunk/test/Driver/complete<wbr>-member-pointers.cpp Tue May 29 20:40:04 2018<br>
@@ -0,0 +1,7 @@<br>
+// RUN: %clangxx -### -c %s -o %t.o -target x86_64-unknown-linux 2>&1 | FileCheck --check-prefix=NOFLAG %s<br>
+// RUN: %clangxx -### -c %s -o %t.o -target x86_64-unknown-linux -fcomplete-member-pointers 2>&1 | FileCheck %s<br>
+// RUN: %clangxx -### -c %s -o %t.o -target x86_64-unknown-linux -fcomplete-member-pointers -fno-complete-member-pointers 2>&1 | FileCheck --check-prefix=NOFLAG %s<br>
+// RUN: %clang_cl -### /c %s /Fo%t.o -target x86_64-pc-win32 -fcomplete-member-pointers 2>&1 | FileCheck %s<br>
+<br>
+// CHECK: "-fcomplete-member-pointers"<br>
+// NOFLAG-NOT: "-fcomplete-member-pointers"<br>
<br>
Added: cfe/trunk/test/SemaCXX/complet<wbr>e-member-pointers.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/complete-member-pointers.cpp?rev=333498&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/cfe/trunk/test/SemaCXX/<wbr>complete-member-pointers.cpp?<wbr>rev=333498&view=auto</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/test/SemaCXX/complet<wbr>e-member-pointers.cpp (added)<br>
+++ cfe/trunk/test/SemaCXX/complet<wbr>e-member-pointers.cpp Tue May 29 20:40:04 2018<br>
@@ -0,0 +1,15 @@<br>
+// RUN: %clang_cc1 -verify -fsyntax-only -fcomplete-member-pointers %s<br>
+<br>
+struct S; // expected-note {{forward declaration of 'S'}}<br>
+typedef int S::*t;<br>
+t foo; // expected-error {{member pointer has incomplete base type 'S'}}<br>
+<br>
+struct S2 {<br>
+ int S2::*foo;<br>
+};<br>
+int S2::*bar;<br>
+<br>
+template <typename T><br>
+struct S3 {<br>
+ int T::*foo;<br>
+};<br>
<br>
<br>
______________________________<wbr>_________________<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" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/cfe-commits</a><br>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div>