From a67a4d2f3c07bd589d395a5815dea2198a261162 Mon Sep 17 00:00:00 2001 From: Serge Pavlov Date: Thu, 10 Nov 2016 08:49:37 +0000 Subject: [PATCH] Make output of -ast-print a valid C++ code. Output generated by option -ast-print looks like C/C++ code, and it really is for plain C. For C++ the produced output was not valid C++ code, but the differences were small. With this change the output is fixed and can be compiled. Tests are changed so that output produced by -ast-print is compiled again with the same flags and both outputs are compared. Option -ast-print is extensively used in clang tests but it itself was tested poorly, existing tests only checked that compiler did not crash. There are unit tests in file DeclPrinterTest.cpp, but they test only terse output mode. Differential Revision: https://reviews.llvm.org/D26452 llvm-svn: 286439 --- clang/lib/AST/DeclPrinter.cpp | 221 +++++++++++++++------ clang/test/Analysis/cfg.cpp | 2 +- clang/test/Coverage/ast-print-func.cpp | 12 ++ clang/test/Coverage/ast-print-temp-class.cpp | 64 ++++++ clang/test/Coverage/ast-print-temp-func.cpp | 25 +++ clang/test/Coverage/ast-printing.cpp | 4 +- clang/test/Index/comment-cplus-decls.cpp | 2 +- .../test/Index/comment-to-html-xml-conversion.cpp | 6 +- clang/test/Misc/ast-dump-templates.cpp | 18 +- clang/test/OpenMP/atomic_ast_print.cpp | 4 +- clang/test/OpenMP/barrier_ast_print.cpp | 4 +- clang/test/OpenMP/critical_ast_print.cpp | 12 +- clang/test/OpenMP/declare_reduction_ast_print.cpp | 15 +- clang/test/OpenMP/declare_simd_ast_print.cpp | 38 ++-- clang/test/OpenMP/declare_target_ast_print.cpp | 12 +- clang/test/OpenMP/distribute_ast_print.cpp | 6 +- .../OpenMP/distribute_dist_schedule_ast_print.cpp | 1 + .../OpenMP/distribute_parallel_for_ast_print.cpp | 2 +- .../distribute_parallel_for_simd_ast_print.cpp | 2 +- clang/test/OpenMP/distribute_simd_ast_print.cpp | 2 +- clang/test/OpenMP/flush_ast_print.cpp | 6 +- clang/test/OpenMP/for_ast_print.cpp | 7 +- clang/test/OpenMP/for_simd_ast_print.cpp | 4 +- clang/test/OpenMP/ordered_ast_print.cpp | 8 +- clang/test/OpenMP/parallel_ast_print.cpp | 46 ++--- clang/test/OpenMP/parallel_for_ast_print.cpp | 2 +- clang/test/OpenMP/parallel_for_simd_ast_print.cpp | 4 +- clang/test/OpenMP/parallel_sections_ast_print.cpp | 48 ++--- clang/test/OpenMP/sections_ast_print.cpp | 1 + clang/test/OpenMP/simd_ast_print.cpp | 4 +- clang/test/OpenMP/single_ast_print.cpp | 1 + clang/test/OpenMP/target_ast_print.cpp | 18 +- clang/test/OpenMP/target_data_ast_print.cpp | 12 +- .../target_data_use_device_ptr_ast_print.cpp | 4 +- clang/test/OpenMP/target_enter_data_ast_print.cpp | 12 +- clang/test/OpenMP/target_exit_data_ast_print.cpp | 12 +- .../test/OpenMP/target_is_device_ptr_ast_print.cpp | 4 +- clang/test/OpenMP/target_parallel_ast_print.cpp | 66 +++--- .../test/OpenMP/target_parallel_for_ast_print.cpp | 2 +- .../OpenMP/target_parallel_for_simd_ast_print.cpp | 2 +- clang/test/OpenMP/target_simd_ast_print.cpp | 2 +- clang/test/OpenMP/target_update_ast_print.cpp | 10 +- clang/test/OpenMP/task_ast_print.cpp | 40 ++-- clang/test/OpenMP/taskloop_ast_print.cpp | 1 + clang/test/OpenMP/taskloop_simd_ast_print.cpp | 1 + clang/test/OpenMP/taskwait_ast_print.cpp | 4 +- clang/test/OpenMP/taskyield_ast_print.cpp | 4 +- clang/test/OpenMP/teams_ast_print.cpp | 42 ++-- clang/test/OpenMP/teams_distribute_ast_print.cpp | 4 +- .../OpenMP/teams_distribute_simd_ast_print.cpp | 4 +- clang/test/OpenMP/threadprivate_ast_print.cpp | 6 +- clang/test/SemaTemplate/temp_arg_enum_printing.cpp | 6 +- clang/unittests/AST/ASTTypeTraitsTest.cpp | 2 +- clang/unittests/AST/DeclPrinterTest.cpp | 124 +++--------- 54 files changed, 554 insertions(+), 411 deletions(-) create mode 100644 clang/test/Coverage/ast-print-func.cpp create mode 100644 clang/test/Coverage/ast-print-temp-class.cpp create mode 100644 clang/test/Coverage/ast-print-temp-func.cpp diff --git a/clang/lib/AST/DeclPrinter.cpp b/clang/lib/AST/DeclPrinter.cpp index 921c8e3..b8ebe1c 100644 --- a/clang/lib/AST/DeclPrinter.cpp +++ b/clang/lib/AST/DeclPrinter.cpp @@ -78,6 +78,10 @@ namespace { void VisitTemplateDecl(const TemplateDecl *D); void VisitFunctionTemplateDecl(FunctionTemplateDecl *D); void VisitClassTemplateDecl(ClassTemplateDecl *D); + void VisitClassTemplateSpecializationDecl( + ClassTemplateSpecializationDecl *D); + void VisitClassTemplatePartialSpecializationDecl( + ClassTemplatePartialSpecializationDecl *D); void VisitObjCMethodDecl(ObjCMethodDecl *D); void VisitObjCImplementationDecl(ObjCImplementationDecl *D); void VisitObjCInterfaceDecl(ObjCInterfaceDecl *D); @@ -95,8 +99,9 @@ namespace { void VisitOMPDeclareReductionDecl(OMPDeclareReductionDecl *D); void VisitOMPCapturedExprDecl(OMPCapturedExprDecl *D); - void PrintTemplateParameters(const TemplateParameterList *Params, - const TemplateArgumentList *Args = nullptr); + void printTemplateParameters(const TemplateParameterList *Params); + void printTemplateArguments(const TemplateArgumentList &Args, + const TemplateParameterList *Params = nullptr); void prettyPrintAttributes(Decl *D); void prettyPrintPragmas(Decl *D); void printDeclType(QualType T, StringRef DeclName, bool Pack = false); @@ -290,6 +295,13 @@ void DeclPrinter::VisitDeclContext(DeclContext *DC, bool Indent) { if (D->isImplicit()) continue; + // Don't print implicit specializations, as they are printed when visiting + // corresponding templates. + if (auto FD = dyn_cast(*D)) + if (FD->getTemplateSpecializationKind() == TSK_ImplicitInstantiation && + !isa(DC)) + continue; + // The next bits of code handles stuff like "struct {int x;} a,b"; we're // forced to merge the declarations because there's no other way to // refer to the struct in question. This limited merging is safe without @@ -337,11 +349,19 @@ void DeclPrinter::VisitDeclContext(DeclContext *DC, bool Indent) { const char *Terminator = nullptr; if (isa(*D) || isa(*D)) Terminator = nullptr; - else if (isa(*D) && cast(*D)->hasBody()) - Terminator = nullptr; else if (isa(*D) && cast(*D)->hasBody()) Terminator = nullptr; - else if (isa(*D) || isa(*D) || + else if (auto FD = dyn_cast(*D)) { + if (FD->isThisDeclarationADefinition()) + Terminator = nullptr; + else + Terminator = ";"; + } else if (auto TD = dyn_cast(*D)) { + if (TD->getTemplatedDecl()->isThisDeclarationADefinition()) + Terminator = nullptr; + else + Terminator = ";"; + } else if (isa(*D) || isa(*D) || isa(*D) || isa(*D) || isa(*D) || @@ -358,7 +378,14 @@ void DeclPrinter::VisitDeclContext(DeclContext *DC, bool Indent) { if (Terminator) Out << Terminator; - Out << "\n"; + if (!Policy.TerseOutput && + ((isa(*D) && + cast(*D)->doesThisDeclarationHaveABody()) || + (isa(*D) && + cast(*D)->getTemplatedDecl()->doesThisDeclarationHaveABody()))) + ; // StmtPrinter already added '\n' after CompoundStmt. + else + Out << "\n"; // Declare target attribute is special one, natural spelling for the pragma // assumes "ending" construct so print it here. @@ -448,6 +475,9 @@ void DeclPrinter::VisitFunctionDecl(FunctionDecl *D) { !D->isFunctionTemplateSpecialization()) prettyPrintPragmas(D); + if (D->isFunctionTemplateSpecialization()) + Out << "template<> "; + CXXConstructorDecl *CDecl = dyn_cast(D); CXXConversionDecl *ConversionDecl = dyn_cast(D); if (!Policy.SuppressSpecifiers) { @@ -472,6 +502,11 @@ void DeclPrinter::VisitFunctionDecl(FunctionDecl *D) { PrintingPolicy SubPolicy(Policy); SubPolicy.SuppressSpecifiers = false; std::string Proto = D->getNameInfo().getAsString(); + if (const TemplateArgumentList *TArgs = D->getTemplateSpecializationArgs()) { + llvm::raw_string_ostream POut(Proto); + DeclPrinter TArgPrinter(POut, SubPolicy, Indentation); + TArgPrinter.printTemplateArguments(*TArgs); + } QualType Ty = D->getType(); while (const ParenType *PT = dyn_cast(Ty)) { @@ -635,25 +670,29 @@ void DeclPrinter::VisitFunctionDecl(FunctionDecl *D) { Out << " = delete"; else if (D->isExplicitlyDefaulted()) Out << " = default"; - else if (D->doesThisDeclarationHaveABody() && !Policy.TerseOutput) { - if (!D->hasPrototype() && D->getNumParams()) { - // This is a K&R function definition, so we need to print the - // parameters. - Out << '\n'; - DeclPrinter ParamPrinter(Out, SubPolicy, Indentation); - Indentation += Policy.Indentation; - for (unsigned i = 0, e = D->getNumParams(); i != e; ++i) { - Indent(); - ParamPrinter.VisitParmVarDecl(D->getParamDecl(i)); - Out << ";\n"; - } - Indentation -= Policy.Indentation; - } else - Out << ' '; + else if (D->doesThisDeclarationHaveABody()) { + if (!Policy.TerseOutput) { + if (!D->hasPrototype() && D->getNumParams()) { + // This is a K&R function definition, so we need to print the + // parameters. + Out << '\n'; + DeclPrinter ParamPrinter(Out, SubPolicy, Indentation); + Indentation += Policy.Indentation; + for (unsigned i = 0, e = D->getNumParams(); i != e; ++i) { + Indent(); + ParamPrinter.VisitParmVarDecl(D->getParamDecl(i)); + Out << ";\n"; + } + Indentation -= Policy.Indentation; + } else + Out << ' '; - if (D->getBody()) - D->getBody()->printPretty(Out, nullptr, SubPolicy, Indentation); - Out << '\n'; + if (D->getBody()) + D->getBody()->printPretty(Out, nullptr, SubPolicy, Indentation); + } else { + if (isa(*D)) + Out << " {}"; + } } } @@ -661,7 +700,7 @@ void DeclPrinter::VisitFriendDecl(FriendDecl *D) { if (TypeSourceInfo *TSI = D->getFriendType()) { unsigned NumTPLists = D->getFriendTypeNumTemplateParameterLists(); for (unsigned i = 0; i < NumTPLists; ++i) - PrintTemplateParameters(D->getFriendTypeTemplateParameterList(i)); + printTemplateParameters(D->getFriendTypeTemplateParameterList(i)); Out << "friend "; Out << " " << TSI->getType().getAsString(Policy); } @@ -838,9 +877,15 @@ void DeclPrinter::VisitCXXRecordDecl(CXXRecordDecl *D) { prettyPrintAttributes(D); - if (D->getIdentifier()) + if (D->getIdentifier()) { Out << ' ' << *D; + if (auto S = dyn_cast(D)) + printTemplateArguments(S->getTemplateArgs(), S->getTemplateParameters()); + else if (auto S = dyn_cast(D)) + printTemplateArguments(S->getTemplateArgs()); + } + if (D->isCompleteDefinition()) { // Print the base classes if (D->getNumBases()) { @@ -867,9 +912,13 @@ void DeclPrinter::VisitCXXRecordDecl(CXXRecordDecl *D) { // Print the class definition // FIXME: Doesn't print access specifiers, e.g., "public:" - Out << " {\n"; - VisitDeclContext(D); - Indent() << "}"; + if (Policy.TerseOutput) { + Out << " {}"; + } else { + Out << " {\n"; + VisitDeclContext(D); + Indent() << "}"; + } } } @@ -892,10 +941,8 @@ void DeclPrinter::VisitLinkageSpecDecl(LinkageSpecDecl *D) { Visit(*D->decls_begin()); } -void DeclPrinter::PrintTemplateParameters(const TemplateParameterList *Params, - const TemplateArgumentList *Args) { +void DeclPrinter::printTemplateParameters(const TemplateParameterList *Params) { assert(Params); - assert(!Args || Params->size() == Args->size()); Out << "template <"; @@ -904,8 +951,7 @@ void DeclPrinter::PrintTemplateParameters(const TemplateParameterList *Params, Out << ", "; const Decl *Param = Params->getParam(i); - if (const TemplateTypeParmDecl *TTP = - dyn_cast(Param)) { + if (auto TTP = dyn_cast(Param)) { if (TTP->wasDeclaredWithTypename()) Out << "typename "; @@ -917,30 +963,22 @@ void DeclPrinter::PrintTemplateParameters(const TemplateParameterList *Params, Out << *TTP; - if (Args) { - Out << " = "; - Args->get(i).print(Policy, Out); - } else if (TTP->hasDefaultArgument()) { + if (TTP->hasDefaultArgument()) { Out << " = "; Out << TTP->getDefaultArgument().getAsString(Policy); }; - } else if (const NonTypeTemplateParmDecl *NTTP = - dyn_cast(Param)) { + } else if (auto NTTP = dyn_cast(Param)) { StringRef Name; if (IdentifierInfo *II = NTTP->getIdentifier()) Name = II->getName(); printDeclType(NTTP->getType(), Name, NTTP->isParameterPack()); - if (Args) { - Out << " = "; - Args->get(i).print(Policy, Out); - } else if (NTTP->hasDefaultArgument()) { + if (NTTP->hasDefaultArgument()) { Out << " = "; NTTP->getDefaultArgument()->printPretty(Out, nullptr, Policy, Indentation); } - } else if (const TemplateTemplateParmDecl *TTPD = - dyn_cast(Param)) { + } else if (auto TTPD = dyn_cast(Param)) { VisitTemplateDecl(TTPD); // FIXME: print the default argument, if present. } @@ -949,8 +987,46 @@ void DeclPrinter::PrintTemplateParameters(const TemplateParameterList *Params, Out << "> "; } +void DeclPrinter::printTemplateArguments(const TemplateArgumentList &Args, + const TemplateParameterList *Params) { + Out << "<"; + for (size_t I = 0, E = Args.size(); I < E; ++I) { + const TemplateArgument &A = Args[I]; + if (I) + Out << ", "; + if (Params) { + if (A.getKind() == TemplateArgument::Type) + if (auto T = A.getAsType()->getAs()) { + auto P = cast(Params->getParam(T->getIndex())); + Out << *P; + continue; + } + if (A.getKind() == TemplateArgument::Template) { + if (auto T = A.getAsTemplate().getAsTemplateDecl()) + if (auto TD = dyn_cast(T)) { + auto P = cast( + Params->getParam(TD->getIndex())); + Out << *P; + continue; + } + } + if (A.getKind() == TemplateArgument::Expression) { + if (auto E = dyn_cast(A.getAsExpr())) + if (auto N = dyn_cast(E->getDecl())) { + auto P = cast( + Params->getParam(N->getIndex())); + Out << *P; + continue; + } + } + } + A.print(Policy, Out); + } + Out << ">"; +} + void DeclPrinter::VisitTemplateDecl(const TemplateDecl *D) { - PrintTemplateParameters(D->getTemplateParameters()); + printTemplateParameters(D->getTemplateParameters()); if (const TemplateTemplateParmDecl *TTP = dyn_cast(D)) { @@ -964,30 +1040,49 @@ void DeclPrinter::VisitTemplateDecl(const TemplateDecl *D) { } void DeclPrinter::VisitFunctionTemplateDecl(FunctionTemplateDecl *D) { + prettyPrintPragmas(D->getTemplatedDecl()); + VisitRedeclarableTemplateDecl(D); + if (PrintInstantiation) { - TemplateParameterList *Params = D->getTemplateParameters(); - for (auto *I : D->specializations()) { - prettyPrintPragmas(I); - PrintTemplateParameters(Params, I->getTemplateSpecializationArgs()); - Visit(I); - } + FunctionDecl *PrevDecl = D->getTemplatedDecl(); + const FunctionDecl *Def; + if (PrevDecl->isDefined(Def) && Def != PrevDecl) + return; + for (auto *I : D->specializations()) + if (I->getTemplateSpecializationKind() == TSK_ImplicitInstantiation) { + if (!PrevDecl->isThisDeclarationADefinition()) + Out << ";\n"; + Indent(); + prettyPrintPragmas(I); + Visit(I); + } } - - prettyPrintPragmas(D->getTemplatedDecl()); - return VisitRedeclarableTemplateDecl(D); } void DeclPrinter::VisitClassTemplateDecl(ClassTemplateDecl *D) { + VisitRedeclarableTemplateDecl(D); + if (PrintInstantiation) { - TemplateParameterList *Params = D->getTemplateParameters(); - for (auto *I : D->specializations()) { - PrintTemplateParameters(Params, &I->getTemplateArgs()); - Visit(I); - Out << ";\n"; - } + for (auto *I : D->specializations()) + if (I->getSpecializationKind() == TSK_ImplicitInstantiation) { + if (D->isThisDeclarationADefinition()) + Out << ";"; + Out << "\n"; + Visit(I); + } } +} + +void DeclPrinter::VisitClassTemplateSpecializationDecl( + ClassTemplateSpecializationDecl *D) { + Out << "template<> "; + VisitCXXRecordDecl(D); +} - return VisitRedeclarableTemplateDecl(D); +void DeclPrinter::VisitClassTemplatePartialSpecializationDecl( + ClassTemplatePartialSpecializationDecl *D) { + printTemplateParameters(D->getTemplateParameters()); + VisitCXXRecordDecl(D); } //---------------------------------------------------------------------------- diff --git a/clang/test/Analysis/cfg.cpp b/clang/test/Analysis/cfg.cpp index 4fa7f1d..3e34a0f 100644 --- a/clang/test/Analysis/cfg.cpp +++ b/clang/test/Analysis/cfg.cpp @@ -432,7 +432,7 @@ void test_lifetime_extended_temporaries() { } -// CHECK-LABEL: int *PR18472() +// CHECK-LABEL: template<> int *PR18472() // CHECK: [B2 (ENTRY)] // CHECK-NEXT: Succs (1): B1 // CHECK: [B1] diff --git a/clang/test/Coverage/ast-print-func.cpp b/clang/test/Coverage/ast-print-func.cpp new file mode 100644 index 0000000..46083a7 --- /dev/null +++ b/clang/test/Coverage/ast-print-func.cpp @@ -0,0 +1,12 @@ +// RUN: %clang_cc1 -ast-print -std=c++14 %s -o %t.1.cpp +// RUN: %clang_cc1 -ast-print -std=c++14 %t.1.cpp -o %t.2.cpp +// RUN: diff %t.1.cpp %t.2.cpp + +auto func_01(int, char) -> double; + +auto func_02(int x) -> int { return 2 + x; } + +void func_03() { + extern void g(), h(); + return; +} diff --git a/clang/test/Coverage/ast-print-temp-class.cpp b/clang/test/Coverage/ast-print-temp-class.cpp new file mode 100644 index 0000000..f6b94efb --- /dev/null +++ b/clang/test/Coverage/ast-print-temp-class.cpp @@ -0,0 +1,64 @@ +// RUN: %clang_cc1 -ast-print -std=c++14 %s -v -o %t.1.cpp +// RUN: %clang_cc1 -ast-print -std=c++14 %t.1.cpp -o %t.2.cpp +// RUN: diff %t.1.cpp %t.2.cpp + +// Specializations + +template class C0 {}; +template<> class C0 {}; +template<> class C0 {}; +C0 c0; + +template class C1 {}; +template<> class C1<11> {}; +C1<2> c1a; +C1<4> c1b; + +template class C2a {}; +template class C2b {}; +template class TC> class C2 {}; +template<> class C2 {}; +C2 c2; + + +// Default arguments + +template class C10 {}; +template class C11 {}; +template class C12a {}; +//FIXME: template class TC = C12a> class C12 {}; +//FIXME: template class TC = C12a> class C13 {}; + + +// Partial specializations + +template struct C20 { + T a; + U b; +}; +template struct C20 { + T a; +}; + +template struct C21 { + U a; + U b[N]; +}; +template struct C21 { + int a[N]; +}; + +template class TC, typename U> struct C22 { + TC a; + U b; +}; +template class TC> struct C22 { + TC a; +}; + + +// Declaration only +template class C30; +template<> class C30; +template<> class C30; +extern C30 c30; diff --git a/clang/test/Coverage/ast-print-temp-func.cpp b/clang/test/Coverage/ast-print-temp-func.cpp new file mode 100644 index 0000000..37c8298 --- /dev/null +++ b/clang/test/Coverage/ast-print-temp-func.cpp @@ -0,0 +1,25 @@ +// RUN: %clang_cc1 -ast-print -std=c++14 %s -o %t.1.cpp +// RUN: %clang_cc1 -ast-print -std=c++14 %t.1.cpp -o %t.2.cpp +// RUN: diff %t.1.cpp %t.2.cpp + +template void func_01(); +template void func_01() {} +template<> void func_01() {} +template<> void func_01() {} +template void func_01(); + +void main_01() { + func_01(); + func_01(); +} + +template void func_02(); +template void func_02(); +template<> void func_02(); +template<> void func_02(); +template void func_02(); + +void main_02() { + func_02(); + func_02(); +} diff --git a/clang/test/Coverage/ast-printing.cpp b/clang/test/Coverage/ast-printing.cpp index 3205078..5cff09d 100644 --- a/clang/test/Coverage/ast-printing.cpp +++ b/clang/test/Coverage/ast-printing.cpp @@ -1,5 +1,7 @@ // RUN: %clang_cc1 -fsyntax-only %s -// RUN: %clang_cc1 -ast-print %s +// RUN: %clang_cc1 -ast-print %s -o %t.1.cpp +// RUN: %clang_cc1 -ast-print %t.1.cpp -o %t.2.cpp +// RUN: diff %t.1.cpp %t.2.cpp // RUN: %clang_cc1 -ast-dump %s // RUN: %clang_cc1 -print-decl-contexts %s // RUN: %clang_cc1 -fdump-record-layouts %s diff --git a/clang/test/Index/comment-cplus-decls.cpp b/clang/test/Index/comment-cplus-decls.cpp index 002482e..d4f968f 100644 --- a/clang/test/Index/comment-cplus-decls.cpp +++ b/clang/test/Index/comment-cplus-decls.cpp @@ -40,7 +40,7 @@ protected: data* reserved; }; // CHECK: class Test {} -// CHECK: Test() : reserved(new Test::data()) +// CHECK: Test() : reserved(new Test::data()) {} // CHECK: unsigned int getID() const // CHECK: ~Test() // CHECK: Test::data *reserved diff --git a/clang/test/Index/comment-to-html-xml-conversion.cpp b/clang/test/Index/comment-to-html-xml-conversion.cpp index 6c10efe..9e25ff1 100644 --- a/clang/test/Index/comment-to-html-xml-conversion.cpp +++ b/clang/test/Index/comment-to-html-xml-conversion.cpp @@ -813,7 +813,7 @@ void comment_to_xml_conversion_10(T aaa, U bbb); template<> void comment_to_xml_conversion_10(int aaa, int bbb); -// CHECK: comment-to-html-xml-conversion.cpp:[[@LINE-2]]:6: FunctionDecl=comment_to_xml_conversion_10:{{.*}} FullCommentAsXML=[comment_to_xml_conversion_10c:@F@comment_to_xml_conversion_10<#I#I>#I#I#void comment_to_xml_conversion_10(int aaa, int bbb) Aaa.] +// CHECK: comment-to-html-xml-conversion.cpp:[[@LINE-2]]:6: FunctionDecl=comment_to_xml_conversion_10:{{.*}} FullCommentAsXML=[comment_to_xml_conversion_10c:@F@comment_to_xml_conversion_10<#I#I>#I#I#template <> void comment_to_xml_conversion_10<int, int>(int aaa, int bbb) Aaa.] /// Aaa. template @@ -825,13 +825,13 @@ class comment_to_xml_conversion_11 { }; template class comment_to_xml_conversion_11 { }; -// CHECK: comment-to-html-xml-conversion.cpp:[[@LINE-2]]:7: ClassTemplatePartialSpecialization=comment_to_xml_conversion_11:{{.*}} FullCommentAsXML=[comment_to_xml_conversion_11c:@SP>1#T@comment_to_xml_conversion_11>#t0.0#Iclass comment_to_xml_conversion_11 {} Aaa.] +// CHECK: comment-to-html-xml-conversion.cpp:[[@LINE-2]]:7: ClassTemplatePartialSpecialization=comment_to_xml_conversion_11:{{.*}} FullCommentAsXML=[comment_to_xml_conversion_11c:@SP>1#T@comment_to_xml_conversion_11>#t0.0#Itemplate <typename T> class comment_to_xml_conversion_11<T, int> {} Aaa.] /// Aaa. template<> class comment_to_xml_conversion_11 { }; -// CHECK: comment-to-html-xml-conversion.cpp:[[@LINE-2]]:7: ClassDecl=comment_to_xml_conversion_11:{{.*}} FullCommentAsXML=[comment_to_xml_conversion_11c:@S@comment_to_xml_conversion_11>#I#Iclass comment_to_xml_conversion_11 {} Aaa.] +// CHECK: comment-to-html-xml-conversion.cpp:[[@LINE-2]]:7: ClassDecl=comment_to_xml_conversion_11:{{.*}} FullCommentAsXML=[comment_to_xml_conversion_11c:@S@comment_to_xml_conversion_11>#I#Itemplate <> class comment_to_xml_conversion_11<int, int> {} Aaa.] /// Aaa. int comment_to_xml_conversion_12; diff --git a/clang/test/Misc/ast-dump-templates.cpp b/clang/test/Misc/ast-dump-templates.cpp index 022d5c4..eb493b4 100644 --- a/clang/test/Misc/ast-dump-templates.cpp +++ b/clang/test/Misc/ast-dump-templates.cpp @@ -21,24 +21,24 @@ void baz() { double z = foo<2, double, 3>().getSum(); } -// Template instantiation - foo -// Since the order of instantiation may vary during runs, run FileCheck twice -// to make sure each instantiation is in the correct spot. -// CHECK1: template struct foo { -// CHECK2: template struct foo { - // Template definition - foo // CHECK1: template struct foo { // CHECK2: template struct foo { -// Template instantiation - bar -// CHECK1: template int bar() -// CHECK2: template int bar() +// Template instantiation - foo +// Since the order of instantiation may vary during runs, run FileCheck twice +// to make sure each instantiation is in the correct spot. +// CHECK1: template<> struct foo<5, int, 5> { +// CHECK2: template<> struct foo<2, double, 3> { // Template definition - bar // CHECK1: template B bar() // CHECK2: template B bar() +// Template instantiation - bar +// CHECK1: template<> int bar<5, int>() +// CHECK2: template<> int bar<5, int>() + // CHECK1-LABEL: template struct A { // CHECK1-NEXT: template struct B { template struct A { diff --git a/clang/test/OpenMP/atomic_ast_print.cpp b/clang/test/OpenMP/atomic_ast_print.cpp index 961c1e6..f1fc7c8 100644 --- a/clang/test/OpenMP/atomic_ast_print.cpp +++ b/clang/test/OpenMP/atomic_ast_print.cpp @@ -43,7 +43,7 @@ T foo(T argc) { return T(); } -// CHECK: int a = int(); +// CHECK: T a = T(); // CHECK-NEXT: #pragma omp atomic // CHECK-NEXT: a++; // CHECK-NEXT: #pragma omp atomic read @@ -74,7 +74,7 @@ T foo(T argc) { // CHECK-NEXT: a = b; // CHECK-NEXT: b++; // CHECK-NEXT: } -// CHECK: T a = T(); +// CHECK: int a = int(); // CHECK-NEXT: #pragma omp atomic // CHECK-NEXT: a++; // CHECK-NEXT: #pragma omp atomic read diff --git a/clang/test/OpenMP/barrier_ast_print.cpp b/clang/test/OpenMP/barrier_ast_print.cpp index 062df80..fd03a9a 100644 --- a/clang/test/OpenMP/barrier_ast_print.cpp +++ b/clang/test/OpenMP/barrier_ast_print.cpp @@ -23,12 +23,12 @@ T tmain(T argc) { } return a + argc; } +// CHECK: static T a; +// CHECK-NEXT: #pragma omp barrier // CHECK: static int a; // CHECK-NEXT: #pragma omp barrier // CHECK: static char a; // CHECK-NEXT: #pragma omp barrier -// CHECK: static T a; -// CHECK-NEXT: #pragma omp barrier // CHECK-NEXT: switch (argc) { // CHECK-NEXT: case 0: // CHECK-NEXT: #pragma omp barrier diff --git a/clang/test/OpenMP/critical_ast_print.cpp b/clang/test/OpenMP/critical_ast_print.cpp index 7189fdd..0579d03 100644 --- a/clang/test/OpenMP/critical_ast_print.cpp +++ b/clang/test/OpenMP/critical_ast_print.cpp @@ -9,6 +9,14 @@ void foo() {} // CHECK: template int tmain(T argc, char **argv) +// CHECK: static int a; +// CHECK-NEXT: #pragma omp critical +// CHECK-NEXT: a = 2; +// CHECK-NEXT: ++a; +// CHECK-NEXT: #pragma omp critical (the_name) hint(N) +// CHECK-NEXT: foo(); +// CHECK-NEXT: return N; +// CHECK: template<> int tmain(int argc, char **argv) template int tmain (T argc, char **argv) { T b = argc, c, d, e, f, g; @@ -22,9 +30,9 @@ int tmain (T argc, char **argv) { ++a; #pragma omp critical (the_name) hint(N) foo(); -// CHECK-NEXT: #pragma omp critical (the_name) hint(N) +// CHECK-NEXT: #pragma omp critical (the_name) hint(4) // CHECK-NEXT: foo(); -// CHECK-NEXT: return N; +// CHECK-NEXT: return 4; return N; } diff --git a/clang/test/OpenMP/declare_reduction_ast_print.cpp b/clang/test/OpenMP/declare_reduction_ast_print.cpp index 26b2ff9..816ff79 100644 --- a/clang/test/OpenMP/declare_reduction_ast_print.cpp +++ b/clang/test/OpenMP/declare_reduction_ast_print.cpp @@ -10,13 +10,12 @@ // CHECK: #pragma omp declare reduction (+ : int : omp_out *= omp_in) // CHECK-NEXT: #pragma omp declare reduction (+ : char : omp_out *= omp_in) -// CHECK: #pragma omp declare reduction (fun : int : omp_out += omp_in) initializer(omp_priv = omp_orig + 15) - template class SSS { public: #pragma omp declare reduction(fun : T : omp_out += omp_in) initializer(omp_priv = omp_orig + 15) // CHECK: #pragma omp declare reduction (fun : T : omp_out += omp_in) initializer(omp_priv = omp_orig + 15) + // CHECK: #pragma omp declare reduction (fun : int : omp_out += omp_in) initializer(omp_priv = omp_orig + 15) }; SSS d; @@ -26,18 +25,18 @@ void init(SSS &lhs, SSS rhs); #pragma omp declare reduction(fun : SSS < int > : omp_out = omp_in) initializer(init(omp_priv, omp_orig)) // CHECK: #pragma omp declare reduction (fun : SSS : omp_out = omp_in) initializer(init(omp_priv, omp_orig)) -// CHECK: template int foo(int a) { -// CHECK: #pragma omp declare reduction (fun : int : omp_out += omp_in) initializer(omp_priv = omp_orig + 15); +// CHECK: template T foo(T a) { +// CHECK: #pragma omp declare reduction (fun : T : omp_out += omp_in) initializer(omp_priv = omp_orig + 15); // CHECK: { -// CHECK: #pragma omp declare reduction (fun : int : omp_out += omp_in) initializer(omp_priv = omp_orig + 15); +// CHECK: #pragma omp declare reduction (fun : T : omp_out += omp_in) initializer(omp_priv = omp_orig + 15); // CHECK: } // CHECK: return a; // CHECK: } -// CHECK: template T foo(T a) { -// CHECK: #pragma omp declare reduction (fun : T : omp_out += omp_in) initializer(omp_priv = omp_orig + 15); +// CHECK: template<> int foo(int a) { +// CHECK: #pragma omp declare reduction (fun : int : omp_out += omp_in) initializer(omp_priv = omp_orig + 15); // CHECK: { -// CHECK: #pragma omp declare reduction (fun : T : omp_out += omp_in) initializer(omp_priv = omp_orig + 15); +// CHECK: #pragma omp declare reduction (fun : int : omp_out += omp_in) initializer(omp_priv = omp_orig + 15); // CHECK: } // CHECK: return a; // CHECK: } diff --git a/clang/test/OpenMP/declare_simd_ast_print.cpp b/clang/test/OpenMP/declare_simd_ast_print.cpp index 5a32e61..632e038 100644 --- a/clang/test/OpenMP/declare_simd_ast_print.cpp +++ b/clang/test/OpenMP/declare_simd_ast_print.cpp @@ -22,18 +22,16 @@ template void h(C *hp, C *hp2, C *hq, C *lin) { } // CHECK: #pragma omp declare simd aligned(hp) aligned(hp2) -// CHECK-NEXT: template void h(int *hp, int *hp2, int *hq, int *lin) { -// CHECK-NEXT: h((float *)hp, (float *)hp2, (float *)hq, (float *)lin); +// CHECK-NEXT: template void h(C *hp, C *hp2, C *hq, C *lin) { // CHECK-NEXT: } -// CHECK: #pragma omp declare simd aligned(hp) aligned(hp2) -// CHECK-NEXT: template void h(float *hp, float *hp2, float *hq, float *lin) { +// CHECK: #pragma omp declare simd aligned(hp) aligned(hp2) +// CHECK-NEXT: template<> void h(float *hp, float *hp2, float *hq, float *lin) { // CHECK-NEXT: } -// CHECK: #pragma omp declare simd aligned(hp) aligned(hp2) -// CHECK: template void h(C *hp, C *hp2, C *hq, C *lin) { +// CHECK-NEXT: template<> void h(int *hp, int *hp2, int *hq, int *lin) { +// CHECK-NEXT: h((float *)hp, (float *)hp2, (float *)hq, (float *)lin); // CHECK-NEXT: } -// // Explicit specialization with . // Pragmas need to be same, otherwise standard says that's undefined behavior. @@ -75,11 +73,11 @@ private: int x[10]; }; -// CHECK: template class TVV { -// CHECK: #pragma omp declare simd -// CHECK-NEXT: int tadd(int a, int b); -// CHECK: #pragma omp declare simd aligned(a: 16 * 2) aligned(b) linear(ref(b): 16) -// CHECK-NEXT: float taddpf(float *a, float *&b) { +// CHECK: template class TVV { +// CHECK: #pragma omp declare simd simdlen(X) +// CHECK-NEXT: int tadd(int a, int b) { +// CHECK: #pragma omp declare simd aligned(a: X * 2) aligned(b) linear(ref(b): X) +// CHECK-NEXT: float taddpf(float *a, T *&b) { // CHECK-NEXT: return *a + *b; // CHECK-NEXT: } // CHECK: #pragma omp declare simd @@ -91,20 +89,18 @@ private: template class TVV { public: -// CHECK: template class TVV { +// CHECK: template<> class TVV<16, float> { #pragma omp declare simd simdlen(X) int tadd(int a, int b) { return a + b; } -// CHECK: #pragma omp declare simd simdlen(X) -// CHECK-NEXT: int tadd(int a, int b) { -// CHECK-NEXT: return a + b; -// CHECK-NEXT: } +// CHECK: #pragma omp declare simd simdlen(16) +// CHECK-NEXT: int tadd(int a, int b); #pragma omp declare simd aligned(a : X * 2) aligned(b) linear(ref(b): X) float taddpf(float *a, T *&b) { return *a + *b; } -// CHECK: #pragma omp declare simd aligned(a: X * 2) aligned(b) -// CHECK-NEXT: float taddpf(float *a, T *&b) { +// CHECK: #pragma omp declare simd aligned(a: 16 * 2) aligned(b) linear(ref(b): 16) +// CHECK-NEXT: float taddpf(float *a, float *&b) { // CHECK-NEXT: return *a + *b; // CHECK-NEXT: } @@ -123,10 +119,10 @@ private: }; // CHECK: }; -// CHECK: #pragma omp declare simd simdlen(64) aligned(b: 64 * 2) linear(uval(c): 64) -// CHECK: template void foo(int (&b)[64], float *&c) // CHECK: #pragma omp declare simd simdlen(N) aligned(b: N * 2) linear(uval(c): N) // CHECK: template void foo(int (&b)[N], float *&c) +// CHECK: #pragma omp declare simd simdlen(64) aligned(b: 64 * 2) linear(uval(c): 64) +// CHECK: template<> void foo<64>(int (&b)[64], float *&c) #pragma omp declare simd simdlen(N) aligned(b : N * 2) linear(uval(c): N) template void foo(int (&b)[N], float *&c); diff --git a/clang/test/OpenMP/declare_target_ast_print.cpp b/clang/test/OpenMP/declare_target_ast_print.cpp index 78a9cf6..591844b 100644 --- a/clang/test/OpenMP/declare_target_ast_print.cpp +++ b/clang/test/OpenMP/declare_target_ast_print.cpp @@ -34,7 +34,12 @@ void foo_cpp() {} #pragma omp declare target template struct C { -// CHECK: template struct C +// CHECK: template struct C { +// CHECK: #pragma omp declare target +// CHECK-NEXT: static T ts; +// CHECK-NEXT: #pragma omp end declare target + +// CHECK: template<> struct C T t; // CHECK-NEXT: int t; static T ts; @@ -59,11 +64,6 @@ struct C { // CHECK: #pragma omp end declare target }; -// CHECK: template struct C { -// CHECK: #pragma omp declare target -// CHECK-NEXT: static T ts; -// CHECK-NEXT: #pragma omp end declare target - template T C::ts = 1; // CHECK: #pragma omp declare target diff --git a/clang/test/OpenMP/distribute_ast_print.cpp b/clang/test/OpenMP/distribute_ast_print.cpp index 5748fc7..d4a9df9 100644 --- a/clang/test/OpenMP/distribute_ast_print.cpp +++ b/clang/test/OpenMP/distribute_ast_print.cpp @@ -41,13 +41,13 @@ public: // CHECK: #pragma omp target // CHECK-NEXT: #pragma omp teams -// CHECK-NEXT: #pragma omp distribute private(this->a) private(this->a) private(this->S::a) -// CHECK: #pragma omp target -// CHECK-NEXT: #pragma omp teams // CHECK-NEXT: #pragma omp distribute private(this->a) private(this->a) private(T::a) // CHECK: #pragma omp target // CHECK-NEXT: #pragma omp teams // CHECK-NEXT: #pragma omp distribute private(this->a) private(this->a) +// CHECK: #pragma omp target +// CHECK-NEXT: #pragma omp teams +// CHECK-NEXT: #pragma omp distribute private(this->a) private(this->a) private(this->S::a) class S8 : public S7 { S8() {} diff --git a/clang/test/OpenMP/distribute_dist_schedule_ast_print.cpp b/clang/test/OpenMP/distribute_dist_schedule_ast_print.cpp index 32389ef..b06a56e 100644 --- a/clang/test/OpenMP/distribute_dist_schedule_ast_print.cpp +++ b/clang/test/OpenMP/distribute_dist_schedule_ast_print.cpp @@ -57,6 +57,7 @@ T tmain(T argc) { } int main (int argc, char **argv) { +// CHECK: int main(int argc, char **argv) { int b = argc, c, d, e, f, g; static int a; // CHECK: static int a; diff --git a/clang/test/OpenMP/distribute_parallel_for_ast_print.cpp b/clang/test/OpenMP/distribute_parallel_for_ast_print.cpp index 993cc2a..012f278 100644 --- a/clang/test/OpenMP/distribute_parallel_for_ast_print.cpp +++ b/clang/test/OpenMP/distribute_parallel_for_ast_print.cpp @@ -37,9 +37,9 @@ public: } }; -// CHECK: #pragma omp distribute parallel for private(this->a) private(this->a) private(this->S::a) // CHECK: #pragma omp distribute parallel for private(this->a) private(this->a) private(T::a) // CHECK: #pragma omp distribute parallel for private(this->a) private(this->a) +// CHECK: #pragma omp distribute parallel for private(this->a) private(this->a) private(this->S::a) class S8 : public S7 { S8() {} diff --git a/clang/test/OpenMP/distribute_parallel_for_simd_ast_print.cpp b/clang/test/OpenMP/distribute_parallel_for_simd_ast_print.cpp index 56809dc..021b8f8 100644 --- a/clang/test/OpenMP/distribute_parallel_for_simd_ast_print.cpp +++ b/clang/test/OpenMP/distribute_parallel_for_simd_ast_print.cpp @@ -37,9 +37,9 @@ public: } }; -// CHECK: #pragma omp distribute parallel for simd private(this->a) private(this->a) private(this->S::a) // CHECK: #pragma omp distribute parallel for simd private(this->a) private(this->a) private(T::a) // CHECK: #pragma omp distribute parallel for simd private(this->a) private(this->a) +// CHECK: #pragma omp distribute parallel for simd private(this->a) private(this->a) private(this->S::a) class S8 : public S7 { S8() {} diff --git a/clang/test/OpenMP/distribute_simd_ast_print.cpp b/clang/test/OpenMP/distribute_simd_ast_print.cpp index 0435815..6d2e916 100644 --- a/clang/test/OpenMP/distribute_simd_ast_print.cpp +++ b/clang/test/OpenMP/distribute_simd_ast_print.cpp @@ -37,9 +37,9 @@ public: } }; -// CHECK: #pragma omp distribute simd private(this->a) private(this->a) private(this->S::a) // CHECK: #pragma omp distribute simd private(this->a) private(this->a) private(T::a) // CHECK: #pragma omp distribute simd private(this->a) private(this->a) +// CHECK: #pragma omp distribute simd private(this->a) private(this->a) private(this->S::a) class S8 : public S7 { S8() {} diff --git a/clang/test/OpenMP/flush_ast_print.cpp b/clang/test/OpenMP/flush_ast_print.cpp index 081c534..f3af47b 100644 --- a/clang/test/OpenMP/flush_ast_print.cpp +++ b/clang/test/OpenMP/flush_ast_print.cpp @@ -15,13 +15,13 @@ T tmain(T argc) { #pragma omp flush(a) return a + argc; } -// CHECK: static int a; +// CHECK: static T a; // CHECK-NEXT: #pragma omp flush // CHECK-NEXT: #pragma omp flush (a) -// CHECK: static char a; +// CHECK: static int a; // CHECK-NEXT: #pragma omp flush // CHECK-NEXT: #pragma omp flush (a) -// CHECK: static T a; +// CHECK: static char a; // CHECK-NEXT: #pragma omp flush // CHECK-NEXT: #pragma omp flush (a) diff --git a/clang/test/OpenMP/for_ast_print.cpp b/clang/test/OpenMP/for_ast_print.cpp index 182b395..f489b21 100644 --- a/clang/test/OpenMP/for_ast_print.cpp +++ b/clang/test/OpenMP/for_ast_print.cpp @@ -50,15 +50,15 @@ public: } }; -// CHECK: #pragma omp for private(this->a) private(this->a) private(this->S::a) -// CHECK: #pragma omp for lastprivate(this->a) lastprivate(this->a) lastprivate(this->S::a) -// CHECK: #pragma omp for linear(val(this->c)) // CHECK: #pragma omp for private(this->a) private(this->a) private(T::a) // CHECK: #pragma omp for lastprivate(this->a) lastprivate(this->a) lastprivate(T::a) // CHECK: #pragma omp for linear(val(this->c)) // CHECK: #pragma omp for private(this->a) private(this->a) // CHECK: #pragma omp for lastprivate(this->a) lastprivate(this->a) // CHECK: #pragma omp for linear(uval(this->b)) +// CHECK: #pragma omp for private(this->a) private(this->a) private(this->S::a) +// CHECK: #pragma omp for lastprivate(this->a) lastprivate(this->a) lastprivate(this->S::a) +// CHECK: #pragma omp for linear(val(this->c)) class S8 : public S7 { S8() {} @@ -137,6 +137,7 @@ T tmain(T argc) { } int main(int argc, char **argv) { +// CHECK: int main(int argc, char **argv) { int b = argc, c, d, e, f, g; static int a; // CHECK: static int a; diff --git a/clang/test/OpenMP/for_simd_ast_print.cpp b/clang/test/OpenMP/for_simd_ast_print.cpp index 54f0d46..befad16 100644 --- a/clang/test/OpenMP/for_simd_ast_print.cpp +++ b/clang/test/OpenMP/for_simd_ast_print.cpp @@ -33,9 +33,9 @@ public: } }; -// CHECK: #pragma omp for simd private(this->a) private(this->a) private(this->S1::a) // CHECK: #pragma omp for simd private(this->a) private(this->a) private(T::a) // CHECK: #pragma omp for simd private(this->a) private(this->a) +// CHECK: #pragma omp for simd private(this->a) private(this->a) private(this->S1::a) class S8 : public S7 { S8() {} @@ -125,7 +125,7 @@ template struct S2 { }; // S2<4>::func is called below in main. -// CHECK: template struct S2 { +// CHECK: template<> struct S2<4> { // CHECK-NEXT: static void func(int n, float *a, float *b, float *c) { // CHECK-NEXT: int k1 = 0, k2 = 0; // CHECK-NEXT: #pragma omp for simd safelen(4) linear(k1,k2: 4) aligned(a: 4) simdlen(4) diff --git a/clang/test/OpenMP/ordered_ast_print.cpp b/clang/test/OpenMP/ordered_ast_print.cpp index 97fe700..c7baa9c 100644 --- a/clang/test/OpenMP/ordered_ast_print.cpp +++ b/clang/test/OpenMP/ordered_ast_print.cpp @@ -51,7 +51,7 @@ T tmain (T argc) { return (0); } -// CHECK: static int a; +// CHECK: static T a; // CHECK-NEXT: #pragma omp for ordered // CHECK-NEXT: for (int i = 0; i < argc; ++i) // CHECK-NEXT: #pragma omp ordered @@ -85,10 +85,10 @@ T tmain (T argc) { // CHECK-NEXT: #pragma omp parallel for ordered(1) // CHECK-NEXT: for (int i = 0; i < argc; ++i) { // CHECK-NEXT: #pragma omp ordered depend(source) -// CHECK-NEXT: #pragma omp ordered depend(sink : i + 3) +// CHECK-NEXT: #pragma omp ordered depend(sink : i + N) // CHECK-NEXT: a = 2; // CHECK-NEXT: } -// CHECK: static T a; +// CHECK: static int a; // CHECK-NEXT: #pragma omp for ordered // CHECK-NEXT: for (int i = 0; i < argc; ++i) // CHECK-NEXT: #pragma omp ordered @@ -122,7 +122,7 @@ T tmain (T argc) { // CHECK-NEXT: #pragma omp parallel for ordered(1) // CHECK-NEXT: for (int i = 0; i < argc; ++i) { // CHECK-NEXT: #pragma omp ordered depend(source) -// CHECK-NEXT: #pragma omp ordered depend(sink : i + N) +// CHECK-NEXT: #pragma omp ordered depend(sink : i + 3) // CHECK-NEXT: a = 2; // CHECK-NEXT: } diff --git a/clang/test/OpenMP/parallel_ast_print.cpp b/clang/test/OpenMP/parallel_ast_print.cpp index 8a15339..135c085 100644 --- a/clang/test/OpenMP/parallel_ast_print.cpp +++ b/clang/test/OpenMP/parallel_ast_print.cpp @@ -58,10 +58,6 @@ public: } }; -// CHECK: #pragma omp parallel private(this->a) private(this->a) private(this->S1::a) -// CHECK: #pragma omp parallel firstprivate(this->a) firstprivate(this->a) firstprivate(this->S1::a) -// CHECK: #pragma omp parallel shared(this->a) shared(this->a) shared(this->S1::a) -// CHECK: #pragma omp parallel reduction(+: this->a) reduction(*: this->b[:]) // CHECK: #pragma omp parallel private(this->a) private(this->a) private(T::a) // CHECK: #pragma omp parallel firstprivate(this->a) firstprivate(this->a) firstprivate(T::a) // CHECK: #pragma omp parallel shared(this->a) shared(this->a) shared(T::a) @@ -70,6 +66,10 @@ public: // CHECK: #pragma omp parallel firstprivate(this->a) firstprivate(this->a) // CHECK: #pragma omp parallel shared(this->a) shared(this->a) // CHECK: #pragma omp parallel reduction(&&: this->a) reduction(^: this->b[s.a.a]) +// CHECK: #pragma omp parallel private(this->a) private(this->a) private(this->S1::a) +// CHECK: #pragma omp parallel firstprivate(this->a) firstprivate(this->a) firstprivate(this->S1::a) +// CHECK: #pragma omp parallel shared(this->a) shared(this->a) shared(this->S1::a) +// CHECK: #pragma omp parallel reduction(+: this->a) reduction(*: this->b[:]) class S8 : public S7 { S8() {} @@ -122,18 +122,18 @@ struct S { #pragma omp threadprivate(TS) }; -// CHECK: template struct S { +// CHECK: template struct S { +// CHECK: static T TS; +// CHECK-NEXT: #pragma omp threadprivate(S::TS) +// CHECK: }; +// CHECK: template<> struct S { // CHECK: static int TS; // CHECK-NEXT: #pragma omp threadprivate(S::TS) // CHECK-NEXT: } -// CHECK: template struct S { +// CHECK: template<> struct S { // CHECK: static long TS; // CHECK-NEXT: #pragma omp threadprivate(S::TS) // CHECK-NEXT: } -// CHECK: template struct S { -// CHECK: static T TS; -// CHECK-NEXT: #pragma omp threadprivate(S::TS) -// CHECK: }; template T tmain(T argc, T *argv) { @@ -150,7 +150,18 @@ T tmain(T argc, T *argv) { return 0; } -// CHECK: template int tmain(int argc, int *argv) { +// CHECK: template T tmain(T argc, T *argv) { +// CHECK-NEXT: T b = argc, c, d, e, f, g; +// CHECK-NEXT: static T a; +// CHECK-NEXT: S s; +// CHECK-NEXT: T arr[C][10], arr1[C]; +// CHECK-NEXT: #pragma omp parallel +// CHECK-NEXT: a = 2; +// CHECK-NEXT: #pragma omp parallel default(none) private(argc,b) firstprivate(argv) shared(d) if(parallel: argc > 0) num_threads(C) copyin(S::TS) proc_bind(master) reduction(+: c,arr1[argc]) reduction(max: e,arr[:C][0:10]) +// CHECK-NEXT: foo() +// CHECK-NEXT: #pragma omp parallel if(C) num_threads(s) proc_bind(close) reduction(^: e,f,arr[0:C][:argc]) reduction(&&: g) +// CHECK-NEXT: foo() +// CHECK: template<> int tmain(int argc, int *argv) { // CHECK-NEXT: int b = argc, c, d, e, f, g; // CHECK-NEXT: static int a; // CHECK-NEXT: S s; @@ -161,7 +172,7 @@ T tmain(T argc, T *argv) { // CHECK-NEXT: foo() // CHECK-NEXT: #pragma omp parallel if(5) num_threads(s) proc_bind(close) reduction(^: e,f,arr[0:5][:argc]) reduction(&&: g) // CHECK-NEXT: foo() -// CHECK: template long tmain(long argc, long *argv) { +// CHECK: template<> long tmain(long argc, long *argv) { // CHECK-NEXT: long b = argc, c, d, e, f, g; // CHECK-NEXT: static long a; // CHECK-NEXT: S s; @@ -172,17 +183,6 @@ T tmain(T argc, T *argv) { // CHECK-NEXT: foo() // CHECK-NEXT: #pragma omp parallel if(1) num_threads(s) proc_bind(close) reduction(^: e,f,arr[0:1][:argc]) reduction(&&: g) // CHECK-NEXT: foo() -// CHECK: template T tmain(T argc, T *argv) { -// CHECK-NEXT: T b = argc, c, d, e, f, g; -// CHECK-NEXT: static T a; -// CHECK-NEXT: S s; -// CHECK-NEXT: T arr[C][10], arr1[C]; -// CHECK-NEXT: #pragma omp parallel -// CHECK-NEXT: a = 2; -// CHECK-NEXT: #pragma omp parallel default(none) private(argc,b) firstprivate(argv) shared(d) if(parallel: argc > 0) num_threads(C) copyin(S::TS) proc_bind(master) reduction(+: c,arr1[argc]) reduction(max: e,arr[:C][0:10]) -// CHECK-NEXT: foo() -// CHECK-NEXT: #pragma omp parallel if(C) num_threads(s) proc_bind(close) reduction(^: e,f,arr[0:C][:argc]) reduction(&&: g) -// CHECK-NEXT: foo() enum Enum { }; diff --git a/clang/test/OpenMP/parallel_for_ast_print.cpp b/clang/test/OpenMP/parallel_for_ast_print.cpp index 2476ee8..c400e9b 100644 --- a/clang/test/OpenMP/parallel_for_ast_print.cpp +++ b/clang/test/OpenMP/parallel_for_ast_print.cpp @@ -35,9 +35,9 @@ public: } }; -// CHECK: #pragma omp parallel for private(this->a) private(this->a) private(this->S::a) // CHECK: #pragma omp parallel for private(this->a) private(this->a) private(T::a) // CHECK: #pragma omp parallel for private(this->a) private(this->a) +// CHECK: #pragma omp parallel for private(this->a) private(this->a) private(this->S::a) class S8 : public S7 { S8() {} diff --git a/clang/test/OpenMP/parallel_for_simd_ast_print.cpp b/clang/test/OpenMP/parallel_for_simd_ast_print.cpp index cdd1b73..137d8dfa 100644 --- a/clang/test/OpenMP/parallel_for_simd_ast_print.cpp +++ b/clang/test/OpenMP/parallel_for_simd_ast_print.cpp @@ -35,9 +35,9 @@ public: } }; -// CHECK: #pragma omp parallel for simd private(this->a) private(this->a) private(this->S1::a) // CHECK: #pragma omp parallel for simd private(this->a) private(this->a) private(T::a) // CHECK: #pragma omp parallel for simd private(this->a) private(this->a) +// CHECK: #pragma omp parallel for simd private(this->a) private(this->a) private(this->S1::a) class S8 : public S7 { S8() {} @@ -126,7 +126,7 @@ template struct S2 { }; // S2<4>::func is called below in main. -// CHECK: template struct S2 { +// CHECK: template<> struct S2<4> { // CHECK-NEXT: static void func(int n, float *a, float *b, float *c) { // CHECK-NEXT: int k1 = 0, k2 = 0; // CHECK-NEXT: #pragma omp parallel for simd safelen(4) linear(k1,k2: 4) aligned(a: 4) simdlen(4) diff --git a/clang/test/OpenMP/parallel_sections_ast_print.cpp b/clang/test/OpenMP/parallel_sections_ast_print.cpp index a66b75e..4c298df 100644 --- a/clang/test/OpenMP/parallel_sections_ast_print.cpp +++ b/clang/test/OpenMP/parallel_sections_ast_print.cpp @@ -15,18 +15,18 @@ struct S { #pragma omp threadprivate(TS) }; -// CHECK: template struct S { +// CHECK: template struct S { +// CHECK: static T TS; +// CHECK-NEXT: #pragma omp threadprivate(S::TS) +// CHECK: }; +// CHECK: template<> struct S { // CHECK: static int TS; // CHECK-NEXT: #pragma omp threadprivate(S::TS) // CHECK-NEXT: } -// CHECK: template struct S { +// CHECK: template<> struct S { // CHECK: static long TS; // CHECK-NEXT: #pragma omp threadprivate(S::TS) // CHECK-NEXT: } -// CHECK: template struct S { -// CHECK: static T TS; -// CHECK-NEXT: #pragma omp threadprivate(S::TS) -// CHECK: }; template T tmain(T argc, T *argv) { @@ -50,55 +50,55 @@ T tmain(T argc, T *argv) { return 0; } -// CHECK: template int tmain(int argc, int *argv) { -// CHECK-NEXT: int b = argc, c, d, e, f, g; -// CHECK-NEXT: static int a; -// CHECK-NEXT: S s; +// CHECK: template T tmain(T argc, T *argv) { +// CHECK-NEXT: T b = argc, c, d, e, f, g; +// CHECK-NEXT: static T a; +// CHECK-NEXT: S s; // CHECK-NEXT: #pragma omp parallel sections // CHECK-NEXT: { // CHECK-NEXT: a = 2; // CHECK-NEXT: } -// CHECK-NEXT: #pragma omp parallel sections default(none) private(argc,b) firstprivate(argv) shared(d) if(parallel: argc > 0) num_threads(5) copyin(S::TS) proc_bind(master) reduction(+: c) reduction(max: e) +// CHECK-NEXT: #pragma omp parallel sections default(none) private(argc,b) firstprivate(argv) shared(d) if(parallel: argc > 0) num_threads(C) copyin(S::TS) proc_bind(master) reduction(+: c) reduction(max: e) // CHECK-NEXT: { // CHECK-NEXT: foo(); // CHECK-NEXT: } -// CHECK-NEXT: #pragma omp parallel sections if(5) num_threads(s) proc_bind(close) reduction(^: e,f) reduction(&&: g) lastprivate(b,c) +// CHECK-NEXT: #pragma omp parallel sections if(C) num_threads(s) proc_bind(close) reduction(^: e,f) reduction(&&: g) lastprivate(b,c) // CHECK-NEXT: { // CHECK-NEXT: foo(); // CHECK-NEXT: #pragma omp section // CHECK-NEXT: foo(); // CHECK-NEXT: } -// CHECK: template long tmain(long argc, long *argv) { -// CHECK-NEXT: long b = argc, c, d, e, f, g; -// CHECK-NEXT: static long a; -// CHECK-NEXT: S s; +// CHECK: template<> int tmain(int argc, int *argv) { +// CHECK-NEXT: int b = argc, c, d, e, f, g; +// CHECK-NEXT: static int a; +// CHECK-NEXT: S s; // CHECK-NEXT: #pragma omp parallel sections // CHECK-NEXT: { // CHECK-NEXT: a = 2; // CHECK-NEXT: } -// CHECK-NEXT: #pragma omp parallel sections default(none) private(argc,b) firstprivate(argv) shared(d) if(parallel: argc > 0) num_threads(1) copyin(S::TS) proc_bind(master) reduction(+: c) reduction(max: e) +// CHECK-NEXT: #pragma omp parallel sections default(none) private(argc,b) firstprivate(argv) shared(d) if(parallel: argc > 0) num_threads(5) copyin(S::TS) proc_bind(master) reduction(+: c) reduction(max: e) // CHECK-NEXT: { // CHECK-NEXT: foo(); // CHECK-NEXT: } -// CHECK-NEXT: #pragma omp parallel sections if(1) num_threads(s) proc_bind(close) reduction(^: e,f) reduction(&&: g) lastprivate(b,c) +// CHECK-NEXT: #pragma omp parallel sections if(5) num_threads(s) proc_bind(close) reduction(^: e,f) reduction(&&: g) lastprivate(b,c) // CHECK-NEXT: { // CHECK-NEXT: foo(); // CHECK-NEXT: #pragma omp section // CHECK-NEXT: foo(); // CHECK-NEXT: } -// CHECK: template T tmain(T argc, T *argv) { -// CHECK-NEXT: T b = argc, c, d, e, f, g; -// CHECK-NEXT: static T a; -// CHECK-NEXT: S s; +// CHECK: template<> long tmain(long argc, long *argv) { +// CHECK-NEXT: long b = argc, c, d, e, f, g; +// CHECK-NEXT: static long a; +// CHECK-NEXT: S s; // CHECK-NEXT: #pragma omp parallel sections // CHECK-NEXT: { // CHECK-NEXT: a = 2; // CHECK-NEXT: } -// CHECK-NEXT: #pragma omp parallel sections default(none) private(argc,b) firstprivate(argv) shared(d) if(parallel: argc > 0) num_threads(C) copyin(S::TS) proc_bind(master) reduction(+: c) reduction(max: e) +// CHECK-NEXT: #pragma omp parallel sections default(none) private(argc,b) firstprivate(argv) shared(d) if(parallel: argc > 0) num_threads(1) copyin(S::TS) proc_bind(master) reduction(+: c) reduction(max: e) // CHECK-NEXT: { // CHECK-NEXT: foo(); // CHECK-NEXT: } -// CHECK-NEXT: #pragma omp parallel sections if(C) num_threads(s) proc_bind(close) reduction(^: e,f) reduction(&&: g) lastprivate(b,c) +// CHECK-NEXT: #pragma omp parallel sections if(1) num_threads(s) proc_bind(close) reduction(^: e,f) reduction(&&: g) lastprivate(b,c) // CHECK-NEXT: { // CHECK-NEXT: foo(); // CHECK-NEXT: #pragma omp section diff --git a/clang/test/OpenMP/sections_ast_print.cpp b/clang/test/OpenMP/sections_ast_print.cpp index ea96be3..7fecd5b 100644 --- a/clang/test/OpenMP/sections_ast_print.cpp +++ b/clang/test/OpenMP/sections_ast_print.cpp @@ -27,6 +27,7 @@ T tmain(T argc) { } int main(int argc, char **argv) { +// CHECK: int main(int argc, char **argv) { int b = argc, c, d, e, f, g; static int a; // CHECK: static int a; diff --git a/clang/test/OpenMP/simd_ast_print.cpp b/clang/test/OpenMP/simd_ast_print.cpp index 99c00c6..9fcd459 100644 --- a/clang/test/OpenMP/simd_ast_print.cpp +++ b/clang/test/OpenMP/simd_ast_print.cpp @@ -35,8 +35,8 @@ public: }; // CHECK: #pragma omp simd aligned(this->a) -// CHECK: #pragma omp simd aligned(this->a) // CHECK: #pragma omp simd aligned(this->b: 8) +// CHECK: #pragma omp simd aligned(this->a) class S8 : public S7 { S8() {} @@ -129,7 +129,7 @@ template struct S2 { }; // S2<4>::func is called below in main. -// CHECK: template struct S2 { +// CHECK: template<> struct S2<4> { // CHECK-NEXT: static void func(int n, float *a, float *b, float *c) { // CHECK-NEXT: int k1 = 0, k2 = 0; // CHECK-NEXT: #pragma omp simd safelen(4) linear(k1,k2: 4) aligned(a: 4) simdlen(4) diff --git a/clang/test/OpenMP/single_ast_print.cpp b/clang/test/OpenMP/single_ast_print.cpp index d30b7fe..e819ab9 100644 --- a/clang/test/OpenMP/single_ast_print.cpp +++ b/clang/test/OpenMP/single_ast_print.cpp @@ -57,6 +57,7 @@ T tmain(T argc) { } int main(int argc, char **argv) { +// CHECK: int main(int argc, char **argv) { int b = argc, c, d, e, f, g; static int a; SS ss(a); diff --git a/clang/test/OpenMP/target_ast_print.cpp b/clang/test/OpenMP/target_ast_print.cpp index e093e29..24f6d5a 100644 --- a/clang/test/OpenMP/target_ast_print.cpp +++ b/clang/test/OpenMP/target_ast_print.cpp @@ -34,13 +34,13 @@ T tmain(T argc, T *argv) { return 0; } -// CHECK: template int tmain(int argc, int *argv) { -// CHECK-NEXT: int i, j, a[20] +// CHECK: template T tmain(T argc, T *argv) { +// CHECK-NEXT: T i, j, a[20] // CHECK-NEXT: #pragma omp target // CHECK-NEXT: foo(); // CHECK-NEXT: #pragma omp target if(target: argc > 0) // CHECK-NEXT: foo() -// CHECK-NEXT: #pragma omp target if(5) +// CHECK-NEXT: #pragma omp target if(C) // CHECK-NEXT: foo() // CHECK-NEXT: #pragma omp target map(tofrom: i) // CHECK-NEXT: foo() @@ -56,13 +56,13 @@ T tmain(T argc, T *argv) { // CHECK-NEXT: foo() // CHECK-NEXT: #pragma omp target defaultmap(tofrom: scalar) // CHECK-NEXT: foo() -// CHECK: template char tmain(char argc, char *argv) { -// CHECK-NEXT: char i, j, a[20] +// CHECK: template<> int tmain(int argc, int *argv) { +// CHECK-NEXT: int i, j, a[20] // CHECK-NEXT: #pragma omp target // CHECK-NEXT: foo(); // CHECK-NEXT: #pragma omp target if(target: argc > 0) // CHECK-NEXT: foo() -// CHECK-NEXT: #pragma omp target if(1) +// CHECK-NEXT: #pragma omp target if(5) // CHECK-NEXT: foo() // CHECK-NEXT: #pragma omp target map(tofrom: i) // CHECK-NEXT: foo() @@ -78,13 +78,13 @@ T tmain(T argc, T *argv) { // CHECK-NEXT: foo() // CHECK-NEXT: #pragma omp target defaultmap(tofrom: scalar) // CHECK-NEXT: foo() -// CHECK: template T tmain(T argc, T *argv) { -// CHECK-NEXT: T i, j, a[20] +// CHECK: template<> char tmain(char argc, char *argv) { +// CHECK-NEXT: char i, j, a[20] // CHECK-NEXT: #pragma omp target // CHECK-NEXT: foo(); // CHECK-NEXT: #pragma omp target if(target: argc > 0) // CHECK-NEXT: foo() -// CHECK-NEXT: #pragma omp target if(C) +// CHECK-NEXT: #pragma omp target if(1) // CHECK-NEXT: foo() // CHECK-NEXT: #pragma omp target map(tofrom: i) // CHECK-NEXT: foo() diff --git a/clang/test/OpenMP/target_data_ast_print.cpp b/clang/test/OpenMP/target_data_ast_print.cpp index ed7a965..88c8df8 100644 --- a/clang/test/OpenMP/target_data_ast_print.cpp +++ b/clang/test/OpenMP/target_data_ast_print.cpp @@ -46,8 +46,8 @@ T tmain(T argc, T *argv) { return 0; } -// CHECK: template int tmain(int argc, int *argv) { -// CHECK-NEXT: int i, j, b, c, d, e, x[20]; +// CHECK: template T tmain(T argc, T *argv) { +// CHECK-NEXT: T i, j, b, c, d, e, x[20]; // CHECK-NEXT: #pragma omp target data map(to: c) // CHECK-NEXT: i = argc; // CHECK-NEXT: #pragma omp target data map(to: c) if(target data: j > 0) @@ -68,8 +68,8 @@ T tmain(T argc, T *argv) { // CHECK-NEXT: { // CHECK-NEXT: #pragma omp target map(always,alloc: e) // CHECK-NEXT: foo(); -// CHECK: template char tmain(char argc, char *argv) { -// CHECK-NEXT: char i, j, b, c, d, e, x[20]; +// CHECK: template<> int tmain(int argc, int *argv) { +// CHECK-NEXT: int i, j, b, c, d, e, x[20]; // CHECK-NEXT: #pragma omp target data map(to: c) // CHECK-NEXT: i = argc; // CHECK-NEXT: #pragma omp target data map(to: c) if(target data: j > 0) @@ -90,8 +90,8 @@ T tmain(T argc, T *argv) { // CHECK-NEXT: { // CHECK-NEXT: #pragma omp target map(always,alloc: e) // CHECK-NEXT: foo(); -// CHECK: template T tmain(T argc, T *argv) { -// CHECK-NEXT: T i, j, b, c, d, e, x[20]; +// CHECK: template<> char tmain(char argc, char *argv) { +// CHECK-NEXT: char i, j, b, c, d, e, x[20]; // CHECK-NEXT: #pragma omp target data map(to: c) // CHECK-NEXT: i = argc; // CHECK-NEXT: #pragma omp target data map(to: c) if(target data: j > 0) diff --git a/clang/test/OpenMP/target_data_use_device_ptr_ast_print.cpp b/clang/test/OpenMP/target_data_use_device_ptr_ast_print.cpp index 4e3253b..ce1ec1d 100644 --- a/clang/test/OpenMP/target_data_use_device_ptr_ast_print.cpp +++ b/clang/test/OpenMP/target_data_use_device_ptr_ast_print.cpp @@ -110,7 +110,7 @@ T tmain(T argc) { return 0; } -// CHECK: template int tmain(int argc) { +// CHECK: template<> int tmain(int argc) { // CHECK-NEXT: int i; // CHECK-NEXT: int &j = i; // CHECK-NEXT: int *k = &j; @@ -120,7 +120,7 @@ T tmain(T argc) { // CHECK-NEXT: } // CHECK-NEXT: #pragma omp target data map(tofrom: i) use_device_ptr(z) -// CHECK: template int *tmain(int *argc) { +// CHECK: template<> int *tmain(int *argc) { // CHECK-NEXT: int *i; // CHECK-NEXT: int *&j = i; // CHECK-NEXT: int **k = &j; diff --git a/clang/test/OpenMP/target_enter_data_ast_print.cpp b/clang/test/OpenMP/target_enter_data_ast_print.cpp index 10ec925..9c4c62f 100644 --- a/clang/test/OpenMP/target_enter_data_ast_print.cpp +++ b/clang/test/OpenMP/target_enter_data_ast_print.cpp @@ -62,8 +62,8 @@ T tmain(T argc, T *argv) { return 0; } -// CHECK: template int tmain(int argc, int *argv) { -// CHECK-NEXT: int i, j, b, c, d, e, x[20]; +// CHECK: template T tmain(T argc, T *argv) { +// CHECK-NEXT: T i, j, b, c, d, e, x[20]; // CHECK-NEXT: i = argc; // CHECK-NEXT: #pragma omp target enter data map(to: i) // CHECK-NEXT: #pragma omp target enter data map(to: i) if(target enter data: j > 0) @@ -89,8 +89,8 @@ T tmain(T argc, T *argv) { // CHECK-NEXT: #pragma omp target enter data nowait map(alloc: x[0:10],c) depend(in : argc,argv[i:argc],x[:]) // CHECK-NEXT: #pragma omp target enter data nowait depend(in : argc,argv[i:argc],x[:]) map(to: c) map(alloc: d) // CHECK-NEXT: #pragma omp target enter data nowait map(always,alloc: e) depend(in : argc,argv[i:argc],x[:]) -// CHECK: template char tmain(char argc, char *argv) { -// CHECK-NEXT: char i, j, b, c, d, e, x[20]; +// CHECK: template<> int tmain(int argc, int *argv) { +// CHECK-NEXT: int i, j, b, c, d, e, x[20]; // CHECK-NEXT: i = argc; // CHECK-NEXT: #pragma omp target enter data map(to: i) // CHECK-NEXT: #pragma omp target enter data map(to: i) if(target enter data: j > 0) @@ -116,8 +116,8 @@ T tmain(T argc, T *argv) { // CHECK-NEXT: #pragma omp target enter data nowait map(alloc: x[0:10],c) depend(in : argc,argv[i:argc],x[:]) // CHECK-NEXT: #pragma omp target enter data nowait depend(in : argc,argv[i:argc],x[:]) map(to: c) map(alloc: d) // CHECK-NEXT: #pragma omp target enter data nowait map(always,alloc: e) depend(in : argc,argv[i:argc],x[:]) -// CHECK: template T tmain(T argc, T *argv) { -// CHECK-NEXT: T i, j, b, c, d, e, x[20]; +// CHECK: template<> char tmain(char argc, char *argv) { +// CHECK-NEXT: char i, j, b, c, d, e, x[20]; // CHECK-NEXT: i = argc; // CHECK-NEXT: #pragma omp target enter data map(to: i) // CHECK-NEXT: #pragma omp target enter data map(to: i) if(target enter data: j > 0) diff --git a/clang/test/OpenMP/target_exit_data_ast_print.cpp b/clang/test/OpenMP/target_exit_data_ast_print.cpp index e2c6d7f..bebb2da 100644 --- a/clang/test/OpenMP/target_exit_data_ast_print.cpp +++ b/clang/test/OpenMP/target_exit_data_ast_print.cpp @@ -66,8 +66,8 @@ T tmain(T argc, T *argv) { return 0; } -// CHECK: template int tmain(int argc, int *argv) { -// CHECK-NEXT: int i, j, b, c, d, e, x[20]; +// CHECK: template T tmain(T argc, T *argv) { +// CHECK-NEXT: T i, j, b, c, d, e, x[20]; // CHECK-NEXT: i = argc; // CHECK-NEXT: #pragma omp target exit data map(from: i) // CHECK-NEXT: #pragma omp target exit data map(from: i) if(target exit data: j > 0) @@ -95,8 +95,8 @@ T tmain(T argc, T *argv) { // CHECK-NEXT: #pragma omp target exit data nowait map(release: x[0:10],c) depend(in : argc,argv[i:argc],x[:]) // CHECK-NEXT: #pragma omp target exit data nowait map(from: c) depend(in : argc,argv[i:argc],x[:]) map(release: d) // CHECK-NEXT: #pragma omp target exit data depend(in : argc,argv[i:argc],x[:]) nowait map(always,release: e) -// CHECK: template char tmain(char argc, char *argv) { -// CHECK-NEXT: char i, j, b, c, d, e, x[20]; +// CHECK: template<> int tmain(int argc, int *argv) { +// CHECK-NEXT: int i, j, b, c, d, e, x[20]; // CHECK-NEXT: i = argc; // CHECK-NEXT: #pragma omp target exit data map(from: i) // CHECK-NEXT: #pragma omp target exit data map(from: i) if(target exit data: j > 0) @@ -124,8 +124,8 @@ T tmain(T argc, T *argv) { // CHECK-NEXT: #pragma omp target exit data nowait map(release: x[0:10],c) depend(in : argc,argv[i:argc],x[:]) // CHECK-NEXT: #pragma omp target exit data nowait map(from: c) depend(in : argc,argv[i:argc],x[:]) map(release: d) // CHECK-NEXT: #pragma omp target exit data depend(in : argc,argv[i:argc],x[:]) nowait map(always,release: e) -// CHECK: template T tmain(T argc, T *argv) { -// CHECK-NEXT: T i, j, b, c, d, e, x[20]; +// CHECK: template<> char tmain(char argc, char *argv) { +// CHECK-NEXT: char i, j, b, c, d, e, x[20]; // CHECK-NEXT: i = argc; // CHECK-NEXT: #pragma omp target exit data map(from: i) // CHECK-NEXT: #pragma omp target exit data map(from: i) if(target exit data: j > 0) diff --git a/clang/test/OpenMP/target_is_device_ptr_ast_print.cpp b/clang/test/OpenMP/target_is_device_ptr_ast_print.cpp index f519235..8e56aa2 100644 --- a/clang/test/OpenMP/target_is_device_ptr_ast_print.cpp +++ b/clang/test/OpenMP/target_is_device_ptr_ast_print.cpp @@ -172,7 +172,7 @@ T tmain(T argc) { return 0; } -// CHECK: template int tmain(int argc) { +// CHECK: template<> int tmain(int argc) { // CHECK-NEXT: const int da[5] = {0}; // CHECK-NEXT: S6 h[10]; // CHECK-NEXT: auto &rh = h; @@ -202,7 +202,7 @@ T tmain(T argc) { // CHECK-NEXT: } // CHECK-NEXT: #pragma omp target is_device_ptr(da) -// CHECK: template int *tmain(int *argc) { +// CHECK: template<> int *tmain(int *argc) { // CHECK-NEXT: int *const da[5] = {0}; // CHECK-NEXT: S6 h[10]; // CHECK-NEXT: auto &rh = h; diff --git a/clang/test/OpenMP/target_parallel_ast_print.cpp b/clang/test/OpenMP/target_parallel_ast_print.cpp index 1c0fca5..7e31f50 100644 --- a/clang/test/OpenMP/target_parallel_ast_print.cpp +++ b/clang/test/OpenMP/target_parallel_ast_print.cpp @@ -15,18 +15,18 @@ struct S { #pragma omp threadprivate(TS) }; -// CHECK: template struct S { +// CHECK: template struct S { +// CHECK: static T TS; +// CHECK-NEXT: #pragma omp threadprivate(S::TS) +// CHECK: }; +// CHECK: template<> struct S { // CHECK: static int TS; // CHECK-NEXT: #pragma omp threadprivate(S::TS) // CHECK-NEXT: } -// CHECK: template struct S { +// CHECK: template<> struct S { // CHECK: static char TS; // CHECK-NEXT: #pragma omp threadprivate(S::TS) // CHECK-NEXT: } -// CHECK: template struct S { -// CHECK: static T TS; -// CHECK-NEXT: #pragma omp threadprivate(S::TS) -// CHECK: }; template T tmain(T argc, T *argv) { @@ -64,23 +64,23 @@ T tmain(T argc, T *argv) { return 0; } -// CHECK: template int tmain(int argc, int *argv) { -// CHECK-NEXT: int b = argc, c, d, e, f, g; -// CHECK-NEXT: static int h; -// CHECK-NEXT: S s; -// CHECK-NEXT: int arr[5][10], arr1[5]; -// CHECK-NEXT: int i, j, a[20] +// CHECK: template T tmain(T argc, T *argv) { +// CHECK-NEXT: T b = argc, c, d, e, f, g; +// CHECK-NEXT: static T h; +// CHECK-NEXT: S s; +// CHECK-NEXT: T arr[C][10], arr1[C]; +// CHECK-NEXT: T i, j, a[20] // CHECK-NEXT: #pragma omp target parallel // CHECK-NEXT: h = 2; -// CHECK-NEXT: #pragma omp target parallel default(none) private(argc,b) firstprivate(argv) shared(d) if(parallel: argc > 0) num_threads(5) proc_bind(master) reduction(+: c,arr1[argc]) reduction(max: e,arr[:5][0:10]) +// CHECK-NEXT: #pragma omp target parallel default(none) private(argc,b) firstprivate(argv) shared(d) if(parallel: argc > 0) num_threads(C) proc_bind(master) reduction(+: c,arr1[argc]) reduction(max: e,arr[:C][0:10]) // CHECK-NEXT: foo() -// CHECK-NEXT: #pragma omp target parallel if(5) num_threads(s) proc_bind(close) reduction(^: e,f,arr[0:5][:argc]) reduction(&&: g) +// CHECK-NEXT: #pragma omp target parallel if(C) num_threads(s) proc_bind(close) reduction(^: e,f,arr[0:C][:argc]) reduction(&&: g) // CHECK-NEXT: foo() // CHECK-NEXT: #pragma omp target parallel if(target: argc > 0) // CHECK-NEXT: foo() // CHECK-NEXT: #pragma omp target parallel if(parallel: argc > 0) // CHECK-NEXT: foo() -// CHECK-NEXT: #pragma omp target parallel if(5) +// CHECK-NEXT: #pragma omp target parallel if(C) // CHECK-NEXT: foo() // CHECK-NEXT: #pragma omp target parallel map(tofrom: i) // CHECK-NEXT: foo() @@ -96,23 +96,23 @@ T tmain(T argc, T *argv) { // CHECK-NEXT: foo() // CHECK-NEXT: #pragma omp target parallel defaultmap(tofrom: scalar) // CHECK-NEXT: foo() -// CHECK: template char tmain(char argc, char *argv) { -// CHECK-NEXT: char b = argc, c, d, e, f, g; -// CHECK-NEXT: static char h; -// CHECK-NEXT: S s; -// CHECK-NEXT: char arr[1][10], arr1[1]; -// CHECK-NEXT: char i, j, a[20] +// CHECK: template<> int tmain(int argc, int *argv) { +// CHECK-NEXT: int b = argc, c, d, e, f, g; +// CHECK-NEXT: static int h; +// CHECK-NEXT: S s; +// CHECK-NEXT: int arr[5][10], arr1[5]; +// CHECK-NEXT: int i, j, a[20] // CHECK-NEXT: #pragma omp target parallel // CHECK-NEXT: h = 2; -// CHECK-NEXT: #pragma omp target parallel default(none) private(argc,b) firstprivate(argv) shared(d) if(parallel: argc > 0) num_threads(1) proc_bind(master) reduction(+: c,arr1[argc]) reduction(max: e,arr[:1][0:10]) +// CHECK-NEXT: #pragma omp target parallel default(none) private(argc,b) firstprivate(argv) shared(d) if(parallel: argc > 0) num_threads(5) proc_bind(master) reduction(+: c,arr1[argc]) reduction(max: e,arr[:5][0:10]) // CHECK-NEXT: foo() -// CHECK-NEXT: #pragma omp target parallel if(1) num_threads(s) proc_bind(close) reduction(^: e,f,arr[0:1][:argc]) reduction(&&: g) +// CHECK-NEXT: #pragma omp target parallel if(5) num_threads(s) proc_bind(close) reduction(^: e,f,arr[0:5][:argc]) reduction(&&: g) // CHECK-NEXT: foo() // CHECK-NEXT: #pragma omp target parallel if(target: argc > 0) // CHECK-NEXT: foo() // CHECK-NEXT: #pragma omp target parallel if(parallel: argc > 0) // CHECK-NEXT: foo() -// CHECK-NEXT: #pragma omp target parallel if(1) +// CHECK-NEXT: #pragma omp target parallel if(5) // CHECK-NEXT: foo() // CHECK-NEXT: #pragma omp target parallel map(tofrom: i) // CHECK-NEXT: foo() @@ -128,23 +128,23 @@ T tmain(T argc, T *argv) { // CHECK-NEXT: foo() // CHECK-NEXT: #pragma omp target parallel defaultmap(tofrom: scalar) // CHECK-NEXT: foo() -// CHECK: template T tmain(T argc, T *argv) { -// CHECK-NEXT: T b = argc, c, d, e, f, g; -// CHECK-NEXT: static T h; -// CHECK-NEXT: S s; -// CHECK-NEXT: T arr[C][10], arr1[C]; -// CHECK-NEXT: T i, j, a[20] +// CHECK: template<> char tmain(char argc, char *argv) { +// CHECK-NEXT: char b = argc, c, d, e, f, g; +// CHECK-NEXT: static char h; +// CHECK-NEXT: S s; +// CHECK-NEXT: char arr[1][10], arr1[1]; +// CHECK-NEXT: char i, j, a[20] // CHECK-NEXT: #pragma omp target parallel // CHECK-NEXT: h = 2; -// CHECK-NEXT: #pragma omp target parallel default(none) private(argc,b) firstprivate(argv) shared(d) if(parallel: argc > 0) num_threads(C) proc_bind(master) reduction(+: c,arr1[argc]) reduction(max: e,arr[:C][0:10]) +// CHECK-NEXT: #pragma omp target parallel default(none) private(argc,b) firstprivate(argv) shared(d) if(parallel: argc > 0) num_threads(1) proc_bind(master) reduction(+: c,arr1[argc]) reduction(max: e,arr[:1][0:10]) // CHECK-NEXT: foo() -// CHECK-NEXT: #pragma omp target parallel if(C) num_threads(s) proc_bind(close) reduction(^: e,f,arr[0:C][:argc]) reduction(&&: g) +// CHECK-NEXT: #pragma omp target parallel if(1) num_threads(s) proc_bind(close) reduction(^: e,f,arr[0:1][:argc]) reduction(&&: g) // CHECK-NEXT: foo() // CHECK-NEXT: #pragma omp target parallel if(target: argc > 0) // CHECK-NEXT: foo() // CHECK-NEXT: #pragma omp target parallel if(parallel: argc > 0) // CHECK-NEXT: foo() -// CHECK-NEXT: #pragma omp target parallel if(C) +// CHECK-NEXT: #pragma omp target parallel if(1) // CHECK-NEXT: foo() // CHECK-NEXT: #pragma omp target parallel map(tofrom: i) // CHECK-NEXT: foo() diff --git a/clang/test/OpenMP/target_parallel_for_ast_print.cpp b/clang/test/OpenMP/target_parallel_for_ast_print.cpp index 6c551cb..b63f3bf 100644 --- a/clang/test/OpenMP/target_parallel_for_ast_print.cpp +++ b/clang/test/OpenMP/target_parallel_for_ast_print.cpp @@ -35,9 +35,9 @@ public: } }; -// CHECK: #pragma omp target parallel for private(this->a) private(this->a) private(this->S::a) // CHECK: #pragma omp target parallel for private(this->a) private(this->a) private(T::a) // CHECK: #pragma omp target parallel for private(this->a) private(this->a) +// CHECK: #pragma omp target parallel for private(this->a) private(this->a) private(this->S::a) class S8 : public S7 { S8() {} diff --git a/clang/test/OpenMP/target_parallel_for_simd_ast_print.cpp b/clang/test/OpenMP/target_parallel_for_simd_ast_print.cpp index e25f93f..1765152 100644 --- a/clang/test/OpenMP/target_parallel_for_simd_ast_print.cpp +++ b/clang/test/OpenMP/target_parallel_for_simd_ast_print.cpp @@ -35,9 +35,9 @@ public: } }; -// CHECK: #pragma omp target parallel for simd private(this->a) private(this->a) private(this->S::a) // CHECK: #pragma omp target parallel for simd private(this->a) private(this->a) private(T::a) // CHECK: #pragma omp target parallel for simd private(this->a) private(this->a) +// CHECK: #pragma omp target parallel for simd private(this->a) private(this->a) private(this->S::a) class S8 : public S7 { S8() {} diff --git a/clang/test/OpenMP/target_simd_ast_print.cpp b/clang/test/OpenMP/target_simd_ast_print.cpp index 8f03950..0a936a0 100644 --- a/clang/test/OpenMP/target_simd_ast_print.cpp +++ b/clang/test/OpenMP/target_simd_ast_print.cpp @@ -35,9 +35,9 @@ public: } }; -// CHECK: #pragma omp target simd private(this->a) private(this->a) private(this->S::a) // CHECK: #pragma omp target simd private(this->a) private(this->a) private(T::a) // CHECK: #pragma omp target simd private(this->a) private(this->a) +// CHECK: #pragma omp target simd private(this->a) private(this->a) private(this->S::a) class S8 : public S7 { S8() {} diff --git a/clang/test/OpenMP/target_update_ast_print.cpp b/clang/test/OpenMP/target_update_ast_print.cpp index 3a98f54..cbff907 100644 --- a/clang/test/OpenMP/target_update_ast_print.cpp +++ b/clang/test/OpenMP/target_update_ast_print.cpp @@ -18,18 +18,18 @@ T foo(T targ, U uarg) { #pragma omp target update from(b) if(l<5) device(l-1) nowait depend(inout:l) return a + targ + (T)b; } -// CHECK: static int a; -// CHECK-NEXT: float b; +// CHECK: static T a; +// CHECK-NEXT: U b; // CHECK-NEXT: int l; // CHECK-NEXT: #pragma omp target update to(a) if(l > 5) device(l) nowait depend(inout : l) // CHECK-NEXT: #pragma omp target update from(b) if(l < 5) device(l - 1) nowait depend(inout : l) -// CHECK: static char a; +// CHECK: static int a; // CHECK-NEXT: float b; // CHECK-NEXT: int l; // CHECK-NEXT: #pragma omp target update to(a) if(l > 5) device(l) nowait depend(inout : l) // CHECK-NEXT: #pragma omp target update from(b) if(l < 5) device(l - 1) nowait depend(inout : l) -// CHECK: static T a; -// CHECK-NEXT: U b; +// CHECK: static char a; +// CHECK-NEXT: float b; // CHECK-NEXT: int l; // CHECK-NEXT: #pragma omp target update to(a) if(l > 5) device(l) nowait depend(inout : l) // CHECK-NEXT: #pragma omp target update from(b) if(l < 5) device(l - 1) nowait depend(inout : l) diff --git a/clang/test/OpenMP/task_ast_print.cpp b/clang/test/OpenMP/task_ast_print.cpp index 37e5833..3481d5d 100644 --- a/clang/test/OpenMP/task_ast_print.cpp +++ b/clang/test/OpenMP/task_ast_print.cpp @@ -35,9 +35,9 @@ public: } }; -// CHECK: #pragma omp task private(this->a) private(this->a) private(this->S1::a) // CHECK: #pragma omp task private(this->a) private(this->a) private(T::a) // CHECK: #pragma omp task private(this->a) private(this->a) +// CHECK: #pragma omp task private(this->a) private(this->a) private(this->S1::a) class S8 : public S7 { S8() {} @@ -66,18 +66,18 @@ struct S { #pragma omp threadprivate(TS) }; -// CHECK: template struct S { +// CHECK: template struct S { +// CHECK: static T TS; +// CHECK-NEXT: #pragma omp threadprivate(S::TS) +// CHECK: }; +// CHECK: template<> struct S { // CHECK: static int TS; // CHECK-NEXT: #pragma omp threadprivate(S::TS) // CHECK-NEXT: } -// CHECK: template struct S { +// CHECK: template<> struct S { // CHECK: static long TS; // CHECK-NEXT: #pragma omp threadprivate(S::TS) // CHECK-NEXT: } -// CHECK: template struct S { -// CHECK: static T TS; -// CHECK-NEXT: #pragma omp threadprivate(S::TS) -// CHECK: }; template T tmain(T argc, T *argv) { @@ -94,7 +94,18 @@ T tmain(T argc, T *argv) { return 0; } -// CHECK: template int tmain(int argc, int *argv) { +// CHECK: template T tmain(T argc, T *argv) { +// CHECK-NEXT: T b = argc, c, d, e, f, g; +// CHECK-NEXT: static T a; +// CHECK-NEXT: S s; +// CHECK-NEXT: T arr[argc]; +// CHECK-NEXT: #pragma omp task untied depend(in : argc,argv[b:argc],arr[:]) if(task: argc > 0) +// CHECK-NEXT: a = 2; +// CHECK-NEXT: #pragma omp task default(none) private(argc,b) firstprivate(argv) shared(d) if(argc > 0) final(S::TS > 0) priority(argc) +// CHECK-NEXT: foo() +// CHECK-NEXT: #pragma omp task if(C) mergeable priority(C) +// CHECK-NEXT: foo() +// CHECK: template<> int tmain(int argc, int *argv) { // CHECK-NEXT: int b = argc, c, d, e, f, g; // CHECK-NEXT: static int a; // CHECK-NEXT: S s; @@ -105,7 +116,7 @@ T tmain(T argc, T *argv) { // CHECK-NEXT: foo() // CHECK-NEXT: #pragma omp task if(5) mergeable priority(5) // CHECK-NEXT: foo() -// CHECK: template long tmain(long argc, long *argv) { +// CHECK: template<> long tmain(long argc, long *argv) { // CHECK-NEXT: long b = argc, c, d, e, f, g; // CHECK-NEXT: static long a; // CHECK-NEXT: S s; @@ -116,17 +127,6 @@ T tmain(T argc, T *argv) { // CHECK-NEXT: foo() // CHECK-NEXT: #pragma omp task if(1) mergeable priority(1) // CHECK-NEXT: foo() -// CHECK: template T tmain(T argc, T *argv) { -// CHECK-NEXT: T b = argc, c, d, e, f, g; -// CHECK-NEXT: static T a; -// CHECK-NEXT: S s; -// CHECK-NEXT: T arr[argc]; -// CHECK-NEXT: #pragma omp task untied depend(in : argc,argv[b:argc],arr[:]) if(task: argc > 0) -// CHECK-NEXT: a = 2; -// CHECK-NEXT: #pragma omp task default(none) private(argc,b) firstprivate(argv) shared(d) if(argc > 0) final(S::TS > 0) priority(argc) -// CHECK-NEXT: foo() -// CHECK-NEXT: #pragma omp task if(C) mergeable priority(C) -// CHECK-NEXT: foo() enum Enum {}; diff --git a/clang/test/OpenMP/taskloop_ast_print.cpp b/clang/test/OpenMP/taskloop_ast_print.cpp index 06164ab..b70fd8e 100644 --- a/clang/test/OpenMP/taskloop_ast_print.cpp +++ b/clang/test/OpenMP/taskloop_ast_print.cpp @@ -48,6 +48,7 @@ T tmain(T argc) { return T(); } +// CHECK-LABEL: int main(int argc, char **argv) { int main(int argc, char **argv) { int b = argc, c, d, e, f, g; static int a; diff --git a/clang/test/OpenMP/taskloop_simd_ast_print.cpp b/clang/test/OpenMP/taskloop_simd_ast_print.cpp index 3e3b7e4..a7ec43e 100644 --- a/clang/test/OpenMP/taskloop_simd_ast_print.cpp +++ b/clang/test/OpenMP/taskloop_simd_ast_print.cpp @@ -49,6 +49,7 @@ T tmain(T argc) { return T(); } +// CHECK-LABEL: int main(int argc, char **argv) { int main(int argc, char **argv) { int b = argc, c, d, e, f, g; static int a; diff --git a/clang/test/OpenMP/taskwait_ast_print.cpp b/clang/test/OpenMP/taskwait_ast_print.cpp index b5b0f0d..1a69b58 100644 --- a/clang/test/OpenMP/taskwait_ast_print.cpp +++ b/clang/test/OpenMP/taskwait_ast_print.cpp @@ -14,12 +14,12 @@ T tmain(T argc) { #pragma omp taskwait return a + argc; } +// CHECK: static T a; +// CHECK-NEXT: #pragma omp taskwait // CHECK: static int a; // CHECK-NEXT: #pragma omp taskwait // CHECK: static char a; // CHECK-NEXT: #pragma omp taskwait -// CHECK: static T a; -// CHECK-NEXT: #pragma omp taskwait int main(int argc, char **argv) { static int a; diff --git a/clang/test/OpenMP/taskyield_ast_print.cpp b/clang/test/OpenMP/taskyield_ast_print.cpp index 8767909..1fd9b9c1 100644 --- a/clang/test/OpenMP/taskyield_ast_print.cpp +++ b/clang/test/OpenMP/taskyield_ast_print.cpp @@ -14,12 +14,12 @@ T tmain(T argc) { #pragma omp taskyield return a + argc; } +// CHECK: static T a; +// CHECK-NEXT: #pragma omp taskyield // CHECK: static int a; // CHECK-NEXT: #pragma omp taskyield // CHECK: static char a; // CHECK-NEXT: #pragma omp taskyield -// CHECK: static T a; -// CHECK-NEXT: #pragma omp taskyield int main(int argc, char **argv) { static int a; diff --git a/clang/test/OpenMP/teams_ast_print.cpp b/clang/test/OpenMP/teams_ast_print.cpp index f3d577c..861b25d 100644 --- a/clang/test/OpenMP/teams_ast_print.cpp +++ b/clang/test/OpenMP/teams_ast_print.cpp @@ -15,18 +15,18 @@ struct S { #pragma omp threadprivate(TS) }; -// CHECK: template struct S { +// CHECK: template struct S { +// CHECK: static T TS; +// CHECK-NEXT: #pragma omp threadprivate(S::TS) +// CHECK: }; +// CHECK: template<> struct S { // CHECK: static int TS; // CHECK-NEXT: #pragma omp threadprivate(S::TS) // CHECK-NEXT: } -// CHECK: template struct S { +// CHECK: template<> struct S { // CHECK: static long TS; // CHECK-NEXT: #pragma omp threadprivate(S::TS) // CHECK-NEXT: } -// CHECK: template struct S { -// CHECK: static T TS; -// CHECK-NEXT: #pragma omp threadprivate(S::TS) -// CHECK: }; template T tmain(T argc, T *argv) { @@ -45,41 +45,41 @@ T tmain(T argc, T *argv) { return 0; } -// CHECK: template int tmain(int argc, int *argv) { -// CHECK-NEXT: int b = argc, c, d, e, f, g; -// CHECK-NEXT: static int a; -// CHECK-NEXT: S s; +// CHECK: template T tmain(T argc, T *argv) { +// CHECK-NEXT: T b = argc, c, d, e, f, g; +// CHECK-NEXT: static T a; +// CHECK-NEXT: S s; // CHECK-NEXT: #pragma omp target // CHECK-NEXT: #pragma omp teams // CHECK-NEXT: a = 2; // CHECK-NEXT: #pragma omp target -// CHECK-NEXT: #pragma omp teams default(none) private(argc,b) firstprivate(argv) shared(d) reduction(+: c) reduction(max: e) num_teams(5) thread_limit(d * 5) +// CHECK-NEXT: #pragma omp teams default(none) private(argc,b) firstprivate(argv) shared(d) reduction(+: c) reduction(max: e) num_teams(C) thread_limit(d * C) // CHECK-NEXT: foo() // CHECK-NEXT: #pragma omp target // CHECK-NEXT: #pragma omp teams reduction(^: e,f) reduction(&&: g) // CHECK-NEXT: foo() -// CHECK: template long tmain(long argc, long *argv) { -// CHECK-NEXT: long b = argc, c, d, e, f, g; -// CHECK-NEXT: static long a; -// CHECK-NEXT: S s; +// CHECK: template<> int tmain(int argc, int *argv) { +// CHECK-NEXT: int b = argc, c, d, e, f, g; +// CHECK-NEXT: static int a; +// CHECK-NEXT: S s; // CHECK-NEXT: #pragma omp target // CHECK-NEXT: #pragma omp teams // CHECK-NEXT: a = 2; // CHECK-NEXT: #pragma omp target -// CHECK-NEXT: #pragma omp teams default(none) private(argc,b) firstprivate(argv) shared(d) reduction(+: c) reduction(max: e) num_teams(1) thread_limit(d * 1) +// CHECK-NEXT: #pragma omp teams default(none) private(argc,b) firstprivate(argv) shared(d) reduction(+: c) reduction(max: e) num_teams(5) thread_limit(d * 5) // CHECK-NEXT: foo() // CHECK-NEXT: #pragma omp target // CHECK-NEXT: #pragma omp teams reduction(^: e,f) reduction(&&: g) // CHECK-NEXT: foo() -// CHECK: template T tmain(T argc, T *argv) { -// CHECK-NEXT: T b = argc, c, d, e, f, g; -// CHECK-NEXT: static T a; -// CHECK-NEXT: S s; +// CHECK: template<> long tmain(long argc, long *argv) { +// CHECK-NEXT: long b = argc, c, d, e, f, g; +// CHECK-NEXT: static long a; +// CHECK-NEXT: S s; // CHECK-NEXT: #pragma omp target // CHECK-NEXT: #pragma omp teams // CHECK-NEXT: a = 2; // CHECK-NEXT: #pragma omp target -// CHECK-NEXT: #pragma omp teams default(none) private(argc,b) firstprivate(argv) shared(d) reduction(+: c) reduction(max: e) num_teams(C) thread_limit(d * C) +// CHECK-NEXT: #pragma omp teams default(none) private(argc,b) firstprivate(argv) shared(d) reduction(+: c) reduction(max: e) num_teams(1) thread_limit(d * 1) // CHECK-NEXT: foo() // CHECK-NEXT: #pragma omp target // CHECK-NEXT: #pragma omp teams reduction(^: e,f) reduction(&&: g) diff --git a/clang/test/OpenMP/teams_distribute_ast_print.cpp b/clang/test/OpenMP/teams_distribute_ast_print.cpp index 5dd71c9..f465c3f 100644 --- a/clang/test/OpenMP/teams_distribute_ast_print.cpp +++ b/clang/test/OpenMP/teams_distribute_ast_print.cpp @@ -45,13 +45,13 @@ public: } }; // CHECK: #pragma omp target -// CHECK-NEXT: #pragma omp teams distribute private(this->a) private(this->a) private(this->S::a) -// CHECK: #pragma omp target // CHECK-NEXT: #pragma omp teams distribute private(this->a) private(this->a) private(T::a) // CHECK: #pragma omp target // CHECK-NEXT: #pragma omp teams distribute private(this->a) private(this->a) // CHECK: #pragma omp target // CHECK-NEXT: #pragma omp teams distribute default(none) private(b) firstprivate(argv) shared(d) reduction(+: c) reduction(max: e) num_teams(f) thread_limit(d) +// CHECK: #pragma omp target +// CHECK-NEXT: #pragma omp teams distribute private(this->a) private(this->a) private(this->S::a) class S8 : public S7 { S8() {} diff --git a/clang/test/OpenMP/teams_distribute_simd_ast_print.cpp b/clang/test/OpenMP/teams_distribute_simd_ast_print.cpp index 5b988ee..aaf6745 100644 --- a/clang/test/OpenMP/teams_distribute_simd_ast_print.cpp +++ b/clang/test/OpenMP/teams_distribute_simd_ast_print.cpp @@ -54,8 +54,6 @@ public: } }; // CHECK: #pragma omp target -// CHECK-NEXT: #pragma omp teams distribute simd private(this->a) private(this->a) private(this->S::a) -// CHECK: #pragma omp target // CHECK-NEXT: #pragma omp teams distribute simd private(this->a) private(this->a) private(T::a) // CHECK: #pragma omp target // CHECK-NEXT: #pragma omp teams distribute simd private(this->a) private(this->a) @@ -63,6 +61,8 @@ public: // CHECK-NEXT: #pragma omp teams distribute simd default(none) private(b) firstprivate(argv) shared(d) reduction(+: c) reduction(max: e) num_teams(f) thread_limit(d) // CHECK: #pragma omp target // CHECK-NEXT: #pragma omp teams distribute simd simdlen(slen1) safelen(slen2) aligned(arr: alen) +// CHECK: #pragma omp target +// CHECK-NEXT: #pragma omp teams distribute simd private(this->a) private(this->a) private(this->S::a) class S8 : public S7 { S8() {} diff --git a/clang/test/OpenMP/threadprivate_ast_print.cpp b/clang/test/OpenMP/threadprivate_ast_print.cpp index 0706c70..5502c62 100644 --- a/clang/test/OpenMP/threadprivate_ast_print.cpp +++ b/clang/test/OpenMP/threadprivate_ast_print.cpp @@ -43,12 +43,12 @@ template T foo() { v = ST::m; return v; } -//CHECK: template int foo() { -//CHECK-NEXT: static int v; -//CHECK-NEXT: #pragma omp threadprivate(v) //CHECK: template T foo() { //CHECK-NEXT: static T v; //CHECK-NEXT: #pragma omp threadprivate(v) +//CHECK: template<> int foo() { +//CHECK-NEXT: static int v; +//CHECK-NEXT: #pragma omp threadprivate(v) namespace ns{ int a; diff --git a/clang/test/SemaTemplate/temp_arg_enum_printing.cpp b/clang/test/SemaTemplate/temp_arg_enum_printing.cpp index a788975..bdf277d 100644 --- a/clang/test/SemaTemplate/temp_arg_enum_printing.cpp +++ b/clang/test/SemaTemplate/temp_arg_enum_printing.cpp @@ -13,11 +13,11 @@ template void foo(); void test() { - // CHECK: template + // CHECK: template<> void foo() NamedEnumNS::foo(); - // CHECK: template + // CHECK: template<> void foo() NamedEnumNS::foo<(NamedEnum)1>(); - // CHECK: template + // CHECK: template<> void foo<2>() NamedEnumNS::foo<(NamedEnum)2>(); } diff --git a/clang/unittests/AST/ASTTypeTraitsTest.cpp b/clang/unittests/AST/ASTTypeTraitsTest.cpp index 436cd77..722c468 100644 --- a/clang/unittests/AST/ASTTypeTraitsTest.cpp +++ b/clang/unittests/AST/ASTTypeTraitsTest.cpp @@ -163,7 +163,7 @@ TEST(DynTypedNode, StmtDump) { TEST(DynTypedNode, DeclPrint) { PrintVerifier Verifier; - Verifier.expectString("void f() {\n}\n\n"); + Verifier.expectString("void f() {\n}\n"); EXPECT_TRUE(Verifier.match("void f() {}", functionDecl())); } diff --git a/clang/unittests/AST/DeclPrinterTest.cpp b/clang/unittests/AST/DeclPrinterTest.cpp index d06fbfe..dc4f914 100644 --- a/clang/unittests/AST/DeclPrinterTest.cpp +++ b/clang/unittests/AST/DeclPrinterTest.cpp @@ -254,24 +254,21 @@ TEST(DeclPrinter, TestCXXRecordDecl1) { ASSERT_TRUE(PrintedDeclCXX98Matches( "class A { int a; };", "A", - "class A {\n}")); - // Should be: with semicolon, with { ... } + "class A {}")); } TEST(DeclPrinter, TestCXXRecordDecl2) { ASSERT_TRUE(PrintedDeclCXX98Matches( "struct A { int a; };", "A", - "struct A {\n}")); - // Should be: with semicolon, with { ... } + "struct A {}")); } TEST(DeclPrinter, TestCXXRecordDecl3) { ASSERT_TRUE(PrintedDeclCXX98Matches( "union A { int a; };", "A", - "union A {\n}")); - // Should be: with semicolon, with { ... } + "union A {}")); } TEST(DeclPrinter, TestCXXRecordDecl4) { @@ -279,8 +276,7 @@ TEST(DeclPrinter, TestCXXRecordDecl4) { "class Z { int a; };" "class A : Z { int b; };", "A", - "class A : Z {\n}")); - // Should be: with semicolon, with { ... } + "class A : Z {}")); } TEST(DeclPrinter, TestCXXRecordDecl5) { @@ -288,8 +284,7 @@ TEST(DeclPrinter, TestCXXRecordDecl5) { "struct Z { int a; };" "struct A : Z { int b; };", "A", - "struct A : Z {\n}")); - // Should be: with semicolon, with { ... } + "struct A : Z {}")); } TEST(DeclPrinter, TestCXXRecordDecl6) { @@ -297,8 +292,7 @@ TEST(DeclPrinter, TestCXXRecordDecl6) { "class Z { int a; };" "class A : public Z { int b; };", "A", - "class A : public Z {\n}")); - // Should be: with semicolon, with { ... } + "class A : public Z {}")); } TEST(DeclPrinter, TestCXXRecordDecl7) { @@ -306,8 +300,7 @@ TEST(DeclPrinter, TestCXXRecordDecl7) { "class Z { int a; };" "class A : protected Z { int b; };", "A", - "class A : protected Z {\n}")); - // Should be: with semicolon, with { ... } + "class A : protected Z {}")); } TEST(DeclPrinter, TestCXXRecordDecl8) { @@ -315,8 +308,7 @@ TEST(DeclPrinter, TestCXXRecordDecl8) { "class Z { int a; };" "class A : private Z { int b; };", "A", - "class A : private Z {\n}")); - // Should be: with semicolon, with { ... } + "class A : private Z {}")); } TEST(DeclPrinter, TestCXXRecordDecl9) { @@ -324,8 +316,7 @@ TEST(DeclPrinter, TestCXXRecordDecl9) { "class Z { int a; };" "class A : virtual Z { int b; };", "A", - "class A : virtual Z {\n}")); - // Should be: with semicolon, with { ... } + "class A : virtual Z {}")); } TEST(DeclPrinter, TestCXXRecordDecl10) { @@ -333,8 +324,7 @@ TEST(DeclPrinter, TestCXXRecordDecl10) { "class Z { int a; };" "class A : virtual public Z { int b; };", "A", - "class A : virtual public Z {\n}")); - // Should be: with semicolon, with { ... } + "class A : virtual public Z {}")); } TEST(DeclPrinter, TestCXXRecordDecl11) { @@ -343,8 +333,7 @@ TEST(DeclPrinter, TestCXXRecordDecl11) { "class Y : virtual public Z { int b; };" "class A : virtual public Z, private Y { int c; };", "A", - "class A : virtual public Z, private Y {\n}")); - // Should be: with semicolon, with { ... } + "class A : virtual public Z, private Y {}")); } TEST(DeclPrinter, TestFunctionDecl1) { @@ -352,7 +341,6 @@ TEST(DeclPrinter, TestFunctionDecl1) { "void A();", "A", "void A()")); - // Should be: with semicolon } TEST(DeclPrinter, TestFunctionDecl2) { @@ -360,7 +348,6 @@ TEST(DeclPrinter, TestFunctionDecl2) { "void A() {}", "A", "void A()")); - // Should be: with semicolon } TEST(DeclPrinter, TestFunctionDecl3) { @@ -369,7 +356,6 @@ TEST(DeclPrinter, TestFunctionDecl3) { "void A() { Z(); }", "A", "void A()")); - // Should be: with semicolon } TEST(DeclPrinter, TestFunctionDecl4) { @@ -377,7 +363,6 @@ TEST(DeclPrinter, TestFunctionDecl4) { "extern void A();", "A", "extern void A()")); - // Should be: with semicolon } TEST(DeclPrinter, TestFunctionDecl5) { @@ -385,7 +370,6 @@ TEST(DeclPrinter, TestFunctionDecl5) { "static void A();", "A", "static void A()")); - // Should be: with semicolon } TEST(DeclPrinter, TestFunctionDecl6) { @@ -393,7 +377,6 @@ TEST(DeclPrinter, TestFunctionDecl6) { "inline void A();", "A", "inline void A()")); - // Should be: with semicolon } TEST(DeclPrinter, TestFunctionDecl7) { @@ -401,7 +384,6 @@ TEST(DeclPrinter, TestFunctionDecl7) { "constexpr int A(int a);", "A", "constexpr int A(int a)")); - // Should be: with semicolon } TEST(DeclPrinter, TestFunctionDecl8) { @@ -409,7 +391,6 @@ TEST(DeclPrinter, TestFunctionDecl8) { "void A(int a);", "A", "void A(int a)")); - // Should be: with semicolon } TEST(DeclPrinter, TestFunctionDecl9) { @@ -417,7 +398,6 @@ TEST(DeclPrinter, TestFunctionDecl9) { "void A(...);", "A", "void A(...)")); - // Should be: with semicolon } TEST(DeclPrinter, TestFunctionDecl10) { @@ -425,7 +405,6 @@ TEST(DeclPrinter, TestFunctionDecl10) { "void A(int a, ...);", "A", "void A(int a, ...)")); - // Should be: with semicolon } TEST(DeclPrinter, TestFunctionDecl11) { @@ -435,7 +414,6 @@ TEST(DeclPrinter, TestFunctionDecl11) { "void A(int a, pInt b, ssize_t c);", "A", "void A(int a, pInt b, ssize_t c)")); - // Should be: with semicolon } TEST(DeclPrinter, TestFunctionDecl12) { @@ -443,7 +421,6 @@ TEST(DeclPrinter, TestFunctionDecl12) { "void A(int a, int b = 0);", "A", "void A(int a, int b = 0)")); - // Should be: with semicolon } TEST(DeclPrinter, TestFunctionDecl13) { @@ -451,7 +428,7 @@ TEST(DeclPrinter, TestFunctionDecl13) { "void (*A(int a))(int b);", "A", "void (*A(int a))(int)")); - // Should be: with semicolon, with parameter name (?) + // Should be: with parameter name (?) } TEST(DeclPrinter, TestFunctionDecl14) { @@ -461,8 +438,7 @@ TEST(DeclPrinter, TestFunctionDecl14) { "template<>" "void A(int N) { }", functionDecl(hasName("A"), isExplicitTemplateSpecialization()).bind("id"), - "void A(int N)")); - // WRONG; Should be: "template <> void A(int N);")); + "template<> void A(int N)")); } @@ -555,7 +531,6 @@ TEST(DeclPrinter, TestCXXConstructorDecl10) { "};", cxxConstructorDecl(ofClass(hasName("A"))).bind("id"), "A(const A &a)")); - // WRONG; Should be: "A(const A &a);" } TEST(DeclPrinter, TestCXXConstructorDecl11) { @@ -565,8 +540,7 @@ TEST(DeclPrinter, TestCXXConstructorDecl11) { " A(T&&... ts) : T(ts)... {}" "};", cxxConstructorDecl(ofClass(hasName("A"))).bind("id"), - "A(T &&...ts) : T(ts)...")); - // WRONG; Should be: "A(T &&...ts) : T(ts)... {}" + "A(T &&...ts) : T(ts)... {}")); } TEST(DeclPrinter, TestCXXDestructorDecl1) { @@ -623,7 +597,6 @@ TEST(DeclPrinter, TestCXXMethodDecl_AllocationFunction1) { "};", cxxMethodDecl(ofClass(hasName("Z"))).bind("id"), "void *operator new(std::size_t)")); - // Should be: with semicolon } TEST(DeclPrinter, TestCXXMethodDecl_AllocationFunction2) { @@ -634,7 +607,6 @@ TEST(DeclPrinter, TestCXXMethodDecl_AllocationFunction2) { "};", cxxMethodDecl(ofClass(hasName("Z"))).bind("id"), "void *operator new[](std::size_t)")); - // Should be: with semicolon } TEST(DeclPrinter, TestCXXMethodDecl_AllocationFunction3) { @@ -644,7 +616,7 @@ TEST(DeclPrinter, TestCXXMethodDecl_AllocationFunction3) { "};", cxxMethodDecl(ofClass(hasName("Z"))).bind("id"), "void operator delete(void *) noexcept")); - // Should be: with semicolon, without noexcept? + // Should be: without noexcept? } TEST(DeclPrinter, TestCXXMethodDecl_AllocationFunction4) { @@ -654,7 +626,6 @@ TEST(DeclPrinter, TestCXXMethodDecl_AllocationFunction4) { "};", cxxMethodDecl(ofClass(hasName("Z"))).bind("id"), "void operator delete(void *)")); - // Should be: with semicolon } TEST(DeclPrinter, TestCXXMethodDecl_AllocationFunction5) { @@ -664,7 +635,7 @@ TEST(DeclPrinter, TestCXXMethodDecl_AllocationFunction5) { "};", cxxMethodDecl(ofClass(hasName("Z"))).bind("id"), "void operator delete[](void *) noexcept")); - // Should be: with semicolon, without noexcept? + // Should be: without noexcept? } TEST(DeclPrinter, TestCXXMethodDecl_Operator1) { @@ -686,7 +657,6 @@ TEST(DeclPrinter, TestCXXMethodDecl_Operator1) { Expected.append("void operator"); Expected.append(OperatorNames[i]); Expected.append("(Z z)"); - // Should be: with semicolon ASSERT_TRUE(PrintedDeclCXX98Matches( Code, @@ -710,7 +680,6 @@ TEST(DeclPrinter, TestCXXMethodDecl_Operator2) { Expected.append("void operator"); Expected.append(OperatorNames[i]); Expected.append("()"); - // Should be: with semicolon ASSERT_TRUE(PrintedDeclCXX98Matches( Code, @@ -726,7 +695,6 @@ TEST(DeclPrinter, TestCXXMethodDecl1) { "};", "A", "void A(int a)")); - // Should be: with semicolon } TEST(DeclPrinter, TestCXXMethodDecl2) { @@ -736,7 +704,6 @@ TEST(DeclPrinter, TestCXXMethodDecl2) { "};", "A", "virtual void A(int a)")); - // Should be: with semicolon } TEST(DeclPrinter, TestCXXMethodDecl3) { @@ -749,7 +716,6 @@ TEST(DeclPrinter, TestCXXMethodDecl3) { "};", "ZZ::A", "void A(int a)")); - // Should be: with semicolon // TODO: should we print "virtual"? } @@ -760,7 +726,6 @@ TEST(DeclPrinter, TestCXXMethodDecl4) { "};", "A", "inline void A(int a)")); - // Should be: with semicolon } TEST(DeclPrinter, TestCXXMethodDecl5) { @@ -770,7 +735,6 @@ TEST(DeclPrinter, TestCXXMethodDecl5) { "};", "A", "virtual void A(int a) = 0")); - // Should be: with semicolon } TEST(DeclPrinter, TestCXXMethodDecl_CVQualifier1) { @@ -780,7 +744,6 @@ TEST(DeclPrinter, TestCXXMethodDecl_CVQualifier1) { "};", "A", "void A(int a) const")); - // Should be: with semicolon } TEST(DeclPrinter, TestCXXMethodDecl_CVQualifier2) { @@ -790,7 +753,6 @@ TEST(DeclPrinter, TestCXXMethodDecl_CVQualifier2) { "};", "A", "void A(int a) volatile")); - // Should be: with semicolon } TEST(DeclPrinter, TestCXXMethodDecl_CVQualifier3) { @@ -800,7 +762,6 @@ TEST(DeclPrinter, TestCXXMethodDecl_CVQualifier3) { "};", "A", "void A(int a) const volatile")); - // Should be: with semicolon } TEST(DeclPrinter, TestCXXMethodDecl_RefQualifier1) { @@ -810,7 +771,6 @@ TEST(DeclPrinter, TestCXXMethodDecl_RefQualifier1) { "};", "A", "void A(int a) &")); - // Should be: with semicolon } TEST(DeclPrinter, TestCXXMethodDecl_RefQualifier2) { @@ -820,7 +780,6 @@ TEST(DeclPrinter, TestCXXMethodDecl_RefQualifier2) { "};", "A", "void A(int a) &&")); - // Should be: with semicolon } TEST(DeclPrinter, TestFunctionDecl_ExceptionSpecification1) { @@ -830,7 +789,6 @@ TEST(DeclPrinter, TestFunctionDecl_ExceptionSpecification1) { "};", "A", "void A(int a) throw()")); - // Should be: with semicolon } TEST(DeclPrinter, TestFunctionDecl_ExceptionSpecification2) { @@ -840,7 +798,6 @@ TEST(DeclPrinter, TestFunctionDecl_ExceptionSpecification2) { "};", "A", "void A(int a) throw(int)")); - // Should be: with semicolon } TEST(DeclPrinter, TestFunctionDecl_ExceptionSpecification3) { @@ -851,7 +808,6 @@ TEST(DeclPrinter, TestFunctionDecl_ExceptionSpecification3) { "};", "A", "void A(int a) throw(ZZ, int)")); - // Should be: with semicolon } TEST(DeclPrinter, TestFunctionDecl_ExceptionSpecification4) { @@ -861,7 +817,6 @@ TEST(DeclPrinter, TestFunctionDecl_ExceptionSpecification4) { "};", "A", "void A(int a) noexcept")); - // Should be: with semicolon } TEST(DeclPrinter, TestFunctionDecl_ExceptionSpecification5) { @@ -942,8 +897,7 @@ TEST(DeclPrinter, TestClassTemplateDecl1) { "template" "struct A { T a; };", classTemplateDecl(hasName("A")).bind("id"), - "template struct A {\n}")); - // Should be: with semicolon, with { ... } + "template struct A {}")); } TEST(DeclPrinter, TestClassTemplateDecl2) { @@ -951,8 +905,7 @@ TEST(DeclPrinter, TestClassTemplateDecl2) { "template" "struct A { T a; };", classTemplateDecl(hasName("A")).bind("id"), - "template struct A {\n}")); - // Should be: with semicolon, with { ... } + "template struct A {}")); } TEST(DeclPrinter, TestClassTemplateDecl3) { @@ -960,8 +913,7 @@ TEST(DeclPrinter, TestClassTemplateDecl3) { "template" "struct A { T a; };", classTemplateDecl(hasName("A")).bind("id"), - "template struct A {\n}")); - // Should be: with semicolon, with { ... } + "template struct A {}")); } TEST(DeclPrinter, TestClassTemplateDecl4) { @@ -969,8 +921,7 @@ TEST(DeclPrinter, TestClassTemplateDecl4) { "template" "struct A { T a; U b; };", classTemplateDecl(hasName("A")).bind("id"), - "template struct A {\n}")); - // Should be: with semicolon, with { ... } + "template struct A {}")); } TEST(DeclPrinter, TestClassTemplateDecl5) { @@ -978,8 +929,7 @@ TEST(DeclPrinter, TestClassTemplateDecl5) { "template" "struct A { int a[N]; };", classTemplateDecl(hasName("A")).bind("id"), - "template struct A {\n}")); - // Should be: with semicolon, with { ... } + "template struct A {}")); } TEST(DeclPrinter, TestClassTemplateDecl6) { @@ -987,8 +937,7 @@ TEST(DeclPrinter, TestClassTemplateDecl6) { "template" "struct A { int a[N]; };", classTemplateDecl(hasName("A")).bind("id"), - "template struct A {\n}")); - // Should be: with semicolon, with { ... } + "template struct A {}")); } TEST(DeclPrinter, TestClassTemplateDecl7) { @@ -997,16 +946,14 @@ TEST(DeclPrinter, TestClassTemplateDecl7) { "template" "struct A { int a[N]; };", classTemplateDecl(hasName("A")).bind("id"), - "template struct A {\n}")); - // Should be: with semicolon, with { ... } + "template struct A {}")); } TEST(DeclPrinter, TestClassTemplateDecl8) { ASSERT_TRUE(PrintedDeclCXX98Matches( "template class T> struct A { };", classTemplateDecl(hasName("A")).bind("id"), - "template