[PATCH] D82099: [AST][RecoveryAST] Populate error-bit from Type to Expr.
This revision was automatically updated to reflect the committed changes. hokein marked an inline comment as done. Closed by commit rGbfec030e69af: [AST][RecoveryExpr] Populate error-bit from Type to Expr. (authored by hokein). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D82099/new/ https://reviews.llvm.org/D82099 Files: clang/include/clang/AST/DependenceFlags.h clang/test/SemaCXX/invalid-template-base-specifier.cpp Index: clang/test/SemaCXX/invalid-template-base-specifier.cpp === --- clang/test/SemaCXX/invalid-template-base-specifier.cpp +++ clang/test/SemaCXX/invalid-template-base-specifier.cpp @@ -1,6 +1,7 @@ // RUN: %clang_cc1 -frecovery-ast -verify %s -bool Foo(int *); // expected-note {{candidate function not viable}} +bool Foo(int *); // expected-note {{candidate function not viable}} \ + // expected-note {{candidate function not viable}} template struct Crash : decltype(Foo(T())) { // expected-error {{no matching function for call to 'Foo'}} @@ -8,3 +9,12 @@ }; void test() { Crash(); } // expected-note {{in instantiation of template class}} + +template +using Alias = decltype(Foo(T())); // expected-error {{no matching function for call to 'Foo'}} +template +struct Crash2 : decltype(Alias()) { // expected-note {{in instantiation of template type alias 'Alias' requested here}} + Crash2(){}; +}; + +void test2() { Crash2(); } // expected-note {{in instantiation of template class 'Crash2' requested here}} Index: clang/include/clang/AST/DependenceFlags.h === --- clang/include/clang/AST/DependenceFlags.h +++ clang/include/clang/AST/DependenceFlags.h @@ -118,10 +118,10 @@ Dependence(TypeDependence D) : V(translate(D, TypeDependence::UnexpandedPack, UnexpandedPack) | - translate(D, TypeDependence::Instantiation, Instantiation) | - translate(D, TypeDependence::Dependent, Dependent) | - translate(D, TypeDependence::VariablyModified, VariablyModified)) { - } + translate(D, TypeDependence::Instantiation, Instantiation) | + translate(D, TypeDependence::Dependent, Dependent) | + translate(D, TypeDependence::Error, Error) | + translate(D, TypeDependence::VariablyModified, VariablyModified)) {} Dependence(ExprDependence D) : V(translate(D, ExprDependence::UnexpandedPack, UnexpandedPack) | Index: clang/test/SemaCXX/invalid-template-base-specifier.cpp === --- clang/test/SemaCXX/invalid-template-base-specifier.cpp +++ clang/test/SemaCXX/invalid-template-base-specifier.cpp @@ -1,6 +1,7 @@ // RUN: %clang_cc1 -frecovery-ast -verify %s -bool Foo(int *); // expected-note {{candidate function not viable}} +bool Foo(int *); // expected-note {{candidate function not viable}} \ + // expected-note {{candidate function not viable}} template struct Crash : decltype(Foo(T())) { // expected-error {{no matching function for call to 'Foo'}} @@ -8,3 +9,12 @@ }; void test() { Crash(); } // expected-note {{in instantiation of template class}} + +template +using Alias = decltype(Foo(T())); // expected-error {{no matching function for call to 'Foo'}} +template +struct Crash2 : decltype(Alias()) { // expected-note {{in instantiation of template type alias 'Alias' requested here}} + Crash2(){}; +}; + +void test2() { Crash2(); } // expected-note {{in instantiation of template class 'Crash2' requested here}} Index: clang/include/clang/AST/DependenceFlags.h === --- clang/include/clang/AST/DependenceFlags.h +++ clang/include/clang/AST/DependenceFlags.h @@ -118,10 +118,10 @@ Dependence(TypeDependence D) : V(translate(D, TypeDependence::UnexpandedPack, UnexpandedPack) | - translate(D, TypeDependence::Instantiation, Instantiation) | - translate(D, TypeDependence::Dependent, Dependent) | - translate(D, TypeDependence::VariablyModified, VariablyModified)) { - } + translate(D, TypeDependence::Instantiation, Instantiation) | + translate(D, TypeDependence::Dependent, Dependent) | + translate(D, TypeDependence::Error, Error) | + translate(D, TypeDependence::VariablyModified, VariablyModified)) {} Dependence(ExprDependence D) : V(translate(D, ExprDependence::UnexpandedPack, UnexpandedPack) | ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D82099: [AST][RecoveryAST] Populate error-bit from Type to Expr.
hokein marked 2 inline comments as done. hokein added inline comments. Comment at: clang/include/clang/AST/DependenceFlags.h:123 + translate(D, TypeDependence::Dependent, Dependent) | + translate(D, TypeDependence::Error, Error) | + translate(D, TypeDependence::VariablyModified, VariablyModified)) {} sammccall wrote: > oops! seems like we should be able to observe this directly in an AST dump > test too, which should be failing to mark some nodes as error-dependent. > (Not sure if there's a simpler example than your crashing testcase though) yes, in theory. The code path need to go through "error expr" -> "error type" -> "recovery expr", but it seems not easy to produce a case in non-template context, either we bail out too early, or the recovery expression is not built. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D82099/new/ https://reviews.llvm.org/D82099 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D82099: [AST][RecoveryAST] Populate error-bit from Type to Expr.
sammccall accepted this revision. sammccall added inline comments. This revision is now accepted and ready to land. Comment at: clang/include/clang/AST/DependenceFlags.h:123 + translate(D, TypeDependence::Dependent, Dependent) | + translate(D, TypeDependence::Error, Error) | + translate(D, TypeDependence::VariablyModified, VariablyModified)) {} oops! seems like we should be able to observe this directly in an AST dump test too, which should be failing to mark some nodes as error-dependent. (Not sure if there's a simpler example than your crashing testcase though) Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D82099/new/ https://reviews.llvm.org/D82099 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D82099: [AST][RecoveryAST] Populate error-bit from Type to Expr.
hokein created this revision. hokein added a reviewer: sammccall. Herald added a project: clang. Looks like this is a fallout when we introduce the error-bit in Type. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D82099 Files: clang/include/clang/AST/DependenceFlags.h clang/test/SemaCXX/invalid-template-base-specifier.cpp Index: clang/test/SemaCXX/invalid-template-base-specifier.cpp === --- clang/test/SemaCXX/invalid-template-base-specifier.cpp +++ clang/test/SemaCXX/invalid-template-base-specifier.cpp @@ -1,6 +1,7 @@ // RUN: %clang_cc1 -frecovery-ast -verify %s -bool Foo(int *); // expected-note {{candidate function not viable}} +bool Foo(int *); // expected-note {{candidate function not viable}} \ + // expected-note {{candidate function not viable}} template struct Crash : decltype(Foo(T())) { // expected-error {{no matching function for call to 'Foo'}} @@ -8,3 +9,12 @@ }; void test() { Crash(); } // expected-note {{in instantiation of template class}} + +template +using Alias = decltype(Foo(T())); // expected-error {{no matching function for call to 'Foo'}} +template +struct Crash2 : decltype(Alias()) { // expected-note {{in instantiation of template type alias 'Alias' requested here}} + Crash2(){}; +}; + +void test2() { Crash2(); } // expected-note {{in instantiation of template class 'Crash2' requested here}} Index: clang/include/clang/AST/DependenceFlags.h === --- clang/include/clang/AST/DependenceFlags.h +++ clang/include/clang/AST/DependenceFlags.h @@ -118,10 +118,10 @@ Dependence(TypeDependence D) : V(translate(D, TypeDependence::UnexpandedPack, UnexpandedPack) | - translate(D, TypeDependence::Instantiation, Instantiation) | - translate(D, TypeDependence::Dependent, Dependent) | - translate(D, TypeDependence::VariablyModified, VariablyModified)) { - } + translate(D, TypeDependence::Instantiation, Instantiation) | + translate(D, TypeDependence::Dependent, Dependent) | + translate(D, TypeDependence::Error, Error) | + translate(D, TypeDependence::VariablyModified, VariablyModified)) {} Dependence(ExprDependence D) : V(translate(D, ExprDependence::UnexpandedPack, UnexpandedPack) | Index: clang/test/SemaCXX/invalid-template-base-specifier.cpp === --- clang/test/SemaCXX/invalid-template-base-specifier.cpp +++ clang/test/SemaCXX/invalid-template-base-specifier.cpp @@ -1,6 +1,7 @@ // RUN: %clang_cc1 -frecovery-ast -verify %s -bool Foo(int *); // expected-note {{candidate function not viable}} +bool Foo(int *); // expected-note {{candidate function not viable}} \ + // expected-note {{candidate function not viable}} template struct Crash : decltype(Foo(T())) { // expected-error {{no matching function for call to 'Foo'}} @@ -8,3 +9,12 @@ }; void test() { Crash(); } // expected-note {{in instantiation of template class}} + +template +using Alias = decltype(Foo(T())); // expected-error {{no matching function for call to 'Foo'}} +template +struct Crash2 : decltype(Alias()) { // expected-note {{in instantiation of template type alias 'Alias' requested here}} + Crash2(){}; +}; + +void test2() { Crash2(); } // expected-note {{in instantiation of template class 'Crash2' requested here}} Index: clang/include/clang/AST/DependenceFlags.h === --- clang/include/clang/AST/DependenceFlags.h +++ clang/include/clang/AST/DependenceFlags.h @@ -118,10 +118,10 @@ Dependence(TypeDependence D) : V(translate(D, TypeDependence::UnexpandedPack, UnexpandedPack) | - translate(D, TypeDependence::Instantiation, Instantiation) | - translate(D, TypeDependence::Dependent, Dependent) | - translate(D, TypeDependence::VariablyModified, VariablyModified)) { - } + translate(D, TypeDependence::Instantiation, Instantiation) | + translate(D, TypeDependence::Dependent, Dependent) | + translate(D, TypeDependence::Error, Error) | + translate(D, TypeDependence::VariablyModified, VariablyModified)) {} Dependence(ExprDependence D) : V(translate(D, ExprDependence::UnexpandedPack, UnexpandedPack) | ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits