<div dir="ltr">Either this or your other ODR hash change seems to have broken the modules buildbot:<div><br></div><div><a href="http://lab.llvm.org:8011/builders/clang-x86_64-linux-selfhost-modules-2/builds/6274/steps/compile.llvm.stage2/logs/stdio">http://lab.llvm.org:8011/builders/clang-x86_64-linux-selfhost-modules-2/builds/6274/steps/compile.llvm.stage2/logs/stdio</a><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On 11 April 2017 at 15:32, Richard Trieu 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: rtrieu<br>
Date: Tue Apr 11 17:32:03 2017<br>
New Revision: 300001<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=300001&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project?rev=300001&view=rev</a><br>
Log:<br>
Revert r298824 & r298816, recommit r298742 & r298754<br>
<br>
r299989 fixes the underlying issue by waiting long enough to late parsed<br>
arguments to be processed before doing an calculating the hash.<br>
<br>
r298742<br>
[ODRHash] Add error messages for mismatched parameters in methods.<br>
<br>
r298754<br>
[ODRHash] Add support for array and decayed types.<br>
<br>
Modified:<br>
cfe/trunk/include/clang/Basic/<wbr>DiagnosticSerializationKinds.<wbr>td<br>
cfe/trunk/lib/AST/ODRHash.cpp<br>
cfe/trunk/lib/Serialization/<wbr>ASTReader.cpp<br>
cfe/trunk/test/Modules/odr_<wbr>hash.cpp<br>
<br>
Modified: cfe/trunk/include/clang/Basic/<wbr>DiagnosticSerializationKinds.<wbr>td<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSerializationKinds.td?rev=300001&r1=300000&r2=300001&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/include/<wbr>clang/Basic/<wbr>DiagnosticSerializationKinds.<wbr>td?rev=300001&r1=300000&r2=<wbr>300001&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/include/clang/Basic/<wbr>DiagnosticSerializationKinds.<wbr>td (original)<br>
+++ cfe/trunk/include/clang/Basic/<wbr>DiagnosticSerializationKinds.<wbr>td Tue Apr 11 17:32:03 2017<br>
@@ -146,7 +146,12 @@ def err_module_odr_violation_<wbr>mismatch_de<br>
"method %4 is %select{not static|static}5|"<br>
"method %4 is %select{not volatile|volatile}5|"<br>
"method %4 is %select{not const|const}5|"<br>
- "method %4 is %select{not inline|inline}5}3">;<br>
+ "method %4 is %select{not inline|inline}5|"<br>
+ "method %4 that has %5 parameter%s5|"<br>
+ "method %4 with %ordinal5 parameter of type %6%select{| decayed from %8}7|"<br>
+ "method %4 with %ordinal5 parameter named %6|"<br>
+ "method %4 with %ordinal5 parameter with %select{no |}6default argument|"<br>
+ "method %4 with %ordinal5 parameter with default argument}3">;<br>
<br>
def note_module_odr_violation_<wbr>mismatch_decl_diff : Note<"but in '%0' found "<br>
"%select{"<br>
@@ -166,7 +171,12 @@ def note_module_odr_violation_<wbr>mismatch_d<br>
"method %2 is %select{not static|static}3|"<br>
"method %2 is %select{not volatile|volatile}3|"<br>
"method %2 is %select{not const|const}3|"<br>
- "method %2 is %select{not inline|inline}3}1">;<br>
+ "method %2 is %select{not inline|inline}3|"<br>
+ "method %2 that has %3 parameter%s3|"<br>
+ "method %2 with %ordinal3 parameter of type %4%select{| decayed from %6}5|"<br>
+ "method %2 with %ordinal3 parameter named %4|"<br>
+ "method %2 with %ordinal3 parameter with %select{no |}4default argument|"<br>
+ "method %2 with %ordinal3 parameter with different default argument}1">;<br>
<br>
def warn_module_uses_date_time : Warning<<br>
"%select{precompiled header|module}0 uses __DATE__ or __TIME__">,<br>
<br>
Modified: cfe/trunk/lib/AST/ODRHash.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ODRHash.cpp?rev=300001&r1=300000&r2=300001&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/lib/AST/<wbr>ODRHash.cpp?rev=300001&r1=<wbr>300000&r2=300001&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/lib/AST/ODRHash.cpp (original)<br>
+++ cfe/trunk/lib/AST/ODRHash.cpp Tue Apr 11 17:32:03 2017<br>
@@ -169,6 +169,11 @@ public:<br>
Inherited::VisitValueDecl(D);<br>
}<br>
<br>
+ void VisitParmVarDecl(const ParmVarDecl *D) {<br>
+ AddStmt(D->getDefaultArg());<br>
+ Inherited::VisitParmVarDecl(D)<wbr>;<br>
+ }<br>
+<br>
void VisitAccessSpecDecl(const AccessSpecDecl *D) {<br>
ID.AddInteger(D->getAccess());<br>
Inherited::<wbr>VisitAccessSpecDecl(D);<br>
@@ -202,6 +207,12 @@ public:<br>
Hash.AddBoolean(D->isPure());<br>
Hash.AddBoolean(D-><wbr>isDeletedAsWritten());<br>
<br>
+ ID.AddInteger(D->param_size())<wbr>;<br>
+<br>
+ for (auto *Param : D->parameters()) {<br>
+ Hash.AddSubDecl(Param);<br>
+ }<br>
+<br>
Inherited::VisitFunctionDecl(<wbr>D);<br>
}<br>
<br>
@@ -315,6 +326,14 @@ public:<br>
}<br>
}<br>
<br>
+ void AddQualType(QualType T) {<br>
+ Hash.AddQualType(T);<br>
+ }<br>
+<br>
+ void VisitQualifiers(Qualifiers Quals) {<br>
+ ID.AddInteger(Quals.<wbr>getAsOpaqueValue());<br>
+ }<br>
+<br>
void Visit(const Type *T) {<br>
ID.AddInteger(T->getTypeClass(<wbr>));<br>
Inherited::Visit(T);<br>
@@ -322,11 +341,92 @@ public:<br>
<br>
void VisitType(const Type *T) {}<br>
<br>
+ void VisitAdjustedType(const AdjustedType *T) {<br>
+ AddQualType(T-><wbr>getOriginalType());<br>
+ AddQualType(T-><wbr>getAdjustedType());<br>
+ VisitType(T);<br>
+ }<br>
+<br>
+ void VisitDecayedType(const DecayedType *T) {<br>
+ AddQualType(T->getDecayedType(<wbr>));<br>
+ AddQualType(T->getPointeeType(<wbr>));<br>
+ VisitAdjustedType(T);<br>
+ }<br>
+<br>
+ void VisitArrayType(const ArrayType *T) {<br>
+ AddQualType(T->getElementType(<wbr>));<br>
+ ID.AddInteger(T-><wbr>getSizeModifier());<br>
+ VisitQualifiers(T-><wbr>getIndexTypeQualifiers());<br>
+ VisitType(T);<br>
+ }<br>
+ void VisitConstantArrayType(const ConstantArrayType *T) {<br>
+ T->getSize().Profile(ID);<br>
+ VisitArrayType(T);<br>
+ }<br>
+<br>
+ void VisitDependentSizedArrayType(<wbr>const DependentSizedArrayType *T) {<br>
+ AddStmt(T->getSizeExpr());<br>
+ VisitArrayType(T);<br>
+ }<br>
+<br>
+ void VisitIncompleteArrayType(const IncompleteArrayType *T) {<br>
+ VisitArrayType(T);<br>
+ }<br>
+<br>
+ void VisitVariableArrayType(const VariableArrayType *T) {<br>
+ AddStmt(T->getSizeExpr());<br>
+ VisitArrayType(T);<br>
+ }<br>
+<br>
void VisitBuiltinType(const BuiltinType *T) {<br>
ID.AddInteger(T->getKind());<br>
VisitType(T);<br>
}<br>
<br>
+ void VisitFunctionType(const FunctionType *T) {<br>
+ AddQualType(T->getReturnType()<wbr>);<br>
+ T->getExtInfo().Profile(ID);<br>
+ Hash.AddBoolean(T->isConst());<br>
+ Hash.AddBoolean(T->isVolatile(<wbr>));<br>
+ Hash.AddBoolean(T->isRestrict(<wbr>));<br>
+ VisitType(T);<br>
+ }<br>
+<br>
+ void VisitFunctionNoProtoType(const FunctionNoProtoType *T) {<br>
+ VisitFunctionType(T);<br>
+ }<br>
+<br>
+ void VisitFunctionProtoType(const FunctionProtoType *T) {<br>
+ ID.AddInteger(T->getNumParams(<wbr>));<br>
+ for (auto ParamType : T->getParamTypes())<br>
+ AddQualType(ParamType);<br>
+<br>
+ const auto &epi = T->getExtProtoInfo();<br>
+ ID.AddInteger(epi.Variadic);<br>
+ ID.AddInteger(epi.TypeQuals);<br>
+ ID.AddInteger(epi.<wbr>RefQualifier);<br>
+ ID.AddInteger(epi.<wbr>ExceptionSpec.Type);<br>
+<br>
+ if (epi.ExceptionSpec.Type == EST_Dynamic) {<br>
+ for (QualType Ex : epi.ExceptionSpec.Exceptions)<br>
+ AddQualType(Ex);<br>
+ } else if (epi.ExceptionSpec.Type == EST_ComputedNoexcept &&<br>
+ epi.ExceptionSpec.<wbr>NoexceptExpr) {<br>
+ AddStmt(epi.ExceptionSpec.<wbr>NoexceptExpr);<br>
+ } else if (epi.ExceptionSpec.Type == EST_Uninstantiated ||<br>
+ epi.ExceptionSpec.Type == EST_Unevaluated) {<br>
+ AddDecl(epi.ExceptionSpec.<wbr>SourceDecl->getCanonicalDecl()<wbr>);<br>
+ }<br>
+ if (epi.ExtParameterInfos) {<br>
+ for (unsigned i = 0; i != T->getNumParams(); ++i)<br>
+ ID.AddInteger(epi.<wbr>ExtParameterInfos[i].<wbr>getOpaqueValue());<br>
+ }<br>
+ epi.ExtInfo.Profile(ID);<br>
+ Hash.AddBoolean(epi.<wbr>HasTrailingReturn);<br>
+<br>
+ VisitFunctionType(T);<br>
+ }<br>
+<br>
void VisitTypedefType(const TypedefType *T) {<br>
AddDecl(T->getDecl());<br>
Hash.AddQualType(T->getDecl()-<wbr>>getUnderlyingType());<br>
<br>
Modified: cfe/trunk/lib/Serialization/<wbr>ASTReader.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReader.cpp?rev=300001&r1=300000&r2=300001&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/lib/<wbr>Serialization/ASTReader.cpp?<wbr>rev=300001&r1=300000&r2=<wbr>300001&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/lib/Serialization/<wbr>ASTReader.cpp (original)<br>
+++ cfe/trunk/lib/Serialization/<wbr>ASTReader.cpp Tue Apr 11 17:32:03 2017<br>
@@ -9282,6 +9282,11 @@ void ASTReader::<wbr>diagnoseOdrViolations()<br>
MethodVolatile,<br>
MethodConst,<br>
MethodInline,<br>
+ MethodNumberParameters,<br>
+ MethodParameterType,<br>
+ MethodParameterName,<br>
+ MethodParameterSingleDefaultAr<wbr>gument,<br>
+ MethodParameterDifferentDefaul<wbr>tArguments,<br>
};<br>
<br>
// These lambdas have the common portions of the ODR diagnostics. This<br>
@@ -9605,6 +9610,104 @@ void ASTReader::<wbr>diagnoseOdrViolations()<br>
Diagnosed = true;<br>
break;<br>
}<br>
+<br>
+ const unsigned FirstNumParameters = FirstMethod->param_size();<br>
+ const unsigned SecondNumParameters = SecondMethod->param_size();<br>
+ if (FirstNumParameters != SecondNumParameters) {<br>
+ ODRDiagError(FirstMethod-><wbr>getLocation(),<br>
+ FirstMethod->getSourceRange(), MethodNumberParameters)<br>
+ << FirstName << FirstNumParameters;<br>
+ ODRDiagNote(SecondMethod-><wbr>getLocation(),<br>
+ SecondMethod->getSourceRange()<wbr>, MethodNumberParameters)<br>
+ << SecondName << SecondNumParameters;<br>
+ Diagnosed = true;<br>
+ break;<br>
+ }<br>
+<br>
+ // Need this status boolean to know when break out of the switch.<br>
+ bool ParameterMismatch = false;<br>
+ for (unsigned I = 0; I < FirstNumParameters; ++I) {<br>
+ const ParmVarDecl *FirstParam = FirstMethod->getParamDecl(I);<br>
+ const ParmVarDecl *SecondParam = SecondMethod->getParamDecl(I);<br>
+<br>
+ QualType FirstParamType = FirstParam->getType();<br>
+ QualType SecondParamType = SecondParam->getType();<br>
+ if (FirstParamType != SecondParamType) {<br>
+ if (const DecayedType *ParamDecayedType =<br>
+ FirstParamType->getAs<<wbr>DecayedType>()) {<br>
+ ODRDiagError(FirstMethod-><wbr>getLocation(),<br>
+ FirstMethod->getSourceRange(), MethodParameterType)<br>
+ << FirstName << (I + 1) << FirstParamType << true<br>
+ << ParamDecayedType-><wbr>getOriginalType();<br>
+ } else {<br>
+ ODRDiagError(FirstMethod-><wbr>getLocation(),<br>
+ FirstMethod->getSourceRange(), MethodParameterType)<br>
+ << FirstName << (I + 1) << FirstParamType << false;<br>
+ }<br>
+<br>
+ if (const DecayedType *ParamDecayedType =<br>
+ SecondParamType->getAs<<wbr>DecayedType>()) {<br>
+ ODRDiagNote(SecondMethod-><wbr>getLocation(),<br>
+ SecondMethod->getSourceRange()<wbr>, MethodParameterType)<br>
+ << SecondName << (I + 1) << SecondParamType << true<br>
+ << ParamDecayedType-><wbr>getOriginalType();<br>
+ } else {<br>
+ ODRDiagNote(SecondMethod-><wbr>getLocation(),<br>
+ SecondMethod->getSourceRange()<wbr>, MethodParameterType)<br>
+ << SecondName << (I + 1) << SecondParamType << false;<br>
+ }<br>
+ ParameterMismatch = true;<br>
+ break;<br>
+ }<br>
+<br>
+ DeclarationName FirstParamName = FirstParam->getDeclName();<br>
+ DeclarationName SecondParamName = SecondParam->getDeclName();<br>
+ if (FirstParamName != SecondParamName) {<br>
+ ODRDiagError(FirstMethod-><wbr>getLocation(),<br>
+ FirstMethod->getSourceRange(), MethodParameterName)<br>
+ << FirstName << (I + 1) << FirstParamName;<br>
+ ODRDiagNote(SecondMethod-><wbr>getLocation(),<br>
+ SecondMethod->getSourceRange()<wbr>, MethodParameterName)<br>
+ << SecondName << (I + 1) << SecondParamName;<br>
+ ParameterMismatch = true;<br>
+ break;<br>
+ }<br>
+<br>
+ const Expr* FirstDefaultArg = FirstParam->getDefaultArg();<br>
+ const Expr* SecondDefaultArg = SecondParam->getDefaultArg();<br>
+ if ((!FirstDefaultArg && SecondDefaultArg) ||<br>
+ (FirstDefaultArg && !SecondDefaultArg)) {<br>
+ ODRDiagError(FirstMethod-><wbr>getLocation(),<br>
+ FirstMethod->getSourceRange(),<br>
+ MethodParameterSingleDefaultAr<wbr>gument)<br>
+ << FirstName << (I + 1) << (FirstDefaultArg != nullptr);<br>
+ ODRDiagNote(SecondMethod-><wbr>getLocation(),<br>
+ SecondMethod->getSourceRange()<wbr>,<br>
+ MethodParameterSingleDefaultAr<wbr>gument)<br>
+ << SecondName << (I + 1) << (SecondDefaultArg != nullptr);<br>
+ ParameterMismatch = true;<br>
+ break;<br>
+ }<br>
+<br>
+ if (ComputeODRHash(<wbr>FirstDefaultArg) !=<br>
+ ComputeODRHash(<wbr>SecondDefaultArg)) {<br>
+ ODRDiagError(FirstMethod-><wbr>getLocation(),<br>
+ FirstMethod->getSourceRange(),<br>
+ MethodParameterDifferentDefaul<wbr>tArguments)<br>
+ << FirstName << (I + 1);<br>
+ ODRDiagNote(SecondMethod-><wbr>getLocation(),<br>
+ SecondMethod->getSourceRange()<wbr>,<br>
+ MethodParameterDifferentDefaul<wbr>tArguments)<br>
+ << SecondName << (I + 1);<br>
+ ParameterMismatch = true;<br>
+ break;<br>
+ }<br>
+ }<br>
+<br>
+ if (ParameterMismatch) {<br>
+ Diagnosed = true;<br>
+ break;<br>
+ }<br>
<br>
break;<br>
}<br>
<br>
Modified: cfe/trunk/test/Modules/odr_<wbr>hash.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/odr_hash.cpp?rev=300001&r1=300000&r2=300001&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/test/<wbr>Modules/odr_hash.cpp?rev=<wbr>300001&r1=300000&r2=300001&<wbr>view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/test/Modules/odr_<wbr>hash.cpp (original)<br>
+++ cfe/trunk/test/Modules/odr_<wbr>hash.cpp Tue Apr 11 17:32:03 2017<br>
@@ -275,6 +275,33 @@ S11 s11;<br>
// expected-note@first.h:* {{but in 'FirstModule' found field 'x' with a different initializer}}<br>
#endif<br>
<br>
+#if defined(FIRST)<br>
+struct S12 {<br>
+ unsigned x[5];<br>
+};<br>
+#elif defined(SECOND)<br>
+struct S12 {<br>
+ unsigned x[7];<br>
+};<br>
+#else<br>
+S12 s12;<br>
+// expected-error@first.h:* {{'Field::S12::x' from module 'FirstModule' is not present in definition of 'Field::S12' in module 'SecondModule'}}<br>
+// expected-note@second.h:* {{declaration of 'x' does not match}}<br>
+#endif<br>
+<br>
+#if defined(FIRST)<br>
+struct S13 {<br>
+ unsigned x[7];<br>
+};<br>
+#elif defined(SECOND)<br>
+struct S13 {<br>
+ double x[7];<br>
+};<br>
+#else<br>
+S13 s13;<br>
+// expected-error@first.h:* {{'Field::S13::x' from module 'FirstModule' is not present in definition of 'Field::S13' in module 'SecondModule'}}<br>
+// expected-note@second.h:* {{declaration of 'x' does not match}}<br>
+#endif<br>
} // namespace Field<br>
<br>
namespace Method {<br>
@@ -403,6 +430,93 @@ S8 s8;<br>
// expected-note@first.h:* {{but in 'FirstModule' found method 'A' is const}}<br>
#endif<br>
<br>
+#if defined(FIRST)<br>
+struct S9 {<br>
+ void A(int x) {}<br>
+ void A(int x, int y) {}<br>
+};<br>
+#elif defined(SECOND)<br>
+struct S9 {<br>
+ void A(int x, int y) {}<br>
+ void A(int x) {}<br>
+};<br>
+#else<br>
+S9 s9;<br>
+// expected-error@second.h:* {{'Method::S9' has different definitions in different modules; first difference is definition in module 'SecondModule' found method 'A' that has 2 parameters}}<br>
+// expected-note@first.h:* {{but in 'FirstModule' found method 'A' that has 1 parameter}}<br>
+#endif<br>
+<br>
+#if defined(FIRST)<br>
+struct S10 {<br>
+ void A(int x) {}<br>
+ void A(float x) {}<br>
+};<br>
+#elif defined(SECOND)<br>
+struct S10 {<br>
+ void A(float x) {}<br>
+ void A(int x) {}<br>
+};<br>
+#else<br>
+S10 s10;<br>
+// expected-error@second.h:* {{'Method::S10' has different definitions in different modules; first difference is definition in module 'SecondModule' found method 'A' with 1st parameter of type 'float'}}<br>
+// expected-note@first.h:* {{but in 'FirstModule' found method 'A' with 1st parameter of type 'int'}}<br>
+#endif<br>
+<br>
+#if defined(FIRST)<br>
+struct S11 {<br>
+ void A(int x) {}<br>
+};<br>
+#elif defined(SECOND)<br>
+struct S11 {<br>
+ void A(int y) {}<br>
+};<br>
+#else<br>
+S11 s11;<br>
+// expected-error@second.h:* {{'Method::S11' has different definitions in different modules; first difference is definition in module 'SecondModule' found method 'A' with 1st parameter named 'y'}}<br>
+// expected-note@first.h:* {{but in 'FirstModule' found method 'A' with 1st parameter named 'x'}}<br>
+#endif<br>
+<br>
+#if defined(FIRST)<br>
+struct S12 {<br>
+ void A(int x) {}<br>
+};<br>
+#elif defined(SECOND)<br>
+struct S12 {<br>
+ void A(int x = 1) {}<br>
+};<br>
+#else<br>
+S12 s12;<br>
+// expected-error@second.h:* {{'Method::S12' has different definitions in different modules; first difference is definition in module 'SecondModule' found method 'A' with 1st parameter with default argument}}<br>
+// expected-note@first.h:* {{but in 'FirstModule' found method 'A' with 1st parameter with no default argument}}<br>
+#endif<br>
+<br>
+#if defined(FIRST)<br>
+struct S13 {<br>
+ void A(int x = 1 + 0) {}<br>
+};<br>
+#elif defined(SECOND)<br>
+struct S13 {<br>
+ void A(int x = 1) {}<br>
+};<br>
+#else<br>
+S13 s13;<br>
+// expected-error@second.h:* {{'Method::S13' has different definitions in different modules; first difference is definition in module 'SecondModule' found method 'A' with 1st parameter with default argument}}<br>
+// expected-note@first.h:* {{but in 'FirstModule' found method 'A' with 1st parameter with different default argument}}<br>
+#endif<br>
+<br>
+#if defined(FIRST)<br>
+struct S14 {<br>
+ void A(int x[2]) {}<br>
+};<br>
+#elif defined(SECOND)<br>
+struct S14 {<br>
+ void A(int x[3]) {}<br>
+};<br>
+#else<br>
+S14 s14;<br>
+// expected-error@second.h:* {{'Method::S14' has different definitions in different modules; first difference is definition in module 'SecondModule' found method 'A' with 1st parameter of type 'int *' decayed from 'int [3]'}}<br>
+// expected-note@first.h:* {{but in 'FirstModule' found method 'A' with 1st parameter of type 'int *' decayed from 'int [2]'}}<br>
+#endif<br>
} // namespace Method<br>
<br>
// Naive parsing of AST can lead to cycles in processing. Ensure<br>
@@ -522,71 +636,54 @@ S3 s3;<br>
#endif<br>
} // namespace Using<br>
<br>
-<br>
// Interesting cases that should not cause errors. struct S should not error<br>
// while struct T should error at the access specifier mismatch at the end.<br>
+#define ALL_DECLS \<br>
+public: \<br>
+private: \<br>
+protected: \<br>
+ static_assert(1 == 1, "Message"); \<br>
+ static_assert(2 == 2); \<br>
+ \<br>
+ int x; \<br>
+ double y; \<br>
+ \<br>
+ INT z; \<br>
+ \<br>
+ unsigned a : 1; \<br>
+ unsigned b : 2 * 2 + 5 / 2; \<br>
+ \<br>
+ mutable int c = sizeof(x + y); \<br>
+ \<br>
+ void method() {} \<br>
+ static void static_method() {} \<br>
+ virtual void virtual_method() {} \<br>
+ virtual void pure_virtual_method() = 0; \<br>
+ inline void inline_method() {} \<br>
+ void volatile_method() volatile {} \<br>
+ void const_method() const {} \<br>
+ \<br>
+ typedef int typedef_int; \<br>
+ using using_int = int; \<br>
+ \<br>
+ void method_one_arg(int x) {} \<br>
+ void method_one_arg_default_<wbr>argument(int x = 5 + 5) {} \<br>
+ void method_decayed_type(int x[5]) {} \<br>
+ \<br>
+ int constant_arr[5]; \<br>
+ \<br>
+ double last_decl;<br>
+<br>
namespace AllDecls {<br>
#if defined(FIRST)<br>
typedef int INT;<br>
struct S {<br>
- public:<br>
- private:<br>
- protected:<br>
-<br>
- static_assert(1 == 1, "Message");<br>
- static_assert(2 == 2);<br>
-<br>
- int x;<br>
- double y;<br>
-<br>
- INT z;<br>
-<br>
- unsigned a : 1;<br>
- unsigned b : 2*2 + 5/2;<br>
-<br>
- mutable int c = sizeof(x + y);<br>
-<br>
- void method() {}<br>
- static void static_method() {}<br>
- virtual void virtual_method() {}<br>
- virtual void pure_virtual_method() = 0;<br>
- inline void inline_method() {}<br>
- void volatile_method() volatile {}<br>
- void const_method() const {}<br>
-<br>
- typedef int typedef_int;<br>
- using using_int = int;<br>
+ ALL_DECLS<br>
};<br>
#elif defined(SECOND)<br>
typedef int INT;<br>
struct S {<br>
- public:<br>
- private:<br>
- protected:<br>
-<br>
- static_assert(1 == 1, "Message");<br>
- static_assert(2 == 2);<br>
-<br>
- int x;<br>
- double y;<br>
-<br>
- INT z;<br>
-<br>
- unsigned a : 1;<br>
- unsigned b : 2 * 2 + 5 / 2;<br>
-<br>
- mutable int c = sizeof(x + y);<br>
-<br>
- void method() {}<br>
- static void static_method() {}<br>
- virtual void virtual_method() {}<br>
- virtual void pure_virtual_method() = 0;<br>
- inline void inline_method() {}<br>
- void volatile_method() volatile {}<br>
- void const_method() const {}<br>
-<br>
- typedef int typedef_int;<br>
- using using_int = int;<br>
+ ALL_DECLS<br>
};<br>
#else<br>
S *s;<br>
@@ -595,66 +692,14 @@ S *s;<br>
#if defined(FIRST)<br>
typedef int INT;<br>
struct T {<br>
- public:<br>
- private:<br>
- protected:<br>
-<br>
- static_assert(1 == 1, "Message");<br>
- static_assert(2 == 2);<br>
-<br>
- int x;<br>
- double y;<br>
-<br>
- INT z;<br>
-<br>
- unsigned a : 1;<br>
- unsigned b : 2 * 2 + 5 / 2;<br>
-<br>
- mutable int c = sizeof(x + y);<br>
-<br>
- void method() {}<br>
- static void static_method() {}<br>
- virtual void virtual_method() {}<br>
- virtual void pure_virtual_method() = 0;<br>
- inline void inline_method() {}<br>
- void volatile_method() volatile {}<br>
- void const_method() const {}<br>
-<br>
- typedef int typedef_int;<br>
- using using_int = int;<br>
+ ALL_DECLS<br>
<br>
private:<br>
};<br>
#elif defined(SECOND)<br>
typedef int INT;<br>
struct T {<br>
- public:<br>
- private:<br>
- protected:<br>
-<br>
- static_assert(1 == 1, "Message");<br>
- static_assert(2 == 2);<br>
-<br>
- int x;<br>
- double y;<br>
-<br>
- INT z;<br>
-<br>
- unsigned a : 1;<br>
- unsigned b : 2 * 2 + 5 / 2;<br>
-<br>
- mutable int c = sizeof(x + y);<br>
-<br>
- void method() {}<br>
- static void static_method() {}<br>
- virtual void virtual_method() {}<br>
- virtual void pure_virtual_method() = 0;<br>
- inline void inline_method() {}<br>
- void volatile_method() volatile {}<br>
- void const_method() const {}<br>
-<br>
- typedef int typedef_int;<br>
- using using_int = int;<br>
+ ALL_DECLS<br>
<br>
public:<br>
};<br>
@@ -944,6 +989,22 @@ T t;<br>
#endif<br>
} // namespace StructWithForwardDeclarationNo<wbr>Definition<br>
<br>
+namespace LateParsedDefaultArgument {<br>
+#if defined(FIRST)<br>
+template <typename T><br>
+struct S {<br>
+ struct R {<br>
+ void foo(T x = 0) {}<br>
+ };<br>
+};<br>
+#elif defined(SECOND)<br>
+#else<br>
+void run() {<br>
+ S<int>::R().foo();<br>
+}<br>
+#endif<br>
+}<br>
+<br>
// Keep macros contained to one file.<br>
#ifdef FIRST<br>
#undef FIRST<br>
<br>
<br>
______________________________<wbr>_________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@lists.llvm.org">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>