[PATCH] D50347: Add getBeginLoc API to replace getStartLoc
teemperor resigned from this revision. teemperor added a comment. This revision now requires review to proceed. Woops, I wanted to resign actually (and not accept this). Repository: rC Clang https://reviews.llvm.org/D50347 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D50352: Mark up deprecated methods as such
teemperor added a comment. I don't think Clang/LLVM use `[[deprecated]]` anywhere. Just change the API and people have to migrate their code. Repository: rC Clang https://reviews.llvm.org/D50352 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D50550: [ASTImporter] Added test case for opaque enums
teemperor created this revision. Herald added a subscriber: martong. Herald added a reviewer: a.sidorin. Repository: rC Clang https://reviews.llvm.org/D50550 Files: test/Import/enum/Inputs/S.cpp test/Import/enum/test.cpp Index: test/Import/enum/test.cpp === --- test/Import/enum/test.cpp +++ test/Import/enum/test.cpp @@ -1,4 +1,9 @@ -// RUN: clang-import-test -import %S/Inputs/S.cpp -expression %s +// RUN: clang-import-test -dump-ast -import %S/Inputs/S.cpp -expression %s | FileCheck %s + +// CHECK: OpaqueWithType 'long' +// CHECK-SANE: EnumDecl + void expr() { static_assert(E::a + E::b == 3); + static_assert(sizeof(OpaqueWithType) == sizeof(long)); } Index: test/Import/enum/Inputs/S.cpp === --- test/Import/enum/Inputs/S.cpp +++ test/Import/enum/Inputs/S.cpp @@ -2,3 +2,5 @@ a = 1, b = 2 }; + +enum OpaqueWithType : long; Index: test/Import/enum/test.cpp === --- test/Import/enum/test.cpp +++ test/Import/enum/test.cpp @@ -1,4 +1,9 @@ -// RUN: clang-import-test -import %S/Inputs/S.cpp -expression %s +// RUN: clang-import-test -dump-ast -import %S/Inputs/S.cpp -expression %s | FileCheck %s + +// CHECK: OpaqueWithType 'long' +// CHECK-SANE: EnumDecl + void expr() { static_assert(E::a + E::b == 3); + static_assert(sizeof(OpaqueWithType) == sizeof(long)); } Index: test/Import/enum/Inputs/S.cpp === --- test/Import/enum/Inputs/S.cpp +++ test/Import/enum/Inputs/S.cpp @@ -2,3 +2,5 @@ a = 1, b = 2 }; + +enum OpaqueWithType : long; ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D50550: [ASTImporter] Added test case for opaque enums
teemperor updated this revision to Diff 160057. teemperor added a comment. - Removed broken FileCheck directive https://reviews.llvm.org/D50550 Files: test/Import/enum/Inputs/S.cpp test/Import/enum/test.cpp Index: test/Import/enum/test.cpp === --- test/Import/enum/test.cpp +++ test/Import/enum/test.cpp @@ -1,4 +1,8 @@ -// RUN: clang-import-test -import %S/Inputs/S.cpp -expression %s +// RUN: clang-import-test -dump-ast -import %S/Inputs/S.cpp -expression %s | FileCheck %s + +// CHECK: OpaqueWithType 'long' + void expr() { static_assert(E::a + E::b == 3); + static_assert(sizeof(OpaqueWithType) == sizeof(long)); } Index: test/Import/enum/Inputs/S.cpp === --- test/Import/enum/Inputs/S.cpp +++ test/Import/enum/Inputs/S.cpp @@ -2,3 +2,5 @@ a = 1, b = 2 }; + +enum OpaqueWithType : long; Index: test/Import/enum/test.cpp === --- test/Import/enum/test.cpp +++ test/Import/enum/test.cpp @@ -1,4 +1,8 @@ -// RUN: clang-import-test -import %S/Inputs/S.cpp -expression %s +// RUN: clang-import-test -dump-ast -import %S/Inputs/S.cpp -expression %s | FileCheck %s + +// CHECK: OpaqueWithType 'long' + void expr() { static_assert(E::a + E::b == 3); + static_assert(sizeof(OpaqueWithType) == sizeof(long)); } Index: test/Import/enum/Inputs/S.cpp === --- test/Import/enum/Inputs/S.cpp +++ test/Import/enum/Inputs/S.cpp @@ -2,3 +2,5 @@ a = 1, b = 2 }; + +enum OpaqueWithType : long; ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D50552: [ASTImporter] Added test case for CXXConversionDecl importing
teemperor created this revision. Herald added a subscriber: martong. Herald added a reviewer: a.sidorin. Repository: rC Clang https://reviews.llvm.org/D50552 Files: test/Import/conversion-decl/Inputs/F.cpp test/Import/conversion-decl/test.cpp Index: test/Import/conversion-decl/test.cpp === --- /dev/null +++ test/Import/conversion-decl/test.cpp @@ -0,0 +1,5 @@ +// RUN: clang-import-test -import %S/Inputs/F.cpp -expression %s +void expr() { + X X1; + Y Y1 = X1; +} Index: test/Import/conversion-decl/Inputs/F.cpp === --- /dev/null +++ test/Import/conversion-decl/Inputs/F.cpp @@ -0,0 +1,10 @@ +class Y { + int M; +}; + +class X { + int N, M; + +public: + operator Y(); +}; Index: test/Import/conversion-decl/test.cpp === --- /dev/null +++ test/Import/conversion-decl/test.cpp @@ -0,0 +1,5 @@ +// RUN: clang-import-test -import %S/Inputs/F.cpp -expression %s +void expr() { + X X1; + Y Y1 = X1; +} Index: test/Import/conversion-decl/Inputs/F.cpp === --- /dev/null +++ test/Import/conversion-decl/Inputs/F.cpp @@ -0,0 +1,10 @@ +class Y { + int M; +}; + +class X { + int N, M; + +public: + operator Y(); +}; ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D50552: [ASTImporter] Added test case for CXXConversionDecl importing
This revision was automatically updated to reflect the committed changes. Closed by commit rL339505: [ASTImporter] Added test case for CXXConversionDecl importing (authored by teemperor, committed by ). Herald added a subscriber: llvm-commits. Changed prior to commit: https://reviews.llvm.org/D50552?vs=160060&id=160247#toc Repository: rL LLVM https://reviews.llvm.org/D50552 Files: cfe/trunk/test/Import/conversion-decl/Inputs/F.cpp cfe/trunk/test/Import/conversion-decl/test.cpp Index: cfe/trunk/test/Import/conversion-decl/Inputs/F.cpp === --- cfe/trunk/test/Import/conversion-decl/Inputs/F.cpp +++ cfe/trunk/test/Import/conversion-decl/Inputs/F.cpp @@ -0,0 +1,10 @@ +class Y { + int M; +}; + +class X { + int N, M; + +public: + operator Y(); +}; Index: cfe/trunk/test/Import/conversion-decl/test.cpp === --- cfe/trunk/test/Import/conversion-decl/test.cpp +++ cfe/trunk/test/Import/conversion-decl/test.cpp @@ -0,0 +1,5 @@ +// RUN: clang-import-test -import %S/Inputs/F.cpp -expression %s +void expr() { + X X1; + Y Y1 = X1; +} Index: cfe/trunk/test/Import/conversion-decl/Inputs/F.cpp === --- cfe/trunk/test/Import/conversion-decl/Inputs/F.cpp +++ cfe/trunk/test/Import/conversion-decl/Inputs/F.cpp @@ -0,0 +1,10 @@ +class Y { + int M; +}; + +class X { + int N, M; + +public: + operator Y(); +}; Index: cfe/trunk/test/Import/conversion-decl/test.cpp === --- cfe/trunk/test/Import/conversion-decl/test.cpp +++ cfe/trunk/test/Import/conversion-decl/test.cpp @@ -0,0 +1,5 @@ +// RUN: clang-import-test -import %S/Inputs/F.cpp -expression %s +void expr() { + X X1; + Y Y1 = X1; +} ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D50550: [ASTImporter] Added test case for opaque enums
This revision was automatically updated to reflect the committed changes. Closed by commit rL339506: [ASTImporter] Added test case for opaque enums (authored by teemperor, committed by ). Herald added a subscriber: llvm-commits. Changed prior to commit: https://reviews.llvm.org/D50550?vs=160057&id=160248#toc Repository: rL LLVM https://reviews.llvm.org/D50550 Files: cfe/trunk/test/Import/enum/Inputs/S.cpp cfe/trunk/test/Import/enum/test.cpp Index: cfe/trunk/test/Import/enum/Inputs/S.cpp === --- cfe/trunk/test/Import/enum/Inputs/S.cpp +++ cfe/trunk/test/Import/enum/Inputs/S.cpp @@ -2,3 +2,5 @@ a = 1, b = 2 }; + +enum OpaqueWithType : long; Index: cfe/trunk/test/Import/enum/test.cpp === --- cfe/trunk/test/Import/enum/test.cpp +++ cfe/trunk/test/Import/enum/test.cpp @@ -1,4 +1,8 @@ -// RUN: clang-import-test -import %S/Inputs/S.cpp -expression %s +// RUN: clang-import-test -dump-ast -import %S/Inputs/S.cpp -expression %s | FileCheck %s + +// CHECK: OpaqueWithType 'long' + void expr() { static_assert(E::a + E::b == 3); + static_assert(sizeof(OpaqueWithType) == sizeof(long)); } Index: cfe/trunk/test/Import/enum/Inputs/S.cpp === --- cfe/trunk/test/Import/enum/Inputs/S.cpp +++ cfe/trunk/test/Import/enum/Inputs/S.cpp @@ -2,3 +2,5 @@ a = 1, b = 2 }; + +enum OpaqueWithType : long; Index: cfe/trunk/test/Import/enum/test.cpp === --- cfe/trunk/test/Import/enum/test.cpp +++ cfe/trunk/test/Import/enum/test.cpp @@ -1,4 +1,8 @@ -// RUN: clang-import-test -import %S/Inputs/S.cpp -expression %s +// RUN: clang-import-test -dump-ast -import %S/Inputs/S.cpp -expression %s | FileCheck %s + +// CHECK: OpaqueWithType 'long' + void expr() { static_assert(E::a + E::b == 3); + static_assert(sizeof(OpaqueWithType) == sizeof(long)); } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D50731: [ASTImporter] Add test for ExprWithCleanups
teemperor created this revision. Herald added a subscriber: martong. Herald added a reviewer: a.sidorin. Repository: rC Clang https://reviews.llvm.org/D50731 Files: test/Import/expr-with-cleanups/Inputs/S.cpp test/Import/expr-with-cleanups/test.cpp Index: test/Import/expr-with-cleanups/test.cpp === --- /dev/null +++ test/Import/expr-with-cleanups/test.cpp @@ -0,0 +1,8 @@ +// RUN: clang-import-test -dump-ast -import %S/Inputs/S.cpp -expression %s | FileCheck %s +// CHECK: ExprWithCleanups +// CHECK-SAME: 'RAII' +// CHECK-NEXT: CXXBindTemporaryExpr + +void expr() { + f(); +} Index: test/Import/expr-with-cleanups/Inputs/S.cpp === --- /dev/null +++ test/Import/expr-with-cleanups/Inputs/S.cpp @@ -0,0 +1,8 @@ +struct RAII { + int i = 0; + RAII() { i++; } + ~RAII() { i--; } +}; +void f() { + RAII(); +} Index: test/Import/expr-with-cleanups/test.cpp === --- /dev/null +++ test/Import/expr-with-cleanups/test.cpp @@ -0,0 +1,8 @@ +// RUN: clang-import-test -dump-ast -import %S/Inputs/S.cpp -expression %s | FileCheck %s +// CHECK: ExprWithCleanups +// CHECK-SAME: 'RAII' +// CHECK-NEXT: CXXBindTemporaryExpr + +void expr() { + f(); +} Index: test/Import/expr-with-cleanups/Inputs/S.cpp === --- /dev/null +++ test/Import/expr-with-cleanups/Inputs/S.cpp @@ -0,0 +1,8 @@ +struct RAII { + int i = 0; + RAII() { i++; } + ~RAII() { i--; } +}; +void f() { + RAII(); +} ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D50732: [ASTImporter] Add test for CXXDefaultInitExpr
teemperor created this revision. Herald added a subscriber: martong. Herald added a reviewer: a.sidorin. Repository: rC Clang https://reviews.llvm.org/D50732 Files: test/Import/cxx-default-init-expr/Inputs/S.cpp test/Import/cxx-default-init-expr/test.cpp Index: test/Import/cxx-default-init-expr/test.cpp === --- /dev/null +++ test/Import/cxx-default-init-expr/test.cpp @@ -0,0 +1,22 @@ +// RUN: clang-import-test -dump-ast -import %S/Inputs/S.cpp -expression %s | FileCheck %s +// CHECK: CXXCtorInitializer +// CHECK-SAME: 'int_member' +// CHECK-SAME: 'int' +// CHECK-NEXT: CXXDefaultInitExpr +// CHECK-SAME: 'int' + +// CHECK-NEXT: CXXCtorInitializer +// CHECK-SAME: 'float_member' +// CHECK-SAME: 'float' +// CHECK-NEXT: CXXDefaultInitExpr +// CHECK-SAME: 'float' + +// CHECK-NEXT: CXXCtorInitializer +// CHECK-SAME: 'class_member' +// CHECK-SAME: 'Foo' +// CHECK-NEXT: CXXDefaultInitExpr +// CHECK-SAME: 'Foo' + +void expr() { + struct S s; +} Index: test/Import/cxx-default-init-expr/Inputs/S.cpp === --- /dev/null +++ test/Import/cxx-default-init-expr/Inputs/S.cpp @@ -0,0 +1,9 @@ +struct Foo { + int i; +}; + +struct S { + int int_member = 3; + float float_member = 3.0f; + Foo class_member = Foo(); +}; Index: test/Import/cxx-default-init-expr/test.cpp === --- /dev/null +++ test/Import/cxx-default-init-expr/test.cpp @@ -0,0 +1,22 @@ +// RUN: clang-import-test -dump-ast -import %S/Inputs/S.cpp -expression %s | FileCheck %s +// CHECK: CXXCtorInitializer +// CHECK-SAME: 'int_member' +// CHECK-SAME: 'int' +// CHECK-NEXT: CXXDefaultInitExpr +// CHECK-SAME: 'int' + +// CHECK-NEXT: CXXCtorInitializer +// CHECK-SAME: 'float_member' +// CHECK-SAME: 'float' +// CHECK-NEXT: CXXDefaultInitExpr +// CHECK-SAME: 'float' + +// CHECK-NEXT: CXXCtorInitializer +// CHECK-SAME: 'class_member' +// CHECK-SAME: 'Foo' +// CHECK-NEXT: CXXDefaultInitExpr +// CHECK-SAME: 'Foo' + +void expr() { + struct S s; +} Index: test/Import/cxx-default-init-expr/Inputs/S.cpp === --- /dev/null +++ test/Import/cxx-default-init-expr/Inputs/S.cpp @@ -0,0 +1,9 @@ +struct Foo { + int i; +}; + +struct S { + int int_member = 3; + float float_member = 3.0f; + Foo class_member = Foo(); +}; ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D50733: [ASTImporter] Add test for ArrayInitLoopExpr
teemperor created this revision. Herald added a subscriber: martong. Herald added a reviewer: a.sidorin. Repository: rC Clang https://reviews.llvm.org/D50733 Files: test/Import/array-init-loop-expr/Inputs/S.cpp test/Import/array-init-loop-expr/test.cpp Index: test/Import/array-init-loop-expr/test.cpp === --- /dev/null +++ test/Import/array-init-loop-expr/test.cpp @@ -0,0 +1,11 @@ +// RUN: clang-import-test -dump-ast -import %S/Inputs/S.cpp -expression %s | FileCheck %s +// CHECK: CXXCtorInitializer +// CHECK-NEXT: ArrayInitLoopExpr +// CHECK-SAME: 'int [10]' + +// CHECK: ArrayInitIndexExpr + +void expr() { + S s; + S copy = s; +} Index: test/Import/array-init-loop-expr/Inputs/S.cpp === --- /dev/null +++ test/Import/array-init-loop-expr/Inputs/S.cpp @@ -0,0 +1,3 @@ +class S { + int a[10]; +}; Index: test/Import/array-init-loop-expr/test.cpp === --- /dev/null +++ test/Import/array-init-loop-expr/test.cpp @@ -0,0 +1,11 @@ +// RUN: clang-import-test -dump-ast -import %S/Inputs/S.cpp -expression %s | FileCheck %s +// CHECK: CXXCtorInitializer +// CHECK-NEXT: ArrayInitLoopExpr +// CHECK-SAME: 'int [10]' + +// CHECK: ArrayInitIndexExpr + +void expr() { + S s; + S copy = s; +} Index: test/Import/array-init-loop-expr/Inputs/S.cpp === --- /dev/null +++ test/Import/array-init-loop-expr/Inputs/S.cpp @@ -0,0 +1,3 @@ +class S { + int a[10]; +}; ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D50735: [ASTImporter] Add test for CXXScalarValueInit
teemperor created this revision. Herald added a subscriber: martong. Herald added a reviewer: a.sidorin. Repository: rC Clang https://reviews.llvm.org/D50735 Files: test/Import/cxx-scalar-value-init/Inputs/S.cpp test/Import/cxx-scalar-value-init/test.cpp Index: test/Import/cxx-scalar-value-init/test.cpp === --- /dev/null +++ test/Import/cxx-scalar-value-init/test.cpp @@ -0,0 +1,11 @@ +// RUN: clang-import-test -dump-ast -import %S/Inputs/S.cpp -expression %s | FileCheck %s +// CHECK: CXXScalarValueInitExpr +// CHECK-SAME: 'int' + +// CHECK: CXXScalarValueInitExpr +// CHECK-SAME: 'float' + +void expr() { + int i = si(); + float f = sf(); +} Index: test/Import/cxx-scalar-value-init/Inputs/S.cpp === --- /dev/null +++ test/Import/cxx-scalar-value-init/Inputs/S.cpp @@ -0,0 +1,2 @@ +int si() { return int(); } +float sf() { return float(); } Index: test/Import/cxx-scalar-value-init/test.cpp === --- /dev/null +++ test/Import/cxx-scalar-value-init/test.cpp @@ -0,0 +1,11 @@ +// RUN: clang-import-test -dump-ast -import %S/Inputs/S.cpp -expression %s | FileCheck %s +// CHECK: CXXScalarValueInitExpr +// CHECK-SAME: 'int' + +// CHECK: CXXScalarValueInitExpr +// CHECK-SAME: 'float' + +void expr() { + int i = si(); + float f = sf(); +} Index: test/Import/cxx-scalar-value-init/Inputs/S.cpp === --- /dev/null +++ test/Import/cxx-scalar-value-init/Inputs/S.cpp @@ -0,0 +1,2 @@ +int si() { return int(); } +float sf() { return float(); } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D50737: [ASTImporter] Add test for CXXNoexceptExpr
teemperor created this revision. Herald added a subscriber: martong. Herald added a reviewer: a.sidorin. Repository: rC Clang https://reviews.llvm.org/D50737 Files: test/Import/cxx-noexcept-expr/Inputs/F.cpp test/Import/cxx-noexcept-expr/test.cpp Index: test/Import/cxx-noexcept-expr/test.cpp === --- /dev/null +++ test/Import/cxx-noexcept-expr/test.cpp @@ -0,0 +1,8 @@ +// RUN: clang-import-test -dump-ast -import %S/Inputs/F.cpp -expression %s | FileCheck %s + +// CHECK: CXXNoexceptExpr +// CHECK-NEXT: IntegerLiteral + +void expr() { + f(); +} Index: test/Import/cxx-noexcept-expr/Inputs/F.cpp === --- /dev/null +++ test/Import/cxx-noexcept-expr/Inputs/F.cpp @@ -0,0 +1 @@ +bool f() { return noexcept(1); } Index: test/Import/cxx-noexcept-expr/test.cpp === --- /dev/null +++ test/Import/cxx-noexcept-expr/test.cpp @@ -0,0 +1,8 @@ +// RUN: clang-import-test -dump-ast -import %S/Inputs/F.cpp -expression %s | FileCheck %s + +// CHECK: CXXNoexceptExpr +// CHECK-NEXT: IntegerLiteral + +void expr() { + f(); +} Index: test/Import/cxx-noexcept-expr/Inputs/F.cpp === --- /dev/null +++ test/Import/cxx-noexcept-expr/Inputs/F.cpp @@ -0,0 +1 @@ +bool f() { return noexcept(1); } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D50792: [ASTImporter] Add test for member pointer types.
teemperor created this revision. Herald added a subscriber: martong. Herald added a reviewer: a.sidorin. Repository: rC Clang https://reviews.llvm.org/D50792 Files: test/Import/cxx-member-pointers/Inputs/S.cpp test/Import/cxx-member-pointers/test.cpp Index: test/Import/cxx-member-pointers/test.cpp === --- /dev/null +++ test/Import/cxx-member-pointers/test.cpp @@ -0,0 +1,16 @@ +// RUN: clang-import-test -dump-ast -import %S/Inputs/S.cpp -expression %s | FileCheck %s + +// CHECK: VarDecl +// CHECK-SAME: int S::* +// CHECK-NEXT: CallExpr +// CHECK-NEXT: ImplicitCastExpr +// CHECK-SAME: int S::*(*)() +// CHECK-NEXT: DeclRefExpr +// CHECK-SAME: int S::*() + +void expr() { + int S::*p = iptr(); + S s; + s.i = 3; + int i = s.*p; +} Index: test/Import/cxx-member-pointers/Inputs/S.cpp === --- /dev/null +++ test/Import/cxx-member-pointers/Inputs/S.cpp @@ -0,0 +1,7 @@ +struct S { + int i; +}; + +int S::*iptr() { + return &S::i; +} Index: test/Import/cxx-member-pointers/test.cpp === --- /dev/null +++ test/Import/cxx-member-pointers/test.cpp @@ -0,0 +1,16 @@ +// RUN: clang-import-test -dump-ast -import %S/Inputs/S.cpp -expression %s | FileCheck %s + +// CHECK: VarDecl +// CHECK-SAME: int S::* +// CHECK-NEXT: CallExpr +// CHECK-NEXT: ImplicitCastExpr +// CHECK-SAME: int S::*(*)() +// CHECK-NEXT: DeclRefExpr +// CHECK-SAME: int S::*() + +void expr() { + int S::*p = iptr(); + S s; + s.i = 3; + int i = s.*p; +} Index: test/Import/cxx-member-pointers/Inputs/S.cpp === --- /dev/null +++ test/Import/cxx-member-pointers/Inputs/S.cpp @@ -0,0 +1,7 @@ +struct S { + int i; +}; + +int S::*iptr() { + return &S::i; +} ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D50793: [ASTImporter] Add test for importing CompoundAssignOperators
teemperor created this revision. Herald added a subscriber: martong. Herald added a reviewer: a.sidorin. Repository: rC Clang https://reviews.llvm.org/D50793 Files: test/Import/compound-assign-op/Inputs/F.cpp test/Import/compound-assign-op/test.cpp Index: test/Import/compound-assign-op/test.cpp === --- /dev/null +++ test/Import/compound-assign-op/test.cpp @@ -0,0 +1,45 @@ +// RUN: clang-import-test -dump-ast -import %S/Inputs/F.cpp -expression %s | FileCheck %s + +// CHECK: VarDecl +// CHECK-NEXT: Integer +// CHECK-NEXT: CompoundAssignOperator +// CHECK-SAME: '+=' + +// CHECK: VarDecl +// CHECK-NEXT: Integer +// CHECK-NEXT: CompoundAssignOperator +// CHECK-SAME: '-=' + +// CHECK: VarDecl +// CHECK-NEXT: Integer +// CHECK-NEXT: CompoundAssignOperator +// CHECK-SAME: '*=' + +// CHECK: VarDecl +// CHECK-NEXT: Integer +// CHECK-NEXT: CompoundAssignOperator +// CHECK-SAME: '/=' + +// CHECK: VarDecl +// CHECK-NEXT: Integer +// CHECK-NEXT: CompoundAssignOperator +// CHECK-SAME: '&=' + +// CHECK: VarDecl +// CHECK-NEXT: Integer +// CHECK-NEXT: CompoundAssignOperator +// CHECK-SAME: '^=' + +// CHECK: VarDecl +// CHECK-NEXT: Integer +// CHECK-NEXT: CompoundAssignOperator +// CHECK-SAME: '<<=' + +// CHECK: VarDecl +// CHECK-NEXT: Integer +// CHECK-NEXT: CompoundAssignOperator +// CHECK-SAME: '>>=' + +void expr() { + f(); +} Index: test/Import/compound-assign-op/Inputs/F.cpp === --- /dev/null +++ test/Import/compound-assign-op/Inputs/F.cpp @@ -0,0 +1,18 @@ +void f() { + unsigned iadd_eq = 0U; + iadd_eq += 1U; + unsigned isub_eq = 0U; + isub_eq -= 1U; + unsigned imul_eq = 0U; + imul_eq *= 1U; + unsigned idiv_eq = 0U; + idiv_eq /= 1U; + unsigned iand_eq = 0U; + iand_eq &= 1U; + unsigned ixor_eq = 0U; + ixor_eq ^= 1U; + unsigned ilsh_eq = 0U; + ilsh_eq <<= 1U; + unsigned irsh_eq = 0U; + irsh_eq >>= 1U; +} Index: test/Import/compound-assign-op/test.cpp === --- /dev/null +++ test/Import/compound-assign-op/test.cpp @@ -0,0 +1,45 @@ +// RUN: clang-import-test -dump-ast -import %S/Inputs/F.cpp -expression %s | FileCheck %s + +// CHECK: VarDecl +// CHECK-NEXT: Integer +// CHECK-NEXT: CompoundAssignOperator +// CHECK-SAME: '+=' + +// CHECK: VarDecl +// CHECK-NEXT: Integer +// CHECK-NEXT: CompoundAssignOperator +// CHECK-SAME: '-=' + +// CHECK: VarDecl +// CHECK-NEXT: Integer +// CHECK-NEXT: CompoundAssignOperator +// CHECK-SAME: '*=' + +// CHECK: VarDecl +// CHECK-NEXT: Integer +// CHECK-NEXT: CompoundAssignOperator +// CHECK-SAME: '/=' + +// CHECK: VarDecl +// CHECK-NEXT: Integer +// CHECK-NEXT: CompoundAssignOperator +// CHECK-SAME: '&=' + +// CHECK: VarDecl +// CHECK-NEXT: Integer +// CHECK-NEXT: CompoundAssignOperator +// CHECK-SAME: '^=' + +// CHECK: VarDecl +// CHECK-NEXT: Integer +// CHECK-NEXT: CompoundAssignOperator +// CHECK-SAME: '<<=' + +// CHECK: VarDecl +// CHECK-NEXT: Integer +// CHECK-NEXT: CompoundAssignOperator +// CHECK-SAME: '>>=' + +void expr() { + f(); +} Index: test/Import/compound-assign-op/Inputs/F.cpp === --- /dev/null +++ test/Import/compound-assign-op/Inputs/F.cpp @@ -0,0 +1,18 @@ +void f() { + unsigned iadd_eq = 0U; + iadd_eq += 1U; + unsigned isub_eq = 0U; + isub_eq -= 1U; + unsigned imul_eq = 0U; + imul_eq *= 1U; + unsigned idiv_eq = 0U; + idiv_eq /= 1U; + unsigned iand_eq = 0U; + iand_eq &= 1U; + unsigned ixor_eq = 0U; + ixor_eq ^= 1U; + unsigned ilsh_eq = 0U; + ilsh_eq <<= 1U; + unsigned irsh_eq = 0U; + irsh_eq >>= 1U; +} ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D50796: [ASTImporter] Add test for IfStmt
teemperor created this revision. Herald added a subscriber: martong. Herald added a reviewer: a.sidorin. Repository: rC Clang https://reviews.llvm.org/D50796 Files: test/Import/if-stmt/Inputs/F.cpp test/Import/if-stmt/test.cpp Index: test/Import/if-stmt/test.cpp === --- /dev/null +++ test/Import/if-stmt/test.cpp @@ -0,0 +1,47 @@ +// RUN: clang-import-test -dump-ast -import %S/Inputs/F.cpp -expression %s | FileCheck %s + +// CHECK: IfStmt +// CHECK-NEXT: <> +// CHECK-NEXT: <> +// CHECK-NEXT: CXXBoolLiteralExpr +// CHECK-NEXT: ReturnStmt +// CHECK-NEXT: <> + +// CHECK: IfStmt +// CHECK-NEXT: <> +// CHECK-NEXT: DeclStmt +// CHECK-NEXT: VarDecl +// CHECK-NEXT: IntegerLiteral +// CHECK-NEXT: ImplicitCastExpr +// CHECK-NEXT: ImplicitCastExpr +// CHECK-NEXT: DeclRefExpr +// CHECK-NEXT: ReturnStmt +// CHECK-NEXT: <> + +// CHECK: IfStmt +// CHECK-NEXT: DeclStmt +// CHECK-NEXT: VarDecl +// CHECK-NEXT: <> +// CHECK-NEXT: CXXBoolLiteralExpr +// CHECK-NEXT: ReturnStmt +// CHECK-NEXT: <> + +// CHECK: IfStmt +// CHECK-NEXT: <> +// CHECK-NEXT: <> +// CHECK-NEXT: CXXBoolLiteralExpr +// CHECK-NEXT: ReturnStmt +// CHECK-NEXT: ReturnStmt + +// CHECK: IfStmt +// CHECK-NEXT: <> +// CHECK-NEXT: <> +// CHECK-NEXT: CXXBoolLiteralExpr +// CHECK-NEXT: CompoundStmt +// CHECK-NEXT: ReturnStmt +// CHECK-NEXT: CompoundStmt +// CHECK-NEXT: ReturnStmt + +void expr() { + f(); +} Index: test/Import/if-stmt/Inputs/F.cpp === --- /dev/null +++ test/Import/if-stmt/Inputs/F.cpp @@ -0,0 +1,21 @@ +void f() { + if (true) +return; + + if (int j = 3) +return; + + if (int j; true) +return; + + if (true) +return; + else +return; + + if (true) { +return; + } else { +return; + } +} Index: test/Import/if-stmt/test.cpp === --- /dev/null +++ test/Import/if-stmt/test.cpp @@ -0,0 +1,47 @@ +// RUN: clang-import-test -dump-ast -import %S/Inputs/F.cpp -expression %s | FileCheck %s + +// CHECK: IfStmt +// CHECK-NEXT: <> +// CHECK-NEXT: <> +// CHECK-NEXT: CXXBoolLiteralExpr +// CHECK-NEXT: ReturnStmt +// CHECK-NEXT: <> + +// CHECK: IfStmt +// CHECK-NEXT: <> +// CHECK-NEXT: DeclStmt +// CHECK-NEXT: VarDecl +// CHECK-NEXT: IntegerLiteral +// CHECK-NEXT: ImplicitCastExpr +// CHECK-NEXT: ImplicitCastExpr +// CHECK-NEXT: DeclRefExpr +// CHECK-NEXT: ReturnStmt +// CHECK-NEXT: <> + +// CHECK: IfStmt +// CHECK-NEXT: DeclStmt +// CHECK-NEXT: VarDecl +// CHECK-NEXT: <> +// CHECK-NEXT: CXXBoolLiteralExpr +// CHECK-NEXT: ReturnStmt +// CHECK-NEXT: <> + +// CHECK: IfStmt +// CHECK-NEXT: <> +// CHECK-NEXT: <> +// CHECK-NEXT: CXXBoolLiteralExpr +// CHECK-NEXT: ReturnStmt +// CHECK-NEXT: ReturnStmt + +// CHECK: IfStmt +// CHECK-NEXT: <> +// CHECK-NEXT: <> +// CHECK-NEXT: CXXBoolLiteralExpr +// CHECK-NEXT: CompoundStmt +// CHECK-NEXT: ReturnStmt +// CHECK-NEXT: CompoundStmt +// CHECK-NEXT: ReturnStmt + +void expr() { + f(); +} Index: test/Import/if-stmt/Inputs/F.cpp === --- /dev/null +++ test/Import/if-stmt/Inputs/F.cpp @@ -0,0 +1,21 @@ +void f() { + if (true) +return; + + if (int j = 3) +return; + + if (int j; true) +return; + + if (true) +return; + else +return; + + if (true) { +return; + } else { +return; + } +} ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D50810: [ASTImporter] Add test for DoStmt
teemperor created this revision. Herald added a subscriber: martong. Herald added a reviewer: a.sidorin. Repository: rC Clang https://reviews.llvm.org/D50810 Files: test/Import/do-stmt/Inputs/F.cpp test/Import/do-stmt/test.cpp Index: test/Import/do-stmt/test.cpp === --- /dev/null +++ test/Import/do-stmt/test.cpp @@ -0,0 +1,15 @@ +// RUN: clang-import-test -dump-ast -import %S/Inputs/F.cpp -expression %s | FileCheck %s + +// CHECK: DoStmt +// CHECK-NEXT: NullStmt +// CHECK-NEXT: CXXBoolLiteralExpr +// CHECK-SAME: true + +// CHECK: DoStmt +// CHECK-NEXT: CompoundStmt +// CHECK-NEXT: CXXBoolLiteralExpr +// CHECK-SAME: false + +void expr() { + f(); +} Index: test/Import/do-stmt/Inputs/F.cpp === --- /dev/null +++ test/Import/do-stmt/Inputs/F.cpp @@ -0,0 +1,7 @@ +void f() { + do +; + while (true); + do { + } while (false); +} Index: test/Import/do-stmt/test.cpp === --- /dev/null +++ test/Import/do-stmt/test.cpp @@ -0,0 +1,15 @@ +// RUN: clang-import-test -dump-ast -import %S/Inputs/F.cpp -expression %s | FileCheck %s + +// CHECK: DoStmt +// CHECK-NEXT: NullStmt +// CHECK-NEXT: CXXBoolLiteralExpr +// CHECK-SAME: true + +// CHECK: DoStmt +// CHECK-NEXT: CompoundStmt +// CHECK-NEXT: CXXBoolLiteralExpr +// CHECK-SAME: false + +void expr() { + f(); +} Index: test/Import/do-stmt/Inputs/F.cpp === --- /dev/null +++ test/Import/do-stmt/Inputs/F.cpp @@ -0,0 +1,7 @@ +void f() { + do +; + while (true); + do { + } while (false); +} ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D50811: [ASTImporter] Add test for WhileStmt
teemperor created this revision. Herald added a subscriber: martong. Herald added a reviewer: a.sidorin. Repository: rC Clang https://reviews.llvm.org/D50811 Files: test/Import/while-stmt/Inputs/F.cpp test/Import/while-stmt/test.cpp Index: test/Import/while-stmt/test.cpp === --- /dev/null +++ test/Import/while-stmt/test.cpp @@ -0,0 +1,23 @@ +// RUN: clang-import-test -dump-ast -import %S/Inputs/F.cpp -expression %s | FileCheck %s + +// CHECK: WhileStmt +// CHECK-NEXT: <> +// CHECK-NEXT: CXXBoolLiteralExpr +// CHECK-NEXT: NullStmt + +// CHECK: WhileStmt +// CHECK-NEXT: <> +// CHECK-NEXT: CXXBoolLiteralExpr +// CHECK-NEXT: CompoundStmt + +// CHECK: WhileStmt +// CHECK-NEXT: DeclStmt +// CHECK-NEXT: VarDecl +// CHECK-NEXT: CXXBoolLiteralExpr +// CHECK-NEXT: ImplicitCastExpr +// CHECK-NEXT: DeclRefExpr +// CHECK-NEXT: NullStmt + +void expr() { + f(); +} Index: test/Import/while-stmt/Inputs/F.cpp === --- /dev/null +++ test/Import/while-stmt/Inputs/F.cpp @@ -0,0 +1,8 @@ +void f() { + while (false) +; + while (false) { + } + while (bool ini = true) +; +} Index: test/Import/while-stmt/test.cpp === --- /dev/null +++ test/Import/while-stmt/test.cpp @@ -0,0 +1,23 @@ +// RUN: clang-import-test -dump-ast -import %S/Inputs/F.cpp -expression %s | FileCheck %s + +// CHECK: WhileStmt +// CHECK-NEXT: <> +// CHECK-NEXT: CXXBoolLiteralExpr +// CHECK-NEXT: NullStmt + +// CHECK: WhileStmt +// CHECK-NEXT: <> +// CHECK-NEXT: CXXBoolLiteralExpr +// CHECK-NEXT: CompoundStmt + +// CHECK: WhileStmt +// CHECK-NEXT: DeclStmt +// CHECK-NEXT: VarDecl +// CHECK-NEXT: CXXBoolLiteralExpr +// CHECK-NEXT: ImplicitCastExpr +// CHECK-NEXT: DeclRefExpr +// CHECK-NEXT: NullStmt + +void expr() { + f(); +} Index: test/Import/while-stmt/Inputs/F.cpp === --- /dev/null +++ test/Import/while-stmt/Inputs/F.cpp @@ -0,0 +1,8 @@ +void f() { + while (false) +; + while (false) { + } + while (bool ini = true) +; +} ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D50812: [ASTImporter] Add test for ForStmt and ContinueStmt
teemperor created this revision. Herald added a subscriber: martong. Herald added a reviewer: a.sidorin. Repository: rC Clang https://reviews.llvm.org/D50812 Files: test/Import/for-stmt/Inputs/F.cpp test/Import/for-stmt/test.cpp Index: test/Import/for-stmt/test.cpp === --- /dev/null +++ test/Import/for-stmt/test.cpp @@ -0,0 +1,38 @@ +// RUN: clang-import-test -dump-ast -import %S/Inputs/F.cpp -expression %s | FileCheck %s + +// CHECK: ForStmt +// CHECK-NEXT: <> +// CHECK-NEXT: <> +// CHECK-NEXT: <> +// CHECK-NEXT: <> +// CHECK-NEXT: NullStmt + +// CHECK: ForStmt +// CHECK-NEXT: DeclStmt +// CHECK-NEXT: VarDecl +// CHECK-NEXT: IntegerLiteral +// CHECK-NEXT: <> +// CHECK-NEXT: <> +// CHECK-NEXT: <> +// CHECK-NEXT: ContinueStmt + +// CHECK: ForStmt +// CHECK-NEXT: DeclStmt +// CHECK-NEXT: VarDecl +// CHECK-NEXT: IntegerLiteral +// CHECK-NEXT: <> + +// CHECK-NEXT: BinaryOperator +// CHECK-NEXT: ImplicitCastExpr +// CHECK-NEXT: DeclRefExpr +// CHECK-NEXT: IntegerLiteral + +// CHECK-NEXT: UnaryOperator +// CHECK-SAME: '++' +// CHECK-NEXT: DeclRefExpr + +// CHECK-NEXT: CompoundStmt + +void expr() { + f(); +} Index: test/Import/for-stmt/Inputs/F.cpp === --- /dev/null +++ test/Import/for-stmt/Inputs/F.cpp @@ -0,0 +1,9 @@ +void f() { + for (;;) +; + for (int i = 0;;) +continue; + for (int i = 0; i != 0; ++i) { +i++; + } +} Index: test/Import/for-stmt/test.cpp === --- /dev/null +++ test/Import/for-stmt/test.cpp @@ -0,0 +1,38 @@ +// RUN: clang-import-test -dump-ast -import %S/Inputs/F.cpp -expression %s | FileCheck %s + +// CHECK: ForStmt +// CHECK-NEXT: <> +// CHECK-NEXT: <> +// CHECK-NEXT: <> +// CHECK-NEXT: <> +// CHECK-NEXT: NullStmt + +// CHECK: ForStmt +// CHECK-NEXT: DeclStmt +// CHECK-NEXT: VarDecl +// CHECK-NEXT: IntegerLiteral +// CHECK-NEXT: <> +// CHECK-NEXT: <> +// CHECK-NEXT: <> +// CHECK-NEXT: ContinueStmt + +// CHECK: ForStmt +// CHECK-NEXT: DeclStmt +// CHECK-NEXT: VarDecl +// CHECK-NEXT: IntegerLiteral +// CHECK-NEXT: <> + +// CHECK-NEXT: BinaryOperator +// CHECK-NEXT: ImplicitCastExpr +// CHECK-NEXT: DeclRefExpr +// CHECK-NEXT: IntegerLiteral + +// CHECK-NEXT: UnaryOperator +// CHECK-SAME: '++' +// CHECK-NEXT: DeclRefExpr + +// CHECK-NEXT: CompoundStmt + +void expr() { + f(); +} Index: test/Import/for-stmt/Inputs/F.cpp === --- /dev/null +++ test/Import/for-stmt/Inputs/F.cpp @@ -0,0 +1,9 @@ +void f() { + for (;;) +; + for (int i = 0;;) +continue; + for (int i = 0; i != 0; ++i) { +i++; + } +} ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D50813: [ASTImporter] Add test for IndirectGotoStmt
teemperor created this revision. Herald added a subscriber: martong. Herald added a reviewer: a.sidorin. Repository: rC Clang https://reviews.llvm.org/D50813 Files: test/Import/indirect-goto/Inputs/F.cpp test/Import/indirect-goto/test.cpp Index: test/Import/indirect-goto/test.cpp === --- /dev/null +++ test/Import/indirect-goto/test.cpp @@ -0,0 +1,10 @@ +// RUN: clang-import-test -dump-ast -import %S/Inputs/F.cpp -expression %s | FileCheck %s + +// CHECK: IndirectGotoStmt +// CHECK-NEXT: ImplicitCastExpr +// CHECK-NEXT: DeclRefExpr +// CHECK-SAME: 'l1_ptr' + +void expr() { + f(); +} Index: test/Import/indirect-goto/Inputs/F.cpp === --- /dev/null +++ test/Import/indirect-goto/Inputs/F.cpp @@ -0,0 +1,6 @@ +void f() { + void const *l1_ptr = &&l1; + goto *l1_ptr; +l1: + return; +} Index: test/Import/indirect-goto/test.cpp === --- /dev/null +++ test/Import/indirect-goto/test.cpp @@ -0,0 +1,10 @@ +// RUN: clang-import-test -dump-ast -import %S/Inputs/F.cpp -expression %s | FileCheck %s + +// CHECK: IndirectGotoStmt +// CHECK-NEXT: ImplicitCastExpr +// CHECK-NEXT: DeclRefExpr +// CHECK-SAME: 'l1_ptr' + +void expr() { + f(); +} Index: test/Import/indirect-goto/Inputs/F.cpp === --- /dev/null +++ test/Import/indirect-goto/Inputs/F.cpp @@ -0,0 +1,6 @@ +void f() { + void const *l1_ptr = &&l1; + goto *l1_ptr; +l1: + return; +} ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D50732: [ASTImporter] Add test for CXXDefaultInitExpr
teemperor added a comment. As a side note: It seems this test case actually reveals that we don't import the body of Foo's destructor? test/Import/cxx-default-init-expr/Inputs/S.cpp:1:8: inline function 'Foo::~Foo' is not defined struct Foo { ^ test/Import/cxx-default-init-expr/Inputs/S.cpp:5:8: used here struct S { ^ This doesn't make the test itself fail, so I'll fix this in an upcoming patch. Repository: rC Clang https://reviews.llvm.org/D50732 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D50796: [ASTImporter] Add test for IfStmt
This revision was automatically updated to reflect the committed changes. Closed by commit rL339825: [ASTImporter] Add test for IfStmt (authored by teemperor, committed by ). Herald added a subscriber: llvm-commits. Changed prior to commit: https://reviews.llvm.org/D50796?vs=160876&id=160930#toc Repository: rL LLVM https://reviews.llvm.org/D50796 Files: lldb/trunk/test/Import/if-stmt/Inputs/F.cpp lldb/trunk/test/Import/if-stmt/test.cpp Index: lldb/trunk/test/Import/if-stmt/Inputs/F.cpp === --- lldb/trunk/test/Import/if-stmt/Inputs/F.cpp +++ lldb/trunk/test/Import/if-stmt/Inputs/F.cpp @@ -0,0 +1,21 @@ +void f() { + if (true) +return; + + if (int j = 3) +return; + + if (int j; true) +return; + + if (true) +return; + else +return; + + if (true) { +return; + } else { +return; + } +} Index: lldb/trunk/test/Import/if-stmt/test.cpp === --- lldb/trunk/test/Import/if-stmt/test.cpp +++ lldb/trunk/test/Import/if-stmt/test.cpp @@ -0,0 +1,47 @@ +// RUN: clang-import-test -dump-ast -import %S/Inputs/F.cpp -expression %s | FileCheck %s + +// CHECK: IfStmt +// CHECK-NEXT: <> +// CHECK-NEXT: <> +// CHECK-NEXT: CXXBoolLiteralExpr +// CHECK-NEXT: ReturnStmt +// CHECK-NEXT: <> + +// CHECK: IfStmt +// CHECK-NEXT: <> +// CHECK-NEXT: DeclStmt +// CHECK-NEXT: VarDecl +// CHECK-NEXT: IntegerLiteral +// CHECK-NEXT: ImplicitCastExpr +// CHECK-NEXT: ImplicitCastExpr +// CHECK-NEXT: DeclRefExpr +// CHECK-NEXT: ReturnStmt +// CHECK-NEXT: <> + +// CHECK: IfStmt +// CHECK-NEXT: DeclStmt +// CHECK-NEXT: VarDecl +// CHECK-NEXT: <> +// CHECK-NEXT: CXXBoolLiteralExpr +// CHECK-NEXT: ReturnStmt +// CHECK-NEXT: <> + +// CHECK: IfStmt +// CHECK-NEXT: <> +// CHECK-NEXT: <> +// CHECK-NEXT: CXXBoolLiteralExpr +// CHECK-NEXT: ReturnStmt +// CHECK-NEXT: ReturnStmt + +// CHECK: IfStmt +// CHECK-NEXT: <> +// CHECK-NEXT: <> +// CHECK-NEXT: CXXBoolLiteralExpr +// CHECK-NEXT: CompoundStmt +// CHECK-NEXT: ReturnStmt +// CHECK-NEXT: CompoundStmt +// CHECK-NEXT: ReturnStmt + +void expr() { + f(); +} Index: lldb/trunk/test/Import/if-stmt/Inputs/F.cpp === --- lldb/trunk/test/Import/if-stmt/Inputs/F.cpp +++ lldb/trunk/test/Import/if-stmt/Inputs/F.cpp @@ -0,0 +1,21 @@ +void f() { + if (true) +return; + + if (int j = 3) +return; + + if (int j; true) +return; + + if (true) +return; + else +return; + + if (true) { +return; + } else { +return; + } +} Index: lldb/trunk/test/Import/if-stmt/test.cpp === --- lldb/trunk/test/Import/if-stmt/test.cpp +++ lldb/trunk/test/Import/if-stmt/test.cpp @@ -0,0 +1,47 @@ +// RUN: clang-import-test -dump-ast -import %S/Inputs/F.cpp -expression %s | FileCheck %s + +// CHECK: IfStmt +// CHECK-NEXT: <> +// CHECK-NEXT: <> +// CHECK-NEXT: CXXBoolLiteralExpr +// CHECK-NEXT: ReturnStmt +// CHECK-NEXT: <> + +// CHECK: IfStmt +// CHECK-NEXT: <> +// CHECK-NEXT: DeclStmt +// CHECK-NEXT: VarDecl +// CHECK-NEXT: IntegerLiteral +// CHECK-NEXT: ImplicitCastExpr +// CHECK-NEXT: ImplicitCastExpr +// CHECK-NEXT: DeclRefExpr +// CHECK-NEXT: ReturnStmt +// CHECK-NEXT: <> + +// CHECK: IfStmt +// CHECK-NEXT: DeclStmt +// CHECK-NEXT: VarDecl +// CHECK-NEXT: <> +// CHECK-NEXT: CXXBoolLiteralExpr +// CHECK-NEXT: ReturnStmt +// CHECK-NEXT: <> + +// CHECK: IfStmt +// CHECK-NEXT: <> +// CHECK-NEXT: <> +// CHECK-NEXT: CXXBoolLiteralExpr +// CHECK-NEXT: ReturnStmt +// CHECK-NEXT: ReturnStmt + +// CHECK: IfStmt +// CHECK-NEXT: <> +// CHECK-NEXT: <> +// CHECK-NEXT: CXXBoolLiteralExpr +// CHECK-NEXT: CompoundStmt +// CHECK-NEXT: ReturnStmt +// CHECK-NEXT: CompoundStmt +// CHECK-NEXT: ReturnStmt + +void expr() { + f(); +} ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D50731: [ASTImporter] Add test for ExprWithCleanups
This revision was automatically updated to reflect the committed changes. Closed by commit rC339830: [ASTImporter] Add test for ExprWithCleanups (authored by teemperor, committed by ). Repository: rC Clang https://reviews.llvm.org/D50731 Files: test/Import/expr-with-cleanups/Inputs/S.cpp test/Import/expr-with-cleanups/test.cpp Index: test/Import/expr-with-cleanups/Inputs/S.cpp === --- test/Import/expr-with-cleanups/Inputs/S.cpp +++ test/Import/expr-with-cleanups/Inputs/S.cpp @@ -0,0 +1,8 @@ +struct RAII { + int i = 0; + RAII() { i++; } + ~RAII() { i--; } +}; +void f() { + RAII(); +} Index: test/Import/expr-with-cleanups/test.cpp === --- test/Import/expr-with-cleanups/test.cpp +++ test/Import/expr-with-cleanups/test.cpp @@ -0,0 +1,8 @@ +// RUN: clang-import-test -dump-ast -import %S/Inputs/S.cpp -expression %s | FileCheck %s +// CHECK: ExprWithCleanups +// CHECK-SAME: 'RAII' +// CHECK-NEXT: CXXBindTemporaryExpr + +void expr() { + f(); +} Index: test/Import/expr-with-cleanups/Inputs/S.cpp === --- test/Import/expr-with-cleanups/Inputs/S.cpp +++ test/Import/expr-with-cleanups/Inputs/S.cpp @@ -0,0 +1,8 @@ +struct RAII { + int i = 0; + RAII() { i++; } + ~RAII() { i--; } +}; +void f() { + RAII(); +} Index: test/Import/expr-with-cleanups/test.cpp === --- test/Import/expr-with-cleanups/test.cpp +++ test/Import/expr-with-cleanups/test.cpp @@ -0,0 +1,8 @@ +// RUN: clang-import-test -dump-ast -import %S/Inputs/S.cpp -expression %s | FileCheck %s +// CHECK: ExprWithCleanups +// CHECK-SAME: 'RAII' +// CHECK-NEXT: CXXBindTemporaryExpr + +void expr() { + f(); +} ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D50733: [ASTImporter] Add test for ArrayInitLoopExpr
This revision was automatically updated to reflect the committed changes. Closed by commit rL339831: [ASTImporter] Add test for ArrayInitLoopExpr (authored by teemperor, committed by ). Herald added a subscriber: llvm-commits. Changed prior to commit: https://reviews.llvm.org/D50733?vs=160682&id=160934#toc Repository: rL LLVM https://reviews.llvm.org/D50733 Files: cfe/trunk/test/Import/array-init-loop-expr/Inputs/S.cpp cfe/trunk/test/Import/array-init-loop-expr/test.cpp Index: cfe/trunk/test/Import/array-init-loop-expr/Inputs/S.cpp === --- cfe/trunk/test/Import/array-init-loop-expr/Inputs/S.cpp +++ cfe/trunk/test/Import/array-init-loop-expr/Inputs/S.cpp @@ -0,0 +1,3 @@ +class S { + int a[10]; +}; Index: cfe/trunk/test/Import/array-init-loop-expr/test.cpp === --- cfe/trunk/test/Import/array-init-loop-expr/test.cpp +++ cfe/trunk/test/Import/array-init-loop-expr/test.cpp @@ -0,0 +1,11 @@ +// RUN: clang-import-test -dump-ast -import %S/Inputs/S.cpp -expression %s | FileCheck %s +// CHECK: CXXCtorInitializer +// CHECK-NEXT: ArrayInitLoopExpr +// CHECK-SAME: 'int [10]' + +// CHECK: ArrayInitIndexExpr + +void expr() { + S s; + S copy = s; +} Index: cfe/trunk/test/Import/array-init-loop-expr/Inputs/S.cpp === --- cfe/trunk/test/Import/array-init-loop-expr/Inputs/S.cpp +++ cfe/trunk/test/Import/array-init-loop-expr/Inputs/S.cpp @@ -0,0 +1,3 @@ +class S { + int a[10]; +}; Index: cfe/trunk/test/Import/array-init-loop-expr/test.cpp === --- cfe/trunk/test/Import/array-init-loop-expr/test.cpp +++ cfe/trunk/test/Import/array-init-loop-expr/test.cpp @@ -0,0 +1,11 @@ +// RUN: clang-import-test -dump-ast -import %S/Inputs/S.cpp -expression %s | FileCheck %s +// CHECK: CXXCtorInitializer +// CHECK-NEXT: ArrayInitLoopExpr +// CHECK-SAME: 'int [10]' + +// CHECK: ArrayInitIndexExpr + +void expr() { + S s; + S copy = s; +} ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D50812: [ASTImporter] Add test for ForStmt and ContinueStmt
This revision was automatically updated to reflect the committed changes. Closed by commit rL339837: [ASTImporter] Add test for ForStmt and ContinueStmt (authored by teemperor, committed by ). Herald added a subscriber: llvm-commits. Changed prior to commit: https://reviews.llvm.org/D50812?vs=160921&id=160965#toc Repository: rL LLVM https://reviews.llvm.org/D50812 Files: cfe/trunk/test/Import/for-stmt/Inputs/F.cpp cfe/trunk/test/Import/for-stmt/test.cpp Index: cfe/trunk/test/Import/for-stmt/Inputs/F.cpp === --- cfe/trunk/test/Import/for-stmt/Inputs/F.cpp +++ cfe/trunk/test/Import/for-stmt/Inputs/F.cpp @@ -0,0 +1,9 @@ +void f() { + for (;;) +; + for (int i = 0;;) +continue; + for (int i = 0; i != 0; ++i) { +i++; + } +} Index: cfe/trunk/test/Import/for-stmt/test.cpp === --- cfe/trunk/test/Import/for-stmt/test.cpp +++ cfe/trunk/test/Import/for-stmt/test.cpp @@ -0,0 +1,38 @@ +// RUN: clang-import-test -dump-ast -import %S/Inputs/F.cpp -expression %s | FileCheck %s + +// CHECK: ForStmt +// CHECK-NEXT: <> +// CHECK-NEXT: <> +// CHECK-NEXT: <> +// CHECK-NEXT: <> +// CHECK-NEXT: NullStmt + +// CHECK: ForStmt +// CHECK-NEXT: DeclStmt +// CHECK-NEXT: VarDecl +// CHECK-NEXT: IntegerLiteral +// CHECK-NEXT: <> +// CHECK-NEXT: <> +// CHECK-NEXT: <> +// CHECK-NEXT: ContinueStmt + +// CHECK: ForStmt +// CHECK-NEXT: DeclStmt +// CHECK-NEXT: VarDecl +// CHECK-NEXT: IntegerLiteral +// CHECK-NEXT: <> + +// CHECK-NEXT: BinaryOperator +// CHECK-NEXT: ImplicitCastExpr +// CHECK-NEXT: DeclRefExpr +// CHECK-NEXT: IntegerLiteral + +// CHECK-NEXT: UnaryOperator +// CHECK-SAME: '++' +// CHECK-NEXT: DeclRefExpr + +// CHECK-NEXT: CompoundStmt + +void expr() { + f(); +} Index: cfe/trunk/test/Import/for-stmt/Inputs/F.cpp === --- cfe/trunk/test/Import/for-stmt/Inputs/F.cpp +++ cfe/trunk/test/Import/for-stmt/Inputs/F.cpp @@ -0,0 +1,9 @@ +void f() { + for (;;) +; + for (int i = 0;;) +continue; + for (int i = 0; i != 0; ++i) { +i++; + } +} Index: cfe/trunk/test/Import/for-stmt/test.cpp === --- cfe/trunk/test/Import/for-stmt/test.cpp +++ cfe/trunk/test/Import/for-stmt/test.cpp @@ -0,0 +1,38 @@ +// RUN: clang-import-test -dump-ast -import %S/Inputs/F.cpp -expression %s | FileCheck %s + +// CHECK: ForStmt +// CHECK-NEXT: <> +// CHECK-NEXT: <> +// CHECK-NEXT: <> +// CHECK-NEXT: <> +// CHECK-NEXT: NullStmt + +// CHECK: ForStmt +// CHECK-NEXT: DeclStmt +// CHECK-NEXT: VarDecl +// CHECK-NEXT: IntegerLiteral +// CHECK-NEXT: <> +// CHECK-NEXT: <> +// CHECK-NEXT: <> +// CHECK-NEXT: ContinueStmt + +// CHECK: ForStmt +// CHECK-NEXT: DeclStmt +// CHECK-NEXT: VarDecl +// CHECK-NEXT: IntegerLiteral +// CHECK-NEXT: <> + +// CHECK-NEXT: BinaryOperator +// CHECK-NEXT: ImplicitCastExpr +// CHECK-NEXT: DeclRefExpr +// CHECK-NEXT: IntegerLiteral + +// CHECK-NEXT: UnaryOperator +// CHECK-SAME: '++' +// CHECK-NEXT: DeclRefExpr + +// CHECK-NEXT: CompoundStmt + +void expr() { + f(); +} ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D50735: [ASTImporter] Add test for CXXScalarValueInit
This revision was automatically updated to reflect the committed changes. Closed by commit rL339838: [ASTImporter] Add test for CXXScalarValueInit (authored by teemperor, committed by ). Herald added a subscriber: llvm-commits. Changed prior to commit: https://reviews.llvm.org/D50735?vs=160685&id=160966#toc Repository: rL LLVM https://reviews.llvm.org/D50735 Files: cfe/trunk/test/Import/cxx-scalar-value-init/Inputs/S.cpp cfe/trunk/test/Import/cxx-scalar-value-init/test.cpp Index: cfe/trunk/test/Import/cxx-scalar-value-init/Inputs/S.cpp === --- cfe/trunk/test/Import/cxx-scalar-value-init/Inputs/S.cpp +++ cfe/trunk/test/Import/cxx-scalar-value-init/Inputs/S.cpp @@ -0,0 +1,2 @@ +int si() { return int(); } +float sf() { return float(); } Index: cfe/trunk/test/Import/cxx-scalar-value-init/test.cpp === --- cfe/trunk/test/Import/cxx-scalar-value-init/test.cpp +++ cfe/trunk/test/Import/cxx-scalar-value-init/test.cpp @@ -0,0 +1,11 @@ +// RUN: clang-import-test -dump-ast -import %S/Inputs/S.cpp -expression %s | FileCheck %s +// CHECK: CXXScalarValueInitExpr +// CHECK-SAME: 'int' + +// CHECK: CXXScalarValueInitExpr +// CHECK-SAME: 'float' + +void expr() { + int i = si(); + float f = sf(); +} Index: cfe/trunk/test/Import/cxx-scalar-value-init/Inputs/S.cpp === --- cfe/trunk/test/Import/cxx-scalar-value-init/Inputs/S.cpp +++ cfe/trunk/test/Import/cxx-scalar-value-init/Inputs/S.cpp @@ -0,0 +1,2 @@ +int si() { return int(); } +float sf() { return float(); } Index: cfe/trunk/test/Import/cxx-scalar-value-init/test.cpp === --- cfe/trunk/test/Import/cxx-scalar-value-init/test.cpp +++ cfe/trunk/test/Import/cxx-scalar-value-init/test.cpp @@ -0,0 +1,11 @@ +// RUN: clang-import-test -dump-ast -import %S/Inputs/S.cpp -expression %s | FileCheck %s +// CHECK: CXXScalarValueInitExpr +// CHECK-SAME: 'int' + +// CHECK: CXXScalarValueInitExpr +// CHECK-SAME: 'float' + +void expr() { + int i = si(); + float f = sf(); +} ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D50732: [ASTImporter] Add test for CXXDefaultInitExpr
This revision was automatically updated to reflect the committed changes. Closed by commit rL339839: [ASTImporter] Add test for CXXDefaultInitExpr (authored by teemperor, committed by ). Herald added a subscriber: llvm-commits. Changed prior to commit: https://reviews.llvm.org/D50732?vs=160678&id=160967#toc Repository: rL LLVM https://reviews.llvm.org/D50732 Files: cfe/trunk/test/Import/cxx-default-init-expr/Inputs/S.cpp cfe/trunk/test/Import/cxx-default-init-expr/test.cpp Index: cfe/trunk/test/Import/cxx-default-init-expr/Inputs/S.cpp === --- cfe/trunk/test/Import/cxx-default-init-expr/Inputs/S.cpp +++ cfe/trunk/test/Import/cxx-default-init-expr/Inputs/S.cpp @@ -0,0 +1,9 @@ +struct Foo { + int i; +}; + +struct S { + int int_member = 3; + float float_member = 3.0f; + Foo class_member = Foo(); +}; Index: cfe/trunk/test/Import/cxx-default-init-expr/test.cpp === --- cfe/trunk/test/Import/cxx-default-init-expr/test.cpp +++ cfe/trunk/test/Import/cxx-default-init-expr/test.cpp @@ -0,0 +1,22 @@ +// RUN: clang-import-test -dump-ast -import %S/Inputs/S.cpp -expression %s | FileCheck %s +// CHECK: CXXCtorInitializer +// CHECK-SAME: 'int_member' +// CHECK-SAME: 'int' +// CHECK-NEXT: CXXDefaultInitExpr +// CHECK-SAME: 'int' + +// CHECK-NEXT: CXXCtorInitializer +// CHECK-SAME: 'float_member' +// CHECK-SAME: 'float' +// CHECK-NEXT: CXXDefaultInitExpr +// CHECK-SAME: 'float' + +// CHECK-NEXT: CXXCtorInitializer +// CHECK-SAME: 'class_member' +// CHECK-SAME: 'Foo' +// CHECK-NEXT: CXXDefaultInitExpr +// CHECK-SAME: 'Foo' + +void expr() { + struct S s; +} Index: cfe/trunk/test/Import/cxx-default-init-expr/Inputs/S.cpp === --- cfe/trunk/test/Import/cxx-default-init-expr/Inputs/S.cpp +++ cfe/trunk/test/Import/cxx-default-init-expr/Inputs/S.cpp @@ -0,0 +1,9 @@ +struct Foo { + int i; +}; + +struct S { + int int_member = 3; + float float_member = 3.0f; + Foo class_member = Foo(); +}; Index: cfe/trunk/test/Import/cxx-default-init-expr/test.cpp === --- cfe/trunk/test/Import/cxx-default-init-expr/test.cpp +++ cfe/trunk/test/Import/cxx-default-init-expr/test.cpp @@ -0,0 +1,22 @@ +// RUN: clang-import-test -dump-ast -import %S/Inputs/S.cpp -expression %s | FileCheck %s +// CHECK: CXXCtorInitializer +// CHECK-SAME: 'int_member' +// CHECK-SAME: 'int' +// CHECK-NEXT: CXXDefaultInitExpr +// CHECK-SAME: 'int' + +// CHECK-NEXT: CXXCtorInitializer +// CHECK-SAME: 'float_member' +// CHECK-SAME: 'float' +// CHECK-NEXT: CXXDefaultInitExpr +// CHECK-SAME: 'float' + +// CHECK-NEXT: CXXCtorInitializer +// CHECK-SAME: 'class_member' +// CHECK-SAME: 'Foo' +// CHECK-NEXT: CXXDefaultInitExpr +// CHECK-SAME: 'Foo' + +void expr() { + struct S s; +} ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D50813: [ASTImporter] Add test for IndirectGotoStmt
This revision was automatically updated to reflect the committed changes. Closed by commit rC339915: [ASTImporter] Add test for IndirectGotoStmt (authored by teemperor, committed by ). Repository: rC Clang https://reviews.llvm.org/D50813 Files: test/Import/indirect-goto/Inputs/F.cpp test/Import/indirect-goto/test.cpp Index: test/Import/indirect-goto/test.cpp === --- test/Import/indirect-goto/test.cpp +++ test/Import/indirect-goto/test.cpp @@ -0,0 +1,10 @@ +// RUN: clang-import-test -dump-ast -import %S/Inputs/F.cpp -expression %s | FileCheck %s + +// CHECK: IndirectGotoStmt +// CHECK-NEXT: ImplicitCastExpr +// CHECK-NEXT: DeclRefExpr +// CHECK-SAME: 'l1_ptr' + +void expr() { + f(); +} Index: test/Import/indirect-goto/Inputs/F.cpp === --- test/Import/indirect-goto/Inputs/F.cpp +++ test/Import/indirect-goto/Inputs/F.cpp @@ -0,0 +1,6 @@ +void f() { + void const *l1_ptr = &&l1; + goto *l1_ptr; +l1: + return; +} Index: test/Import/indirect-goto/test.cpp === --- test/Import/indirect-goto/test.cpp +++ test/Import/indirect-goto/test.cpp @@ -0,0 +1,10 @@ +// RUN: clang-import-test -dump-ast -import %S/Inputs/F.cpp -expression %s | FileCheck %s + +// CHECK: IndirectGotoStmt +// CHECK-NEXT: ImplicitCastExpr +// CHECK-NEXT: DeclRefExpr +// CHECK-SAME: 'l1_ptr' + +void expr() { + f(); +} Index: test/Import/indirect-goto/Inputs/F.cpp === --- test/Import/indirect-goto/Inputs/F.cpp +++ test/Import/indirect-goto/Inputs/F.cpp @@ -0,0 +1,6 @@ +void f() { + void const *l1_ptr = &&l1; + goto *l1_ptr; +l1: + return; +} ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D50811: [ASTImporter] Add test for WhileStmt
This revision was automatically updated to reflect the committed changes. Closed by commit rL339916: [ASTImporter] Add test for WhileStmt (authored by teemperor, committed by ). Herald added a subscriber: llvm-commits. Changed prior to commit: https://reviews.llvm.org/D50811?vs=160919&id=161074#toc Repository: rL LLVM https://reviews.llvm.org/D50811 Files: cfe/trunk/test/Import/while-stmt/Inputs/F.cpp cfe/trunk/test/Import/while-stmt/test.cpp Index: cfe/trunk/test/Import/while-stmt/Inputs/F.cpp === --- cfe/trunk/test/Import/while-stmt/Inputs/F.cpp +++ cfe/trunk/test/Import/while-stmt/Inputs/F.cpp @@ -0,0 +1,8 @@ +void f() { + while (false) +; + while (false) { + } + while (bool ini = true) +; +} Index: cfe/trunk/test/Import/while-stmt/test.cpp === --- cfe/trunk/test/Import/while-stmt/test.cpp +++ cfe/trunk/test/Import/while-stmt/test.cpp @@ -0,0 +1,23 @@ +// RUN: clang-import-test -dump-ast -import %S/Inputs/F.cpp -expression %s | FileCheck %s + +// CHECK: WhileStmt +// CHECK-NEXT: <> +// CHECK-NEXT: CXXBoolLiteralExpr +// CHECK-NEXT: NullStmt + +// CHECK: WhileStmt +// CHECK-NEXT: <> +// CHECK-NEXT: CXXBoolLiteralExpr +// CHECK-NEXT: CompoundStmt + +// CHECK: WhileStmt +// CHECK-NEXT: DeclStmt +// CHECK-NEXT: VarDecl +// CHECK-NEXT: CXXBoolLiteralExpr +// CHECK-NEXT: ImplicitCastExpr +// CHECK-NEXT: DeclRefExpr +// CHECK-NEXT: NullStmt + +void expr() { + f(); +} Index: cfe/trunk/test/Import/while-stmt/Inputs/F.cpp === --- cfe/trunk/test/Import/while-stmt/Inputs/F.cpp +++ cfe/trunk/test/Import/while-stmt/Inputs/F.cpp @@ -0,0 +1,8 @@ +void f() { + while (false) +; + while (false) { + } + while (bool ini = true) +; +} Index: cfe/trunk/test/Import/while-stmt/test.cpp === --- cfe/trunk/test/Import/while-stmt/test.cpp +++ cfe/trunk/test/Import/while-stmt/test.cpp @@ -0,0 +1,23 @@ +// RUN: clang-import-test -dump-ast -import %S/Inputs/F.cpp -expression %s | FileCheck %s + +// CHECK: WhileStmt +// CHECK-NEXT: <> +// CHECK-NEXT: CXXBoolLiteralExpr +// CHECK-NEXT: NullStmt + +// CHECK: WhileStmt +// CHECK-NEXT: <> +// CHECK-NEXT: CXXBoolLiteralExpr +// CHECK-NEXT: CompoundStmt + +// CHECK: WhileStmt +// CHECK-NEXT: DeclStmt +// CHECK-NEXT: VarDecl +// CHECK-NEXT: CXXBoolLiteralExpr +// CHECK-NEXT: ImplicitCastExpr +// CHECK-NEXT: DeclRefExpr +// CHECK-NEXT: NullStmt + +void expr() { + f(); +} ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D50810: [ASTImporter] Add test for DoStmt
This revision was automatically updated to reflect the committed changes. Closed by commit rL339917: [ASTImporter] Add test for DoStmt (authored by teemperor, committed by ). Herald added a subscriber: llvm-commits. Changed prior to commit: https://reviews.llvm.org/D50810?vs=160918&id=161075#toc Repository: rL LLVM https://reviews.llvm.org/D50810 Files: cfe/trunk/test/Import/do-stmt/Inputs/F.cpp cfe/trunk/test/Import/do-stmt/test.cpp Index: cfe/trunk/test/Import/do-stmt/Inputs/F.cpp === --- cfe/trunk/test/Import/do-stmt/Inputs/F.cpp +++ cfe/trunk/test/Import/do-stmt/Inputs/F.cpp @@ -0,0 +1,7 @@ +void f() { + do +; + while (true); + do { + } while (false); +} Index: cfe/trunk/test/Import/do-stmt/test.cpp === --- cfe/trunk/test/Import/do-stmt/test.cpp +++ cfe/trunk/test/Import/do-stmt/test.cpp @@ -0,0 +1,15 @@ +// RUN: clang-import-test -dump-ast -import %S/Inputs/F.cpp -expression %s | FileCheck %s + +// CHECK: DoStmt +// CHECK-NEXT: NullStmt +// CHECK-NEXT: CXXBoolLiteralExpr +// CHECK-SAME: true + +// CHECK: DoStmt +// CHECK-NEXT: CompoundStmt +// CHECK-NEXT: CXXBoolLiteralExpr +// CHECK-SAME: false + +void expr() { + f(); +} Index: cfe/trunk/test/Import/do-stmt/Inputs/F.cpp === --- cfe/trunk/test/Import/do-stmt/Inputs/F.cpp +++ cfe/trunk/test/Import/do-stmt/Inputs/F.cpp @@ -0,0 +1,7 @@ +void f() { + do +; + while (true); + do { + } while (false); +} Index: cfe/trunk/test/Import/do-stmt/test.cpp === --- cfe/trunk/test/Import/do-stmt/test.cpp +++ cfe/trunk/test/Import/do-stmt/test.cpp @@ -0,0 +1,15 @@ +// RUN: clang-import-test -dump-ast -import %S/Inputs/F.cpp -expression %s | FileCheck %s + +// CHECK: DoStmt +// CHECK-NEXT: NullStmt +// CHECK-NEXT: CXXBoolLiteralExpr +// CHECK-SAME: true + +// CHECK: DoStmt +// CHECK-NEXT: CompoundStmt +// CHECK-NEXT: CXXBoolLiteralExpr +// CHECK-SAME: false + +void expr() { + f(); +} ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D50793: [ASTImporter] Add test for importing CompoundAssignOperators
This revision was automatically updated to reflect the committed changes. Closed by commit rL339918: [ASTImporter] Add test for importing CompoundAssignOperators (authored by teemperor, committed by ). Herald added a subscriber: llvm-commits. Changed prior to commit: https://reviews.llvm.org/D50793?vs=160862&id=161076#toc Repository: rL LLVM https://reviews.llvm.org/D50793 Files: cfe/trunk/test/Import/compound-assign-op/Inputs/F.cpp cfe/trunk/test/Import/compound-assign-op/test.cpp Index: cfe/trunk/test/Import/compound-assign-op/Inputs/F.cpp === --- cfe/trunk/test/Import/compound-assign-op/Inputs/F.cpp +++ cfe/trunk/test/Import/compound-assign-op/Inputs/F.cpp @@ -0,0 +1,18 @@ +void f() { + unsigned iadd_eq = 0U; + iadd_eq += 1U; + unsigned isub_eq = 0U; + isub_eq -= 1U; + unsigned imul_eq = 0U; + imul_eq *= 1U; + unsigned idiv_eq = 0U; + idiv_eq /= 1U; + unsigned iand_eq = 0U; + iand_eq &= 1U; + unsigned ixor_eq = 0U; + ixor_eq ^= 1U; + unsigned ilsh_eq = 0U; + ilsh_eq <<= 1U; + unsigned irsh_eq = 0U; + irsh_eq >>= 1U; +} Index: cfe/trunk/test/Import/compound-assign-op/test.cpp === --- cfe/trunk/test/Import/compound-assign-op/test.cpp +++ cfe/trunk/test/Import/compound-assign-op/test.cpp @@ -0,0 +1,45 @@ +// RUN: clang-import-test -dump-ast -import %S/Inputs/F.cpp -expression %s | FileCheck %s + +// CHECK: VarDecl +// CHECK-NEXT: Integer +// CHECK-NEXT: CompoundAssignOperator +// CHECK-SAME: '+=' + +// CHECK: VarDecl +// CHECK-NEXT: Integer +// CHECK-NEXT: CompoundAssignOperator +// CHECK-SAME: '-=' + +// CHECK: VarDecl +// CHECK-NEXT: Integer +// CHECK-NEXT: CompoundAssignOperator +// CHECK-SAME: '*=' + +// CHECK: VarDecl +// CHECK-NEXT: Integer +// CHECK-NEXT: CompoundAssignOperator +// CHECK-SAME: '/=' + +// CHECK: VarDecl +// CHECK-NEXT: Integer +// CHECK-NEXT: CompoundAssignOperator +// CHECK-SAME: '&=' + +// CHECK: VarDecl +// CHECK-NEXT: Integer +// CHECK-NEXT: CompoundAssignOperator +// CHECK-SAME: '^=' + +// CHECK: VarDecl +// CHECK-NEXT: Integer +// CHECK-NEXT: CompoundAssignOperator +// CHECK-SAME: '<<=' + +// CHECK: VarDecl +// CHECK-NEXT: Integer +// CHECK-NEXT: CompoundAssignOperator +// CHECK-SAME: '>>=' + +void expr() { + f(); +} Index: cfe/trunk/test/Import/compound-assign-op/Inputs/F.cpp === --- cfe/trunk/test/Import/compound-assign-op/Inputs/F.cpp +++ cfe/trunk/test/Import/compound-assign-op/Inputs/F.cpp @@ -0,0 +1,18 @@ +void f() { + unsigned iadd_eq = 0U; + iadd_eq += 1U; + unsigned isub_eq = 0U; + isub_eq -= 1U; + unsigned imul_eq = 0U; + imul_eq *= 1U; + unsigned idiv_eq = 0U; + idiv_eq /= 1U; + unsigned iand_eq = 0U; + iand_eq &= 1U; + unsigned ixor_eq = 0U; + ixor_eq ^= 1U; + unsigned ilsh_eq = 0U; + ilsh_eq <<= 1U; + unsigned irsh_eq = 0U; + irsh_eq >>= 1U; +} Index: cfe/trunk/test/Import/compound-assign-op/test.cpp === --- cfe/trunk/test/Import/compound-assign-op/test.cpp +++ cfe/trunk/test/Import/compound-assign-op/test.cpp @@ -0,0 +1,45 @@ +// RUN: clang-import-test -dump-ast -import %S/Inputs/F.cpp -expression %s | FileCheck %s + +// CHECK: VarDecl +// CHECK-NEXT: Integer +// CHECK-NEXT: CompoundAssignOperator +// CHECK-SAME: '+=' + +// CHECK: VarDecl +// CHECK-NEXT: Integer +// CHECK-NEXT: CompoundAssignOperator +// CHECK-SAME: '-=' + +// CHECK: VarDecl +// CHECK-NEXT: Integer +// CHECK-NEXT: CompoundAssignOperator +// CHECK-SAME: '*=' + +// CHECK: VarDecl +// CHECK-NEXT: Integer +// CHECK-NEXT: CompoundAssignOperator +// CHECK-SAME: '/=' + +// CHECK: VarDecl +// CHECK-NEXT: Integer +// CHECK-NEXT: CompoundAssignOperator +// CHECK-SAME: '&=' + +// CHECK: VarDecl +// CHECK-NEXT: Integer +// CHECK-NEXT: CompoundAssignOperator +// CHECK-SAME: '^=' + +// CHECK: VarDecl +// CHECK-NEXT: Integer +// CHECK-NEXT: CompoundAssignOperator +// CHECK-SAME: '<<=' + +// CHECK: VarDecl +// CHECK-NEXT: Integer +// CHECK-NEXT: CompoundAssignOperator +// CHECK-SAME: '>>=' + +void expr() { + f(); +} ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D50792: [ASTImporter] Add test for member pointer types.
This revision was automatically updated to reflect the committed changes. Closed by commit rL339919: [ASTImporter] Add test for member pointer types. (authored by teemperor, committed by ). Herald added a subscriber: llvm-commits. Changed prior to commit: https://reviews.llvm.org/D50792?vs=160860&id=161078#toc Repository: rL LLVM https://reviews.llvm.org/D50792 Files: cfe/trunk/test/Import/cxx-member-pointers/Inputs/S.cpp cfe/trunk/test/Import/cxx-member-pointers/test.cpp Index: cfe/trunk/test/Import/cxx-member-pointers/Inputs/S.cpp === --- cfe/trunk/test/Import/cxx-member-pointers/Inputs/S.cpp +++ cfe/trunk/test/Import/cxx-member-pointers/Inputs/S.cpp @@ -0,0 +1,7 @@ +struct S { + int i; +}; + +int S::*iptr() { + return &S::i; +} Index: cfe/trunk/test/Import/cxx-member-pointers/test.cpp === --- cfe/trunk/test/Import/cxx-member-pointers/test.cpp +++ cfe/trunk/test/Import/cxx-member-pointers/test.cpp @@ -0,0 +1,16 @@ +// RUN: clang-import-test -dump-ast -import %S/Inputs/S.cpp -expression %s | FileCheck %s + +// CHECK: VarDecl +// CHECK-SAME: int S::* +// CHECK-NEXT: CallExpr +// CHECK-NEXT: ImplicitCastExpr +// CHECK-SAME: int S::*(*)() +// CHECK-NEXT: DeclRefExpr +// CHECK-SAME: int S::*() + +void expr() { + int S::*p = iptr(); + S s; + s.i = 3; + int i = s.*p; +} Index: cfe/trunk/test/Import/cxx-member-pointers/Inputs/S.cpp === --- cfe/trunk/test/Import/cxx-member-pointers/Inputs/S.cpp +++ cfe/trunk/test/Import/cxx-member-pointers/Inputs/S.cpp @@ -0,0 +1,7 @@ +struct S { + int i; +}; + +int S::*iptr() { + return &S::i; +} Index: cfe/trunk/test/Import/cxx-member-pointers/test.cpp === --- cfe/trunk/test/Import/cxx-member-pointers/test.cpp +++ cfe/trunk/test/Import/cxx-member-pointers/test.cpp @@ -0,0 +1,16 @@ +// RUN: clang-import-test -dump-ast -import %S/Inputs/S.cpp -expression %s | FileCheck %s + +// CHECK: VarDecl +// CHECK-SAME: int S::* +// CHECK-NEXT: CallExpr +// CHECK-NEXT: ImplicitCastExpr +// CHECK-SAME: int S::*(*)() +// CHECK-NEXT: DeclRefExpr +// CHECK-SAME: int S::*() + +void expr() { + int S::*p = iptr(); + S s; + s.i = 3; + int i = s.*p; +} ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D50928: [ASTImporter] Test for importing condition variable from a ForStmt
teemperor created this revision. Herald added a subscriber: martong. Herald added a reviewer: a.sidorin. Repository: rC Clang https://reviews.llvm.org/D50928 Files: test/Import/for-stmt/Inputs/F.cpp test/Import/for-stmt/test.cpp Index: test/Import/for-stmt/test.cpp === --- test/Import/for-stmt/test.cpp +++ test/Import/for-stmt/test.cpp @@ -16,6 +16,18 @@ // CHECK-NEXT: <> // CHECK-NEXT: ContinueStmt +// CHECK: ForStmt +// CHECK-NEXT: <> +// CHECK-NEXT: DeclStmt +// CHECK-NEXT: VarDecl +// CHECK-NEXT: CXXBoolLiteralExpr +// CHECK-NEXT: ImplicitCastExpr +// CHECK-NEXT: DeclRefExpr +// CHECK-SAME: 'j' +// CHECK-SAME: 'bool' +// CHECK-NEXT: <> +// CHECK-NEXT: ContinueStmt + // CHECK: ForStmt // CHECK-NEXT: DeclStmt // CHECK-NEXT: VarDecl Index: test/Import/for-stmt/Inputs/F.cpp === --- test/Import/for-stmt/Inputs/F.cpp +++ test/Import/for-stmt/Inputs/F.cpp @@ -3,6 +3,8 @@ ; for (int i = 0;;) continue; + for (; bool j = false;) +continue; for (int i = 0; i != 0; ++i) { i++; } Index: test/Import/for-stmt/test.cpp === --- test/Import/for-stmt/test.cpp +++ test/Import/for-stmt/test.cpp @@ -16,6 +16,18 @@ // CHECK-NEXT: <> // CHECK-NEXT: ContinueStmt +// CHECK: ForStmt +// CHECK-NEXT: <> +// CHECK-NEXT: DeclStmt +// CHECK-NEXT: VarDecl +// CHECK-NEXT: CXXBoolLiteralExpr +// CHECK-NEXT: ImplicitCastExpr +// CHECK-NEXT: DeclRefExpr +// CHECK-SAME: 'j' +// CHECK-SAME: 'bool' +// CHECK-NEXT: <> +// CHECK-NEXT: ContinueStmt + // CHECK: ForStmt // CHECK-NEXT: DeclStmt // CHECK-NEXT: VarDecl Index: test/Import/for-stmt/Inputs/F.cpp === --- test/Import/for-stmt/Inputs/F.cpp +++ test/Import/for-stmt/Inputs/F.cpp @@ -3,6 +3,8 @@ ; for (int i = 0;;) continue; + for (; bool j = false;) +continue; for (int i = 0; i != 0; ++i) { i++; } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D50932: [ASTImporter] Add test for C++ casts and fix broken const_cast importing.
teemperor created this revision. Herald added a subscriber: martong. Herald added a reviewer: a.sidorin. Repository: rC Clang https://reviews.llvm.org/D50932 Files: lib/AST/ASTImporter.cpp test/Import/cxx-casts/Inputs/F.cpp test/Import/cxx-casts/test.cpp tools/clang-import-test/clang-import-test.cpp Index: tools/clang-import-test/clang-import-test.cpp === --- tools/clang-import-test/clang-import-test.cpp +++ tools/clang-import-test/clang-import-test.cpp @@ -194,6 +194,7 @@ Inv->getLangOpts()->ThreadsafeStatics = false; Inv->getLangOpts()->AccessControl = false; Inv->getLangOpts()->DollarIdents = true; + Inv->getLangOpts()->RTTI = true; Inv->getCodeGenOpts().setDebugInfo(codegenoptions::FullDebugInfo); Inv->getTargetOpts().Triple = llvm::sys::getDefaultTargetTriple(); Index: test/Import/cxx-casts/test.cpp === --- /dev/null +++ test/Import/cxx-casts/test.cpp @@ -0,0 +1,21 @@ +// RUN: clang-import-test -dump-ast -import %S/Inputs/F.cpp -expression %s | FileCheck %s + +// CHECK: CXXDynamicCastExpr +// CHECK-SAME: dynamic_cast +// CHECK-SAME: + +// CHECK: CXXStaticCastExpr +// CHECK-SAME: static_cast +// CHECK-SAME: + +// CHECK: CXXReinterpretCastExpr +// CHECK-SAME: reinterpret_cast +// CHECK-SAME: + +// CHECK: CXXConstCastExpr +// CHECK-SAME: const_cast +// CHECK-SAME: + +void expr() { + f(); +} Index: test/Import/cxx-casts/Inputs/F.cpp === --- /dev/null +++ test/Import/cxx-casts/Inputs/F.cpp @@ -0,0 +1,12 @@ +struct A { + virtual ~A() {} +}; +struct B : public A {}; + +void f() { + const A *b = new B(); + const B *c1 = dynamic_cast(b); + const B *c2 = static_cast(b); + const B *c3 = reinterpret_cast(b); + A *c4 = const_cast(b); +} Index: lib/AST/ASTImporter.cpp === --- lib/AST/ASTImporter.cpp +++ lib/AST/ASTImporter.cpp @@ -6897,6 +6897,10 @@ return CXXReinterpretCastExpr::Create( Importer.getToContext(), ToType, VK, CK, ToOp, &BasePath, ToWritten, ToOperatorLoc, ToRParenLoc, ToAngleBrackets); + } else if (isa(E)) { +return CXXConstCastExpr::Create(Importer.getToContext(), ToType, VK, ToOp, +ToWritten, ToOperatorLoc, ToRParenLoc, +ToAngleBrackets); } else { return nullptr; } Index: tools/clang-import-test/clang-import-test.cpp === --- tools/clang-import-test/clang-import-test.cpp +++ tools/clang-import-test/clang-import-test.cpp @@ -194,6 +194,7 @@ Inv->getLangOpts()->ThreadsafeStatics = false; Inv->getLangOpts()->AccessControl = false; Inv->getLangOpts()->DollarIdents = true; + Inv->getLangOpts()->RTTI = true; Inv->getCodeGenOpts().setDebugInfo(codegenoptions::FullDebugInfo); Inv->getTargetOpts().Triple = llvm::sys::getDefaultTargetTriple(); Index: test/Import/cxx-casts/test.cpp === --- /dev/null +++ test/Import/cxx-casts/test.cpp @@ -0,0 +1,21 @@ +// RUN: clang-import-test -dump-ast -import %S/Inputs/F.cpp -expression %s | FileCheck %s + +// CHECK: CXXDynamicCastExpr +// CHECK-SAME: dynamic_cast +// CHECK-SAME: + +// CHECK: CXXStaticCastExpr +// CHECK-SAME: static_cast +// CHECK-SAME: + +// CHECK: CXXReinterpretCastExpr +// CHECK-SAME: reinterpret_cast +// CHECK-SAME: + +// CHECK: CXXConstCastExpr +// CHECK-SAME: const_cast +// CHECK-SAME: + +void expr() { + f(); +} Index: test/Import/cxx-casts/Inputs/F.cpp === --- /dev/null +++ test/Import/cxx-casts/Inputs/F.cpp @@ -0,0 +1,12 @@ +struct A { + virtual ~A() {} +}; +struct B : public A {}; + +void f() { + const A *b = new B(); + const B *c1 = dynamic_cast(b); + const B *c2 = static_cast(b); + const B *c3 = reinterpret_cast(b); + A *c4 = const_cast(b); +} Index: lib/AST/ASTImporter.cpp === --- lib/AST/ASTImporter.cpp +++ lib/AST/ASTImporter.cpp @@ -6897,6 +6897,10 @@ return CXXReinterpretCastExpr::Create( Importer.getToContext(), ToType, VK, CK, ToOp, &BasePath, ToWritten, ToOperatorLoc, ToRParenLoc, ToAngleBrackets); + } else if (isa(E)) { +return CXXConstCastExpr::Create(Importer.getToContext(), ToType, VK, ToOp, +ToWritten, ToOperatorLoc, ToRParenLoc, +ToAngleBrackets); } else { return nullptr; } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D50928: [ASTImporter] Test for importing condition variable from a ForStmt
This revision was automatically updated to reflect the committed changes. Closed by commit rC340180: [ASTImporter] Test for importing condition variable from a ForStmt (authored by teemperor, committed by ). Changed prior to commit: https://reviews.llvm.org/D50928?vs=161342&id=161493#toc Repository: rC Clang https://reviews.llvm.org/D50928 Files: test/Import/for-stmt/Inputs/F.cpp test/Import/for-stmt/test.cpp Index: test/Import/for-stmt/Inputs/F.cpp === --- test/Import/for-stmt/Inputs/F.cpp +++ test/Import/for-stmt/Inputs/F.cpp @@ -3,6 +3,8 @@ ; for (int i = 0;;) continue; + for (; bool j = false;) +continue; for (int i = 0; i != 0; ++i) { i++; } Index: test/Import/for-stmt/test.cpp === --- test/Import/for-stmt/test.cpp +++ test/Import/for-stmt/test.cpp @@ -17,6 +17,18 @@ // CHECK-NEXT: ContinueStmt // CHECK: ForStmt +// CHECK-NEXT: <> +// CHECK-NEXT: DeclStmt +// CHECK-NEXT: VarDecl +// CHECK-NEXT: CXXBoolLiteralExpr +// CHECK-NEXT: ImplicitCastExpr +// CHECK-NEXT: DeclRefExpr +// CHECK-SAME: 'j' +// CHECK-SAME: 'bool' +// CHECK-NEXT: <> +// CHECK-NEXT: ContinueStmt + +// CHECK: ForStmt // CHECK-NEXT: DeclStmt // CHECK-NEXT: VarDecl // CHECK-NEXT: IntegerLiteral Index: test/Import/for-stmt/Inputs/F.cpp === --- test/Import/for-stmt/Inputs/F.cpp +++ test/Import/for-stmt/Inputs/F.cpp @@ -3,6 +3,8 @@ ; for (int i = 0;;) continue; + for (; bool j = false;) +continue; for (int i = 0; i != 0; ++i) { i++; } Index: test/Import/for-stmt/test.cpp === --- test/Import/for-stmt/test.cpp +++ test/Import/for-stmt/test.cpp @@ -17,6 +17,18 @@ // CHECK-NEXT: ContinueStmt // CHECK: ForStmt +// CHECK-NEXT: <> +// CHECK-NEXT: DeclStmt +// CHECK-NEXT: VarDecl +// CHECK-NEXT: CXXBoolLiteralExpr +// CHECK-NEXT: ImplicitCastExpr +// CHECK-NEXT: DeclRefExpr +// CHECK-SAME: 'j' +// CHECK-SAME: 'bool' +// CHECK-NEXT: <> +// CHECK-NEXT: ContinueStmt + +// CHECK: ForStmt // CHECK-NEXT: DeclStmt // CHECK-NEXT: VarDecl // CHECK-NEXT: IntegerLiteral ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D50932: [ASTImporter] Add test for C++ casts and fix broken const_cast importing.
teemperor updated this revision to Diff 161496. teemperor added a comment. - Added comment why we enable RTTI. https://reviews.llvm.org/D50932 Files: lib/AST/ASTImporter.cpp test/Import/cxx-casts/Inputs/F.cpp test/Import/cxx-casts/test.cpp tools/clang-import-test/clang-import-test.cpp Index: tools/clang-import-test/clang-import-test.cpp === --- tools/clang-import-test/clang-import-test.cpp +++ tools/clang-import-test/clang-import-test.cpp @@ -194,6 +194,8 @@ Inv->getLangOpts()->ThreadsafeStatics = false; Inv->getLangOpts()->AccessControl = false; Inv->getLangOpts()->DollarIdents = true; + // Needed for testing dynamic_cast. + Inv->getLangOpts()->RTTI = true; Inv->getCodeGenOpts().setDebugInfo(codegenoptions::FullDebugInfo); Inv->getTargetOpts().Triple = llvm::sys::getDefaultTargetTriple(); Index: test/Import/cxx-casts/test.cpp === --- /dev/null +++ test/Import/cxx-casts/test.cpp @@ -0,0 +1,21 @@ +// RUN: clang-import-test -dump-ast -import %S/Inputs/F.cpp -expression %s | FileCheck %s + +// CHECK: CXXDynamicCastExpr +// CHECK-SAME: dynamic_cast +// CHECK-SAME: + +// CHECK: CXXStaticCastExpr +// CHECK-SAME: static_cast +// CHECK-SAME: + +// CHECK: CXXReinterpretCastExpr +// CHECK-SAME: reinterpret_cast +// CHECK-SAME: + +// CHECK: CXXConstCastExpr +// CHECK-SAME: const_cast +// CHECK-SAME: + +void expr() { + f(); +} Index: test/Import/cxx-casts/Inputs/F.cpp === --- /dev/null +++ test/Import/cxx-casts/Inputs/F.cpp @@ -0,0 +1,12 @@ +struct A { + virtual ~A() {} +}; +struct B : public A {}; + +void f() { + const A *b = new B(); + const B *c1 = dynamic_cast(b); + const B *c2 = static_cast(b); + const B *c3 = reinterpret_cast(b); + A *c4 = const_cast(b); +} Index: lib/AST/ASTImporter.cpp === --- lib/AST/ASTImporter.cpp +++ lib/AST/ASTImporter.cpp @@ -6897,6 +6897,10 @@ return CXXReinterpretCastExpr::Create( Importer.getToContext(), ToType, VK, CK, ToOp, &BasePath, ToWritten, ToOperatorLoc, ToRParenLoc, ToAngleBrackets); + } else if (isa(E)) { +return CXXConstCastExpr::Create(Importer.getToContext(), ToType, VK, ToOp, +ToWritten, ToOperatorLoc, ToRParenLoc, +ToAngleBrackets); } else { return nullptr; } Index: tools/clang-import-test/clang-import-test.cpp === --- tools/clang-import-test/clang-import-test.cpp +++ tools/clang-import-test/clang-import-test.cpp @@ -194,6 +194,8 @@ Inv->getLangOpts()->ThreadsafeStatics = false; Inv->getLangOpts()->AccessControl = false; Inv->getLangOpts()->DollarIdents = true; + // Needed for testing dynamic_cast. + Inv->getLangOpts()->RTTI = true; Inv->getCodeGenOpts().setDebugInfo(codegenoptions::FullDebugInfo); Inv->getTargetOpts().Triple = llvm::sys::getDefaultTargetTriple(); Index: test/Import/cxx-casts/test.cpp === --- /dev/null +++ test/Import/cxx-casts/test.cpp @@ -0,0 +1,21 @@ +// RUN: clang-import-test -dump-ast -import %S/Inputs/F.cpp -expression %s | FileCheck %s + +// CHECK: CXXDynamicCastExpr +// CHECK-SAME: dynamic_cast +// CHECK-SAME: + +// CHECK: CXXStaticCastExpr +// CHECK-SAME: static_cast +// CHECK-SAME: + +// CHECK: CXXReinterpretCastExpr +// CHECK-SAME: reinterpret_cast +// CHECK-SAME: + +// CHECK: CXXConstCastExpr +// CHECK-SAME: const_cast +// CHECK-SAME: + +void expr() { + f(); +} Index: test/Import/cxx-casts/Inputs/F.cpp === --- /dev/null +++ test/Import/cxx-casts/Inputs/F.cpp @@ -0,0 +1,12 @@ +struct A { + virtual ~A() {} +}; +struct B : public A {}; + +void f() { + const A *b = new B(); + const B *c1 = dynamic_cast(b); + const B *c2 = static_cast(b); + const B *c3 = reinterpret_cast(b); + A *c4 = const_cast(b); +} Index: lib/AST/ASTImporter.cpp === --- lib/AST/ASTImporter.cpp +++ lib/AST/ASTImporter.cpp @@ -6897,6 +6897,10 @@ return CXXReinterpretCastExpr::Create( Importer.getToContext(), ToType, VK, CK, ToOp, &BasePath, ToWritten, ToOperatorLoc, ToRParenLoc, ToAngleBrackets); + } else if (isa(E)) { +return CXXConstCastExpr::Create(Importer.getToContext(), ToType, VK, ToOp, +ToWritten, ToOperatorLoc, ToRParenLoc, +ToAngleBrackets); } else { return nullptr; } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D50932: [ASTImporter] Add test for C++ casts and fix broken const_cast importing.
This revision was automatically updated to reflect the committed changes. Closed by commit rL340182: [ASTImporter] Add test for C++ casts and fix broken const_cast importing. (authored by teemperor, committed by ). Herald added a subscriber: llvm-commits. Changed prior to commit: https://reviews.llvm.org/D50932?vs=161496&id=161498#toc Repository: rL LLVM https://reviews.llvm.org/D50932 Files: cfe/trunk/lib/AST/ASTImporter.cpp cfe/trunk/test/Import/cxx-casts/Inputs/F.cpp cfe/trunk/test/Import/cxx-casts/test.cpp cfe/trunk/tools/clang-import-test/clang-import-test.cpp Index: cfe/trunk/lib/AST/ASTImporter.cpp === --- cfe/trunk/lib/AST/ASTImporter.cpp +++ cfe/trunk/lib/AST/ASTImporter.cpp @@ -6897,6 +6897,10 @@ return CXXReinterpretCastExpr::Create( Importer.getToContext(), ToType, VK, CK, ToOp, &BasePath, ToWritten, ToOperatorLoc, ToRParenLoc, ToAngleBrackets); + } else if (isa(E)) { +return CXXConstCastExpr::Create(Importer.getToContext(), ToType, VK, ToOp, +ToWritten, ToOperatorLoc, ToRParenLoc, +ToAngleBrackets); } else { return nullptr; } Index: cfe/trunk/tools/clang-import-test/clang-import-test.cpp === --- cfe/trunk/tools/clang-import-test/clang-import-test.cpp +++ cfe/trunk/tools/clang-import-test/clang-import-test.cpp @@ -194,6 +194,8 @@ Inv->getLangOpts()->ThreadsafeStatics = false; Inv->getLangOpts()->AccessControl = false; Inv->getLangOpts()->DollarIdents = true; + // Needed for testing dynamic_cast. + Inv->getLangOpts()->RTTI = true; Inv->getCodeGenOpts().setDebugInfo(codegenoptions::FullDebugInfo); Inv->getTargetOpts().Triple = llvm::sys::getDefaultTargetTriple(); Index: cfe/trunk/test/Import/cxx-casts/Inputs/F.cpp === --- cfe/trunk/test/Import/cxx-casts/Inputs/F.cpp +++ cfe/trunk/test/Import/cxx-casts/Inputs/F.cpp @@ -0,0 +1,12 @@ +struct A { + virtual ~A() {} +}; +struct B : public A {}; + +void f() { + const A *b = new B(); + const B *c1 = dynamic_cast(b); + const B *c2 = static_cast(b); + const B *c3 = reinterpret_cast(b); + A *c4 = const_cast(b); +} Index: cfe/trunk/test/Import/cxx-casts/test.cpp === --- cfe/trunk/test/Import/cxx-casts/test.cpp +++ cfe/trunk/test/Import/cxx-casts/test.cpp @@ -0,0 +1,21 @@ +// RUN: clang-import-test -dump-ast -import %S/Inputs/F.cpp -expression %s | FileCheck %s + +// CHECK: CXXDynamicCastExpr +// CHECK-SAME: dynamic_cast +// CHECK-SAME: + +// CHECK: CXXStaticCastExpr +// CHECK-SAME: static_cast +// CHECK-SAME: + +// CHECK: CXXReinterpretCastExpr +// CHECK-SAME: reinterpret_cast +// CHECK-SAME: + +// CHECK: CXXConstCastExpr +// CHECK-SAME: const_cast +// CHECK-SAME: + +void expr() { + f(); +} Index: cfe/trunk/lib/AST/ASTImporter.cpp === --- cfe/trunk/lib/AST/ASTImporter.cpp +++ cfe/trunk/lib/AST/ASTImporter.cpp @@ -6897,6 +6897,10 @@ return CXXReinterpretCastExpr::Create( Importer.getToContext(), ToType, VK, CK, ToOp, &BasePath, ToWritten, ToOperatorLoc, ToRParenLoc, ToAngleBrackets); + } else if (isa(E)) { +return CXXConstCastExpr::Create(Importer.getToContext(), ToType, VK, ToOp, +ToWritten, ToOperatorLoc, ToRParenLoc, +ToAngleBrackets); } else { return nullptr; } Index: cfe/trunk/tools/clang-import-test/clang-import-test.cpp === --- cfe/trunk/tools/clang-import-test/clang-import-test.cpp +++ cfe/trunk/tools/clang-import-test/clang-import-test.cpp @@ -194,6 +194,8 @@ Inv->getLangOpts()->ThreadsafeStatics = false; Inv->getLangOpts()->AccessControl = false; Inv->getLangOpts()->DollarIdents = true; + // Needed for testing dynamic_cast. + Inv->getLangOpts()->RTTI = true; Inv->getCodeGenOpts().setDebugInfo(codegenoptions::FullDebugInfo); Inv->getTargetOpts().Triple = llvm::sys::getDefaultTargetTriple(); Index: cfe/trunk/test/Import/cxx-casts/Inputs/F.cpp === --- cfe/trunk/test/Import/cxx-casts/Inputs/F.cpp +++ cfe/trunk/test/Import/cxx-casts/Inputs/F.cpp @@ -0,0 +1,12 @@ +struct A { + virtual ~A() {} +}; +struct B : public A {}; + +void f() { + const A *b = new B(); + const B *c1 = dynamic_cast(b); + const B *c2 = static_cast(b); + const B *c3 = reinterpret_cast(b); + A *c4 = const_cast(b); +} Index: cfe/trunk/test/Import/cxx-casts/test.cpp === --- cfe/trunk/test/Import/cxx-casts/test.cpp +++ cfe/trunk/test/Import/cxx-casts/test.cpp @@ -0,0 +1,21 @@ +// RUN: clang-imp
[PATCH] D50978: [ASTImporter] Add test for C++'s try/catch statements.
teemperor created this revision. Herald added subscribers: cfe-commits, martong. Herald added a reviewer: a.sidorin. Also enable exceptions in clang-import-test so that we can parse the test files. Repository: rC Clang https://reviews.llvm.org/D50978 Files: test/Import/cxx-try-catch/Inputs/F.cpp test/Import/cxx-try-catch/test.cpp tools/clang-import-test/clang-import-test.cpp Index: tools/clang-import-test/clang-import-test.cpp === --- tools/clang-import-test/clang-import-test.cpp +++ tools/clang-import-test/clang-import-test.cpp @@ -196,6 +196,8 @@ Inv->getLangOpts()->DollarIdents = true; // Needed for testing dynamic_cast. Inv->getLangOpts()->RTTI = true; + Inv->getLangOpts()->Exceptions = true; + Inv->getLangOpts()->CXXExceptions = true; Inv->getCodeGenOpts().setDebugInfo(codegenoptions::FullDebugInfo); Inv->getTargetOpts().Triple = llvm::sys::getDefaultTargetTriple(); Index: test/Import/cxx-try-catch/test.cpp === --- /dev/null +++ test/Import/cxx-try-catch/test.cpp @@ -0,0 +1,39 @@ +// RUN: clang-import-test -dump-ast -import %S/Inputs/F.cpp -expression %s | FileCheck %s + +// CHECK: CXXTryStmt +// CHECK-NEXT: CompoundStmt +// CHECK-NEXT: CXXCatchStmt +// CHECK-NEXT: <> +// CHECK-NEXT: CompoundStmt + +// CHECK: CXXTryStmt +// CHECK-NEXT: CompoundStmt +// CHECK-NEXT: CXXCatchStmt +// CHECK-NEXT: VarDecl +// CHECK-SAME: 'int' +// CHECK-NEXT: CompoundStmt + +// CHECK: CXXTryStmt +// CHECK-NEXT: CompoundStmt +// CHECK-NEXT: CXXCatchStmt +// CHECK-NEXT: VarDecl +// CHECK-SAME: varname +// CHECK-SAME: 'int' +// CHECK-NEXT: CompoundStmt + +// CHECK: CXXTryStmt +// CHECK-NEXT: CompoundStmt +// CHECK-NEXT: CXXCatchStmt +// CHECK-NEXT: VarDecl +// CHECK-SAME: varname1 +// CHECK-SAME: 'int' +// CHECK-NEXT: CompoundStmt +// CHECK-NEXT: CXXCatchStmt +// CHECK-NEXT: VarDecl +// CHECK-SAME: varname2 +// CHECK-SAME: 'long' +// CHECK-NEXT: CompoundStmt + +void expr() { + f(); +} Index: test/Import/cxx-try-catch/Inputs/F.cpp === --- /dev/null +++ test/Import/cxx-try-catch/Inputs/F.cpp @@ -0,0 +1,18 @@ +void f() { + try { + } catch (...) { + } + + try { + } catch (int) { + } + + try { + } catch (int varname) { + } + + try { + } catch (int varname1) { + } catch (long varname2) { + } +} Index: tools/clang-import-test/clang-import-test.cpp === --- tools/clang-import-test/clang-import-test.cpp +++ tools/clang-import-test/clang-import-test.cpp @@ -196,6 +196,8 @@ Inv->getLangOpts()->DollarIdents = true; // Needed for testing dynamic_cast. Inv->getLangOpts()->RTTI = true; + Inv->getLangOpts()->Exceptions = true; + Inv->getLangOpts()->CXXExceptions = true; Inv->getCodeGenOpts().setDebugInfo(codegenoptions::FullDebugInfo); Inv->getTargetOpts().Triple = llvm::sys::getDefaultTargetTriple(); Index: test/Import/cxx-try-catch/test.cpp === --- /dev/null +++ test/Import/cxx-try-catch/test.cpp @@ -0,0 +1,39 @@ +// RUN: clang-import-test -dump-ast -import %S/Inputs/F.cpp -expression %s | FileCheck %s + +// CHECK: CXXTryStmt +// CHECK-NEXT: CompoundStmt +// CHECK-NEXT: CXXCatchStmt +// CHECK-NEXT: <> +// CHECK-NEXT: CompoundStmt + +// CHECK: CXXTryStmt +// CHECK-NEXT: CompoundStmt +// CHECK-NEXT: CXXCatchStmt +// CHECK-NEXT: VarDecl +// CHECK-SAME: 'int' +// CHECK-NEXT: CompoundStmt + +// CHECK: CXXTryStmt +// CHECK-NEXT: CompoundStmt +// CHECK-NEXT: CXXCatchStmt +// CHECK-NEXT: VarDecl +// CHECK-SAME: varname +// CHECK-SAME: 'int' +// CHECK-NEXT: CompoundStmt + +// CHECK: CXXTryStmt +// CHECK-NEXT: CompoundStmt +// CHECK-NEXT: CXXCatchStmt +// CHECK-NEXT: VarDecl +// CHECK-SAME: varname1 +// CHECK-SAME: 'int' +// CHECK-NEXT: CompoundStmt +// CHECK-NEXT: CXXCatchStmt +// CHECK-NEXT: VarDecl +// CHECK-SAME: varname2 +// CHECK-SAME: 'long' +// CHECK-NEXT: CompoundStmt + +void expr() { + f(); +} Index: test/Import/cxx-try-catch/Inputs/F.cpp === --- /dev/null +++ test/Import/cxx-try-catch/Inputs/F.cpp @@ -0,0 +1,18 @@ +void f() { + try { + } catch (...) { + } + + try { + } catch (int) { + } + + try { + } catch (int varname) { + } + + try { + } catch (int varname1) { + } catch (long varname2) { + } +} ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D51001: [ASTImporter] Add test for CXXForRangeStmt
teemperor created this revision. Herald added subscribers: cfe-commits, martong. Herald added a reviewer: a.sidorin. Repository: rC Clang https://reviews.llvm.org/D51001 Files: test/Import/cxx-for-range/Inputs/F.cpp test/Import/cxx-for-range/test.cpp Index: test/Import/cxx-for-range/test.cpp === --- /dev/null +++ test/Import/cxx-for-range/test.cpp @@ -0,0 +1,53 @@ +// RUN: clang-import-test -dump-ast -import %S/Inputs/F.cpp -expression %s | FileCheck %s + +// CHECK: CXXForRangeStmt + +// CHECK-NEXT: DeclStmt +// CHECK-NEXT: VarDecl +// CHECK-NEXT: DeclRefExpr +// CHECK-SAME: 'c' +// CHECK-SAME: Container + +// CHECK-NEXT: DeclStmt +// CHECK-NEXT: VarDecl +// CHECK-NEXT: CXXMemberCallExpr +// CHECK-SAME: 'int *' +// CHECK-NEXT: MemberExpr +// CHECK-SAME: .begin +// CHECK-NEXT: DeclRefExpr +// CHECK-SAME: '__range1' +// CHECK-SAME: Container + +// CHECK-NEXT: DeclStmt +// CHECK-NEXT: VarDecl +// CHECK-NEXT: CXXMemberCallExpr +// CHECK-SAME: 'int *' +// CHECK-NEXT: MemberExpr +// CHECK-SAME: .end +// CHECK-NEXT: DeclRefExpr +// CHECK-SAME: '__range1' +// CHECK-SAME: Container + +// CHECK-NEXT: BinaryOperator +// CHECK-SAME: '!=' +// CHECK-NEXT: ImplicitCastExpr +// CHECK-NEXT: DeclRefExpr +// CHECK-SAME: '__begin1' +// CHECK-NEXT: ImplicitCastExpr +// CHECK-NEXT: DeclRefExpr +// CHECK-SAME: '__end1' + +// CHECK-NEXT: UnaryOperator +// CHECK-SAME: '++' +// CHECK-NEXT: DeclRefExpr +// CHECK-SAME: '__begin1' + +// CHECK-NEXT: DeclStmt +// CHECK-NEXT: VarDecl +// CHECK-SAME: varname + +// CHECK: ReturnStmt + +void expr() { + f(); +} Index: test/Import/cxx-for-range/Inputs/F.cpp === --- /dev/null +++ test/Import/cxx-for-range/Inputs/F.cpp @@ -0,0 +1,11 @@ +struct Container { + int *begin(); + int *end(); +}; + +void f() { + Container c; + for (int varname : c) { +return; + } +} Index: test/Import/cxx-for-range/test.cpp === --- /dev/null +++ test/Import/cxx-for-range/test.cpp @@ -0,0 +1,53 @@ +// RUN: clang-import-test -dump-ast -import %S/Inputs/F.cpp -expression %s | FileCheck %s + +// CHECK: CXXForRangeStmt + +// CHECK-NEXT: DeclStmt +// CHECK-NEXT: VarDecl +// CHECK-NEXT: DeclRefExpr +// CHECK-SAME: 'c' +// CHECK-SAME: Container + +// CHECK-NEXT: DeclStmt +// CHECK-NEXT: VarDecl +// CHECK-NEXT: CXXMemberCallExpr +// CHECK-SAME: 'int *' +// CHECK-NEXT: MemberExpr +// CHECK-SAME: .begin +// CHECK-NEXT: DeclRefExpr +// CHECK-SAME: '__range1' +// CHECK-SAME: Container + +// CHECK-NEXT: DeclStmt +// CHECK-NEXT: VarDecl +// CHECK-NEXT: CXXMemberCallExpr +// CHECK-SAME: 'int *' +// CHECK-NEXT: MemberExpr +// CHECK-SAME: .end +// CHECK-NEXT: DeclRefExpr +// CHECK-SAME: '__range1' +// CHECK-SAME: Container + +// CHECK-NEXT: BinaryOperator +// CHECK-SAME: '!=' +// CHECK-NEXT: ImplicitCastExpr +// CHECK-NEXT: DeclRefExpr +// CHECK-SAME: '__begin1' +// CHECK-NEXT: ImplicitCastExpr +// CHECK-NEXT: DeclRefExpr +// CHECK-SAME: '__end1' + +// CHECK-NEXT: UnaryOperator +// CHECK-SAME: '++' +// CHECK-NEXT: DeclRefExpr +// CHECK-SAME: '__begin1' + +// CHECK-NEXT: DeclStmt +// CHECK-NEXT: VarDecl +// CHECK-SAME: varname + +// CHECK: ReturnStmt + +void expr() { + f(); +} Index: test/Import/cxx-for-range/Inputs/F.cpp === --- /dev/null +++ test/Import/cxx-for-range/Inputs/F.cpp @@ -0,0 +1,11 @@ +struct Container { + int *begin(); + int *end(); +}; + +void f() { + Container c; + for (int varname : c) { +return; + } +} ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D50978: [ASTImporter] Add test for C++'s try/catch statements.
teemperor updated this revision to Diff 161580. teemperor added a comment. - Clarified that the Exception options in LangOpts are not related to the dynamic_cast support by moving them above the comment (Thanks Aleksei!) https://reviews.llvm.org/D50978 Files: test/Import/cxx-try-catch/Inputs/F.cpp test/Import/cxx-try-catch/test.cpp tools/clang-import-test/clang-import-test.cpp Index: tools/clang-import-test/clang-import-test.cpp === --- tools/clang-import-test/clang-import-test.cpp +++ tools/clang-import-test/clang-import-test.cpp @@ -194,6 +194,8 @@ Inv->getLangOpts()->ThreadsafeStatics = false; Inv->getLangOpts()->AccessControl = false; Inv->getLangOpts()->DollarIdents = true; + Inv->getLangOpts()->Exceptions = true; + Inv->getLangOpts()->CXXExceptions = true; // Needed for testing dynamic_cast. Inv->getLangOpts()->RTTI = true; Inv->getCodeGenOpts().setDebugInfo(codegenoptions::FullDebugInfo); Index: test/Import/cxx-try-catch/test.cpp === --- /dev/null +++ test/Import/cxx-try-catch/test.cpp @@ -0,0 +1,39 @@ +// RUN: clang-import-test -dump-ast -import %S/Inputs/F.cpp -expression %s | FileCheck %s + +// CHECK: CXXTryStmt +// CHECK-NEXT: CompoundStmt +// CHECK-NEXT: CXXCatchStmt +// CHECK-NEXT: <> +// CHECK-NEXT: CompoundStmt + +// CHECK: CXXTryStmt +// CHECK-NEXT: CompoundStmt +// CHECK-NEXT: CXXCatchStmt +// CHECK-NEXT: VarDecl +// CHECK-SAME: 'int' +// CHECK-NEXT: CompoundStmt + +// CHECK: CXXTryStmt +// CHECK-NEXT: CompoundStmt +// CHECK-NEXT: CXXCatchStmt +// CHECK-NEXT: VarDecl +// CHECK-SAME: varname +// CHECK-SAME: 'int' +// CHECK-NEXT: CompoundStmt + +// CHECK: CXXTryStmt +// CHECK-NEXT: CompoundStmt +// CHECK-NEXT: CXXCatchStmt +// CHECK-NEXT: VarDecl +// CHECK-SAME: varname1 +// CHECK-SAME: 'int' +// CHECK-NEXT: CompoundStmt +// CHECK-NEXT: CXXCatchStmt +// CHECK-NEXT: VarDecl +// CHECK-SAME: varname2 +// CHECK-SAME: 'long' +// CHECK-NEXT: CompoundStmt + +void expr() { + f(); +} Index: test/Import/cxx-try-catch/Inputs/F.cpp === --- /dev/null +++ test/Import/cxx-try-catch/Inputs/F.cpp @@ -0,0 +1,18 @@ +void f() { + try { + } catch (...) { + } + + try { + } catch (int) { + } + + try { + } catch (int varname) { + } + + try { + } catch (int varname1) { + } catch (long varname2) { + } +} Index: tools/clang-import-test/clang-import-test.cpp === --- tools/clang-import-test/clang-import-test.cpp +++ tools/clang-import-test/clang-import-test.cpp @@ -194,6 +194,8 @@ Inv->getLangOpts()->ThreadsafeStatics = false; Inv->getLangOpts()->AccessControl = false; Inv->getLangOpts()->DollarIdents = true; + Inv->getLangOpts()->Exceptions = true; + Inv->getLangOpts()->CXXExceptions = true; // Needed for testing dynamic_cast. Inv->getLangOpts()->RTTI = true; Inv->getCodeGenOpts().setDebugInfo(codegenoptions::FullDebugInfo); Index: test/Import/cxx-try-catch/test.cpp === --- /dev/null +++ test/Import/cxx-try-catch/test.cpp @@ -0,0 +1,39 @@ +// RUN: clang-import-test -dump-ast -import %S/Inputs/F.cpp -expression %s | FileCheck %s + +// CHECK: CXXTryStmt +// CHECK-NEXT: CompoundStmt +// CHECK-NEXT: CXXCatchStmt +// CHECK-NEXT: <> +// CHECK-NEXT: CompoundStmt + +// CHECK: CXXTryStmt +// CHECK-NEXT: CompoundStmt +// CHECK-NEXT: CXXCatchStmt +// CHECK-NEXT: VarDecl +// CHECK-SAME: 'int' +// CHECK-NEXT: CompoundStmt + +// CHECK: CXXTryStmt +// CHECK-NEXT: CompoundStmt +// CHECK-NEXT: CXXCatchStmt +// CHECK-NEXT: VarDecl +// CHECK-SAME: varname +// CHECK-SAME: 'int' +// CHECK-NEXT: CompoundStmt + +// CHECK: CXXTryStmt +// CHECK-NEXT: CompoundStmt +// CHECK-NEXT: CXXCatchStmt +// CHECK-NEXT: VarDecl +// CHECK-SAME: varname1 +// CHECK-SAME: 'int' +// CHECK-NEXT: CompoundStmt +// CHECK-NEXT: CXXCatchStmt +// CHECK-NEXT: VarDecl +// CHECK-SAME: varname2 +// CHECK-SAME: 'long' +// CHECK-NEXT: CompoundStmt + +void expr() { + f(); +} Index: test/Import/cxx-try-catch/Inputs/F.cpp === --- /dev/null +++ test/Import/cxx-try-catch/Inputs/F.cpp @@ -0,0 +1,18 @@ +void f() { + try { + } catch (...) { + } + + try { + } catch (int) { + } + + try { + } catch (int varname) { + } + + try { + } catch (int varname1) { + } catch (long varname2) { + } +} ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D50978: [ASTImporter] Add test for C++'s try/catch statements.
This revision was automatically updated to reflect the committed changes. Closed by commit rC340220: [ASTImporter] Add test for C++'s try/catch statements. (authored by teemperor, committed by ). Repository: rC Clang https://reviews.llvm.org/D50978 Files: test/Import/cxx-try-catch/Inputs/F.cpp test/Import/cxx-try-catch/test.cpp tools/clang-import-test/clang-import-test.cpp Index: tools/clang-import-test/clang-import-test.cpp === --- tools/clang-import-test/clang-import-test.cpp +++ tools/clang-import-test/clang-import-test.cpp @@ -194,6 +194,8 @@ Inv->getLangOpts()->ThreadsafeStatics = false; Inv->getLangOpts()->AccessControl = false; Inv->getLangOpts()->DollarIdents = true; + Inv->getLangOpts()->Exceptions = true; + Inv->getLangOpts()->CXXExceptions = true; // Needed for testing dynamic_cast. Inv->getLangOpts()->RTTI = true; Inv->getCodeGenOpts().setDebugInfo(codegenoptions::FullDebugInfo); Index: test/Import/cxx-try-catch/Inputs/F.cpp === --- test/Import/cxx-try-catch/Inputs/F.cpp +++ test/Import/cxx-try-catch/Inputs/F.cpp @@ -0,0 +1,18 @@ +void f() { + try { + } catch (...) { + } + + try { + } catch (int) { + } + + try { + } catch (int varname) { + } + + try { + } catch (int varname1) { + } catch (long varname2) { + } +} Index: test/Import/cxx-try-catch/test.cpp === --- test/Import/cxx-try-catch/test.cpp +++ test/Import/cxx-try-catch/test.cpp @@ -0,0 +1,39 @@ +// RUN: clang-import-test -dump-ast -import %S/Inputs/F.cpp -expression %s | FileCheck %s + +// CHECK: CXXTryStmt +// CHECK-NEXT: CompoundStmt +// CHECK-NEXT: CXXCatchStmt +// CHECK-NEXT: <> +// CHECK-NEXT: CompoundStmt + +// CHECK: CXXTryStmt +// CHECK-NEXT: CompoundStmt +// CHECK-NEXT: CXXCatchStmt +// CHECK-NEXT: VarDecl +// CHECK-SAME: 'int' +// CHECK-NEXT: CompoundStmt + +// CHECK: CXXTryStmt +// CHECK-NEXT: CompoundStmt +// CHECK-NEXT: CXXCatchStmt +// CHECK-NEXT: VarDecl +// CHECK-SAME: varname +// CHECK-SAME: 'int' +// CHECK-NEXT: CompoundStmt + +// CHECK: CXXTryStmt +// CHECK-NEXT: CompoundStmt +// CHECK-NEXT: CXXCatchStmt +// CHECK-NEXT: VarDecl +// CHECK-SAME: varname1 +// CHECK-SAME: 'int' +// CHECK-NEXT: CompoundStmt +// CHECK-NEXT: CXXCatchStmt +// CHECK-NEXT: VarDecl +// CHECK-SAME: varname2 +// CHECK-SAME: 'long' +// CHECK-NEXT: CompoundStmt + +void expr() { + f(); +} Index: tools/clang-import-test/clang-import-test.cpp === --- tools/clang-import-test/clang-import-test.cpp +++ tools/clang-import-test/clang-import-test.cpp @@ -194,6 +194,8 @@ Inv->getLangOpts()->ThreadsafeStatics = false; Inv->getLangOpts()->AccessControl = false; Inv->getLangOpts()->DollarIdents = true; + Inv->getLangOpts()->Exceptions = true; + Inv->getLangOpts()->CXXExceptions = true; // Needed for testing dynamic_cast. Inv->getLangOpts()->RTTI = true; Inv->getCodeGenOpts().setDebugInfo(codegenoptions::FullDebugInfo); Index: test/Import/cxx-try-catch/Inputs/F.cpp === --- test/Import/cxx-try-catch/Inputs/F.cpp +++ test/Import/cxx-try-catch/Inputs/F.cpp @@ -0,0 +1,18 @@ +void f() { + try { + } catch (...) { + } + + try { + } catch (int) { + } + + try { + } catch (int varname) { + } + + try { + } catch (int varname1) { + } catch (long varname2) { + } +} Index: test/Import/cxx-try-catch/test.cpp === --- test/Import/cxx-try-catch/test.cpp +++ test/Import/cxx-try-catch/test.cpp @@ -0,0 +1,39 @@ +// RUN: clang-import-test -dump-ast -import %S/Inputs/F.cpp -expression %s | FileCheck %s + +// CHECK: CXXTryStmt +// CHECK-NEXT: CompoundStmt +// CHECK-NEXT: CXXCatchStmt +// CHECK-NEXT: <> +// CHECK-NEXT: CompoundStmt + +// CHECK: CXXTryStmt +// CHECK-NEXT: CompoundStmt +// CHECK-NEXT: CXXCatchStmt +// CHECK-NEXT: VarDecl +// CHECK-SAME: 'int' +// CHECK-NEXT: CompoundStmt + +// CHECK: CXXTryStmt +// CHECK-NEXT: CompoundStmt +// CHECK-NEXT: CXXCatchStmt +// CHECK-NEXT: VarDecl +// CHECK-SAME: varname +// CHECK-SAME: 'int' +// CHECK-NEXT: CompoundStmt + +// CHECK: CXXTryStmt +// CHECK-NEXT: CompoundStmt +// CHECK-NEXT: CXXCatchStmt +// CHECK-NEXT: VarDecl +// CHECK-SAME: varname1 +// CHECK-SAME: 'int' +// CHECK-NEXT: CompoundStmt +// CHECK-NEXT: CXXCatchStmt +// CHECK-NEXT: VarDecl +// CHECK-SAME: varname2 +// CHECK-SAME: 'long' +// CHECK-NEXT: CompoundStmt + +void expr() { + f(); +} ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D51001: [ASTImporter] Add test for CXXForRangeStmt
This revision was automatically updated to reflect the committed changes. Closed by commit rC340297: [ASTImporter] Add test for CXXForRangeStmt (authored by teemperor, committed by ). Repository: rC Clang https://reviews.llvm.org/D51001 Files: test/Import/cxx-for-range/Inputs/F.cpp test/Import/cxx-for-range/test.cpp Index: test/Import/cxx-for-range/Inputs/F.cpp === --- test/Import/cxx-for-range/Inputs/F.cpp +++ test/Import/cxx-for-range/Inputs/F.cpp @@ -0,0 +1,11 @@ +struct Container { + int *begin(); + int *end(); +}; + +void f() { + Container c; + for (int varname : c) { +return; + } +} Index: test/Import/cxx-for-range/test.cpp === --- test/Import/cxx-for-range/test.cpp +++ test/Import/cxx-for-range/test.cpp @@ -0,0 +1,53 @@ +// RUN: clang-import-test -dump-ast -import %S/Inputs/F.cpp -expression %s | FileCheck %s + +// CHECK: CXXForRangeStmt + +// CHECK-NEXT: DeclStmt +// CHECK-NEXT: VarDecl +// CHECK-NEXT: DeclRefExpr +// CHECK-SAME: 'c' +// CHECK-SAME: Container + +// CHECK-NEXT: DeclStmt +// CHECK-NEXT: VarDecl +// CHECK-NEXT: CXXMemberCallExpr +// CHECK-SAME: 'int *' +// CHECK-NEXT: MemberExpr +// CHECK-SAME: .begin +// CHECK-NEXT: DeclRefExpr +// CHECK-SAME: '__range1' +// CHECK-SAME: Container + +// CHECK-NEXT: DeclStmt +// CHECK-NEXT: VarDecl +// CHECK-NEXT: CXXMemberCallExpr +// CHECK-SAME: 'int *' +// CHECK-NEXT: MemberExpr +// CHECK-SAME: .end +// CHECK-NEXT: DeclRefExpr +// CHECK-SAME: '__range1' +// CHECK-SAME: Container + +// CHECK-NEXT: BinaryOperator +// CHECK-SAME: '!=' +// CHECK-NEXT: ImplicitCastExpr +// CHECK-NEXT: DeclRefExpr +// CHECK-SAME: '__begin1' +// CHECK-NEXT: ImplicitCastExpr +// CHECK-NEXT: DeclRefExpr +// CHECK-SAME: '__end1' + +// CHECK-NEXT: UnaryOperator +// CHECK-SAME: '++' +// CHECK-NEXT: DeclRefExpr +// CHECK-SAME: '__begin1' + +// CHECK-NEXT: DeclStmt +// CHECK-NEXT: VarDecl +// CHECK-SAME: varname + +// CHECK: ReturnStmt + +void expr() { + f(); +} Index: test/Import/cxx-for-range/Inputs/F.cpp === --- test/Import/cxx-for-range/Inputs/F.cpp +++ test/Import/cxx-for-range/Inputs/F.cpp @@ -0,0 +1,11 @@ +struct Container { + int *begin(); + int *end(); +}; + +void f() { + Container c; + for (int varname : c) { +return; + } +} Index: test/Import/cxx-for-range/test.cpp === --- test/Import/cxx-for-range/test.cpp +++ test/Import/cxx-for-range/test.cpp @@ -0,0 +1,53 @@ +// RUN: clang-import-test -dump-ast -import %S/Inputs/F.cpp -expression %s | FileCheck %s + +// CHECK: CXXForRangeStmt + +// CHECK-NEXT: DeclStmt +// CHECK-NEXT: VarDecl +// CHECK-NEXT: DeclRefExpr +// CHECK-SAME: 'c' +// CHECK-SAME: Container + +// CHECK-NEXT: DeclStmt +// CHECK-NEXT: VarDecl +// CHECK-NEXT: CXXMemberCallExpr +// CHECK-SAME: 'int *' +// CHECK-NEXT: MemberExpr +// CHECK-SAME: .begin +// CHECK-NEXT: DeclRefExpr +// CHECK-SAME: '__range1' +// CHECK-SAME: Container + +// CHECK-NEXT: DeclStmt +// CHECK-NEXT: VarDecl +// CHECK-NEXT: CXXMemberCallExpr +// CHECK-SAME: 'int *' +// CHECK-NEXT: MemberExpr +// CHECK-SAME: .end +// CHECK-NEXT: DeclRefExpr +// CHECK-SAME: '__range1' +// CHECK-SAME: Container + +// CHECK-NEXT: BinaryOperator +// CHECK-SAME: '!=' +// CHECK-NEXT: ImplicitCastExpr +// CHECK-NEXT: DeclRefExpr +// CHECK-SAME: '__begin1' +// CHECK-NEXT: ImplicitCastExpr +// CHECK-NEXT: DeclRefExpr +// CHECK-SAME: '__end1' + +// CHECK-NEXT: UnaryOperator +// CHECK-SAME: '++' +// CHECK-NEXT: DeclRefExpr +// CHECK-SAME: '__begin1' + +// CHECK-NEXT: DeclStmt +// CHECK-NEXT: VarDecl +// CHECK-SAME: varname + +// CHECK: ReturnStmt + +void expr() { + f(); +} ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D50737: [ASTImporter] Add test for CXXNoexceptExpr
teemperor added inline comments. Comment at: test/Import/cxx-noexcept-expr/test.cpp:1 +// RUN: clang-import-test -dump-ast -import %S/Inputs/F.cpp -expression %s | FileCheck %s + hiraditya wrote: > Can we add a line/comment to explain what this test does? Same for the input > files. Well all the 'Import/' tests just try importing the respective AST node type and run checks on the node after importing. But we probably should reorganize the `test/Import` folder in the future, so then we can better document that the tests in the respective 'node-types` folder or so are supposed to do just this kind of check. Repository: rC Clang https://reviews.llvm.org/D50737 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D50737: [ASTImporter] Add test for CXXNoexceptExpr
This revision was automatically updated to reflect the committed changes. Closed by commit rC340304: [ASTImporter] Add test for CXXNoexceptExpr (authored by teemperor, committed by ). Repository: rC Clang https://reviews.llvm.org/D50737 Files: test/Import/cxx-noexcept-expr/Inputs/F.cpp test/Import/cxx-noexcept-expr/test.cpp Index: test/Import/cxx-noexcept-expr/test.cpp === --- test/Import/cxx-noexcept-expr/test.cpp +++ test/Import/cxx-noexcept-expr/test.cpp @@ -0,0 +1,8 @@ +// RUN: clang-import-test -dump-ast -import %S/Inputs/F.cpp -expression %s | FileCheck %s + +// CHECK: CXXNoexceptExpr +// CHECK-NEXT: IntegerLiteral + +void expr() { + f(); +} Index: test/Import/cxx-noexcept-expr/Inputs/F.cpp === --- test/Import/cxx-noexcept-expr/Inputs/F.cpp +++ test/Import/cxx-noexcept-expr/Inputs/F.cpp @@ -0,0 +1 @@ +bool f() { return noexcept(1); } Index: test/Import/cxx-noexcept-expr/test.cpp === --- test/Import/cxx-noexcept-expr/test.cpp +++ test/Import/cxx-noexcept-expr/test.cpp @@ -0,0 +1,8 @@ +// RUN: clang-import-test -dump-ast -import %S/Inputs/F.cpp -expression %s | FileCheck %s + +// CHECK: CXXNoexceptExpr +// CHECK-NEXT: IntegerLiteral + +void expr() { + f(); +} Index: test/Import/cxx-noexcept-expr/Inputs/F.cpp === --- test/Import/cxx-noexcept-expr/Inputs/F.cpp +++ test/Import/cxx-noexcept-expr/Inputs/F.cpp @@ -0,0 +1 @@ +bool f() { return noexcept(1); } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D51056: [ASTImporter] Add test for SwitchStmt
teemperor created this revision. Herald added subscribers: cfe-commits, martong. Herald added a reviewer: a.sidorin. Repository: rC Clang https://reviews.llvm.org/D51056 Files: test/Import/switch-stmt/Inputs/F.cpp test/Import/switch-stmt/test.cpp Index: test/Import/switch-stmt/test.cpp === --- /dev/null +++ test/Import/switch-stmt/test.cpp @@ -0,0 +1,47 @@ +// RUN: clang-import-test -dump-ast -import %S/Inputs/F.cpp -expression %s | FileCheck %s + +// CHECK: SwitchStmt +// CHECK-NEXT: <> +// CHECK-NEXT: <> +// CHECK-NEXT: IntegerLiteral +// CHECK-NEXT: CompoundStmt +// CHECK-NEXT: CaseStmt +// CHECK-NEXT: IntegerLiteral +// CHECK-NEXT: <> +// CHECK-NEXT: CaseStmt +// CHECK-NEXT: IntegerLiteral +// CHECK-NEXT: <> +// CHECK-NEXT: BreakStmt + +// CHECK: SwitchStmt +// CHECK-NEXT: DeclStmt +// CHECK-NEXT: VarDecl +// CHECK-SAME: varname +// CHECK-NEXT: <> +// CHECK-NEXT: IntegerLiteral +// CHECK-NEXT: CompoundStmt +// CHECK-NEXT: CaseStmt +// CHECK-NEXT: IntegerLiteral +// CHECK-NEXT: <> +// CHECK-NEXT: BreakStmt +// CHECK-NEXT: CaseStmt +// CHECK-NEXT: IntegerLiteral +// CHECK-NEXT: <> +// CHECK-NEXT: BreakStmt + +// CHECK: SwitchStmt +// CHECK-NEXT: <> +// CHECK-NEXT: <> +// CHECK-NEXT: IntegerLiteral +// CHECK-NEXT: DefaultStmt +// CHECK-NEXT: BreakStmt + +// CHECK: SwitchStmt +// CHECK-NEXT: <> +// CHECK-NEXT: <> +// CHECK-NEXT: IntegerLiteral +// CHECK-NEXT: NullStmt + +void expr() { + f(); +} Index: test/Import/switch-stmt/Inputs/F.cpp === --- /dev/null +++ test/Import/switch-stmt/Inputs/F.cpp @@ -0,0 +1,18 @@ +void f() { + switch (1) { + case 1: + case 2: +break; + } + switch (int varname; 1) { + case 1: +break; + case 2: +break; + } + switch (1) + default: +break; + switch (0) +; +} Index: test/Import/switch-stmt/test.cpp === --- /dev/null +++ test/Import/switch-stmt/test.cpp @@ -0,0 +1,47 @@ +// RUN: clang-import-test -dump-ast -import %S/Inputs/F.cpp -expression %s | FileCheck %s + +// CHECK: SwitchStmt +// CHECK-NEXT: <> +// CHECK-NEXT: <> +// CHECK-NEXT: IntegerLiteral +// CHECK-NEXT: CompoundStmt +// CHECK-NEXT: CaseStmt +// CHECK-NEXT: IntegerLiteral +// CHECK-NEXT: <> +// CHECK-NEXT: CaseStmt +// CHECK-NEXT: IntegerLiteral +// CHECK-NEXT: <> +// CHECK-NEXT: BreakStmt + +// CHECK: SwitchStmt +// CHECK-NEXT: DeclStmt +// CHECK-NEXT: VarDecl +// CHECK-SAME: varname +// CHECK-NEXT: <> +// CHECK-NEXT: IntegerLiteral +// CHECK-NEXT: CompoundStmt +// CHECK-NEXT: CaseStmt +// CHECK-NEXT: IntegerLiteral +// CHECK-NEXT: <> +// CHECK-NEXT: BreakStmt +// CHECK-NEXT: CaseStmt +// CHECK-NEXT: IntegerLiteral +// CHECK-NEXT: <> +// CHECK-NEXT: BreakStmt + +// CHECK: SwitchStmt +// CHECK-NEXT: <> +// CHECK-NEXT: <> +// CHECK-NEXT: IntegerLiteral +// CHECK-NEXT: DefaultStmt +// CHECK-NEXT: BreakStmt + +// CHECK: SwitchStmt +// CHECK-NEXT: <> +// CHECK-NEXT: <> +// CHECK-NEXT: IntegerLiteral +// CHECK-NEXT: NullStmt + +void expr() { + f(); +} Index: test/Import/switch-stmt/Inputs/F.cpp === --- /dev/null +++ test/Import/switch-stmt/Inputs/F.cpp @@ -0,0 +1,18 @@ +void f() { + switch (1) { + case 1: + case 2: +break; + } + switch (int varname; 1) { + case 1: +break; + case 2: +break; + } + switch (1) + default: +break; + switch (0) +; +} ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D51110: [ASTImporter] Remove duplicated and dead CXXNamedCastExpr handling code.
teemperor added a comment. See http://lab.llvm.org:8080/coverage/coverage-reports/clang/coverage/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/tools/clang/lib/AST/ASTImporter.cpp.html#L6044 for the test coverage entry. Repository: rC Clang https://reviews.llvm.org/D51110 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D51110: [ASTImporter] Remove duplicated and dead CXXNamedCastExpr handling code.
teemperor created this revision. Herald added subscribers: cfe-commits, martong. Herald added a reviewer: a.sidorin. `CXXNamedCastExpr` importing is already handled in the respective `VisitCXXNamedCastExpr` method. So this code here can never be reached under normal circumstances and we might as well remove it. This patch shouldn't change any observable behavior of the ASTImporter. Repository: rC Clang https://reviews.llvm.org/D51110 Files: lib/AST/ASTImporter.cpp Index: lib/AST/ASTImporter.cpp === --- lib/AST/ASTImporter.cpp +++ lib/AST/ASTImporter.cpp @@ -6037,38 +6037,6 @@ E->getCastKind(), Importer.Import(OCE->getBridgeKeywordLoc()), TInfo, SubExpr); } - default: -break; // just fall through - } - - auto *Named = cast(E); - SourceLocation ExprLoc = Importer.Import(Named->getOperatorLoc()), - RParenLoc = Importer.Import(Named->getRParenLoc()); - SourceRange Brackets = Importer.Import(Named->getAngleBrackets()); - - switch (E->getStmtClass()) { - case Stmt::CXXStaticCastExprClass: -return CXXStaticCastExpr::Create(Importer.getToContext(), T, - E->getValueKind(), E->getCastKind(), - SubExpr, &BasePath, TInfo, - ExprLoc, RParenLoc, Brackets); - - case Stmt::CXXDynamicCastExprClass: -return CXXDynamicCastExpr::Create(Importer.getToContext(), T, - E->getValueKind(), E->getCastKind(), - SubExpr, &BasePath, TInfo, - ExprLoc, RParenLoc, Brackets); - - case Stmt::CXXReinterpretCastExprClass: -return CXXReinterpretCastExpr::Create(Importer.getToContext(), T, - E->getValueKind(), E->getCastKind(), - SubExpr, &BasePath, TInfo, - ExprLoc, RParenLoc, Brackets); - - case Stmt::CXXConstCastExprClass: -return CXXConstCastExpr::Create(Importer.getToContext(), T, -E->getValueKind(), SubExpr, TInfo, ExprLoc, -RParenLoc, Brackets); default: llvm_unreachable("Cast expression of unsupported type!"); return nullptr; Index: lib/AST/ASTImporter.cpp === --- lib/AST/ASTImporter.cpp +++ lib/AST/ASTImporter.cpp @@ -6037,38 +6037,6 @@ E->getCastKind(), Importer.Import(OCE->getBridgeKeywordLoc()), TInfo, SubExpr); } - default: -break; // just fall through - } - - auto *Named = cast(E); - SourceLocation ExprLoc = Importer.Import(Named->getOperatorLoc()), - RParenLoc = Importer.Import(Named->getRParenLoc()); - SourceRange Brackets = Importer.Import(Named->getAngleBrackets()); - - switch (E->getStmtClass()) { - case Stmt::CXXStaticCastExprClass: -return CXXStaticCastExpr::Create(Importer.getToContext(), T, - E->getValueKind(), E->getCastKind(), - SubExpr, &BasePath, TInfo, - ExprLoc, RParenLoc, Brackets); - - case Stmt::CXXDynamicCastExprClass: -return CXXDynamicCastExpr::Create(Importer.getToContext(), T, - E->getValueKind(), E->getCastKind(), - SubExpr, &BasePath, TInfo, - ExprLoc, RParenLoc, Brackets); - - case Stmt::CXXReinterpretCastExprClass: -return CXXReinterpretCastExpr::Create(Importer.getToContext(), T, - E->getValueKind(), E->getCastKind(), - SubExpr, &BasePath, TInfo, - ExprLoc, RParenLoc, Brackets); - - case Stmt::CXXConstCastExprClass: -return CXXConstCastExpr::Create(Importer.getToContext(), T, -E->getValueKind(), SubExpr, TInfo, ExprLoc, -RParenLoc, Brackets); default: llvm_unreachable("Cast expression of unsupported type!"); return nullptr; ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D51115: [ASTImporter] Actually test ArrayInitLoopExpr in the array-init-loop-expr test.
teemperor created this revision. Herald added subscribers: cfe-commits, martong. Herald added a reviewer: a.sidorin. The `array-init-loop-expr` test is currently not testing the importing of ArrayInitLoopExprs. This is because we import the `S` struct into the `test.cpp` context and only do a copy-assignment in `test.cpp`, so the actual ArrayInitLoopExpr we wanted to import is generated by clang directly in the target context. This means we actually never test the importing of ArrayInitLoopExpr with this test, which becomes obvious when looking at the missing test coverage for the respective VisitArrayInitLoopExpr method. This patch moves the copy-assignment of our struct to the `S.cpp` context, which means that `test.cpp` now actually has to import the ArrayInitLoopExpr. Repository: rC Clang https://reviews.llvm.org/D51115 Files: test/Import/array-init-loop-expr/Inputs/S.cpp test/Import/array-init-loop-expr/test.cpp Index: test/Import/array-init-loop-expr/test.cpp === --- test/Import/array-init-loop-expr/test.cpp +++ test/Import/array-init-loop-expr/test.cpp @@ -6,6 +6,5 @@ // CHECK: ArrayInitIndexExpr void expr() { - S s; - S copy = s; + f(); } Index: test/Import/array-init-loop-expr/Inputs/S.cpp === --- test/Import/array-init-loop-expr/Inputs/S.cpp +++ test/Import/array-init-loop-expr/Inputs/S.cpp @@ -1,3 +1,8 @@ class S { int a[10]; }; + +void f() { + S s; + S copy = s; +} Index: test/Import/array-init-loop-expr/test.cpp === --- test/Import/array-init-loop-expr/test.cpp +++ test/Import/array-init-loop-expr/test.cpp @@ -6,6 +6,5 @@ // CHECK: ArrayInitIndexExpr void expr() { - S s; - S copy = s; + f(); } Index: test/Import/array-init-loop-expr/Inputs/S.cpp === --- test/Import/array-init-loop-expr/Inputs/S.cpp +++ test/Import/array-init-loop-expr/Inputs/S.cpp @@ -1,3 +1,8 @@ class S { int a[10]; }; + +void f() { + S s; + S copy = s; +} ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D51121: [ASTImporter] Add test for ObjCAtTryStmt/ObjCAtCatchStmt/ObjCAtThrowStmt
teemperor created this revision. Herald added subscribers: cfe-commits, martong. Herald added a reviewer: a.sidorin. Repository: rC Clang https://reviews.llvm.org/D51121 Files: test/Import/objc-try-catch/Inputs/F.m test/Import/objc-try-catch/test.m Index: test/Import/objc-try-catch/test.m === --- /dev/null +++ test/Import/objc-try-catch/test.m @@ -0,0 +1,40 @@ +// RUN: clang-import-test -x objective-c++ -Xcc -fobjc-exceptions -dump-ast -import %S/Inputs/F.m -expression %s | FileCheck %s + +// CHECK: ObjCAtTryStmt +// CHECK-NEXT: CompoundStmt +// CHECK-NEXT: DeclStmt +// CHECK-NEXT: VarDecl +// CHECK-NEXT: ObjCAtThrowStmt +// CHECK-NEXT: ImplicitCastExpr +// CHECK-NEXT: DeclRefExpr +// CHECK-NEXT: ObjCAtCatchStmt +// CHECK-NEXT: VarDecl +// CHECK-SAME: varname +// CHECK-SAME: 'Exception *' +// CHECK-NEXT: CompoundStmt +// CHECK-NEXT: ObjCAtFinallyStmt +// CHECK-NEXT: CompoundStmt + +// CHECK-NEXT: ObjCAtTryStmt +// CHECK-NEXT: CompoundStmt +// CHECK-NEXT: ObjCAtCatchStmt +// CHECK-NEXT: VarDecl +// CHECK-SAME: varname1 +// CHECK-SAME: 'Exception *' +// CHECK-NEXT: CompoundStmt +// CHECK-NEXT: ObjCAtThrowStmt +// CHECK-NEXT: <> +// CHECK-NEXT: ObjCAtCatchStmt +// CHECK-NEXT: VarDecl +// CHECK-SAME: varname2 +// CHECK-SAME: 'OtherException *' +// CHECK-NEXT: CompoundStmt + +// CHECK-NEXT: ObjCAtTryStmt +// CHECK-NEXT: CompoundStmt +// CHECK-NEXT: ObjCAtFinallyStmt +// CHECK-NEXT: CompoundStmt + +void expr() { + f(); +} Index: test/Import/objc-try-catch/Inputs/F.m === --- /dev/null +++ test/Import/objc-try-catch/Inputs/F.m @@ -0,0 +1,28 @@ +@interface Exception +@end +@interface OtherException +@end + +void f() { + @try { +Exception *e; +@throw e; + } + @catch (Exception *varname) { + } + @finally { + } + + @try { + } + @catch (Exception *varname1) { +@throw; + } + @catch (OtherException *varname2) { + } + + @try { + } + @finally { + } +} Index: test/Import/objc-try-catch/test.m === --- /dev/null +++ test/Import/objc-try-catch/test.m @@ -0,0 +1,40 @@ +// RUN: clang-import-test -x objective-c++ -Xcc -fobjc-exceptions -dump-ast -import %S/Inputs/F.m -expression %s | FileCheck %s + +// CHECK: ObjCAtTryStmt +// CHECK-NEXT: CompoundStmt +// CHECK-NEXT: DeclStmt +// CHECK-NEXT: VarDecl +// CHECK-NEXT: ObjCAtThrowStmt +// CHECK-NEXT: ImplicitCastExpr +// CHECK-NEXT: DeclRefExpr +// CHECK-NEXT: ObjCAtCatchStmt +// CHECK-NEXT: VarDecl +// CHECK-SAME: varname +// CHECK-SAME: 'Exception *' +// CHECK-NEXT: CompoundStmt +// CHECK-NEXT: ObjCAtFinallyStmt +// CHECK-NEXT: CompoundStmt + +// CHECK-NEXT: ObjCAtTryStmt +// CHECK-NEXT: CompoundStmt +// CHECK-NEXT: ObjCAtCatchStmt +// CHECK-NEXT: VarDecl +// CHECK-SAME: varname1 +// CHECK-SAME: 'Exception *' +// CHECK-NEXT: CompoundStmt +// CHECK-NEXT: ObjCAtThrowStmt +// CHECK-NEXT: <> +// CHECK-NEXT: ObjCAtCatchStmt +// CHECK-NEXT: VarDecl +// CHECK-SAME: varname2 +// CHECK-SAME: 'OtherException *' +// CHECK-NEXT: CompoundStmt + +// CHECK-NEXT: ObjCAtTryStmt +// CHECK-NEXT: CompoundStmt +// CHECK-NEXT: ObjCAtFinallyStmt +// CHECK-NEXT: CompoundStmt + +void expr() { + f(); +} Index: test/Import/objc-try-catch/Inputs/F.m === --- /dev/null +++ test/Import/objc-try-catch/Inputs/F.m @@ -0,0 +1,28 @@ +@interface Exception +@end +@interface OtherException +@end + +void f() { + @try { +Exception *e; +@throw e; + } + @catch (Exception *varname) { + } + @finally { + } + + @try { + } + @catch (Exception *varname1) { +@throw; + } + @catch (OtherException *varname2) { + } + + @try { + } + @finally { + } +} ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D51121: [ASTImporter] Add test for ObjCAtTryStmt/ObjCAtCatchStmt/ObjCAtThrowStmt
teemperor added a comment. Turns out, the clang-import-test actually allows passing clang args via `-Xcc`, so I probably will revert the lang options changes I did in the previous commits. Repository: rC Clang https://reviews.llvm.org/D51121 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D51123: [ASTImporter] Add test for ObjCAutoreleasePoolStmt
teemperor created this revision. Herald added subscribers: cfe-commits, martong. Herald added a reviewer: a.sidorin. Repository: rC Clang https://reviews.llvm.org/D51123 Files: test/Import/objc-autoreleasepool/Inputs/F.m test/Import/objc-autoreleasepool/test.m Index: test/Import/objc-autoreleasepool/test.m === --- /dev/null +++ test/Import/objc-autoreleasepool/test.m @@ -0,0 +1,9 @@ +// RUN: clang-import-test -dump-ast -x objective-c++ -import %S/Inputs/F.m -expression %s | FileCheck %s + +// CHECK: ObjCAutoreleasePoolStmt +// CHECK-NEXT: CompoundStmt +// CHECK-NEXT: ReturnStmt + +void expr() { + f(); +} Index: test/Import/objc-autoreleasepool/Inputs/F.m === --- /dev/null +++ test/Import/objc-autoreleasepool/Inputs/F.m @@ -0,0 +1,5 @@ +void f() { + @autoreleasepool { +return; + } +} Index: test/Import/objc-autoreleasepool/test.m === --- /dev/null +++ test/Import/objc-autoreleasepool/test.m @@ -0,0 +1,9 @@ +// RUN: clang-import-test -dump-ast -x objective-c++ -import %S/Inputs/F.m -expression %s | FileCheck %s + +// CHECK: ObjCAutoreleasePoolStmt +// CHECK-NEXT: CompoundStmt +// CHECK-NEXT: ReturnStmt + +void expr() { + f(); +} Index: test/Import/objc-autoreleasepool/Inputs/F.m === --- /dev/null +++ test/Import/objc-autoreleasepool/Inputs/F.m @@ -0,0 +1,5 @@ +void f() { + @autoreleasepool { +return; + } +} ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D51121: [ASTImporter] Add test for ObjCAtTryStmt/ObjCAtCatchStmt/ObjCAtThrowStmt
teemperor added inline comments. Comment at: test/Import/objc-try-catch/Inputs/F.m:9 +Exception *e; +@throw e; + } We usually should create a expression here, but the ObjCMessageExpr isn't implemented yet, so this bit weird code has to do the job. Repository: rC Clang https://reviews.llvm.org/D51121 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D51123: [ASTImporter] Add test for ObjCAutoreleasePoolStmt
This revision was automatically updated to reflect the committed changes. Closed by commit rC340463: [ASTImporter] Add test for ObjCAutoreleasePoolStmt (authored by teemperor, committed by ). Repository: rC Clang https://reviews.llvm.org/D51123 Files: test/Import/objc-autoreleasepool/Inputs/F.m test/Import/objc-autoreleasepool/test.m Index: test/Import/objc-autoreleasepool/test.m === --- test/Import/objc-autoreleasepool/test.m +++ test/Import/objc-autoreleasepool/test.m @@ -0,0 +1,9 @@ +// RUN: clang-import-test -dump-ast -x objective-c++ -import %S/Inputs/F.m -expression %s | FileCheck %s + +// CHECK: ObjCAutoreleasePoolStmt +// CHECK-NEXT: CompoundStmt +// CHECK-NEXT: ReturnStmt + +void expr() { + f(); +} Index: test/Import/objc-autoreleasepool/Inputs/F.m === --- test/Import/objc-autoreleasepool/Inputs/F.m +++ test/Import/objc-autoreleasepool/Inputs/F.m @@ -0,0 +1,5 @@ +void f() { + @autoreleasepool { +return; + } +} Index: test/Import/objc-autoreleasepool/test.m === --- test/Import/objc-autoreleasepool/test.m +++ test/Import/objc-autoreleasepool/test.m @@ -0,0 +1,9 @@ +// RUN: clang-import-test -dump-ast -x objective-c++ -import %S/Inputs/F.m -expression %s | FileCheck %s + +// CHECK: ObjCAutoreleasePoolStmt +// CHECK-NEXT: CompoundStmt +// CHECK-NEXT: ReturnStmt + +void expr() { + f(); +} Index: test/Import/objc-autoreleasepool/Inputs/F.m === --- test/Import/objc-autoreleasepool/Inputs/F.m +++ test/Import/objc-autoreleasepool/Inputs/F.m @@ -0,0 +1,5 @@ +void f() { + @autoreleasepool { +return; + } +} ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D51056: [ASTImporter] Add test for SwitchStmt
This revision was automatically updated to reflect the committed changes. Closed by commit rL340464: [ASTImporter] Add test for SwitchStmt (authored by teemperor, committed by ). Herald added a subscriber: llvm-commits. Changed prior to commit: https://reviews.llvm.org/D51056?vs=161798&id=162082#toc Repository: rL LLVM https://reviews.llvm.org/D51056 Files: cfe/trunk/test/Import/switch-stmt/Inputs/F.cpp cfe/trunk/test/Import/switch-stmt/test.cpp Index: cfe/trunk/test/Import/switch-stmt/Inputs/F.cpp === --- cfe/trunk/test/Import/switch-stmt/Inputs/F.cpp +++ cfe/trunk/test/Import/switch-stmt/Inputs/F.cpp @@ -0,0 +1,18 @@ +void f() { + switch (1) { + case 1: + case 2: +break; + } + switch (int varname; 1) { + case 1: +break; + case 2: +break; + } + switch (1) + default: +break; + switch (0) +; +} Index: cfe/trunk/test/Import/switch-stmt/test.cpp === --- cfe/trunk/test/Import/switch-stmt/test.cpp +++ cfe/trunk/test/Import/switch-stmt/test.cpp @@ -0,0 +1,47 @@ +// RUN: clang-import-test -dump-ast -import %S/Inputs/F.cpp -expression %s | FileCheck %s + +// CHECK: SwitchStmt +// CHECK-NEXT: <> +// CHECK-NEXT: <> +// CHECK-NEXT: IntegerLiteral +// CHECK-NEXT: CompoundStmt +// CHECK-NEXT: CaseStmt +// CHECK-NEXT: IntegerLiteral +// CHECK-NEXT: <> +// CHECK-NEXT: CaseStmt +// CHECK-NEXT: IntegerLiteral +// CHECK-NEXT: <> +// CHECK-NEXT: BreakStmt + +// CHECK: SwitchStmt +// CHECK-NEXT: DeclStmt +// CHECK-NEXT: VarDecl +// CHECK-SAME: varname +// CHECK-NEXT: <> +// CHECK-NEXT: IntegerLiteral +// CHECK-NEXT: CompoundStmt +// CHECK-NEXT: CaseStmt +// CHECK-NEXT: IntegerLiteral +// CHECK-NEXT: <> +// CHECK-NEXT: BreakStmt +// CHECK-NEXT: CaseStmt +// CHECK-NEXT: IntegerLiteral +// CHECK-NEXT: <> +// CHECK-NEXT: BreakStmt + +// CHECK: SwitchStmt +// CHECK-NEXT: <> +// CHECK-NEXT: <> +// CHECK-NEXT: IntegerLiteral +// CHECK-NEXT: DefaultStmt +// CHECK-NEXT: BreakStmt + +// CHECK: SwitchStmt +// CHECK-NEXT: <> +// CHECK-NEXT: <> +// CHECK-NEXT: IntegerLiteral +// CHECK-NEXT: NullStmt + +void expr() { + f(); +} Index: cfe/trunk/test/Import/switch-stmt/Inputs/F.cpp === --- cfe/trunk/test/Import/switch-stmt/Inputs/F.cpp +++ cfe/trunk/test/Import/switch-stmt/Inputs/F.cpp @@ -0,0 +1,18 @@ +void f() { + switch (1) { + case 1: + case 2: +break; + } + switch (int varname; 1) { + case 1: +break; + case 2: +break; + } + switch (1) + default: +break; + switch (0) +; +} Index: cfe/trunk/test/Import/switch-stmt/test.cpp === --- cfe/trunk/test/Import/switch-stmt/test.cpp +++ cfe/trunk/test/Import/switch-stmt/test.cpp @@ -0,0 +1,47 @@ +// RUN: clang-import-test -dump-ast -import %S/Inputs/F.cpp -expression %s | FileCheck %s + +// CHECK: SwitchStmt +// CHECK-NEXT: <> +// CHECK-NEXT: <> +// CHECK-NEXT: IntegerLiteral +// CHECK-NEXT: CompoundStmt +// CHECK-NEXT: CaseStmt +// CHECK-NEXT: IntegerLiteral +// CHECK-NEXT: <> +// CHECK-NEXT: CaseStmt +// CHECK-NEXT: IntegerLiteral +// CHECK-NEXT: <> +// CHECK-NEXT: BreakStmt + +// CHECK: SwitchStmt +// CHECK-NEXT: DeclStmt +// CHECK-NEXT: VarDecl +// CHECK-SAME: varname +// CHECK-NEXT: <> +// CHECK-NEXT: IntegerLiteral +// CHECK-NEXT: CompoundStmt +// CHECK-NEXT: CaseStmt +// CHECK-NEXT: IntegerLiteral +// CHECK-NEXT: <> +// CHECK-NEXT: BreakStmt +// CHECK-NEXT: CaseStmt +// CHECK-NEXT: IntegerLiteral +// CHECK-NEXT: <> +// CHECK-NEXT: BreakStmt + +// CHECK: SwitchStmt +// CHECK-NEXT: <> +// CHECK-NEXT: <> +// CHECK-NEXT: IntegerLiteral +// CHECK-NEXT: DefaultStmt +// CHECK-NEXT: BreakStmt + +// CHECK: SwitchStmt +// CHECK-NEXT: <> +// CHECK-NEXT: <> +// CHECK-NEXT: IntegerLiteral +// CHECK-NEXT: NullStmt + +void expr() { + f(); +} ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D51059: [ASTImporter] Add test for ObjCTypeParamDecl
This revision was automatically updated to reflect the committed changes. Closed by commit rC340465: [ASTImporter] Add test for ObjCTypeParamDecl (authored by teemperor, committed by ). Repository: rC Clang https://reviews.llvm.org/D51059 Files: test/Import/objc-param-decl/Inputs/S.m test/Import/objc-param-decl/test.m Index: test/Import/objc-param-decl/Inputs/S.m === --- test/Import/objc-param-decl/Inputs/S.m +++ test/Import/objc-param-decl/Inputs/S.m @@ -0,0 +1,5 @@ +@protocol NSString +@end + +@interface Dictionary , NSString> +@end Index: test/Import/objc-param-decl/test.m === --- test/Import/objc-param-decl/test.m +++ test/Import/objc-param-decl/test.m @@ -0,0 +1,11 @@ +// RUN: clang-import-test -dump-ast -x objective-c++ -import %S/Inputs/S.m -expression %s | FileCheck %s + +// CHECK: ObjCTypeParamDecl +// CHECK-SAME: FirstParam +// CHECK-SAME: 'id' +// CHECK-NEXT: ObjCTypeParamDecl +// CHECK-SAME: 'id':'id' + +void expr() { + Dictionary *d; +} Index: test/Import/objc-param-decl/Inputs/S.m === --- test/Import/objc-param-decl/Inputs/S.m +++ test/Import/objc-param-decl/Inputs/S.m @@ -0,0 +1,5 @@ +@protocol NSString +@end + +@interface Dictionary , NSString> +@end Index: test/Import/objc-param-decl/test.m === --- test/Import/objc-param-decl/test.m +++ test/Import/objc-param-decl/test.m @@ -0,0 +1,11 @@ +// RUN: clang-import-test -dump-ast -x objective-c++ -import %S/Inputs/S.m -expression %s | FileCheck %s + +// CHECK: ObjCTypeParamDecl +// CHECK-SAME: FirstParam +// CHECK-SAME: 'id' +// CHECK-NEXT: ObjCTypeParamDecl +// CHECK-SAME: 'id':'id' + +void expr() { + Dictionary *d; +} ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D51110: [ASTImporter] Remove duplicated and dead CXXNamedCastExpr handling code.
This revision was automatically updated to reflect the committed changes. Closed by commit rC340466: [ASTImporter] Remove duplicated and dead CXXNamedCastExpr handling code. (authored by teemperor, committed by ). Changed prior to commit: https://reviews.llvm.org/D51110?vs=161994&id=162084#toc Repository: rC Clang https://reviews.llvm.org/D51110 Files: lib/AST/ASTImporter.cpp Index: lib/AST/ASTImporter.cpp === --- lib/AST/ASTImporter.cpp +++ lib/AST/ASTImporter.cpp @@ -6088,38 +6088,6 @@ TInfo, SubExpr); } default: -break; // just fall through - } - - auto *Named = cast(E); - SourceLocation ExprLoc = Importer.Import(Named->getOperatorLoc()), - RParenLoc = Importer.Import(Named->getRParenLoc()); - SourceRange Brackets = Importer.Import(Named->getAngleBrackets()); - - switch (E->getStmtClass()) { - case Stmt::CXXStaticCastExprClass: -return CXXStaticCastExpr::Create(Importer.getToContext(), T, - E->getValueKind(), E->getCastKind(), - SubExpr, &BasePath, TInfo, - ExprLoc, RParenLoc, Brackets); - - case Stmt::CXXDynamicCastExprClass: -return CXXDynamicCastExpr::Create(Importer.getToContext(), T, - E->getValueKind(), E->getCastKind(), - SubExpr, &BasePath, TInfo, - ExprLoc, RParenLoc, Brackets); - - case Stmt::CXXReinterpretCastExprClass: -return CXXReinterpretCastExpr::Create(Importer.getToContext(), T, - E->getValueKind(), E->getCastKind(), - SubExpr, &BasePath, TInfo, - ExprLoc, RParenLoc, Brackets); - - case Stmt::CXXConstCastExprClass: -return CXXConstCastExpr::Create(Importer.getToContext(), T, -E->getValueKind(), SubExpr, TInfo, ExprLoc, -RParenLoc, Brackets); - default: llvm_unreachable("Cast expression of unsupported type!"); return nullptr; } Index: lib/AST/ASTImporter.cpp === --- lib/AST/ASTImporter.cpp +++ lib/AST/ASTImporter.cpp @@ -6088,38 +6088,6 @@ TInfo, SubExpr); } default: -break; // just fall through - } - - auto *Named = cast(E); - SourceLocation ExprLoc = Importer.Import(Named->getOperatorLoc()), - RParenLoc = Importer.Import(Named->getRParenLoc()); - SourceRange Brackets = Importer.Import(Named->getAngleBrackets()); - - switch (E->getStmtClass()) { - case Stmt::CXXStaticCastExprClass: -return CXXStaticCastExpr::Create(Importer.getToContext(), T, - E->getValueKind(), E->getCastKind(), - SubExpr, &BasePath, TInfo, - ExprLoc, RParenLoc, Brackets); - - case Stmt::CXXDynamicCastExprClass: -return CXXDynamicCastExpr::Create(Importer.getToContext(), T, - E->getValueKind(), E->getCastKind(), - SubExpr, &BasePath, TInfo, - ExprLoc, RParenLoc, Brackets); - - case Stmt::CXXReinterpretCastExprClass: -return CXXReinterpretCastExpr::Create(Importer.getToContext(), T, - E->getValueKind(), E->getCastKind(), - SubExpr, &BasePath, TInfo, - ExprLoc, RParenLoc, Brackets); - - case Stmt::CXXConstCastExprClass: -return CXXConstCastExpr::Create(Importer.getToContext(), T, -E->getValueKind(), SubExpr, TInfo, ExprLoc, -RParenLoc, Brackets); - default: llvm_unreachable("Cast expression of unsupported type!"); return nullptr; } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D51115: [ASTImporter] Actually test ArrayInitLoopExpr in the array-init-loop-expr test.
This revision was automatically updated to reflect the committed changes. Closed by commit rL340467: [ASTImporter] Actually test ArrayInitLoopExpr in the array-init-loop-expr test. (authored by teemperor, committed by ). Herald added a subscriber: llvm-commits. Changed prior to commit: https://reviews.llvm.org/D51115?vs=162004&id=162086#toc Repository: rL LLVM https://reviews.llvm.org/D51115 Files: cfe/trunk/test/Import/array-init-loop-expr/Inputs/S.cpp cfe/trunk/test/Import/array-init-loop-expr/test.cpp Index: cfe/trunk/test/Import/array-init-loop-expr/test.cpp === --- cfe/trunk/test/Import/array-init-loop-expr/test.cpp +++ cfe/trunk/test/Import/array-init-loop-expr/test.cpp @@ -6,6 +6,5 @@ // CHECK: ArrayInitIndexExpr void expr() { - S s; - S copy = s; + f(); } Index: cfe/trunk/test/Import/array-init-loop-expr/Inputs/S.cpp === --- cfe/trunk/test/Import/array-init-loop-expr/Inputs/S.cpp +++ cfe/trunk/test/Import/array-init-loop-expr/Inputs/S.cpp @@ -1,3 +1,8 @@ class S { int a[10]; }; + +void f() { + S s; + S copy = s; +} Index: cfe/trunk/test/Import/array-init-loop-expr/test.cpp === --- cfe/trunk/test/Import/array-init-loop-expr/test.cpp +++ cfe/trunk/test/Import/array-init-loop-expr/test.cpp @@ -6,6 +6,5 @@ // CHECK: ArrayInitIndexExpr void expr() { - S s; - S copy = s; + f(); } Index: cfe/trunk/test/Import/array-init-loop-expr/Inputs/S.cpp === --- cfe/trunk/test/Import/array-init-loop-expr/Inputs/S.cpp +++ cfe/trunk/test/Import/array-init-loop-expr/Inputs/S.cpp @@ -1,3 +1,8 @@ class S { int a[10]; }; + +void f() { + S s; + S copy = s; +} ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D51121: [ASTImporter] Add test for ObjCAtTryStmt/ObjCAtCatchStmt/ObjCAtThrowStmt
This revision was automatically updated to reflect the committed changes. Closed by commit rC340468: [ASTImporter] Add test for ObjCAtTryStmt/ObjCAtCatchStmt/ObjCAtThrowStmt (authored by teemperor, committed by ). Repository: rC Clang https://reviews.llvm.org/D51121 Files: test/Import/objc-try-catch/Inputs/F.m test/Import/objc-try-catch/test.m Index: test/Import/objc-try-catch/test.m === --- test/Import/objc-try-catch/test.m +++ test/Import/objc-try-catch/test.m @@ -0,0 +1,40 @@ +// RUN: clang-import-test -x objective-c++ -Xcc -fobjc-exceptions -dump-ast -import %S/Inputs/F.m -expression %s | FileCheck %s + +// CHECK: ObjCAtTryStmt +// CHECK-NEXT: CompoundStmt +// CHECK-NEXT: DeclStmt +// CHECK-NEXT: VarDecl +// CHECK-NEXT: ObjCAtThrowStmt +// CHECK-NEXT: ImplicitCastExpr +// CHECK-NEXT: DeclRefExpr +// CHECK-NEXT: ObjCAtCatchStmt +// CHECK-NEXT: VarDecl +// CHECK-SAME: varname +// CHECK-SAME: 'Exception *' +// CHECK-NEXT: CompoundStmt +// CHECK-NEXT: ObjCAtFinallyStmt +// CHECK-NEXT: CompoundStmt + +// CHECK-NEXT: ObjCAtTryStmt +// CHECK-NEXT: CompoundStmt +// CHECK-NEXT: ObjCAtCatchStmt +// CHECK-NEXT: VarDecl +// CHECK-SAME: varname1 +// CHECK-SAME: 'Exception *' +// CHECK-NEXT: CompoundStmt +// CHECK-NEXT: ObjCAtThrowStmt +// CHECK-NEXT: <> +// CHECK-NEXT: ObjCAtCatchStmt +// CHECK-NEXT: VarDecl +// CHECK-SAME: varname2 +// CHECK-SAME: 'OtherException *' +// CHECK-NEXT: CompoundStmt + +// CHECK-NEXT: ObjCAtTryStmt +// CHECK-NEXT: CompoundStmt +// CHECK-NEXT: ObjCAtFinallyStmt +// CHECK-NEXT: CompoundStmt + +void expr() { + f(); +} Index: test/Import/objc-try-catch/Inputs/F.m === --- test/Import/objc-try-catch/Inputs/F.m +++ test/Import/objc-try-catch/Inputs/F.m @@ -0,0 +1,28 @@ +@interface Exception +@end +@interface OtherException +@end + +void f() { + @try { +Exception *e; +@throw e; + } + @catch (Exception *varname) { + } + @finally { + } + + @try { + } + @catch (Exception *varname1) { +@throw; + } + @catch (OtherException *varname2) { + } + + @try { + } + @finally { + } +} Index: test/Import/objc-try-catch/test.m === --- test/Import/objc-try-catch/test.m +++ test/Import/objc-try-catch/test.m @@ -0,0 +1,40 @@ +// RUN: clang-import-test -x objective-c++ -Xcc -fobjc-exceptions -dump-ast -import %S/Inputs/F.m -expression %s | FileCheck %s + +// CHECK: ObjCAtTryStmt +// CHECK-NEXT: CompoundStmt +// CHECK-NEXT: DeclStmt +// CHECK-NEXT: VarDecl +// CHECK-NEXT: ObjCAtThrowStmt +// CHECK-NEXT: ImplicitCastExpr +// CHECK-NEXT: DeclRefExpr +// CHECK-NEXT: ObjCAtCatchStmt +// CHECK-NEXT: VarDecl +// CHECK-SAME: varname +// CHECK-SAME: 'Exception *' +// CHECK-NEXT: CompoundStmt +// CHECK-NEXT: ObjCAtFinallyStmt +// CHECK-NEXT: CompoundStmt + +// CHECK-NEXT: ObjCAtTryStmt +// CHECK-NEXT: CompoundStmt +// CHECK-NEXT: ObjCAtCatchStmt +// CHECK-NEXT: VarDecl +// CHECK-SAME: varname1 +// CHECK-SAME: 'Exception *' +// CHECK-NEXT: CompoundStmt +// CHECK-NEXT: ObjCAtThrowStmt +// CHECK-NEXT: <> +// CHECK-NEXT: ObjCAtCatchStmt +// CHECK-NEXT: VarDecl +// CHECK-SAME: varname2 +// CHECK-SAME: 'OtherException *' +// CHECK-NEXT: CompoundStmt + +// CHECK-NEXT: ObjCAtTryStmt +// CHECK-NEXT: CompoundStmt +// CHECK-NEXT: ObjCAtFinallyStmt +// CHECK-NEXT: CompoundStmt + +void expr() { + f(); +} Index: test/Import/objc-try-catch/Inputs/F.m === --- test/Import/objc-try-catch/Inputs/F.m +++ test/Import/objc-try-catch/Inputs/F.m @@ -0,0 +1,28 @@ +@interface Exception +@end +@interface OtherException +@end + +void f() { + @try { +Exception *e; +@throw e; + } + @catch (Exception *varname) { + } + @finally { + } + + @try { + } + @catch (Exception *varname1) { +@throw; + } + @catch (OtherException *varname2) { + } + + @try { + } + @finally { + } +} ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D51142: [ASTImporter] Add test for PackExpansionExpr
teemperor created this revision. Herald added subscribers: cfe-commits, martong. Herald added a reviewer: a.sidorin. Repository: rC Clang https://reviews.llvm.org/D51142 Files: test/Import/pack-expansion-expr/Inputs/F.cpp test/Import/pack-expansion-expr/test.cpp Index: test/Import/pack-expansion-expr/test.cpp === --- /dev/null +++ test/Import/pack-expansion-expr/test.cpp @@ -0,0 +1,12 @@ +// RUN: clang-import-test -dump-ast -import %S/Inputs/F.cpp -expression %s | FileCheck %s + +// CHECK: PackExpansionExpr +// CHECK-SAME: '' +// CHECK-NEXT: DeclRefExpr +// CHECK-SAME: 'T...' +// CHECK-SAME: ParmVar +// CHECK-SAME: 'a' + +void expr() { + f(); +} Index: test/Import/pack-expansion-expr/Inputs/F.cpp === --- /dev/null +++ test/Import/pack-expansion-expr/Inputs/F.cpp @@ -0,0 +1,11 @@ +template +void sink(T... a); + +template +void packfuncT(T... a) { + sink(a...); +} + +void f() { + packfuncT(1, 2, 3); +} Index: test/Import/pack-expansion-expr/test.cpp === --- /dev/null +++ test/Import/pack-expansion-expr/test.cpp @@ -0,0 +1,12 @@ +// RUN: clang-import-test -dump-ast -import %S/Inputs/F.cpp -expression %s | FileCheck %s + +// CHECK: PackExpansionExpr +// CHECK-SAME: '' +// CHECK-NEXT: DeclRefExpr +// CHECK-SAME: 'T...' +// CHECK-SAME: ParmVar +// CHECK-SAME: 'a' + +void expr() { + f(); +} Index: test/Import/pack-expansion-expr/Inputs/F.cpp === --- /dev/null +++ test/Import/pack-expansion-expr/Inputs/F.cpp @@ -0,0 +1,11 @@ +template +void sink(T... a); + +template +void packfuncT(T... a) { + sink(a...); +} + +void f() { + packfuncT(1, 2, 3); +} ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D47164: Add missing include for cstdint to Visibility.h
teemperor created this revision. We use uint8_t in this header, so we need to include cstdint. Repository: rC Clang https://reviews.llvm.org/D47164 Files: include/clang/Basic/Visibility.h Index: include/clang/Basic/Visibility.h === --- include/clang/Basic/Visibility.h +++ include/clang/Basic/Visibility.h @@ -17,6 +17,7 @@ #include "clang/Basic/Linkage.h" #include +#include namespace clang { Index: include/clang/Basic/Visibility.h === --- include/clang/Basic/Visibility.h +++ include/clang/Basic/Visibility.h @@ -17,6 +17,7 @@ #include "clang/Basic/Linkage.h" #include +#include namespace clang { ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D47164: Add missing include for cstdint to Visibility.h
This revision was not accepted when it landed; it landed in state "Needs Review". This revision was automatically updated to reflect the committed changes. Closed by commit rL332913: Add missing include for cstdint to Visibility.h (authored by teemperor, committed by ). Herald added a subscriber: llvm-commits. Changed prior to commit: https://reviews.llvm.org/D47164?vs=147891&id=147892#toc Repository: rL LLVM https://reviews.llvm.org/D47164 Files: cfe/trunk/include/clang/Basic/Visibility.h Index: cfe/trunk/include/clang/Basic/Visibility.h === --- cfe/trunk/include/clang/Basic/Visibility.h +++ cfe/trunk/include/clang/Basic/Visibility.h @@ -17,6 +17,7 @@ #include "clang/Basic/Linkage.h" #include +#include namespace clang { Index: cfe/trunk/include/clang/Basic/Visibility.h === --- cfe/trunk/include/clang/Basic/Visibility.h +++ cfe/trunk/include/clang/Basic/Visibility.h @@ -17,6 +17,7 @@ #include "clang/Basic/Linkage.h" #include +#include namespace clang { ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D47247: Fix unaligned memory access when reading INPUT_FILE_OFFSETS data
teemperor created this revision. teemperor added reviewers: rsmith, v.g.vassilev. The blob data is unaligned, so we also should read it as such. Should fix the random failures with the sanitizer builds. Repository: rC Clang https://reviews.llvm.org/D47247 Files: lib/Serialization/ASTReader.cpp Index: lib/Serialization/ASTReader.cpp === --- lib/Serialization/ASTReader.cpp +++ lib/Serialization/ASTReader.cpp @@ -4811,7 +4811,8 @@ unsigned NumInputFiles = Record[0]; unsigned NumUserFiles = Record[1]; - const uint64_t *InputFileOffs = (const uint64_t *)Blob.data(); + const llvm::support::unaligned_uint64_t *InputFileOffs = + (const llvm::support::unaligned_uint64_t *)Blob.data(); for (unsigned I = 0; I != NumInputFiles; ++I) { // Go find this input file. bool isSystemFile = I >= NumUserFiles; Index: lib/Serialization/ASTReader.cpp === --- lib/Serialization/ASTReader.cpp +++ lib/Serialization/ASTReader.cpp @@ -4811,7 +4811,8 @@ unsigned NumInputFiles = Record[0]; unsigned NumUserFiles = Record[1]; - const uint64_t *InputFileOffs = (const uint64_t *)Blob.data(); + const llvm::support::unaligned_uint64_t *InputFileOffs = + (const llvm::support::unaligned_uint64_t *)Blob.data(); for (unsigned I = 0; I != NumInputFiles; ++I) { // Go find this input file. bool isSystemFile = I >= NumUserFiles; ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D47247: Fix unaligned memory access when reading INPUT_FILE_OFFSETS data
This revision was automatically updated to reflect the committed changes. Closed by commit rL333069: Fix unaligned memory access when reading INPUT_FILE_OFFSETS data (authored by teemperor, committed by ). Herald added a subscriber: llvm-commits. Changed prior to commit: https://reviews.llvm.org/D47247?vs=148158&id=148173#toc Repository: rL LLVM https://reviews.llvm.org/D47247 Files: cfe/trunk/lib/Serialization/ASTReader.cpp Index: cfe/trunk/lib/Serialization/ASTReader.cpp === --- cfe/trunk/lib/Serialization/ASTReader.cpp +++ cfe/trunk/lib/Serialization/ASTReader.cpp @@ -4811,7 +4811,8 @@ unsigned NumInputFiles = Record[0]; unsigned NumUserFiles = Record[1]; - const uint64_t *InputFileOffs = (const uint64_t *)Blob.data(); + const llvm::support::unaligned_uint64_t *InputFileOffs = + (const llvm::support::unaligned_uint64_t *)Blob.data(); for (unsigned I = 0; I != NumInputFiles; ++I) { // Go find this input file. bool isSystemFile = I >= NumUserFiles; Index: cfe/trunk/lib/Serialization/ASTReader.cpp === --- cfe/trunk/lib/Serialization/ASTReader.cpp +++ cfe/trunk/lib/Serialization/ASTReader.cpp @@ -4811,7 +4811,8 @@ unsigned NumInputFiles = Record[0]; unsigned NumUserFiles = Record[1]; - const uint64_t *InputFileOffs = (const uint64_t *)Blob.data(); + const llvm::support::unaligned_uint64_t *InputFileOffs = + (const llvm::support::unaligned_uint64_t *)Blob.data(); for (unsigned I = 0; I != NumInputFiles; ++I) { // Go find this input file. bool isSystemFile = I >= NumUserFiles; ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D47277: [modules] Mark __wmmintrin_pclmul.h/__wmmintrin_aes.h as textual
teemperor created this revision. teemperor added reviewers: rsmith, slydiman. Since clang r332929 these two headers throw errors when included from somewhere else than their wrapper header. It seems marking them as textual is the best way to fix the builds. Fixes this new module build error: While building module '_Builtin_intrinsics' imported from ...: In file included from :2: In file included from lib/clang/7.0.0/include/immintrin.h:54: In file included from lib/clang/7.0.0/include/wmmintrin.h:29: lib/clang/7.0.0/include/__wmmintrin_aes.h:25:2: error: "Never use <__wmmintrin_aes.h> directly; include instead." #error "Never use <__wmmintrin_aes.h> directly; include instead." https://reviews.llvm.org/D47277 Files: lib/Headers/module.modulemap Index: lib/Headers/module.modulemap === --- lib/Headers/module.modulemap +++ lib/Headers/module.modulemap @@ -71,6 +71,9 @@ textual header "sgxintrin.h" textual header "ptwriteintrin.h" +textual header "__wmmintrin_aes.h" +textual header "__wmmintrin_pclmul.h" + explicit module mm_malloc { requires !freestanding header "mm_malloc.h" @@ -136,14 +139,6 @@ export aes export pclmul } - -explicit module aes { - header "__wmmintrin_aes.h" -} - -explicit module pclmul { - header "__wmmintrin_pclmul.h" -} } explicit module systemz { Index: lib/Headers/module.modulemap === --- lib/Headers/module.modulemap +++ lib/Headers/module.modulemap @@ -71,6 +71,9 @@ textual header "sgxintrin.h" textual header "ptwriteintrin.h" +textual header "__wmmintrin_aes.h" +textual header "__wmmintrin_pclmul.h" + explicit module mm_malloc { requires !freestanding header "mm_malloc.h" @@ -136,14 +139,6 @@ export aes export pclmul } - -explicit module aes { - header "__wmmintrin_aes.h" -} - -explicit module pclmul { - header "__wmmintrin_pclmul.h" -} } explicit module systemz { ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D47277: [modules] Mark __wmmintrin_pclmul.h/__wmmintrin_aes.h as textual
teemperor edited reviewers, added: v.g.vassilev; removed: slydiman. teemperor added a comment. (Wrong Vassil, sorry) https://reviews.llvm.org/D47277 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D47277: [modules] Mark __wmmintrin_pclmul.h/__wmmintrin_aes.h as textual
This revision was automatically updated to reflect the committed changes. Closed by commit rL333123: [modules] Mark __wmmintrin_pclmul.h/__wmmintrin_aes.h as textual (authored by teemperor, committed by ). Herald added a subscriber: llvm-commits. Changed prior to commit: https://reviews.llvm.org/D47277?vs=148272&id=148281#toc Repository: rL LLVM https://reviews.llvm.org/D47277 Files: cfe/trunk/lib/Headers/module.modulemap Index: cfe/trunk/lib/Headers/module.modulemap === --- cfe/trunk/lib/Headers/module.modulemap +++ cfe/trunk/lib/Headers/module.modulemap @@ -71,6 +71,9 @@ textual header "sgxintrin.h" textual header "ptwriteintrin.h" +textual header "__wmmintrin_aes.h" +textual header "__wmmintrin_pclmul.h" + explicit module mm_malloc { requires !freestanding header "mm_malloc.h" @@ -136,14 +139,6 @@ export aes export pclmul } - -explicit module aes { - header "__wmmintrin_aes.h" -} - -explicit module pclmul { - header "__wmmintrin_pclmul.h" -} } explicit module systemz { Index: cfe/trunk/lib/Headers/module.modulemap === --- cfe/trunk/lib/Headers/module.modulemap +++ cfe/trunk/lib/Headers/module.modulemap @@ -71,6 +71,9 @@ textual header "sgxintrin.h" textual header "ptwriteintrin.h" +textual header "__wmmintrin_aes.h" +textual header "__wmmintrin_pclmul.h" + explicit module mm_malloc { requires !freestanding header "mm_malloc.h" @@ -136,14 +139,6 @@ export aes export pclmul } - -explicit module aes { - header "__wmmintrin_aes.h" -} - -explicit module pclmul { - header "__wmmintrin_pclmul.h" -} } explicit module systemz { ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D51178: [ASTImporter] Add test for importing anonymous namespaces.
teemperor created this revision. Herald added subscribers: cfe-commits, martong. Herald added a reviewer: a.sidorin. Repository: rC Clang https://reviews.llvm.org/D51178 Files: test/Import/cxx-anon-namespace/Inputs/F.cpp test/Import/cxx-anon-namespace/test.cpp Index: test/Import/cxx-anon-namespace/test.cpp === --- /dev/null +++ test/Import/cxx-anon-namespace/test.cpp @@ -0,0 +1,43 @@ +// RUN: clang-import-test -dump-ast -import %S/Inputs/F.cpp -expression %s | FileCheck %s + +// CHECK: NamespaceDecl +// The nested anonymous namespace. +// CHECK-NEXT: NamespaceDecl +// CHECK: FunctionDecl +// CHECK-SAME: func4 +// CHECK-NEXT: CompoundStmt +// This is for the nested anonymous namespace. +// CHECK-NEXT: UsingDirectiveDecl +// CHECK-SAME: '' +// CHECK: FunctionDecl +// CHECK-SAME: func1 +// CHECK-NEXT: CompoundStmt +// CHECK-NEXT: UsingDirectiveDecl +// CHECK-SAME: '' + +// CHECK: NamespaceDecl +// CHECK-SAME: test_namespace1 +// CHECK-NEXT: NamespaceDecl +// CHECK: FunctionDecl +// CHECK-SAME: func2 +// CHECK-NEXT: CompoundStmt +// CHECK-NEXT: UsingDirectiveDecl +// CHECK-SAME: '' + +// CHECK-NEXT: NamespaceDecl +// CHECK-SAME: test_namespace2 +// CHECK-NEXT: NamespaceDecl +// CHECK-NEXT: NamespaceDecl +// CHECK-SAME: test_namespace3 +// CHECK: FunctionDecl +// CHECK-SAME: func3 +// CHECK-NEXT: CompoundStmt +// CHECK-NEXT: UsingDirectiveDecl +// CHECK-SAME: '' + +void expr() { + func1(); + test_namespace1::func2(); + test_namespace2::test_namespace3::func3(); + func4(); +} Index: test/Import/cxx-anon-namespace/Inputs/F.cpp === --- /dev/null +++ test/Import/cxx-anon-namespace/Inputs/F.cpp @@ -0,0 +1,25 @@ +namespace { +void func1() { +} +} // namespace + +namespace test_namespace1 { +namespace { +void func2() {} +} // namespace +} // namespace test_namespace1 + +namespace test_namespace2 { +namespace { +namespace test_namespace3 { +void func3() {} +} // namespace test_namespace3 +} // namespace +} // namespace test_namespace2 + +namespace { +namespace { +void func4() { +} +} // namespace +} // namespace Index: test/Import/cxx-anon-namespace/test.cpp === --- /dev/null +++ test/Import/cxx-anon-namespace/test.cpp @@ -0,0 +1,43 @@ +// RUN: clang-import-test -dump-ast -import %S/Inputs/F.cpp -expression %s | FileCheck %s + +// CHECK: NamespaceDecl +// The nested anonymous namespace. +// CHECK-NEXT: NamespaceDecl +// CHECK: FunctionDecl +// CHECK-SAME: func4 +// CHECK-NEXT: CompoundStmt +// This is for the nested anonymous namespace. +// CHECK-NEXT: UsingDirectiveDecl +// CHECK-SAME: '' +// CHECK: FunctionDecl +// CHECK-SAME: func1 +// CHECK-NEXT: CompoundStmt +// CHECK-NEXT: UsingDirectiveDecl +// CHECK-SAME: '' + +// CHECK: NamespaceDecl +// CHECK-SAME: test_namespace1 +// CHECK-NEXT: NamespaceDecl +// CHECK: FunctionDecl +// CHECK-SAME: func2 +// CHECK-NEXT: CompoundStmt +// CHECK-NEXT: UsingDirectiveDecl +// CHECK-SAME: '' + +// CHECK-NEXT: NamespaceDecl +// CHECK-SAME: test_namespace2 +// CHECK-NEXT: NamespaceDecl +// CHECK-NEXT: NamespaceDecl +// CHECK-SAME: test_namespace3 +// CHECK: FunctionDecl +// CHECK-SAME: func3 +// CHECK-NEXT: CompoundStmt +// CHECK-NEXT: UsingDirectiveDecl +// CHECK-SAME: '' + +void expr() { + func1(); + test_namespace1::func2(); + test_namespace2::test_namespace3::func3(); + func4(); +} Index: test/Import/cxx-anon-namespace/Inputs/F.cpp === --- /dev/null +++ test/Import/cxx-anon-namespace/Inputs/F.cpp @@ -0,0 +1,25 @@ +namespace { +void func1() { +} +} // namespace + +namespace test_namespace1 { +namespace { +void func2() {} +} // namespace +} // namespace test_namespace1 + +namespace test_namespace2 { +namespace { +namespace test_namespace3 { +void func3() {} +} // namespace test_namespace3 +} // namespace +} // namespace test_namespace2 + +namespace { +namespace { +void func4() { +} +} // namespace +} // namespace ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D51142: [ASTImporter] Add test for PackExpansionExpr
This revision was automatically updated to reflect the committed changes. Closed by commit rL340627: [ASTImporter] Add test for PackExpansionExpr (authored by teemperor, committed by ). Herald added a subscriber: llvm-commits. Changed prior to commit: https://reviews.llvm.org/D51142?vs=162104&id=162422#toc Repository: rL LLVM https://reviews.llvm.org/D51142 Files: cfe/trunk/test/Import/pack-expansion-expr/Inputs/F.cpp cfe/trunk/test/Import/pack-expansion-expr/test.cpp Index: cfe/trunk/test/Import/pack-expansion-expr/Inputs/F.cpp === --- cfe/trunk/test/Import/pack-expansion-expr/Inputs/F.cpp +++ cfe/trunk/test/Import/pack-expansion-expr/Inputs/F.cpp @@ -0,0 +1,11 @@ +template +void sink(T... a); + +template +void packfuncT(T... a) { + sink(a...); +} + +void f() { + packfuncT(1, 2, 3); +} Index: cfe/trunk/test/Import/pack-expansion-expr/test.cpp === --- cfe/trunk/test/Import/pack-expansion-expr/test.cpp +++ cfe/trunk/test/Import/pack-expansion-expr/test.cpp @@ -0,0 +1,12 @@ +// RUN: clang-import-test -dump-ast -import %S/Inputs/F.cpp -expression %s | FileCheck %s + +// CHECK: PackExpansionExpr +// CHECK-SAME: '' +// CHECK-NEXT: DeclRefExpr +// CHECK-SAME: 'T...' +// CHECK-SAME: ParmVar +// CHECK-SAME: 'a' + +void expr() { + f(); +} Index: cfe/trunk/test/Import/pack-expansion-expr/Inputs/F.cpp === --- cfe/trunk/test/Import/pack-expansion-expr/Inputs/F.cpp +++ cfe/trunk/test/Import/pack-expansion-expr/Inputs/F.cpp @@ -0,0 +1,11 @@ +template +void sink(T... a); + +template +void packfuncT(T... a) { + sink(a...); +} + +void f() { + packfuncT(1, 2, 3); +} Index: cfe/trunk/test/Import/pack-expansion-expr/test.cpp === --- cfe/trunk/test/Import/pack-expansion-expr/test.cpp +++ cfe/trunk/test/Import/pack-expansion-expr/test.cpp @@ -0,0 +1,12 @@ +// RUN: clang-import-test -dump-ast -import %S/Inputs/F.cpp -expression %s | FileCheck %s + +// CHECK: PackExpansionExpr +// CHECK-SAME: '' +// CHECK-NEXT: DeclRefExpr +// CHECK-SAME: 'T...' +// CHECK-SAME: ParmVar +// CHECK-SAME: 'a' + +void expr() { + f(); +} ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D43871: [modules] No longer include stdlib.h from mm_malloc.h.
teemperor updated this revision to Diff 162902. teemperor added a comment. - Now using UpdateExceptionSpec. - Added a comment to the SemaExceptionSpec.cpp code why we are permitting this. https://reviews.llvm.org/D43871 Files: lib/Headers/mm_malloc.h lib/Sema/SemaExceptionSpec.cpp test/CXX/except/except.spec/Inputs/clang/mm_malloc.h test/CXX/except/except.spec/Inputs/clang/module.modulemap test/CXX/except/except.spec/Inputs/libc/module.modulemap test/CXX/except/except.spec/Inputs/libc/stdlib.h test/CXX/except/except.spec/libc-empty-except.cpp Index: test/CXX/except/except.spec/libc-empty-except.cpp === --- /dev/null +++ test/CXX/except/except.spec/libc-empty-except.cpp @@ -0,0 +1,34 @@ +// RUN: %clang_cc1 -std=c++11 -isystem %S/Inputs/clang -internal-externc-isystem %S/Inputs/libc -fexceptions -fcxx-exceptions -fsyntax-only -verify %s +// RUN: %clang_cc1 -std=c++11 -isystem %S/Inputs/clang -internal-externc-isystem %S/Inputs/libc -fexceptions -fcxx-exceptions -fsyntax-only -verify -DREVERSE %s + +// One of the headers is in a user include, so our redeclaration should fail. +// RUN: %clang_cc1 -std=c++11 -I %S/Inputs/clang -internal-externc-isystem %S/Inputs/libc -fexceptions -fcxx-exceptions -fsyntax-only -verify %s +// RUN: not %clang_cc1 -std=c++11 -isystem %S/Inputs/clang -I %S/Inputs/libc -fexceptions -fcxx-exceptions -fsyntax-only -verify -DREVERSE %s + +// The same test cases again with enabled modules. +// The modules cases *all* pass because we marked both as [system]. +// RUN: rm -rf %t +// RUN: %clang_cc1 -fmodules -fmodules-local-submodule-visibility -fimplicit-module-maps -fmodules-cache-path=%t \ +// RUN:-std=c++11 -isystem %S/Inputs/clang -internal-externc-isystem %S/Inputs/libc -fexceptions -fcxx-exceptions -fsyntax-only -verify %s +// RUN: rm -rf %t +// RUN: %clang_cc1 -fmodules -fmodules-local-submodule-visibility -fimplicit-module-maps -fmodules-cache-path=%t \ +// RUN:-std=c++11 -isystem %S/Inputs/clang -internal-externc-isystem %S/Inputs/libc -fexceptions -fcxx-exceptions -fsyntax-only -verify -DREVERSE %s +// RUN: rm -rf %t +// RUN: %clang_cc1 -fmodules -fmodules-local-submodule-visibility -fimplicit-module-maps -fmodules-cache-path=%t \ +// RUN:-std=c++11 -I %S/Inputs/clang -internal-externc-isystem %S/Inputs/libc -fexceptions -fcxx-exceptions -fsyntax-only -verify %s +// RUN: rm -rf %t +// RUN: %clang_cc1 -fmodules -fmodules-local-submodule-visibility -fimplicit-module-maps -fmodules-cache-path=%t \ +// RUN:-std=c++11 -isystem %S/Inputs/clang -I %S/Inputs/libc -fexceptions -fcxx-exceptions -fsyntax-only -verify -DREVERSE %s + +// expected-no-diagnostics +#ifdef REVERSE +#include "mm_malloc.h" +#include "stdlib.h" +#else +#include "mm_malloc.h" +#include "stdlib.h" +#endif + +void f() { + free(nullptr); +} Index: test/CXX/except/except.spec/Inputs/libc/stdlib.h === --- /dev/null +++ test/CXX/except/except.spec/Inputs/libc/stdlib.h @@ -0,0 +1,2 @@ +// Declare 'free' like glibc with a empty exception specifier. +extern "C" void free(void *ptr) throw(); Index: test/CXX/except/except.spec/Inputs/libc/module.modulemap === --- /dev/null +++ test/CXX/except/except.spec/Inputs/libc/module.modulemap @@ -0,0 +1,4 @@ +module libc [system] { + header "stdlib.h" + export * +} Index: test/CXX/except/except.spec/Inputs/clang/module.modulemap === --- /dev/null +++ test/CXX/except/except.spec/Inputs/clang/module.modulemap @@ -0,0 +1,4 @@ +module builtin [system] { + header "mm_malloc.h" + export * +} Index: test/CXX/except/except.spec/Inputs/clang/mm_malloc.h === --- /dev/null +++ test/CXX/except/except.spec/Inputs/clang/mm_malloc.h @@ -0,0 +1,3 @@ +// missing throw() is allowed in this case as we are in a system header. +// This is a redeclaration possibly from glibc. +extern "C" void free(void *ptr); Index: lib/Sema/SemaExceptionSpec.cpp === --- lib/Sema/SemaExceptionSpec.cpp +++ lib/Sema/SemaExceptionSpec.cpp @@ -236,6 +236,7 @@ const FunctionProtoType *New, SourceLocation NewLoc, bool *MissingExceptionSpecification = nullptr, bool *MissingEmptyExceptionSpecification = nullptr, +bool *ExtraEmptyExceptionSpecification = nullptr, bool AllowNoexceptAllMatchWithNoSpec = false, bool IsOperatorNew = false); /// Determine whether a function has an implicitly-generated exception @@ -259,6 +260,15 @@ return !Ty->hasExceptionSpec(); } +/// Returns true if the given function is a function/builtin with C linkage +/// and from a system header. +static bool isCSystemFuncOrBuiltin(FunctionDecl *D, ASTContext &Context) { + return (D-
[PATCH] D43871: [modules] No longer include stdlib.h from mm_malloc.h.
teemperor marked 3 inline comments as done. teemperor added inline comments. Comment at: test/CXX/except/except.spec/libc-empty-except.cpp:6 +#include "libc-empty-except.h" + +void f() { bruno wrote: > In a testcase like this but using the actual real headers, if you do: > > #include > #include > > does it also compiles fine? (I already answered this offline back then, but for the record again): Yes, we tried this actual code and I think the test case (with the actual reverse fix applied) also should cover this case. Comment at: test/CXX/except/except.spec/libc-empty-except.cpp:27 +#else +#include "mm_malloc.h" +#include "stdlib.h" v.g.vassilev wrote: > Maybe we should reverse the includes here as we discussed offline. Thanks! https://reviews.llvm.org/D43871 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D43871: [modules] No longer include stdlib.h from mm_malloc.h.
teemperor updated this revision to Diff 162940. teemperor marked an inline comment as done. teemperor added a comment. - Reverted unintended change to test case that slipped into the latest diff. https://reviews.llvm.org/D43871 Files: lib/Headers/mm_malloc.h lib/Sema/SemaExceptionSpec.cpp test/CXX/except/except.spec/Inputs/clang/mm_malloc.h test/CXX/except/except.spec/Inputs/clang/module.modulemap test/CXX/except/except.spec/Inputs/libc/module.modulemap test/CXX/except/except.spec/Inputs/libc/stdlib.h test/CXX/except/except.spec/libc-empty-except.cpp Index: test/CXX/except/except.spec/libc-empty-except.cpp === --- /dev/null +++ test/CXX/except/except.spec/libc-empty-except.cpp @@ -0,0 +1,34 @@ +// RUN: %clang_cc1 -std=c++11 -isystem %S/Inputs/clang -internal-externc-isystem %S/Inputs/libc -fexceptions -fcxx-exceptions -fsyntax-only -verify %s +// RUN: %clang_cc1 -std=c++11 -isystem %S/Inputs/clang -internal-externc-isystem %S/Inputs/libc -fexceptions -fcxx-exceptions -fsyntax-only -verify -DREVERSE %s + +// One of the headers is in a user include, so our redeclaration should fail. +// RUN: not %clang_cc1 -std=c++11 -I %S/Inputs/clang -internal-externc-isystem %S/Inputs/libc -fexceptions -fcxx-exceptions -fsyntax-only -verify %s +// RUN: not %clang_cc1 -std=c++11 -isystem %S/Inputs/clang -I %S/Inputs/libc -fexceptions -fcxx-exceptions -fsyntax-only -verify -DREVERSE %s + +// The same test cases again with enabled modules. +// The modules cases *all* pass because we marked both as [system]. +// RUN: rm -rf %t +// RUN: %clang_cc1 -fmodules -fmodules-local-submodule-visibility -fimplicit-module-maps -fmodules-cache-path=%t \ +// RUN:-std=c++11 -isystem %S/Inputs/clang -internal-externc-isystem %S/Inputs/libc -fexceptions -fcxx-exceptions -fsyntax-only -verify %s +// RUN: rm -rf %t +// RUN: %clang_cc1 -fmodules -fmodules-local-submodule-visibility -fimplicit-module-maps -fmodules-cache-path=%t \ +// RUN:-std=c++11 -isystem %S/Inputs/clang -internal-externc-isystem %S/Inputs/libc -fexceptions -fcxx-exceptions -fsyntax-only -verify -DREVERSE %s +// RUN: rm -rf %t +// RUN: %clang_cc1 -fmodules -fmodules-local-submodule-visibility -fimplicit-module-maps -fmodules-cache-path=%t \ +// RUN:-std=c++11 -I %S/Inputs/clang -internal-externc-isystem %S/Inputs/libc -fexceptions -fcxx-exceptions -fsyntax-only -verify %s +// RUN: rm -rf %t +// RUN: %clang_cc1 -fmodules -fmodules-local-submodule-visibility -fimplicit-module-maps -fmodules-cache-path=%t \ +// RUN:-std=c++11 -isystem %S/Inputs/clang -I %S/Inputs/libc -fexceptions -fcxx-exceptions -fsyntax-only -verify -DREVERSE %s + +// expected-no-diagnostics +#ifdef REVERSE +#include "mm_malloc.h" +#include "stdlib.h" +#else +#include "mm_malloc.h" +#include "stdlib.h" +#endif + +void f() { + free(nullptr); +} Index: test/CXX/except/except.spec/Inputs/libc/stdlib.h === --- /dev/null +++ test/CXX/except/except.spec/Inputs/libc/stdlib.h @@ -0,0 +1,2 @@ +// Declare 'free' like glibc with a empty exception specifier. +extern "C" void free(void *ptr) throw(); Index: test/CXX/except/except.spec/Inputs/libc/module.modulemap === --- /dev/null +++ test/CXX/except/except.spec/Inputs/libc/module.modulemap @@ -0,0 +1,4 @@ +module libc [system] { + header "stdlib.h" + export * +} Index: test/CXX/except/except.spec/Inputs/clang/module.modulemap === --- /dev/null +++ test/CXX/except/except.spec/Inputs/clang/module.modulemap @@ -0,0 +1,4 @@ +module builtin [system] { + header "mm_malloc.h" + export * +} Index: test/CXX/except/except.spec/Inputs/clang/mm_malloc.h === --- /dev/null +++ test/CXX/except/except.spec/Inputs/clang/mm_malloc.h @@ -0,0 +1,3 @@ +// missing throw() is allowed in this case as we are in a system header. +// This is a redeclaration possibly from glibc. +extern "C" void free(void *ptr); Index: lib/Sema/SemaExceptionSpec.cpp === --- lib/Sema/SemaExceptionSpec.cpp +++ lib/Sema/SemaExceptionSpec.cpp @@ -236,6 +236,7 @@ const FunctionProtoType *New, SourceLocation NewLoc, bool *MissingExceptionSpecification = nullptr, bool *MissingEmptyExceptionSpecification = nullptr, +bool *ExtraEmptyExceptionSpecification = nullptr, bool AllowNoexceptAllMatchWithNoSpec = false, bool IsOperatorNew = false); /// Determine whether a function has an implicitly-generated exception @@ -259,6 +260,15 @@ return !Ty->hasExceptionSpec(); } +/// Returns true if the given function is a function/builtin with C linkage +/// and from a system header. +static bool isCSystemFuncOrBuiltin(FunctionDecl *D, ASTContext &Context) { +
[PATCH] D43871: [modules] No longer include stdlib.h from mm_malloc.h.
teemperor updated this revision to Diff 164885. teemperor marked 3 inline comments as done. teemperor added a comment. - Removed comment about redeclaring free in the test. That's wasn't correctly formulated and is anyway no longer true now that the test case including this file got bigger. - Fixed formatting in the free declaration. (Thanks, Richard). https://reviews.llvm.org/D43871 Files: lib/Headers/mm_malloc.h lib/Sema/SemaExceptionSpec.cpp test/CXX/except/except.spec/Inputs/clang/mm_malloc.h test/CXX/except/except.spec/Inputs/clang/module.modulemap test/CXX/except/except.spec/Inputs/libc/module.modulemap test/CXX/except/except.spec/Inputs/libc/stdlib.h test/CXX/except/except.spec/libc-empty-except.cpp Index: test/CXX/except/except.spec/libc-empty-except.cpp === --- /dev/null +++ test/CXX/except/except.spec/libc-empty-except.cpp @@ -0,0 +1,34 @@ +// RUN: %clang_cc1 -std=c++11 -isystem %S/Inputs/clang -internal-externc-isystem %S/Inputs/libc -fexceptions -fcxx-exceptions -fsyntax-only -verify %s +// RUN: %clang_cc1 -std=c++11 -isystem %S/Inputs/clang -internal-externc-isystem %S/Inputs/libc -fexceptions -fcxx-exceptions -fsyntax-only -verify -DREVERSE %s + +// One of the headers is in a user include, so our redeclaration should fail. +// RUN: not %clang_cc1 -std=c++11 -I %S/Inputs/clang -internal-externc-isystem %S/Inputs/libc -fexceptions -fcxx-exceptions -fsyntax-only -verify %s +// RUN: not %clang_cc1 -std=c++11 -isystem %S/Inputs/clang -I %S/Inputs/libc -fexceptions -fcxx-exceptions -fsyntax-only -verify -DREVERSE %s + +// The same test cases again with enabled modules. +// The modules cases *all* pass because we marked both as [system]. +// RUN: rm -rf %t +// RUN: %clang_cc1 -fmodules -fmodules-local-submodule-visibility -fimplicit-module-maps -fmodules-cache-path=%t \ +// RUN:-std=c++11 -isystem %S/Inputs/clang -internal-externc-isystem %S/Inputs/libc -fexceptions -fcxx-exceptions -fsyntax-only -verify %s +// RUN: rm -rf %t +// RUN: %clang_cc1 -fmodules -fmodules-local-submodule-visibility -fimplicit-module-maps -fmodules-cache-path=%t \ +// RUN:-std=c++11 -isystem %S/Inputs/clang -internal-externc-isystem %S/Inputs/libc -fexceptions -fcxx-exceptions -fsyntax-only -verify -DREVERSE %s +// RUN: rm -rf %t +// RUN: %clang_cc1 -fmodules -fmodules-local-submodule-visibility -fimplicit-module-maps -fmodules-cache-path=%t \ +// RUN:-std=c++11 -I %S/Inputs/clang -internal-externc-isystem %S/Inputs/libc -fexceptions -fcxx-exceptions -fsyntax-only -verify %s +// RUN: rm -rf %t +// RUN: %clang_cc1 -fmodules -fmodules-local-submodule-visibility -fimplicit-module-maps -fmodules-cache-path=%t \ +// RUN:-std=c++11 -isystem %S/Inputs/clang -I %S/Inputs/libc -fexceptions -fcxx-exceptions -fsyntax-only -verify -DREVERSE %s + +// expected-no-diagnostics +#ifdef REVERSE +#include "mm_malloc.h" +#include "stdlib.h" +#else +#include "mm_malloc.h" +#include "stdlib.h" +#endif + +void f() { + free(nullptr); +} Index: test/CXX/except/except.spec/Inputs/libc/stdlib.h === --- /dev/null +++ test/CXX/except/except.spec/Inputs/libc/stdlib.h @@ -0,0 +1,2 @@ +// Declare 'free' like glibc with a empty exception specifier. +extern "C" void free(void *ptr) throw(); Index: test/CXX/except/except.spec/Inputs/libc/module.modulemap === --- /dev/null +++ test/CXX/except/except.spec/Inputs/libc/module.modulemap @@ -0,0 +1,4 @@ +module libc [system] { + header "stdlib.h" + export * +} Index: test/CXX/except/except.spec/Inputs/clang/module.modulemap === --- /dev/null +++ test/CXX/except/except.spec/Inputs/clang/module.modulemap @@ -0,0 +1,4 @@ +module builtin [system] { + header "mm_malloc.h" + export * +} Index: test/CXX/except/except.spec/Inputs/clang/mm_malloc.h === --- /dev/null +++ test/CXX/except/except.spec/Inputs/clang/mm_malloc.h @@ -0,0 +1,2 @@ +// Missing throw() is allowed in this case as we are in a system header. +extern "C" void free(void *ptr); Index: lib/Sema/SemaExceptionSpec.cpp === --- lib/Sema/SemaExceptionSpec.cpp +++ lib/Sema/SemaExceptionSpec.cpp @@ -246,6 +246,7 @@ const FunctionProtoType *New, SourceLocation NewLoc, bool *MissingExceptionSpecification = nullptr, bool *MissingEmptyExceptionSpecification = nullptr, +bool *ExtraEmptyExceptionSpecification = nullptr, bool AllowNoexceptAllMatchWithNoSpec = false, bool IsOperatorNew = false); /// Determine whether a function has an implicitly-generated exception @@ -269,6 +270,15 @@ return !Ty->hasExceptionSpec(); } +/// Returns true if the given function is a function/builtin with C lin
[PATCH] D43871: [modules] No longer include stdlib.h from mm_malloc.h.
teemperor planned changes to this revision. teemperor marked an inline comment as done. teemperor added a comment. (Just marking this as "Plan changes" because otherwise it's just stuck in my "Waiting on review" queue). https://reviews.llvm.org/D43871 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D34022: Repair 2010-05-31-palignr.c test
teemperor created this revision. This test was silently failing since a long time because it failed to include stdlib.h (as it's running in a freestanding environment). However, because we used just `not clang_cc1` instead of the verify mode, this regression was never noticed and the test was just always passing. This adds -ffreestanding to the invocation, so that tmmintrin.h doesn't indirectly include mm_malloc.h, which in turns includes the unavailable stdlib.h. We also run now in the -verify mode to prevent that we silently regress again. I've also updated the test to no longer check the return value of `_mm_alignr_epi8` as this is also causing it to fail (and it's not really the job of this test to test this). https://reviews.llvm.org/D34022 Files: test/Sema/2010-05-31-palignr.c Index: test/Sema/2010-05-31-palignr.c === --- test/Sema/2010-05-31-palignr.c +++ test/Sema/2010-05-31-palignr.c @@ -1,22 +1,20 @@ -// RUN: not %clang_cc1 -triple x86_64-apple-darwin -emit-llvm -o /dev/null %s +// RUN: %clang_cc1 -ffreestanding -verify -fsyntax-only %s #include +#include extern int i; int main () { -#if defined( __SSSE3__ ) - typedef int16_t vSInt16 __attribute__ ((__vector_size__ (16))); short dtbl[] = {1,2,3,4,5,6,7,8}; vSInt16 *vdtbl = (vSInt16*) dtbl; vSInt16 v0; v0 = *vdtbl; - v0 = _mm_alignr_epi8(v0, v0, i); // expected-error {{argument to '__builtin_ia32_palignr128' must be a constant integer}} + _mm_alignr_epi8(v0, v0, i); // expected-error {{argument to '__builtin_ia32_palignr128' must be a constant integer}} return 0; -#endif } Index: test/Sema/2010-05-31-palignr.c === --- test/Sema/2010-05-31-palignr.c +++ test/Sema/2010-05-31-palignr.c @@ -1,22 +1,20 @@ -// RUN: not %clang_cc1 -triple x86_64-apple-darwin -emit-llvm -o /dev/null %s +// RUN: %clang_cc1 -ffreestanding -verify -fsyntax-only %s #include +#include extern int i; int main () { -#if defined( __SSSE3__ ) - typedef int16_t vSInt16 __attribute__ ((__vector_size__ (16))); short dtbl[] = {1,2,3,4,5,6,7,8}; vSInt16 *vdtbl = (vSInt16*) dtbl; vSInt16 v0; v0 = *vdtbl; - v0 = _mm_alignr_epi8(v0, v0, i); // expected-error {{argument to '__builtin_ia32_palignr128' must be a constant integer}} + _mm_alignr_epi8(v0, v0, i); // expected-error {{argument to '__builtin_ia32_palignr128' must be a constant integer}} return 0; -#endif } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D33366: Fix that global delete operator get's assigned to a submodule.
teemperor updated this revision to Diff 101877. teemperor added a comment. - Just unconditionally calling `setHidden` now. IIRC I had to put the conditions for the module builds because setLocalOwningModule did trigger some tests/asserts, otherwise but the setHidden works fine like this. https://reviews.llvm.org/D33366 Files: lib/Sema/SemaExprCXX.cpp test/Modules/Inputs/local-submodule-globaldelete/a.h test/Modules/Inputs/local-submodule-globaldelete/b.h test/Modules/Inputs/local-submodule-globaldelete/c.h test/Modules/Inputs/local-submodule-globaldelete/module.modulemap test/Modules/local-submodule-globaldelete.cpp Index: test/Modules/local-submodule-globaldelete.cpp === --- /dev/null +++ test/Modules/local-submodule-globaldelete.cpp @@ -0,0 +1,23 @@ +// RUN: rm -rf %t +// RUN: mkdir %t +// RUN: cp -r %S/Inputs/local-submodule-globaldelete %t/local-submodule-globaldelete +// RUN: cd %t +// RUN: %clang_cc1 -fmodules -fmodules-local-submodule-visibility -verify -fmodules-cache-path=%t -fimplicit-module-maps -I local-submodule-globaldelete %s -H + +// expected-no-diagnostics + +// This tests that the global delete operator is not by accident assigned +// to a submodule in local-submodule-visibility mode. This could happen +// when the operator is created on demand when we discover a virtual destructor +// inside a module. + +// Build a module with submodules that each need the global delete operator. +#include "a.h" +// Build another module with another global delete operator to check that +// we didn't introduced ambiguity in the lookup. +#include "c.h" + +// Require a lookup of the global delete operator. +class T { + virtual ~T() {} +}; Index: test/Modules/Inputs/local-submodule-globaldelete/module.modulemap === --- /dev/null +++ test/Modules/Inputs/local-submodule-globaldelete/module.modulemap @@ -0,0 +1,7 @@ +module M { + module a { header "a.h" export * } + module b { header "b.h" export * } +} +module Other { + module c { header "c.h" export * } +} Index: test/Modules/Inputs/local-submodule-globaldelete/c.h === --- /dev/null +++ test/Modules/Inputs/local-submodule-globaldelete/c.h @@ -0,0 +1,6 @@ +#ifndef C_H +#define C_H +class C { + virtual ~C(){}; +}; +#endif Index: test/Modules/Inputs/local-submodule-globaldelete/b.h === --- /dev/null +++ test/Modules/Inputs/local-submodule-globaldelete/b.h @@ -0,0 +1,6 @@ +#ifndef B_H +#define B_H +class B { + virtual ~B(){}; +}; +#endif Index: test/Modules/Inputs/local-submodule-globaldelete/a.h === --- /dev/null +++ test/Modules/Inputs/local-submodule-globaldelete/a.h @@ -0,0 +1,6 @@ +#ifndef A_H +#define A_H +class A { + virtual ~A(){}; +}; +#endif Index: lib/Sema/SemaExprCXX.cpp === --- lib/Sema/SemaExprCXX.cpp +++ lib/Sema/SemaExprCXX.cpp @@ -2658,6 +2658,8 @@ Context, GlobalCtx, SourceLocation(), SourceLocation(), Name, FnType, /*TInfo=*/nullptr, SC_None, false, true); Alloc->setImplicit(); +// Global allocation functions should always be visible. +Alloc->setHidden(false); // Implicit sized deallocation functions always have default visibility. Alloc->addAttr( Index: test/Modules/local-submodule-globaldelete.cpp === --- /dev/null +++ test/Modules/local-submodule-globaldelete.cpp @@ -0,0 +1,23 @@ +// RUN: rm -rf %t +// RUN: mkdir %t +// RUN: cp -r %S/Inputs/local-submodule-globaldelete %t/local-submodule-globaldelete +// RUN: cd %t +// RUN: %clang_cc1 -fmodules -fmodules-local-submodule-visibility -verify -fmodules-cache-path=%t -fimplicit-module-maps -I local-submodule-globaldelete %s -H + +// expected-no-diagnostics + +// This tests that the global delete operator is not by accident assigned +// to a submodule in local-submodule-visibility mode. This could happen +// when the operator is created on demand when we discover a virtual destructor +// inside a module. + +// Build a module with submodules that each need the global delete operator. +#include "a.h" +// Build another module with another global delete operator to check that +// we didn't introduced ambiguity in the lookup. +#include "c.h" + +// Require a lookup of the global delete operator. +class T { + virtual ~T() {} +}; Index: test/Modules/Inputs/local-submodule-globaldelete/module.modulemap === --- /dev/null +++ test/Modules/Inputs/local-submodule-globaldelete/module.modulemap @@ -0,0 +1,7 @@ +module M { + module a { header "a.h" export * } + module b { header "b.h" export * } +} +module Other { + module c { he
[PATCH] D34182: [analyzer] Performance optimizations for the CloneChecker
teemperor created this revision. Herald added a subscriber: xazax.hun. This patch aims at optimizing the CloneChecker for larger programs. Before this patch we took around 102 seconds to analyze sqlite3 with a complexity value of 50. After this patch we now take 2.1 seconds to analyze sqlite3. The biggest performance optimization is that we now put the constraint for group size before the constraint for the complexity. The group size constraint is much faster in comparison to the complexity constraint as it only does a simple integer comparison. The complexity constraint on the other hand actually traverses each Stmt and even checks the macro stack, so it is obviously not able to handle larger amounts of incoming clones. The new order filters out all the single-clone groups that the type II constraint generates in a faster way before passing the fewer remaining clones to the complexity constraint. This reduced runtime by around 95%. The other change is that we also delay the verification part of the type II clones back in the chain of constraints. This required to split up the constraint into two parts - a verification and a hash constraint (which is also making it more similar to the original design of the clone detection algorithm). The reasoning for this is the same as before: The verification constraint has to traverse many statements and shouldn't be at the start of the constraint chain. However, as the type II hashing has to be the first step in our algorithm, we have no other choice but split this constrain into two different ones. Now our group size and complexity constrains filter out a chunk of the clones before they reach the slow verification step, which reduces the runtime by around 8%. I also kept the full type II constraint around - that now just calls it's two sub-constraints - in case someone doesn't care about the performance benefits of doing this. https://reviews.llvm.org/D34182 Files: include/clang/Analysis/CloneDetection.h lib/Analysis/CloneDetection.cpp lib/StaticAnalyzer/Checkers/CloneChecker.cpp Index: lib/StaticAnalyzer/Checkers/CloneChecker.cpp === --- lib/StaticAnalyzer/Checkers/CloneChecker.cpp +++ lib/StaticAnalyzer/Checkers/CloneChecker.cpp @@ -78,9 +78,10 @@ // because reportSuspiciousClones() wants to search them for errors. std::vector AllCloneGroups; - Detector.findClones(AllCloneGroups, RecursiveCloneTypeIIConstraint(), - MinComplexityConstraint(MinComplexity), - MinGroupSizeConstraint(2), OnlyLargestCloneConstraint()); + Detector.findClones( + AllCloneGroups, RecursiveCloneTypeIIHashConstraint(), + MinGroupSizeConstraint(2), MinComplexityConstraint(MinComplexity), + RecursiveCloneTypeIIVerifyConstraint(), OnlyLargestCloneConstraint()); if (ReportSuspiciousClones) reportSuspiciousClones(BR, Mgr, AllCloneGroups); Index: lib/Analysis/CloneDetection.cpp === --- lib/Analysis/CloneDetection.cpp +++ lib/Analysis/CloneDetection.cpp @@ -381,9 +381,17 @@ return HashCode; } -size_t RecursiveCloneTypeIIConstraint::saveHash( -const Stmt *S, const Decl *D, -std::vector> &StmtsByHash) { +/// Generates and saves a hash code for the given Stmt. +/// \param S The given Stmt. +/// \param D The Decl containing S. +/// \param StmtsByHash Output parameter that will contain the hash codes for +///each StmtSequence in the given Stmt. +/// \return The hash code of the given Stmt. +/// +/// If the given Stmt is a CompoundStmt, this method will also generate +/// hashes for all possible StmtSequences in the children of this Stmt. +size_t saveHash(const Stmt *S, const Decl *D, +std::vector> &StmtsByHash) { llvm::MD5 Hash; ASTContext &Context = D->getASTContext(); @@ -474,6 +482,14 @@ void RecursiveCloneTypeIIConstraint::constrain( std::vector &Sequences) { + RecursiveCloneTypeIIHashConstraint Hash; + Hash.constrain(Sequences); + RecursiveCloneTypeIIVerifyConstraint Verify; + Verify.constrain(Sequences); +} + +void RecursiveCloneTypeIIHashConstraint::constrain( +std::vector &Sequences) { // FIXME: Maybe we can do this in-place and don't need this additional vector. std::vector Result; @@ -513,8 +529,7 @@ for (; i < StmtsByHash.size(); ++i) { // A different hash value means we have reached the end of the sequence. -if (PrototypeHash != StmtsByHash[i].first || -!areSequencesClones(StmtsByHash[i].second, Current.second)) { +if (PrototypeHash != StmtsByHash[i].first) { // The current sequence could be the start of a new CloneGroup. So we // decrement i so that we visit it again in the outer loop. // Note: i can never be 0 at this point because we are just comparing @@ -537,6 +552,14 @@ Sequences = Result
[PATCH] D34182: [analyzer] Performance optimizations for the CloneChecker
teemperor added inline comments. Comment at: include/clang/Analysis/CloneDetection.h:263 +public: + void constrain(std::vector &Sequences); +}; v.g.vassilev wrote: > Could we typedef `std::vector` into > `CloneDetector::CloneGroups`? Yes, I'll do this in another patch for the whole CloneDetector code base. https://reviews.llvm.org/D34182 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D32341: Fix a bug that warnings generated with -M or -MM flags
teemperor accepted this revision. teemperor added a comment. This revision is now accepted and ready to land. LGTM, good job! (Sorry for the delay, I think I got interrupted here by the GSoC start...) https://reviews.llvm.org/D32341 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D32646: Fix a bug that -Wmissing-braces fires on system headers
teemperor added a comment. Everything beside this last test case seems to be handled. And from what I remember there was a longer discussion how to properly handle this case and so this review got stuck. Can we add this last test case with a FIXME and then get this merged? https://reviews.llvm.org/D32646 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D31320: [analyzer] Teach CloneDetection about Qt Meta-Object Compiler
teemperor requested changes to this revision. teemperor added a comment. This revision now requires changes to proceed. Sorry for the delay, we got stuck because hard coding a certain file pattern into the clang source code doesn't seem to be a optimal solution (e.g. every user that has a different set of generated files needs to patch clang to hide his specific reports). I would prefer if we could get this into a variable that the user can change dynamically. Would it solve your use case if allow specifying file patterns via the command line like this `-analyzer-config alpha.clone.CloneChecker:IgnoredFiles=moc_*;*.pb.h;*.pb.cc`? If yes, please update this PR accordingly and then I think this patch is good to go. Thanks for the work! Repository: rL LLVM https://reviews.llvm.org/D31320 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D34182: [analyzer] Performance optimizations for the CloneChecker
teemperor updated this revision to Diff 102700. teemperor marked an inline comment as done. teemperor added a comment. - made saveHash static. https://reviews.llvm.org/D34182 Files: include/clang/Analysis/CloneDetection.h lib/Analysis/CloneDetection.cpp lib/StaticAnalyzer/Checkers/CloneChecker.cpp Index: lib/StaticAnalyzer/Checkers/CloneChecker.cpp === --- lib/StaticAnalyzer/Checkers/CloneChecker.cpp +++ lib/StaticAnalyzer/Checkers/CloneChecker.cpp @@ -78,9 +78,10 @@ // because reportSuspiciousClones() wants to search them for errors. std::vector AllCloneGroups; - Detector.findClones(AllCloneGroups, RecursiveCloneTypeIIConstraint(), - MinComplexityConstraint(MinComplexity), - MinGroupSizeConstraint(2), OnlyLargestCloneConstraint()); + Detector.findClones( + AllCloneGroups, RecursiveCloneTypeIIHashConstraint(), + MinGroupSizeConstraint(2), MinComplexityConstraint(MinComplexity), + RecursiveCloneTypeIIVerifyConstraint(), OnlyLargestCloneConstraint()); if (ReportSuspiciousClones) reportSuspiciousClones(BR, Mgr, AllCloneGroups); Index: lib/Analysis/CloneDetection.cpp === --- lib/Analysis/CloneDetection.cpp +++ lib/Analysis/CloneDetection.cpp @@ -381,9 +381,18 @@ return HashCode; } -size_t RecursiveCloneTypeIIConstraint::saveHash( -const Stmt *S, const Decl *D, -std::vector> &StmtsByHash) { +/// Generates and saves a hash code for the given Stmt. +/// \param S The given Stmt. +/// \param D The Decl containing S. +/// \param StmtsByHash Output parameter that will contain the hash codes for +///each StmtSequence in the given Stmt. +/// \return The hash code of the given Stmt. +/// +/// If the given Stmt is a CompoundStmt, this method will also generate +/// hashes for all possible StmtSequences in the children of this Stmt. +static size_t +saveHash(const Stmt *S, const Decl *D, + std::vector> &StmtsByHash) { llvm::MD5 Hash; ASTContext &Context = D->getASTContext(); @@ -474,6 +483,14 @@ void RecursiveCloneTypeIIConstraint::constrain( std::vector &Sequences) { + RecursiveCloneTypeIIHashConstraint Hash; + Hash.constrain(Sequences); + RecursiveCloneTypeIIVerifyConstraint Verify; + Verify.constrain(Sequences); +} + +void RecursiveCloneTypeIIHashConstraint::constrain( +std::vector &Sequences) { // FIXME: Maybe we can do this in-place and don't need this additional vector. std::vector Result; @@ -513,8 +530,7 @@ for (; i < StmtsByHash.size(); ++i) { // A different hash value means we have reached the end of the sequence. -if (PrototypeHash != StmtsByHash[i].first || -!areSequencesClones(StmtsByHash[i].second, Current.second)) { +if (PrototypeHash != StmtsByHash[i].first) { // The current sequence could be the start of a new CloneGroup. So we // decrement i so that we visit it again in the outer loop. // Note: i can never be 0 at this point because we are just comparing @@ -537,6 +553,14 @@ Sequences = Result; } +void RecursiveCloneTypeIIVerifyConstraint::constrain( +std::vector &Sequences) { + CloneConstraint::splitCloneGroups( + Sequences, [](const StmtSequence &A, const StmtSequence &B) { +return areSequencesClones(A, B); + }); +} + size_t MinComplexityConstraint::calculateStmtComplexity( const StmtSequence &Seq, const std::string &ParentMacroStack) { if (Seq.empty()) Index: include/clang/Analysis/CloneDetection.h === --- include/clang/Analysis/CloneDetection.h +++ include/clang/Analysis/CloneDetection.h @@ -254,20 +254,37 @@ /// Searches all children of the given clones for type II clones (i.e. they are /// identical in every aspect beside the used variable names). +/// +/// This constraint is also available to be executed in two phases, see +/// RecursiveCloneTypeIIHashConstraint and RecursiveCloneTypeIIVerifyConstraint +/// for more. class RecursiveCloneTypeIIConstraint { +public: + void constrain(std::vector &Sequences); +}; - /// Generates and saves a hash code for the given Stmt. - /// \param S The given Stmt. - /// \param D The Decl containing S. - /// \param StmtsByHash Output parameter that will contain the hash codes for - ///each StmtSequence in the given Stmt. - /// \return The hash code of the given Stmt. - /// - /// If the given Stmt is a CompoundStmt, this method will also generate - /// hashes for all possible StmtSequences in the children of this Stmt. - size_t saveHash(const Stmt *S, const Decl *D, - std::vector> &StmtsByHash); +/// This constraint performs only the hashing part of the +/// RecursiveCloneTypeIIConstraint. +/// +/// It is supposed to be fast and can be used at the fron
[PATCH] D31320: [analyzer] Teach CloneDetection about Qt Meta-Object Compiler
teemperor added a comment. See my inline comments about technical changes, but otherwise this looks ready to land. Please update and I'll give green light ASAP. Thanks! Comment at: lib/Analysis/CloneDetection.cpp:375 +const Decl *D = S.getContainingDecl(); +const SourceManager &SM = D->getASTContext().getSourceManager(); +std::string Filename = std::string(SM.getFilename(D->getLocation())); You can skip the `const Decl *D = S.getContainingDecl();` and just do `const SourceManager &SM = S.getASTContext().getSourceManager();` Comment at: lib/Analysis/CloneDetection.cpp:378 +// Get Basename +const size_t LastSlash = Filename.find_last_of("\\/"); +if (LastSlash != std::string::npos) Let's get the basename with the LLVM path class instead: http://llvm.org/docs/doxygen/html/namespacellvm_1_1sys_1_1path.html#a799b002e67dcf41330fa8d6fa11823dc E.g. `moc_test\.cpp` is a valid filename on Linux and then this code isn't doing the right thing. Comment at: lib/Analysis/CloneDetection.cpp:383 +if (LastDot != std::string::npos) + Filename.erase(LastDot); +llvm::Regex R(StringRef("^(" + IgnoredFilesPattern.str() + "$)")); Hmm, we can't filter by file extension this way? Can we remove this extension stripping and just make people type the file extension in the filter, this feels more intuitive. Comment at: lib/Analysis/CloneDetection.cpp:384 + Filename.erase(LastDot); +llvm::Regex R(StringRef("^(" + IgnoredFilesPattern.str() + "$)")); +if (R.match(StringRef(Filename))) Artem suggested we could move this Regex out of the loop, I think we should even make it a member of the AutoGeneratedCloneConstraint so that we only parse/generate the regex state machine once per invocation. Currently we reparse this Regex a few thousand times and performance is quite important in this Checker. Repository: rL LLVM https://reviews.llvm.org/D31320 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D31320: [analyzer] Teach CloneDetection about Qt Meta-Object Compiler
teemperor accepted this revision. teemperor added a comment. This revision is now accepted and ready to land. Please check the last inline comment and then feel free to commit it with the suggested fix. And I wanted to wait for review on the other performance patches, so you can push this now. Thanks for the work! Comment at: lib/Analysis/CloneDetection.cpp:375 + std::string Error; + llvm::Regex R(StringRef("^(" + IgnoredFilesPattern.str() + "$)")); + if (!R.isValid(Error)) Sorry, I what I wanted to suggest is: make this a member variable of the `AutoGeneratedCloneConstraint` class. Moving this out of the loop actually doesn't change anything for the checker (because the first constraint get's a list of single-sequence groups, so we still call this function N times for N functions). So something like `llvm::Regex AutoGeneratedCloneConstraint::IgnoredFilesRegex` :) Repository: rL LLVM https://reviews.llvm.org/D31320 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D31320: [analyzer] Teach CloneDetection about Qt Meta-Object Compiler
teemperor accepted this revision. teemperor added a comment. LGTM, thanks for the patch! Repository: rL LLVM https://reviews.llvm.org/D31320 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D33383: [GSoC] Flag value completion for clang
teemperor accepted this revision. teemperor added a comment. LGTM. https://reviews.llvm.org/D33383 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D31320: [analyzer] Teach CloneDetection about Qt Meta-Object Compiler
teemperor added inline comments. Comment at: cfe/trunk/include/clang/Analysis/CloneDetection.h:324 +struct AutoGeneratedCloneConstraint { + StringRef IgnoredFilesPattern; xiangzhai wrote: > v.g.vassilev wrote: > > Shouldn't the name be more generic. What this essentially does is to filter > > out false positives according to a regex... > At the very beginning, it is by regex match the filename, it is still very > rough! but in future it is able to filter by looking for > `QT_BEGIN_MOC_NAMESPACE` macro or `qt_meta_ prefix` function in the > ASTContext? and there might be other auto-generated mechanism for different > framework, such as Gtk and sort of open source GUI libraries. so perhaps > `AutoGeneratedCloneConstraint` is better name, I am not good at naming, it is > difficult to name my little kid :) Yeah, maybe we should have named this FilenamePatternConstraint or something like that... Repository: rL LLVM https://reviews.llvm.org/D31320 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D34353: [analyzer] Teach CloneDetection about Qt Meta-Object Compiler to filter auto generated files
teemperor accepted this revision. teemperor added a comment. This revision is now accepted and ready to land. LGTM, thanks! Repository: rL LLVM https://reviews.llvm.org/D34353 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D34439: Add GCC's noexcept-type alias for c++1z-compat-mangling
teemperor created this revision. GCC has named this `-Wnoexcept-type`, so let's add an alias to stay compatible with the GCC flags. https://reviews.llvm.org/D34439 Files: include/clang/Basic/DiagnosticGroups.td test/SemaCXX/cxx1z-noexcept-function-type.cpp Index: test/SemaCXX/cxx1z-noexcept-function-type.cpp === --- test/SemaCXX/cxx1z-noexcept-function-type.cpp +++ test/SemaCXX/cxx1z-noexcept-function-type.cpp @@ -1,6 +1,7 @@ // RUN: %clang_cc1 -std=c++14 -verify -fexceptions -fcxx-exceptions %s // RUN: %clang_cc1 -std=c++1z -verify -fexceptions -fcxx-exceptions %s -Wno-dynamic-exception-spec // RUN: %clang_cc1 -std=c++14 -verify -fexceptions -fcxx-exceptions -Wno-c++1z-compat-mangling -DNO_COMPAT_MANGLING %s +// RUN: %clang_cc1 -std=c++14 -verify -fexceptions -fcxx-exceptions -Wno-noexcept-type -DNO_COMPAT_MANGLING %s #if __cplusplus > 201402L Index: include/clang/Basic/DiagnosticGroups.td === --- include/clang/Basic/DiagnosticGroups.td +++ include/clang/Basic/DiagnosticGroups.td @@ -150,6 +150,8 @@ def FormatExtraArgs : DiagGroup<"format-extra-args">; def FormatZeroLength : DiagGroup<"format-zero-length">; def CXX1zCompatMangling : DiagGroup<"c++1z-compat-mangling">; +// Name of this warning in GCC. +def NoexceptType : DiagGroup<"noexcept-type", [CXX1zCompatMangling]>; // Warnings for C++1y code which is not compatible with prior C++ standards. def CXXPre14Compat : DiagGroup<"c++98-c++11-compat">; Index: test/SemaCXX/cxx1z-noexcept-function-type.cpp === --- test/SemaCXX/cxx1z-noexcept-function-type.cpp +++ test/SemaCXX/cxx1z-noexcept-function-type.cpp @@ -1,6 +1,7 @@ // RUN: %clang_cc1 -std=c++14 -verify -fexceptions -fcxx-exceptions %s // RUN: %clang_cc1 -std=c++1z -verify -fexceptions -fcxx-exceptions %s -Wno-dynamic-exception-spec // RUN: %clang_cc1 -std=c++14 -verify -fexceptions -fcxx-exceptions -Wno-c++1z-compat-mangling -DNO_COMPAT_MANGLING %s +// RUN: %clang_cc1 -std=c++14 -verify -fexceptions -fcxx-exceptions -Wno-noexcept-type -DNO_COMPAT_MANGLING %s #if __cplusplus > 201402L Index: include/clang/Basic/DiagnosticGroups.td === --- include/clang/Basic/DiagnosticGroups.td +++ include/clang/Basic/DiagnosticGroups.td @@ -150,6 +150,8 @@ def FormatExtraArgs : DiagGroup<"format-extra-args">; def FormatZeroLength : DiagGroup<"format-zero-length">; def CXX1zCompatMangling : DiagGroup<"c++1z-compat-mangling">; +// Name of this warning in GCC. +def NoexceptType : DiagGroup<"noexcept-type", [CXX1zCompatMangling]>; // Warnings for C++1y code which is not compatible with prior C++ standards. def CXXPre14Compat : DiagGroup<"c++98-c++11-compat">; ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D34439: Add GCC's noexcept-type alias for c++1z-compat-mangling
teemperor added a comment. @ahatanak I think we can leave the more expressive clang name for this warning and just add the bit cryptic GCC name for compability. But I don't have a strong opinion on this. https://reviews.llvm.org/D34439 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D34607: [Bash-autocompletion] Check clang version in Bash
teemperor accepted this revision. teemperor added a comment. Works as intended, good job! https://reviews.llvm.org/D34607 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D43809: Add possibility to specify output stream for CompilerInstance
teemperor requested changes to this revision. teemperor added a comment. This revision now requires changes to proceed. See the inline comments. Please run clang-format over this patch after addressing them (there are a few indentation issues). Comment at: include/clang/Frontend/CompilerInstance.h:779 + void SetOutputStream(std::unique_ptr OutStream) { +OutputStream = std::move(OutStream); "Set" -> "set", LLVM code style requires lower case first letters in function names (even though it's sadly may be inconsistent with other code that's still using the other style...) Comment at: include/clang/Frontend/CompilerInstance.h:783 + + std::unique_ptr GetOutputStream() { +return std::move(OutputStream); LLVM convention is to call this `takeX` and not `getX` when it moves the member `OutputStream` to the caller. `get` usually doesn't reset the member variable. Comment at: lib/Frontend/CompilerInstance.cpp:65 + ThePCHContainerOperations(std::move(PCHContainerOps)), + OutputStream(nullptr) { // Don't allow this to invalidate buffers in use by others. Don't think we need that. Repository: rC Clang https://reviews.llvm.org/D43809 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D43809: Add possibility to specify output stream for CompilerInstance
teemperor accepted this revision. teemperor added a comment. This revision is now accepted and ready to land. LGTM! Repository: rC Clang https://reviews.llvm.org/D43809 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D43871: [modules] No longer include stdlib.h from mm_malloc.h.
teemperor created this revision. teemperor added reviewers: rsmith, v.g.vassilev, chandlerc. The GNU C library includes headers from the `_Builtin_intrinsics` module. As the `_Builtin_intrinsics` module via the `mm_malloc.h` header also includes the `stdlib.h` header from libc, we get a cyclic dependency with `-fmodules` enabled. The best way to solve this is seems to be removing the `stdlib.h` include from `mm_malloc.h` and make the redeclarations in there work without the include. This patch is doing this in two steps: 1. It reverts some of the changes done in r119958 which re-added the include to `mm_malloc.h` and removed the forward declarations. 2. It expands the workaround in Sema::CheckEquivalentExceptionSpec to also work in the case where we first declare a function with a missing empty exception specification and then redeclare it with an empty exception specification. The second part is necessary because the current workaround only works in the case where the redeclaration is missing an empty exception specification and the `#include ` before our redeclaration ensured that we always have our declarations in this expected order. I compiled a few projects with this patch (curl, ncnn, opencv, openjpeg, scummvm, sqlite, zlib), and it doesn't seem to break any compilation there. Repository: rC Clang https://reviews.llvm.org/D43871 Files: lib/Headers/mm_malloc.h lib/Sema/SemaExceptionSpec.cpp test/CXX/except/except.spec/libc-empty-except-sys/libc-empty-except.h test/CXX/except/except.spec/libc-empty-except.cpp Index: test/CXX/except/except.spec/libc-empty-except.cpp === --- /dev/null +++ test/CXX/except/except.spec/libc-empty-except.cpp @@ -0,0 +1,9 @@ +// RUN: %clang_cc1 -std=c++11 -isystem %S/libc-empty-except-sys -fexceptions -fcxx-exceptions -fsyntax-only -verify %s +// RUN: not %clang_cc1 -std=c++11 -I %S/libc-empty-except-sys -fexceptions -fcxx-exceptions -fsyntax-only -verify %s + +// expected-no-diagnostics +#include "libc-empty-except.h" + +void f() { + free(nullptr); +} Index: test/CXX/except/except.spec/libc-empty-except-sys/libc-empty-except.h === --- /dev/null +++ test/CXX/except/except.spec/libc-empty-except-sys/libc-empty-except.h @@ -0,0 +1,3 @@ +extern "C" void free(void *ptr) throw(); +// missing throw() is allowed in this case as we are in a system header. +extern "C" void free(void *ptr); Index: lib/Sema/SemaExceptionSpec.cpp === --- lib/Sema/SemaExceptionSpec.cpp +++ lib/Sema/SemaExceptionSpec.cpp @@ -213,6 +213,7 @@ const FunctionProtoType *New, SourceLocation NewLoc, bool *MissingExceptionSpecification = nullptr, bool *MissingEmptyExceptionSpecification = nullptr, +bool *ExtraEmptyExceptionSpecification = nullptr, bool AllowNoexceptAllMatchWithNoSpec = false, bool IsOperatorNew = false); /// Determine whether a function has an implicitly-generated exception @@ -236,6 +237,15 @@ return !Ty->hasExceptionSpec(); } +/// Returns true if the given function is a function/builtin with C linkage +/// and from a system header. +static bool isCSystemFuncOrBuiltin(FunctionDecl *D, ASTContext &Context) { + return (D->getLocation().isInvalid() || + Context.getSourceManager().isInSystemHeader(D->getLocation()) || + D->getBuiltinID()) && + D->isExternC(); +} + bool Sema::CheckEquivalentExceptionSpec(FunctionDecl *Old, FunctionDecl *New) { // Just completely ignore this under -fno-exceptions prior to C++17. // In C++17 onwards, the exception specification is part of the type and @@ -247,6 +257,14 @@ bool IsOperatorNew = OO == OO_New || OO == OO_Array_New; bool MissingExceptionSpecification = false; bool MissingEmptyExceptionSpecification = false; + bool ExtraEmptyExceptionSpecification = false; + bool *AllowExtraEmptyExceptionSpecification = nullptr; + + // If both functions are from C functions from system headers, we want to + // know if the redeclaration has an additional empty exception specification. + if (isCSystemFuncOrBuiltin(Old, Context) && + isCSystemFuncOrBuiltin(New, Context)) +AllowExtraEmptyExceptionSpecification = &ExtraEmptyExceptionSpecification; unsigned DiagID = diag::err_mismatched_exception_spec; bool ReturnValueOnError = true; @@ -258,11 +276,12 @@ // Check the types as written: they must match before any exception // specification adjustment is applied. if (!CheckEquivalentExceptionSpecImpl( -*this, PDiag(DiagID), PDiag(diag::note_previous_declaration), -Old->getType()->getAs(), Old->getLocation(), -New->getType()->getAs(), New->getLocation(), -&MissingExceptionSpecification, &MissingEmptyExceptionSpecification, -/*AllowNoexceptAllMatchWithNoSpec=*/true, IsOperatorNew)) { + *this, PDiag(DiagID), PDiag
[PATCH] D39342: [Bash-autocompletion] Pass all flags in shell command-line to Clang
teemperor accepted this revision. teemperor added a comment. This revision is now accepted and ready to land. As this will land in clang 7, can you add a note to the release notes that this breaks backwards compatibility for this interface (can be another commit)? Also, we should point out that this is the only API change this interface will have in the foreseeable future. https://reviews.llvm.org/D39342 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D44191: Add Clang ReleaseNotes that --autocomplete breaks backward compatibily
teemperor accepted this revision. teemperor added a comment. This revision is now accepted and ready to land. LGTM! https://reviews.llvm.org/D44191 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D48062: Fix that AlignedAllocation.h doesn't compile because of VersionTuple
teemperor created this revision. https://reviews.llvm.org/rL334399 put VersionTuple in the llvm namespace, but this header still assumes it's in the clang namespace. This leads to compilation failures with enabled modules when building Clang. Repository: rC Clang https://reviews.llvm.org/D48062 Files: include/clang/Basic/AlignedAllocation.h Index: include/clang/Basic/AlignedAllocation.h === --- include/clang/Basic/AlignedAllocation.h +++ include/clang/Basic/AlignedAllocation.h @@ -22,18 +22,18 @@ namespace clang { -inline VersionTuple alignedAllocMinVersion(llvm::Triple::OSType OS) { +inline llvm::VersionTuple alignedAllocMinVersion(llvm::Triple::OSType OS) { switch (OS) { default: break; case llvm::Triple::Darwin: case llvm::Triple::MacOSX: // Earliest supporting version is 10.13. -return VersionTuple(10U, 13U); +return llvm::VersionTuple(10U, 13U); case llvm::Triple::IOS: case llvm::Triple::TvOS: // Earliest supporting version is 11.0.0. -return VersionTuple(11U); +return llvm::VersionTuple(11U); case llvm::Triple::WatchOS: // Earliest supporting version is 4.0.0. -return VersionTuple(4U); +return llvm::VersionTuple(4U); } llvm_unreachable("Unexpected OS"); Index: include/clang/Basic/AlignedAllocation.h === --- include/clang/Basic/AlignedAllocation.h +++ include/clang/Basic/AlignedAllocation.h @@ -22,18 +22,18 @@ namespace clang { -inline VersionTuple alignedAllocMinVersion(llvm::Triple::OSType OS) { +inline llvm::VersionTuple alignedAllocMinVersion(llvm::Triple::OSType OS) { switch (OS) { default: break; case llvm::Triple::Darwin: case llvm::Triple::MacOSX: // Earliest supporting version is 10.13. -return VersionTuple(10U, 13U); +return llvm::VersionTuple(10U, 13U); case llvm::Triple::IOS: case llvm::Triple::TvOS: // Earliest supporting version is 11.0.0. -return VersionTuple(11U); +return llvm::VersionTuple(11U); case llvm::Triple::WatchOS: // Earliest supporting version is 4.0.0. -return VersionTuple(4U); +return llvm::VersionTuple(4U); } llvm_unreachable("Unexpected OS"); ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D48062: Fix that AlignedAllocation.h doesn't compile because of VersionTuple
This revision was not accepted when it landed; it landed in state "Needs Review". This revision was automatically updated to reflect the committed changes. Closed by commit rC334471: Fix that AlignedAllocation.h doesn't compile because of VersionTuple (authored by teemperor, committed by ). Repository: rC Clang https://reviews.llvm.org/D48062 Files: include/clang/Basic/AlignedAllocation.h Index: include/clang/Basic/AlignedAllocation.h === --- include/clang/Basic/AlignedAllocation.h +++ include/clang/Basic/AlignedAllocation.h @@ -22,18 +22,18 @@ namespace clang { -inline VersionTuple alignedAllocMinVersion(llvm::Triple::OSType OS) { +inline llvm::VersionTuple alignedAllocMinVersion(llvm::Triple::OSType OS) { switch (OS) { default: break; case llvm::Triple::Darwin: case llvm::Triple::MacOSX: // Earliest supporting version is 10.13. -return VersionTuple(10U, 13U); +return llvm::VersionTuple(10U, 13U); case llvm::Triple::IOS: case llvm::Triple::TvOS: // Earliest supporting version is 11.0.0. -return VersionTuple(11U); +return llvm::VersionTuple(11U); case llvm::Triple::WatchOS: // Earliest supporting version is 4.0.0. -return VersionTuple(4U); +return llvm::VersionTuple(4U); } llvm_unreachable("Unexpected OS"); Index: include/clang/Basic/AlignedAllocation.h === --- include/clang/Basic/AlignedAllocation.h +++ include/clang/Basic/AlignedAllocation.h @@ -22,18 +22,18 @@ namespace clang { -inline VersionTuple alignedAllocMinVersion(llvm::Triple::OSType OS) { +inline llvm::VersionTuple alignedAllocMinVersion(llvm::Triple::OSType OS) { switch (OS) { default: break; case llvm::Triple::Darwin: case llvm::Triple::MacOSX: // Earliest supporting version is 10.13. -return VersionTuple(10U, 13U); +return llvm::VersionTuple(10U, 13U); case llvm::Triple::IOS: case llvm::Triple::TvOS: // Earliest supporting version is 11.0.0. -return VersionTuple(11U); +return llvm::VersionTuple(11U); case llvm::Triple::WatchOS: // Earliest supporting version is 4.0.0. -return VersionTuple(4U); +return llvm::VersionTuple(4U); } llvm_unreachable("Unexpected OS"); ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D53639: [autocompletion] Handle the space before pressing tab
teemperor requested changes to this revision. teemperor added inline comments. This revision now requires changes to proceed. Comment at: clang/lib/Driver/Driver.cpp:1514 + // which should end up in a file completion. + bool HasSpace = false; + if (PassedFlags.endswith(",")) Why not `const bool HasSpace = PassedFlags.endswith(",")`? Comment at: clang/lib/Driver/Driver.cpp:1539 + if (HasSpace && !Flags.empty()) { +llvm::outs() << '\n'; +return; Can you describe in the comment why printing a newline and returning here is the correct behavior? It's not obvious to the reader (including me). https://reviews.llvm.org/D53639 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D53639: [autocompletion] Handle the space before pressing tab
teemperor accepted this revision. teemperor added a comment. This revision is now accepted and ready to land. LGTM! https://reviews.llvm.org/D53639 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D56651: [ASTImporter] Fix importing OperatorDelete from CXXConstructorDecl
teemperor created this revision. teemperor added reviewers: shafik, martong, a_sidorin. Herald added subscribers: cfe-commits, rnkovacs. Herald added a reviewer: a.sidorin. Shafik found out that importing a CXXConstructorDecl will create a translation unit that causes Clang's CodeGen to crash. The reason for that is that we don't copy the OperatorDelete from the CXXConstructorDecl when importing. This patch fixes it and adds a test case for that. Repository: rC Clang https://reviews.llvm.org/D56651 Files: lib/AST/ASTImporter.cpp test/Import/destructor/Inputs/F.cpp test/Import/destructor/test.cpp Index: test/Import/destructor/test.cpp === --- /dev/null +++ test/Import/destructor/test.cpp @@ -0,0 +1,10 @@ +// RUN: clang-import-test -dump-ast -import %S/Inputs/F.cpp -expression %s + +// Triggers the deserialization of B's destructor. +B b1; + +// CHECK: CXXDestructorDecl + +// CHECK-NEXT: ~B 'void () noexcept' virtual +// CHECK-SAME: 'void () noexcept' +// CHECK-SAME: virtual Index: test/Import/destructor/Inputs/F.cpp === --- /dev/null +++ test/Import/destructor/Inputs/F.cpp @@ -0,0 +1,3 @@ +struct B { + virtual ~B() {} +}; Index: lib/AST/ASTImporter.cpp === --- lib/AST/ASTImporter.cpp +++ lib/AST/ASTImporter.cpp @@ -3238,7 +3238,25 @@ } ExpectedDecl ASTNodeImporter::VisitCXXDestructorDecl(CXXDestructorDecl *D) { - return VisitCXXMethodDecl(D); + ExpectedDecl R = VisitCXXMethodDecl(D); + + if (R) { +CXXDestructorDecl *ToDtor = cast(*R); + +auto Imp = importSeq(const_cast(D->getOperatorDelete()), + D->getOperatorDeleteThisArg()); + +if (!Imp) + return Imp.takeError(); + +FunctionDecl *ToOperatorDelete; +Expr *ToThisArg; +std::tie(ToOperatorDelete, ToThisArg) = *Imp; + +ToDtor->setOperatorDelete(ToOperatorDelete, ToThisArg); + } + + return R; } ExpectedDecl ASTNodeImporter::VisitCXXConversionDecl(CXXConversionDecl *D) { Index: test/Import/destructor/test.cpp === --- /dev/null +++ test/Import/destructor/test.cpp @@ -0,0 +1,10 @@ +// RUN: clang-import-test -dump-ast -import %S/Inputs/F.cpp -expression %s + +// Triggers the deserialization of B's destructor. +B b1; + +// CHECK: CXXDestructorDecl + +// CHECK-NEXT: ~B 'void () noexcept' virtual +// CHECK-SAME: 'void () noexcept' +// CHECK-SAME: virtual Index: test/Import/destructor/Inputs/F.cpp === --- /dev/null +++ test/Import/destructor/Inputs/F.cpp @@ -0,0 +1,3 @@ +struct B { + virtual ~B() {} +}; Index: lib/AST/ASTImporter.cpp === --- lib/AST/ASTImporter.cpp +++ lib/AST/ASTImporter.cpp @@ -3238,7 +3238,25 @@ } ExpectedDecl ASTNodeImporter::VisitCXXDestructorDecl(CXXDestructorDecl *D) { - return VisitCXXMethodDecl(D); + ExpectedDecl R = VisitCXXMethodDecl(D); + + if (R) { +CXXDestructorDecl *ToDtor = cast(*R); + +auto Imp = importSeq(const_cast(D->getOperatorDelete()), + D->getOperatorDeleteThisArg()); + +if (!Imp) + return Imp.takeError(); + +FunctionDecl *ToOperatorDelete; +Expr *ToThisArg; +std::tie(ToOperatorDelete, ToThisArg) = *Imp; + +ToDtor->setOperatorDelete(ToOperatorDelete, ToThisArg); + } + + return R; } ExpectedDecl ASTNodeImporter::VisitCXXConversionDecl(CXXConversionDecl *D) { ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D56651: [ASTImporter] Fix importing OperatorDelete from CXXConstructorDecl
teemperor added a comment. Didn't really upstream any non-trivial ASTImporter patches yet, so please point out any style errors. Repository: rC Clang CHANGES SINCE LAST ACTION https://reviews.llvm.org/D56651/new/ https://reviews.llvm.org/D56651 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits