mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-11-24 06:10:12 +00:00
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
This commit is contained in:
parent
3d75b62ffe
commit
a67a4d2f3c
@ -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<FunctionDecl>(*D))
|
||||
if (FD->getTemplateSpecializationKind() == TSK_ImplicitInstantiation &&
|
||||
!isa<ClassTemplateSpecializationDecl>(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<OMPThreadPrivateDecl>(*D) || isa<OMPDeclareReductionDecl>(*D))
|
||||
Terminator = nullptr;
|
||||
else if (isa<FunctionDecl>(*D) && cast<FunctionDecl>(*D)->hasBody())
|
||||
Terminator = nullptr;
|
||||
else if (isa<ObjCMethodDecl>(*D) && cast<ObjCMethodDecl>(*D)->hasBody())
|
||||
Terminator = nullptr;
|
||||
else if (isa<NamespaceDecl>(*D) || isa<LinkageSpecDecl>(*D) ||
|
||||
else if (auto FD = dyn_cast<FunctionDecl>(*D)) {
|
||||
if (FD->isThisDeclarationADefinition())
|
||||
Terminator = nullptr;
|
||||
else
|
||||
Terminator = ";";
|
||||
} else if (auto TD = dyn_cast<FunctionTemplateDecl>(*D)) {
|
||||
if (TD->getTemplatedDecl()->isThisDeclarationADefinition())
|
||||
Terminator = nullptr;
|
||||
else
|
||||
Terminator = ";";
|
||||
} else if (isa<NamespaceDecl>(*D) || isa<LinkageSpecDecl>(*D) ||
|
||||
isa<ObjCImplementationDecl>(*D) ||
|
||||
isa<ObjCInterfaceDecl>(*D) ||
|
||||
isa<ObjCProtocolDecl>(*D) ||
|
||||
@ -358,7 +378,14 @@ void DeclPrinter::VisitDeclContext(DeclContext *DC, bool Indent) {
|
||||
|
||||
if (Terminator)
|
||||
Out << Terminator;
|
||||
Out << "\n";
|
||||
if (!Policy.TerseOutput &&
|
||||
((isa<FunctionDecl>(*D) &&
|
||||
cast<FunctionDecl>(*D)->doesThisDeclarationHaveABody()) ||
|
||||
(isa<FunctionTemplateDecl>(*D) &&
|
||||
cast<FunctionTemplateDecl>(*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<CXXConstructorDecl>(D);
|
||||
CXXConversionDecl *ConversionDecl = dyn_cast<CXXConversionDecl>(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<ParenType>(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<CXXConstructorDecl>(*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<ClassTemplatePartialSpecializationDecl>(D))
|
||||
printTemplateArguments(S->getTemplateArgs(), S->getTemplateParameters());
|
||||
else if (auto S = dyn_cast<ClassTemplateSpecializationDecl>(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<TemplateTypeParmDecl>(Param)) {
|
||||
if (auto TTP = dyn_cast<TemplateTypeParmDecl>(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<NonTypeTemplateParmDecl>(Param)) {
|
||||
} else if (auto NTTP = dyn_cast<NonTypeTemplateParmDecl>(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<TemplateTemplateParmDecl>(Param)) {
|
||||
} else if (auto TTPD = dyn_cast<TemplateTemplateParmDecl>(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<TemplateTypeParmType>()) {
|
||||
auto P = cast<TemplateTypeParmDecl>(Params->getParam(T->getIndex()));
|
||||
Out << *P;
|
||||
continue;
|
||||
}
|
||||
if (A.getKind() == TemplateArgument::Template) {
|
||||
if (auto T = A.getAsTemplate().getAsTemplateDecl())
|
||||
if (auto TD = dyn_cast<TemplateTemplateParmDecl>(T)) {
|
||||
auto P = cast<TemplateTemplateParmDecl>(
|
||||
Params->getParam(TD->getIndex()));
|
||||
Out << *P;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (A.getKind() == TemplateArgument::Expression) {
|
||||
if (auto E = dyn_cast<DeclRefExpr>(A.getAsExpr()))
|
||||
if (auto N = dyn_cast<NonTypeTemplateParmDecl>(E->getDecl())) {
|
||||
auto P = cast<NonTypeTemplateParmDecl>(
|
||||
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<TemplateTemplateParmDecl>(D)) {
|
||||
@ -964,30 +1040,49 @@ void DeclPrinter::VisitTemplateDecl(const TemplateDecl *D) {
|
||||
}
|
||||
|
||||
void DeclPrinter::VisitFunctionTemplateDecl(FunctionTemplateDecl *D) {
|
||||
if (PrintInstantiation) {
|
||||
TemplateParameterList *Params = D->getTemplateParameters();
|
||||
for (auto *I : D->specializations()) {
|
||||
prettyPrintPragmas(I);
|
||||
PrintTemplateParameters(Params, I->getTemplateSpecializationArgs());
|
||||
Visit(I);
|
||||
}
|
||||
}
|
||||
|
||||
prettyPrintPragmas(D->getTemplatedDecl());
|
||||
return VisitRedeclarableTemplateDecl(D);
|
||||
VisitRedeclarableTemplateDecl(D);
|
||||
|
||||
if (PrintInstantiation) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DeclPrinter::VisitClassTemplateDecl(ClassTemplateDecl *D) {
|
||||
if (PrintInstantiation) {
|
||||
TemplateParameterList *Params = D->getTemplateParameters();
|
||||
for (auto *I : D->specializations()) {
|
||||
PrintTemplateParameters(Params, &I->getTemplateArgs());
|
||||
Visit(I);
|
||||
Out << ";\n";
|
||||
}
|
||||
}
|
||||
VisitRedeclarableTemplateDecl(D);
|
||||
|
||||
return VisitRedeclarableTemplateDecl(D);
|
||||
if (PrintInstantiation) {
|
||||
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);
|
||||
}
|
||||
|
||||
void DeclPrinter::VisitClassTemplatePartialSpecializationDecl(
|
||||
ClassTemplatePartialSpecializationDecl *D) {
|
||||
printTemplateParameters(D->getTemplateParameters());
|
||||
VisitCXXRecordDecl(D);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
@ -432,7 +432,7 @@ void test_lifetime_extended_temporaries() {
|
||||
}
|
||||
|
||||
|
||||
// CHECK-LABEL: int *PR18472()
|
||||
// CHECK-LABEL: template<> int *PR18472<int>()
|
||||
// CHECK: [B2 (ENTRY)]
|
||||
// CHECK-NEXT: Succs (1): B1
|
||||
// CHECK: [B1]
|
||||
|
12
clang/test/Coverage/ast-print-func.cpp
Normal file
12
clang/test/Coverage/ast-print-func.cpp
Normal file
@ -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;
|
||||
}
|
64
clang/test/Coverage/ast-print-temp-class.cpp
Normal file
64
clang/test/Coverage/ast-print-temp-class.cpp
Normal file
@ -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<typename T> class C0 {};
|
||||
template<> class C0<long> {};
|
||||
template<> class C0<long*> {};
|
||||
C0<int> c0;
|
||||
|
||||
template<int N> class C1 {};
|
||||
template<> class C1<11> {};
|
||||
C1<2> c1a;
|
||||
C1<4> c1b;
|
||||
|
||||
template<typename T> class C2a {};
|
||||
template<typename T> class C2b {};
|
||||
template<template<typename T> class TC> class C2 {};
|
||||
template<> class C2<C2a> {};
|
||||
C2<C2b> c2;
|
||||
|
||||
|
||||
// Default arguments
|
||||
|
||||
template<typename T = int> class C10 {};
|
||||
template<int N = 10> class C11 {};
|
||||
template<typename T, int N = 22> class C12a {};
|
||||
//FIXME: template<template<typename T, int N> class TC = C12a> class C12 {};
|
||||
//FIXME: template<template<typename T> class TC = C12a> class C13 {};
|
||||
|
||||
|
||||
// Partial specializations
|
||||
|
||||
template<typename T, typename U> struct C20 {
|
||||
T a;
|
||||
U b;
|
||||
};
|
||||
template<typename T> struct C20<T, int> {
|
||||
T a;
|
||||
};
|
||||
|
||||
template<int N, typename U> struct C21 {
|
||||
U a;
|
||||
U b[N];
|
||||
};
|
||||
template<int N> struct C21<N, int> {
|
||||
int a[N];
|
||||
};
|
||||
|
||||
template<template<typename T2> class TC, typename U> struct C22 {
|
||||
TC<U> a;
|
||||
U b;
|
||||
};
|
||||
template<template<typename T2> class TC> struct C22<TC, int> {
|
||||
TC<int> a;
|
||||
};
|
||||
|
||||
|
||||
// Declaration only
|
||||
template<typename T> class C30;
|
||||
template<> class C30<long>;
|
||||
template<> class C30<long*>;
|
||||
extern C30<int> c30;
|
25
clang/test/Coverage/ast-print-temp-func.cpp
Normal file
25
clang/test/Coverage/ast-print-temp-func.cpp
Normal file
@ -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<typename T> void func_01();
|
||||
template<typename T> void func_01() {}
|
||||
template<> void func_01<int>() {}
|
||||
template<> void func_01<long>() {}
|
||||
template<typename T> void func_01();
|
||||
|
||||
void main_01() {
|
||||
func_01<int*>();
|
||||
func_01<char>();
|
||||
}
|
||||
|
||||
template<typename T> void func_02();
|
||||
template<typename T> void func_02();
|
||||
template<> void func_02<int>();
|
||||
template<> void func_02<long>();
|
||||
template<typename T> void func_02();
|
||||
|
||||
void main_02() {
|
||||
func_02<int*>();
|
||||
func_02<char>();
|
||||
}
|
@ -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
|
||||
|
@ -40,7 +40,7 @@ protected:
|
||||
data* reserved;
|
||||
};
|
||||
// CHECK: <Declaration>class Test {}</Declaration>
|
||||
// CHECK: <Declaration>Test() : reserved(new Test::data())</Declaration>
|
||||
// CHECK: <Declaration>Test() : reserved(new Test::data()) {}</Declaration>
|
||||
// CHECK: <Declaration>unsigned int getID() const</Declaration>
|
||||
// CHECK: <Declaration>~Test()</Declaration>
|
||||
// CHECK: <Declaration>Test::data *reserved</Declaration>
|
||||
|
@ -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=[<Function templateKind="specialization" file="{{[^"]+}}comment-to-html-xml-conversion.cpp" line="[[@LINE-2]]" column="6"><Name>comment_to_xml_conversion_10</Name><USR>c:@F@comment_to_xml_conversion_10<#I#I>#I#I#</USR><Declaration>void comment_to_xml_conversion_10(int aaa, int bbb)</Declaration><Abstract><Para> Aaa.</Para></Abstract></Function>]
|
||||
// CHECK: comment-to-html-xml-conversion.cpp:[[@LINE-2]]:6: FunctionDecl=comment_to_xml_conversion_10:{{.*}} FullCommentAsXML=[<Function templateKind="specialization" file="{{[^"]+}}comment-to-html-xml-conversion.cpp" line="[[@LINE-2]]" column="6"><Name>comment_to_xml_conversion_10</Name><USR>c:@F@comment_to_xml_conversion_10<#I#I>#I#I#</USR><Declaration>template <> void comment_to_xml_conversion_10<int, int>(int aaa, int bbb)</Declaration><Abstract><Para> Aaa.</Para></Abstract></Function>]
|
||||
|
||||
/// Aaa.
|
||||
template<typename T, typename U>
|
||||
@ -825,13 +825,13 @@ class comment_to_xml_conversion_11 { };
|
||||
template<typename T>
|
||||
class comment_to_xml_conversion_11<T, int> { };
|
||||
|
||||
// CHECK: comment-to-html-xml-conversion.cpp:[[@LINE-2]]:7: ClassTemplatePartialSpecialization=comment_to_xml_conversion_11:{{.*}} FullCommentAsXML=[<Class templateKind="partialSpecialization" file="{{[^"]+}}comment-to-html-xml-conversion.cpp" line="[[@LINE-2]]" column="7"><Name>comment_to_xml_conversion_11</Name><USR>c:@SP>1#T@comment_to_xml_conversion_11>#t0.0#I</USR><Declaration>class comment_to_xml_conversion_11 {}</Declaration><Abstract><Para> Aaa.</Para></Abstract></Class>]
|
||||
// CHECK: comment-to-html-xml-conversion.cpp:[[@LINE-2]]:7: ClassTemplatePartialSpecialization=comment_to_xml_conversion_11:{{.*}} FullCommentAsXML=[<Class templateKind="partialSpecialization" file="{{[^"]+}}comment-to-html-xml-conversion.cpp" line="[[@LINE-2]]" column="7"><Name>comment_to_xml_conversion_11</Name><USR>c:@SP>1#T@comment_to_xml_conversion_11>#t0.0#I</USR><Declaration>template <typename T> class comment_to_xml_conversion_11<T, int> {}</Declaration><Abstract><Para> Aaa.</Para></Abstract></Class>]
|
||||
|
||||
/// Aaa.
|
||||
template<>
|
||||
class comment_to_xml_conversion_11<int, int> { };
|
||||
|
||||
// CHECK: comment-to-html-xml-conversion.cpp:[[@LINE-2]]:7: ClassDecl=comment_to_xml_conversion_11:{{.*}} FullCommentAsXML=[<Class templateKind="specialization" file="{{[^"]+}}comment-to-html-xml-conversion.cpp" line="[[@LINE-2]]" column="7"><Name>comment_to_xml_conversion_11</Name><USR>c:@S@comment_to_xml_conversion_11>#I#I</USR><Declaration>class comment_to_xml_conversion_11 {}</Declaration><Abstract><Para> Aaa.</Para></Abstract></Class>]
|
||||
// CHECK: comment-to-html-xml-conversion.cpp:[[@LINE-2]]:7: ClassDecl=comment_to_xml_conversion_11:{{.*}} FullCommentAsXML=[<Class templateKind="specialization" file="{{[^"]+}}comment-to-html-xml-conversion.cpp" line="[[@LINE-2]]" column="7"><Name>comment_to_xml_conversion_11</Name><USR>c:@S@comment_to_xml_conversion_11>#I#I</USR><Declaration>template <> class comment_to_xml_conversion_11<int, int> {}</Declaration><Abstract><Para> Aaa.</Para></Abstract></Class>]
|
||||
|
||||
/// Aaa.
|
||||
int comment_to_xml_conversion_12;
|
||||
|
@ -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 <int X = 5, typename Y = int, int Z = 5> struct foo {
|
||||
// CHECK2: template <int X = 2, typename Y = double, int Z = 3> struct foo {
|
||||
|
||||
// Template definition - foo
|
||||
// CHECK1: template <int X, typename Y, int Z = 5> struct foo {
|
||||
// CHECK2: template <int X, typename Y, int Z = 5> struct foo {
|
||||
|
||||
// Template instantiation - bar
|
||||
// CHECK1: template <int A = 5, typename B = int> int bar()
|
||||
// CHECK2: template <int A = 5, typename B = int> 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 <int A, typename B> B bar()
|
||||
// CHECK2: template <int A, typename B> B bar()
|
||||
|
||||
// Template instantiation - bar
|
||||
// CHECK1: template<> int bar<5, int>()
|
||||
// CHECK2: template<> int bar<5, int>()
|
||||
|
||||
// CHECK1-LABEL: template <typename ...T> struct A {
|
||||
// CHECK1-NEXT: template <T ...x[3]> struct B {
|
||||
template <typename ...T> struct A {
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -9,6 +9,14 @@
|
||||
void foo() {}
|
||||
|
||||
// CHECK: template <typename T, int N> 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, 4>(int argc, char **argv)
|
||||
template <typename T, int N>
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -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 T>
|
||||
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<int> d;
|
||||
@ -26,14 +25,6 @@ void init(SSS<int> &lhs, SSS<int> 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<int> : omp_out = omp_in) initializer(init(omp_priv, omp_orig))
|
||||
|
||||
// CHECK: template <typename T = int> 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 : int : omp_out += omp_in) initializer(omp_priv = omp_orig + 15);
|
||||
// CHECK: }
|
||||
// CHECK: return a;
|
||||
// CHECK: }
|
||||
|
||||
// CHECK: template <typename T> T foo(T a) {
|
||||
// CHECK: #pragma omp declare reduction (fun : T : omp_out += omp_in) initializer(omp_priv = omp_orig + 15);
|
||||
// CHECK: {
|
||||
@ -41,6 +32,14 @@ void init(SSS<int> &lhs, SSS<int> rhs);
|
||||
// CHECK: }
|
||||
// CHECK: return a;
|
||||
// CHECK: }
|
||||
|
||||
// CHECK: template<> int foo<int>(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 : int : omp_out += omp_in) initializer(omp_priv = omp_orig + 15);
|
||||
// CHECK: }
|
||||
// CHECK: return a;
|
||||
// CHECK: }
|
||||
template <typename T>
|
||||
T foo(T a) {
|
||||
#pragma omp declare reduction(fun : T : omp_out += omp_in) initializer(omp_priv = omp_orig + 15)
|
||||
|
@ -22,18 +22,16 @@ template <class C> void h(C *hp, C *hp2, C *hq, C *lin) {
|
||||
}
|
||||
|
||||
// CHECK: #pragma omp declare simd aligned(hp) aligned(hp2)
|
||||
// CHECK-NEXT: template <class C = int> void h(int *hp, int *hp2, int *hq, int *lin) {
|
||||
// CHECK-NEXT: h((float *)hp, (float *)hp2, (float *)hq, (float *)lin);
|
||||
// CHECK-NEXT: }
|
||||
|
||||
// CHECK: #pragma omp declare simd aligned(hp) aligned(hp2)
|
||||
// CHECK-NEXT: template <class C = float> void h(float *hp, float *hp2, float *hq, float *lin) {
|
||||
// CHECK-NEXT: template <class C> void h(C *hp, C *hp2, C *hq, C *lin) {
|
||||
// CHECK-NEXT: }
|
||||
|
||||
// CHECK: #pragma omp declare simd aligned(hp) aligned(hp2)
|
||||
// CHECK: template <class C> void h(C *hp, C *hp2, C *hq, C *lin) {
|
||||
// CHECK-NEXT: template<> void h<float>(float *hp, float *hp2, float *hq, float *lin) {
|
||||
// CHECK-NEXT: }
|
||||
|
||||
// CHECK-NEXT: template<> void h<int>(int *hp, int *hp2, int *hq, int *lin) {
|
||||
// CHECK-NEXT: h((float *)hp, (float *)hp2, (float *)hq, (float *)lin);
|
||||
// CHECK-NEXT: }
|
||||
//
|
||||
|
||||
// Explicit specialization with <C=int>.
|
||||
// Pragmas need to be same, otherwise standard says that's undefined behavior.
|
||||
@ -75,11 +73,11 @@ private:
|
||||
int x[10];
|
||||
};
|
||||
|
||||
// CHECK: template <int X = 16, typename T = float> 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 <int X, typename T> 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 <int X, typename T>
|
||||
class TVV {
|
||||
public:
|
||||
// CHECK: template <int X, typename T> 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 <int N = 64> void foo(int (&b)[64], float *&c)
|
||||
// CHECK: #pragma omp declare simd simdlen(N) aligned(b: N * 2) linear(uval(c): N)
|
||||
// CHECK: template <int N> 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 <int N>
|
||||
void foo(int (&b)[N], float *&c);
|
||||
|
@ -34,7 +34,12 @@ void foo_cpp() {}
|
||||
#pragma omp declare target
|
||||
template <class T>
|
||||
struct C {
|
||||
// CHECK: template <class T = int> struct C
|
||||
// CHECK: template <class T> struct C {
|
||||
// CHECK: #pragma omp declare target
|
||||
// CHECK-NEXT: static T ts;
|
||||
// CHECK-NEXT: #pragma omp end declare target
|
||||
|
||||
// CHECK: template<> struct C<int>
|
||||
T t;
|
||||
// CHECK-NEXT: int t;
|
||||
static T ts;
|
||||
@ -59,11 +64,6 @@ struct C {
|
||||
// CHECK: #pragma omp end declare target
|
||||
};
|
||||
|
||||
// CHECK: template <class T> struct C {
|
||||
// CHECK: #pragma omp declare target
|
||||
// CHECK-NEXT: static T ts;
|
||||
// CHECK-NEXT: #pragma omp end declare target
|
||||
|
||||
template<class T>
|
||||
T C<T>::ts = 1;
|
||||
// CHECK: #pragma omp declare target
|
||||
|
@ -39,15 +39,15 @@ 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<S> {
|
||||
S8() {}
|
||||
|
@ -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;
|
||||
|
@ -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<S> {
|
||||
S8() {}
|
||||
|
@ -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<S> {
|
||||
S8() {}
|
||||
|
@ -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<S> {
|
||||
S8() {}
|
||||
|
@ -15,15 +15,15 @@ T tmain(T argc) {
|
||||
#pragma omp flush(a)
|
||||
return a + argc;
|
||||
}
|
||||
// CHECK: static T a;
|
||||
// CHECK-NEXT: #pragma omp flush
|
||||
// CHECK-NEXT: #pragma omp flush (a)
|
||||
// CHECK: static int a;
|
||||
// CHECK-NEXT: #pragma omp flush
|
||||
// CHECK-NEXT: #pragma omp flush (a)
|
||||
// CHECK: static char a;
|
||||
// CHECK-NEXT: #pragma omp flush
|
||||
// CHECK-NEXT: #pragma omp flush (a)
|
||||
// CHECK: static T a;
|
||||
// CHECK-NEXT: #pragma omp flush
|
||||
// CHECK-NEXT: #pragma omp flush (a)
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
static int a;
|
||||
|
@ -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<S> {
|
||||
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;
|
||||
|
@ -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<S1> {
|
||||
S8() {}
|
||||
@ -125,7 +125,7 @@ template<int LEN> struct S2 {
|
||||
};
|
||||
|
||||
// S2<4>::func is called below in main.
|
||||
// CHECK: template <int LEN = 4> 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)
|
||||
|
@ -51,43 +51,6 @@ T tmain (T argc) {
|
||||
return (0);
|
||||
}
|
||||
|
||||
// CHECK: static int a;
|
||||
// CHECK-NEXT: #pragma omp for ordered
|
||||
// CHECK-NEXT: for (int i = 0; i < argc; ++i)
|
||||
// CHECK-NEXT: #pragma omp ordered
|
||||
// CHECK-NEXT: {
|
||||
// CHECK-NEXT: a = 2;
|
||||
// CHECK-NEXT: }
|
||||
// CHECK-NEXT: #pragma omp for ordered
|
||||
// CHECK-NEXT: for (int i = 0; i < argc; ++i)
|
||||
// CHECK-NEXT: #pragma omp ordered threads
|
||||
// CHECK-NEXT: {
|
||||
// CHECK-NEXT: a = 2;
|
||||
// CHECK-NEXT: }
|
||||
// CHECK-NEXT: #pragma omp simd
|
||||
// CHECK-NEXT: for (int i = 0; i < argc; ++i)
|
||||
// CHECK-NEXT: #pragma omp ordered simd
|
||||
// CHECK-NEXT: {
|
||||
// CHECK-NEXT: a = 2;
|
||||
// CHECK-NEXT: }
|
||||
// CHECK-NEXT: #pragma omp for simd
|
||||
// CHECK-NEXT: for (int i = 0; i < argc; ++i)
|
||||
// CHECK-NEXT: #pragma omp ordered simd
|
||||
// CHECK-NEXT: {
|
||||
// CHECK-NEXT: a = 2;
|
||||
// CHECK-NEXT: }
|
||||
// CHECK-NEXT: #pragma omp parallel for simd
|
||||
// CHECK-NEXT: for (int i = 0; i < argc; ++i)
|
||||
// CHECK-NEXT: #pragma omp ordered simd
|
||||
// CHECK-NEXT: {
|
||||
// CHECK-NEXT: a = 2;
|
||||
// CHECK-NEXT: }
|
||||
// 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: a = 2;
|
||||
// CHECK-NEXT: }
|
||||
// CHECK: static T a;
|
||||
// CHECK-NEXT: #pragma omp for ordered
|
||||
// CHECK-NEXT: for (int i = 0; i < argc; ++i)
|
||||
@ -125,6 +88,43 @@ T tmain (T argc) {
|
||||
// CHECK-NEXT: #pragma omp ordered depend(sink : i + N)
|
||||
// CHECK-NEXT: a = 2;
|
||||
// CHECK-NEXT: }
|
||||
// CHECK: static int a;
|
||||
// CHECK-NEXT: #pragma omp for ordered
|
||||
// CHECK-NEXT: for (int i = 0; i < argc; ++i)
|
||||
// CHECK-NEXT: #pragma omp ordered
|
||||
// CHECK-NEXT: {
|
||||
// CHECK-NEXT: a = 2;
|
||||
// CHECK-NEXT: }
|
||||
// CHECK-NEXT: #pragma omp for ordered
|
||||
// CHECK-NEXT: for (int i = 0; i < argc; ++i)
|
||||
// CHECK-NEXT: #pragma omp ordered threads
|
||||
// CHECK-NEXT: {
|
||||
// CHECK-NEXT: a = 2;
|
||||
// CHECK-NEXT: }
|
||||
// CHECK-NEXT: #pragma omp simd
|
||||
// CHECK-NEXT: for (int i = 0; i < argc; ++i)
|
||||
// CHECK-NEXT: #pragma omp ordered simd
|
||||
// CHECK-NEXT: {
|
||||
// CHECK-NEXT: a = 2;
|
||||
// CHECK-NEXT: }
|
||||
// CHECK-NEXT: #pragma omp for simd
|
||||
// CHECK-NEXT: for (int i = 0; i < argc; ++i)
|
||||
// CHECK-NEXT: #pragma omp ordered simd
|
||||
// CHECK-NEXT: {
|
||||
// CHECK-NEXT: a = 2;
|
||||
// CHECK-NEXT: }
|
||||
// CHECK-NEXT: #pragma omp parallel for simd
|
||||
// CHECK-NEXT: for (int i = 0; i < argc; ++i)
|
||||
// CHECK-NEXT: #pragma omp ordered simd
|
||||
// CHECK-NEXT: {
|
||||
// CHECK-NEXT: a = 2;
|
||||
// CHECK-NEXT: }
|
||||
// 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: a = 2;
|
||||
// CHECK-NEXT: }
|
||||
|
||||
// CHECK-LABEL: int main(
|
||||
int main (int argc, char **argv) {
|
||||
|
@ -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<S1> {
|
||||
S8() {}
|
||||
@ -122,18 +122,18 @@ struct S {
|
||||
#pragma omp threadprivate(TS)
|
||||
};
|
||||
|
||||
// CHECK: template <class T = int> struct S {
|
||||
// CHECK: static int TS;
|
||||
// CHECK-NEXT: #pragma omp threadprivate(S<int>::TS)
|
||||
// CHECK-NEXT: }
|
||||
// CHECK: template <class T = long> struct S {
|
||||
// CHECK: static long TS;
|
||||
// CHECK-NEXT: #pragma omp threadprivate(S<long>::TS)
|
||||
// CHECK-NEXT: }
|
||||
// CHECK: template <class T> struct S {
|
||||
// CHECK: static T TS;
|
||||
// CHECK-NEXT: #pragma omp threadprivate(S::TS)
|
||||
// CHECK: };
|
||||
// CHECK: template<> struct S<int> {
|
||||
// CHECK: static int TS;
|
||||
// CHECK-NEXT: #pragma omp threadprivate(S<int>::TS)
|
||||
// CHECK-NEXT: }
|
||||
// CHECK: template<> struct S<long> {
|
||||
// CHECK: static long TS;
|
||||
// CHECK-NEXT: #pragma omp threadprivate(S<long>::TS)
|
||||
// CHECK-NEXT: }
|
||||
|
||||
template <typename T, int C>
|
||||
T tmain(T argc, T *argv) {
|
||||
@ -150,28 +150,6 @@ T tmain(T argc, T *argv) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// CHECK: template <typename T = int, int C = 5> int tmain(int argc, int *argv) {
|
||||
// CHECK-NEXT: int b = argc, c, d, e, f, g;
|
||||
// CHECK-NEXT: static int a;
|
||||
// CHECK-NEXT: S<int> s;
|
||||
// CHECK-NEXT: int arr[5][10], arr1[5];
|
||||
// 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(5) copyin(S<int>::TS) proc_bind(master) reduction(+: c,arr1[argc]) reduction(max: e,arr[:5][0:10])
|
||||
// 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 <typename T = long, int C = 1> long tmain(long argc, long *argv) {
|
||||
// CHECK-NEXT: long b = argc, c, d, e, f, g;
|
||||
// CHECK-NEXT: static long a;
|
||||
// CHECK-NEXT: S<long> s;
|
||||
// CHECK-NEXT: long arr[1][10], arr1[1];
|
||||
// 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(1) copyin(S<long>::TS) proc_bind(master) reduction(+: c,arr1[argc]) reduction(max: e,arr[:1][0:10])
|
||||
// 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 <typename T, int C> T tmain(T argc, T *argv) {
|
||||
// CHECK-NEXT: T b = argc, c, d, e, f, g;
|
||||
// CHECK-NEXT: static T a;
|
||||
@ -183,6 +161,28 @@ T tmain(T argc, T *argv) {
|
||||
// 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, 5>(int argc, int *argv) {
|
||||
// CHECK-NEXT: int b = argc, c, d, e, f, g;
|
||||
// CHECK-NEXT: static int a;
|
||||
// CHECK-NEXT: S<int> s;
|
||||
// CHECK-NEXT: int arr[5][10], arr1[5];
|
||||
// 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(5) copyin(S<int>::TS) proc_bind(master) reduction(+: c,arr1[argc]) reduction(max: e,arr[:5][0:10])
|
||||
// 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, 1>(long argc, long *argv) {
|
||||
// CHECK-NEXT: long b = argc, c, d, e, f, g;
|
||||
// CHECK-NEXT: static long a;
|
||||
// CHECK-NEXT: S<long> s;
|
||||
// CHECK-NEXT: long arr[1][10], arr1[1];
|
||||
// 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(1) copyin(S<long>::TS) proc_bind(master) reduction(+: c,arr1[argc]) reduction(max: e,arr[:1][0:10])
|
||||
// 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()
|
||||
|
||||
enum Enum { };
|
||||
|
||||
|
@ -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<S> {
|
||||
S8() {}
|
||||
|
@ -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<S1> {
|
||||
S8() {}
|
||||
@ -126,7 +126,7 @@ template<int LEN> struct S2 {
|
||||
};
|
||||
|
||||
// S2<4>::func is called below in main.
|
||||
// CHECK: template <int LEN = 4> 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)
|
||||
|
@ -15,18 +15,18 @@ struct S {
|
||||
#pragma omp threadprivate(TS)
|
||||
};
|
||||
|
||||
// CHECK: template <class T = int> struct S {
|
||||
// CHECK: static int TS;
|
||||
// CHECK-NEXT: #pragma omp threadprivate(S<int>::TS)
|
||||
// CHECK-NEXT: }
|
||||
// CHECK: template <class T = long> struct S {
|
||||
// CHECK: static long TS;
|
||||
// CHECK-NEXT: #pragma omp threadprivate(S<long>::TS)
|
||||
// CHECK-NEXT: }
|
||||
// CHECK: template <class T> struct S {
|
||||
// CHECK: static T TS;
|
||||
// CHECK-NEXT: #pragma omp threadprivate(S::TS)
|
||||
// CHECK: };
|
||||
// CHECK: template<> struct S<int> {
|
||||
// CHECK: static int TS;
|
||||
// CHECK-NEXT: #pragma omp threadprivate(S<int>::TS)
|
||||
// CHECK-NEXT: }
|
||||
// CHECK: template<> struct S<long> {
|
||||
// CHECK: static long TS;
|
||||
// CHECK-NEXT: #pragma omp threadprivate(S<long>::TS)
|
||||
// CHECK-NEXT: }
|
||||
|
||||
template <typename T, int C>
|
||||
T tmain(T argc, T *argv) {
|
||||
@ -50,7 +50,25 @@ T tmain(T argc, T *argv) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// CHECK: template <typename T = int, int C = 5> int tmain(int argc, int *argv) {
|
||||
// CHECK: template <typename T, int C> T tmain(T argc, T *argv) {
|
||||
// CHECK-NEXT: T b = argc, c, d, e, f, g;
|
||||
// CHECK-NEXT: static T a;
|
||||
// CHECK-NEXT: S<T> 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<T>::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: {
|
||||
// CHECK-NEXT: foo();
|
||||
// CHECK-NEXT: #pragma omp section
|
||||
// CHECK-NEXT: foo();
|
||||
// CHECK-NEXT: }
|
||||
// CHECK: template<> int tmain<int, 5>(int argc, int *argv) {
|
||||
// CHECK-NEXT: int b = argc, c, d, e, f, g;
|
||||
// CHECK-NEXT: static int a;
|
||||
// CHECK-NEXT: S<int> s;
|
||||
@ -68,7 +86,7 @@ T tmain(T argc, T *argv) {
|
||||
// CHECK-NEXT: #pragma omp section
|
||||
// CHECK-NEXT: foo();
|
||||
// CHECK-NEXT: }
|
||||
// CHECK: template <typename T = long, int C = 1> long tmain(long argc, long *argv) {
|
||||
// CHECK: template<> long tmain<long, 1>(long argc, long *argv) {
|
||||
// CHECK-NEXT: long b = argc, c, d, e, f, g;
|
||||
// CHECK-NEXT: static long a;
|
||||
// CHECK-NEXT: S<long> s;
|
||||
@ -86,24 +104,6 @@ T tmain(T argc, T *argv) {
|
||||
// CHECK-NEXT: #pragma omp section
|
||||
// CHECK-NEXT: foo();
|
||||
// CHECK-NEXT: }
|
||||
// CHECK: template <typename T, int C> T tmain(T argc, T *argv) {
|
||||
// CHECK-NEXT: T b = argc, c, d, e, f, g;
|
||||
// CHECK-NEXT: static T a;
|
||||
// CHECK-NEXT: S<T> 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<T>::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: {
|
||||
// CHECK-NEXT: foo();
|
||||
// CHECK-NEXT: #pragma omp section
|
||||
// CHECK-NEXT: foo();
|
||||
// CHECK-NEXT: }
|
||||
|
||||
enum Enum {};
|
||||
|
||||
|
@ -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;
|
||||
|
@ -34,9 +34,9 @@ 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<SS> {
|
||||
S8() {}
|
||||
@ -129,7 +129,7 @@ template<int LEN> struct S2 {
|
||||
};
|
||||
|
||||
// S2<4>::func is called below in main.
|
||||
// CHECK: template <int LEN = 4> 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)
|
||||
|
@ -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);
|
||||
|
@ -34,7 +34,29 @@ T tmain(T argc, T *argv) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// CHECK: template <typename T = int, int C = 5> int tmain(int argc, int *argv) {
|
||||
// CHECK: template <typename T, int C> 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(C)
|
||||
// CHECK-NEXT: foo()
|
||||
// CHECK-NEXT: #pragma omp target map(tofrom: i)
|
||||
// CHECK-NEXT: foo()
|
||||
// CHECK-NEXT: #pragma omp target map(tofrom: a[0:10],i)
|
||||
// CHECK-NEXT: foo()
|
||||
// CHECK-NEXT: #pragma omp target map(to: i) map(from: j)
|
||||
// CHECK-NEXT: foo()
|
||||
// CHECK-NEXT: #pragma omp target map(always,alloc: i)
|
||||
// CHECK-NEXT: foo()
|
||||
// CHECK-NEXT: #pragma omp target nowait
|
||||
// CHECK-NEXT: foo()
|
||||
// CHECK-NEXT: #pragma omp target depend(in : argc,argv[i:argc],a[:])
|
||||
// CHECK-NEXT: foo()
|
||||
// CHECK-NEXT: #pragma omp target defaultmap(tofrom: scalar)
|
||||
// CHECK-NEXT: foo()
|
||||
// CHECK: template<> int tmain<int, 5>(int argc, int *argv) {
|
||||
// CHECK-NEXT: int i, j, a[20]
|
||||
// CHECK-NEXT: #pragma omp target
|
||||
// CHECK-NEXT: foo();
|
||||
@ -56,7 +78,7 @@ T tmain(T argc, T *argv) {
|
||||
// CHECK-NEXT: foo()
|
||||
// CHECK-NEXT: #pragma omp target defaultmap(tofrom: scalar)
|
||||
// CHECK-NEXT: foo()
|
||||
// CHECK: template <typename T = char, int C = 1> char tmain(char argc, char *argv) {
|
||||
// CHECK: template<> char tmain<char, 1>(char argc, char *argv) {
|
||||
// CHECK-NEXT: char i, j, a[20]
|
||||
// CHECK-NEXT: #pragma omp target
|
||||
// CHECK-NEXT: foo();
|
||||
@ -78,28 +100,6 @@ T tmain(T argc, T *argv) {
|
||||
// CHECK-NEXT: foo()
|
||||
// CHECK-NEXT: #pragma omp target defaultmap(tofrom: scalar)
|
||||
// CHECK-NEXT: foo()
|
||||
// CHECK: template <typename T, int C> 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(C)
|
||||
// CHECK-NEXT: foo()
|
||||
// CHECK-NEXT: #pragma omp target map(tofrom: i)
|
||||
// CHECK-NEXT: foo()
|
||||
// CHECK-NEXT: #pragma omp target map(tofrom: a[0:10],i)
|
||||
// CHECK-NEXT: foo()
|
||||
// CHECK-NEXT: #pragma omp target map(to: i) map(from: j)
|
||||
// CHECK-NEXT: foo()
|
||||
// CHECK-NEXT: #pragma omp target map(always,alloc: i)
|
||||
// CHECK-NEXT: foo()
|
||||
// CHECK-NEXT: #pragma omp target nowait
|
||||
// CHECK-NEXT: foo()
|
||||
// CHECK-NEXT: #pragma omp target depend(in : argc,argv[i:argc],a[:])
|
||||
// CHECK-NEXT: foo()
|
||||
// CHECK-NEXT: #pragma omp target defaultmap(tofrom: scalar)
|
||||
// CHECK-NEXT: foo()
|
||||
|
||||
// CHECK-LABEL: int main(int argc, char **argv) {
|
||||
int main (int argc, char **argv) {
|
||||
|
@ -46,7 +46,29 @@ T tmain(T argc, T *argv) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// CHECK: template <typename T = int, int C = 5> int tmain(int argc, int *argv) {
|
||||
// CHECK: template <typename T, int C> 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)
|
||||
// CHECK-NEXT: foo();
|
||||
// CHECK-NEXT: #pragma omp target data map(to: c) if(b)
|
||||
// CHECK-NEXT: foo();
|
||||
// CHECK-NEXT: #pragma omp target data map(tofrom: c)
|
||||
// CHECK-NEXT: foo();
|
||||
// CHECK-NEXT: #pragma omp target data map(tofrom: c) if(b > e)
|
||||
// CHECK-NEXT: foo();
|
||||
// CHECK-NEXT: #pragma omp target data map(tofrom: x[0:10],c)
|
||||
// CHECK-NEXT: foo();
|
||||
// CHECK-NEXT: #pragma omp target data map(to: c) map(from: d)
|
||||
// CHECK-NEXT: foo();
|
||||
// CHECK-NEXT: #pragma omp target data map(always,alloc: e)
|
||||
// CHECK-NEXT: foo();
|
||||
// CHECK-NEXT: #pragma omp target data map(tofrom: e)
|
||||
// CHECK-NEXT: {
|
||||
// CHECK-NEXT: #pragma omp target map(always,alloc: e)
|
||||
// CHECK-NEXT: foo();
|
||||
// CHECK: template<> int tmain<int, 5>(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;
|
||||
@ -68,7 +90,7 @@ T tmain(T argc, T *argv) {
|
||||
// CHECK-NEXT: {
|
||||
// CHECK-NEXT: #pragma omp target map(always,alloc: e)
|
||||
// CHECK-NEXT: foo();
|
||||
// CHECK: template <typename T = char, int C = 1> char tmain(char argc, char *argv) {
|
||||
// CHECK: template<> char tmain<char, 1>(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;
|
||||
@ -90,28 +112,6 @@ T tmain(T argc, T *argv) {
|
||||
// CHECK-NEXT: {
|
||||
// CHECK-NEXT: #pragma omp target map(always,alloc: e)
|
||||
// CHECK-NEXT: foo();
|
||||
// CHECK: template <typename T, int C> 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)
|
||||
// CHECK-NEXT: foo();
|
||||
// CHECK-NEXT: #pragma omp target data map(to: c) if(b)
|
||||
// CHECK-NEXT: foo();
|
||||
// CHECK-NEXT: #pragma omp target data map(tofrom: c)
|
||||
// CHECK-NEXT: foo();
|
||||
// CHECK-NEXT: #pragma omp target data map(tofrom: c) if(b > e)
|
||||
// CHECK-NEXT: foo();
|
||||
// CHECK-NEXT: #pragma omp target data map(tofrom: x[0:10],c)
|
||||
// CHECK-NEXT: foo();
|
||||
// CHECK-NEXT: #pragma omp target data map(to: c) map(from: d)
|
||||
// CHECK-NEXT: foo();
|
||||
// CHECK-NEXT: #pragma omp target data map(always,alloc: e)
|
||||
// CHECK-NEXT: foo();
|
||||
// CHECK-NEXT: #pragma omp target data map(tofrom: e)
|
||||
// CHECK-NEXT: {
|
||||
// CHECK-NEXT: #pragma omp target map(always,alloc: e)
|
||||
// CHECK-NEXT: foo();
|
||||
|
||||
int main (int argc, char **argv) {
|
||||
int b = argc, c, d, e, f, g, x[20];
|
||||
|
@ -110,7 +110,7 @@ T tmain(T argc) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// CHECK: template <typename T = int> int tmain(int argc) {
|
||||
// CHECK: template<> int tmain<int>(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 <typename T = int *> int *tmain(int *argc) {
|
||||
// CHECK: template<> int *tmain<int *>(int *argc) {
|
||||
// CHECK-NEXT: int *i;
|
||||
// CHECK-NEXT: int *&j = i;
|
||||
// CHECK-NEXT: int **k = &j;
|
||||
|
@ -62,7 +62,34 @@ T tmain(T argc, T *argv) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// CHECK: template <typename T = int, int C = 5> int tmain(int argc, int *argv) {
|
||||
// CHECK: template <typename T, int C> 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)
|
||||
// CHECK-NEXT: #pragma omp target enter data map(to: i) if(b)
|
||||
// CHECK-NEXT: #pragma omp target enter data map(to: c)
|
||||
// CHECK-NEXT: #pragma omp target enter data map(to: c) if(b > e)
|
||||
// CHECK-NEXT: #pragma omp target enter data map(alloc: x[0:10],c)
|
||||
// CHECK-NEXT: #pragma omp target enter data map(to: c) map(alloc: d)
|
||||
// CHECK-NEXT: #pragma omp target enter data map(always,alloc: e)
|
||||
// CHECK-NEXT: #pragma omp target enter data nowait map(to: i)
|
||||
// CHECK-NEXT: #pragma omp target enter data nowait map(to: i) if(target enter data: j > 0)
|
||||
// CHECK-NEXT: #pragma omp target enter data map(to: i) if(b) nowait
|
||||
// CHECK-NEXT: #pragma omp target enter data map(to: c) nowait
|
||||
// CHECK-NEXT: #pragma omp target enter data map(to: c) nowait if(b > e)
|
||||
// CHECK-NEXT: #pragma omp target enter data nowait map(alloc: x[0:10],c)
|
||||
// CHECK-NEXT: #pragma omp target enter data nowait map(to: c) map(alloc: d)
|
||||
// CHECK-NEXT: #pragma omp target enter data nowait map(always,alloc: e)
|
||||
// CHECK-NEXT: #pragma omp target enter data nowait depend(in : argc,argv[i:argc],x[:]) map(to: i)
|
||||
// CHECK-NEXT: #pragma omp target enter data nowait map(to: i) if(target enter data: j > 0) depend(in : argc,argv[i:argc],x[:])
|
||||
// CHECK-NEXT: #pragma omp target enter data depend(in : argc,argv[i:argc],x[:]) map(to: i) if(b) nowait
|
||||
// CHECK-NEXT: #pragma omp target enter data map(to: c) depend(in : argc,argv[i:argc],x[:]) nowait
|
||||
// CHECK-NEXT: #pragma omp target enter data map(to: c) nowait if(b > e) depend(in : argc,argv[i:argc],x[:])
|
||||
// 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<> int tmain<int, 5>(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)
|
||||
@ -89,7 +116,7 @@ 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 <typename T = char, int C = 1> char tmain(char argc, char *argv) {
|
||||
// CHECK: template<> char tmain<char, 1>(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)
|
||||
@ -116,33 +143,6 @@ 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 <typename T, int C> 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)
|
||||
// CHECK-NEXT: #pragma omp target enter data map(to: i) if(b)
|
||||
// CHECK-NEXT: #pragma omp target enter data map(to: c)
|
||||
// CHECK-NEXT: #pragma omp target enter data map(to: c) if(b > e)
|
||||
// CHECK-NEXT: #pragma omp target enter data map(alloc: x[0:10],c)
|
||||
// CHECK-NEXT: #pragma omp target enter data map(to: c) map(alloc: d)
|
||||
// CHECK-NEXT: #pragma omp target enter data map(always,alloc: e)
|
||||
// CHECK-NEXT: #pragma omp target enter data nowait map(to: i)
|
||||
// CHECK-NEXT: #pragma omp target enter data nowait map(to: i) if(target enter data: j > 0)
|
||||
// CHECK-NEXT: #pragma omp target enter data map(to: i) if(b) nowait
|
||||
// CHECK-NEXT: #pragma omp target enter data map(to: c) nowait
|
||||
// CHECK-NEXT: #pragma omp target enter data map(to: c) nowait if(b > e)
|
||||
// CHECK-NEXT: #pragma omp target enter data nowait map(alloc: x[0:10],c)
|
||||
// CHECK-NEXT: #pragma omp target enter data nowait map(to: c) map(alloc: d)
|
||||
// CHECK-NEXT: #pragma omp target enter data nowait map(always,alloc: e)
|
||||
// CHECK-NEXT: #pragma omp target enter data nowait depend(in : argc,argv[i:argc],x[:]) map(to: i)
|
||||
// CHECK-NEXT: #pragma omp target enter data nowait map(to: i) if(target enter data: j > 0) depend(in : argc,argv[i:argc],x[:])
|
||||
// CHECK-NEXT: #pragma omp target enter data depend(in : argc,argv[i:argc],x[:]) map(to: i) if(b) nowait
|
||||
// CHECK-NEXT: #pragma omp target enter data map(to: c) depend(in : argc,argv[i:argc],x[:]) nowait
|
||||
// CHECK-NEXT: #pragma omp target enter data map(to: c) nowait if(b > e) depend(in : argc,argv[i:argc],x[:])
|
||||
// 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[:])
|
||||
|
||||
int main (int argc, char **argv) {
|
||||
int b = argc, i, c, d, e, f, g, x[20];
|
||||
|
@ -66,7 +66,36 @@ T tmain(T argc, T *argv) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// CHECK: template <typename T = int, int C = 5> int tmain(int argc, int *argv) {
|
||||
// CHECK: template <typename T, int C> 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)
|
||||
// CHECK-NEXT: #pragma omp target exit data map(from: i) if(b)
|
||||
// CHECK-NEXT: #pragma omp target exit data map(from: c)
|
||||
// CHECK-NEXT: #pragma omp target exit data map(from: c) if(b > e)
|
||||
// CHECK-NEXT: #pragma omp target exit data map(release: x[0:10],c)
|
||||
// CHECK-NEXT: #pragma omp target exit data map(delete: x[0:10])
|
||||
// CHECK-NEXT: #pragma omp target exit data map(always,delete: x[0:10])
|
||||
// CHECK-NEXT: #pragma omp target exit data map(from: c) map(release: d)
|
||||
// CHECK-NEXT: #pragma omp target exit data map(always,release: e)
|
||||
// CHECK-NEXT: #pragma omp target exit data nowait map(from: i)
|
||||
// CHECK-NEXT: #pragma omp target exit data nowait map(from: i) if(target exit data: j > 0)
|
||||
// CHECK-NEXT: #pragma omp target exit data map(from: i) if(b) nowait
|
||||
// CHECK-NEXT: #pragma omp target exit data map(from: c) nowait
|
||||
// CHECK-NEXT: #pragma omp target exit data map(from: c) nowait if(b > e)
|
||||
// CHECK-NEXT: #pragma omp target exit data nowait map(release: x[0:10],c)
|
||||
// CHECK-NEXT: #pragma omp target exit data nowait map(from: c) map(release: d)
|
||||
// CHECK-NEXT: #pragma omp target exit data nowait map(always,release: e)
|
||||
// CHECK-NEXT: #pragma omp target exit data depend(in : argc,argv[i:argc],x[:]) nowait map(from: i)
|
||||
// CHECK-NEXT: #pragma omp target exit data nowait depend(in : argc,argv[i:argc],x[:]) map(from: i) if(target exit data: j > 0)
|
||||
// CHECK-NEXT: #pragma omp target exit data map(from: i) depend(in : argc,argv[i:argc],x[:]) if(b) nowait
|
||||
// CHECK-NEXT: #pragma omp target exit data map(from: c) depend(in : argc,argv[i:argc],x[:]) nowait
|
||||
// CHECK-NEXT: #pragma omp target exit data map(from: c) depend(in : argc,argv[i:argc],x[:]) nowait if(b > e)
|
||||
// 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<> int tmain<int, 5>(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)
|
||||
@ -95,7 +124,7 @@ 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 <typename T = char, int C = 1> char tmain(char argc, char *argv) {
|
||||
// CHECK: template<> char tmain<char, 1>(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)
|
||||
@ -124,35 +153,6 @@ 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 <typename T, int C> 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)
|
||||
// CHECK-NEXT: #pragma omp target exit data map(from: i) if(b)
|
||||
// CHECK-NEXT: #pragma omp target exit data map(from: c)
|
||||
// CHECK-NEXT: #pragma omp target exit data map(from: c) if(b > e)
|
||||
// CHECK-NEXT: #pragma omp target exit data map(release: x[0:10],c)
|
||||
// CHECK-NEXT: #pragma omp target exit data map(delete: x[0:10])
|
||||
// CHECK-NEXT: #pragma omp target exit data map(always,delete: x[0:10])
|
||||
// CHECK-NEXT: #pragma omp target exit data map(from: c) map(release: d)
|
||||
// CHECK-NEXT: #pragma omp target exit data map(always,release: e)
|
||||
// CHECK-NEXT: #pragma omp target exit data nowait map(from: i)
|
||||
// CHECK-NEXT: #pragma omp target exit data nowait map(from: i) if(target exit data: j > 0)
|
||||
// CHECK-NEXT: #pragma omp target exit data map(from: i) if(b) nowait
|
||||
// CHECK-NEXT: #pragma omp target exit data map(from: c) nowait
|
||||
// CHECK-NEXT: #pragma omp target exit data map(from: c) nowait if(b > e)
|
||||
// CHECK-NEXT: #pragma omp target exit data nowait map(release: x[0:10],c)
|
||||
// CHECK-NEXT: #pragma omp target exit data nowait map(from: c) map(release: d)
|
||||
// CHECK-NEXT: #pragma omp target exit data nowait map(always,release: e)
|
||||
// CHECK-NEXT: #pragma omp target exit data depend(in : argc,argv[i:argc],x[:]) nowait map(from: i)
|
||||
// CHECK-NEXT: #pragma omp target exit data nowait depend(in : argc,argv[i:argc],x[:]) map(from: i) if(target exit data: j > 0)
|
||||
// CHECK-NEXT: #pragma omp target exit data map(from: i) depend(in : argc,argv[i:argc],x[:]) if(b) nowait
|
||||
// CHECK-NEXT: #pragma omp target exit data map(from: c) depend(in : argc,argv[i:argc],x[:]) nowait
|
||||
// CHECK-NEXT: #pragma omp target exit data map(from: c) depend(in : argc,argv[i:argc],x[:]) nowait if(b > e)
|
||||
// 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)
|
||||
|
||||
int main (int argc, char **argv) {
|
||||
int b = argc, i, c, d, e, f, g, x[20];
|
||||
|
@ -172,7 +172,7 @@ T tmain(T argc) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// CHECK: template <typename T = int> int tmain(int argc) {
|
||||
// CHECK: template<> int tmain<int>(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 <typename T = int *> int *tmain(int *argc) {
|
||||
// CHECK: template<> int *tmain<int *>(int *argc) {
|
||||
// CHECK-NEXT: int *const da[5] = {0};
|
||||
// CHECK-NEXT: S6 h[10];
|
||||
// CHECK-NEXT: auto &rh = h;
|
||||
|
@ -15,18 +15,18 @@ struct S {
|
||||
#pragma omp threadprivate(TS)
|
||||
};
|
||||
|
||||
// CHECK: template <class T = int> struct S {
|
||||
// CHECK: static int TS;
|
||||
// CHECK-NEXT: #pragma omp threadprivate(S<int>::TS)
|
||||
// CHECK-NEXT: }
|
||||
// CHECK: template <class T = char> struct S {
|
||||
// CHECK: static char TS;
|
||||
// CHECK-NEXT: #pragma omp threadprivate(S<char>::TS)
|
||||
// CHECK-NEXT: }
|
||||
// CHECK: template <class T> struct S {
|
||||
// CHECK: static T TS;
|
||||
// CHECK-NEXT: #pragma omp threadprivate(S::TS)
|
||||
// CHECK: };
|
||||
// CHECK: template<> struct S<int> {
|
||||
// CHECK: static int TS;
|
||||
// CHECK-NEXT: #pragma omp threadprivate(S<int>::TS)
|
||||
// CHECK-NEXT: }
|
||||
// CHECK: template<> struct S<char> {
|
||||
// CHECK: static char TS;
|
||||
// CHECK-NEXT: #pragma omp threadprivate(S<char>::TS)
|
||||
// CHECK-NEXT: }
|
||||
|
||||
template <typename T, int C>
|
||||
T tmain(T argc, T *argv) {
|
||||
@ -64,7 +64,39 @@ T tmain(T argc, T *argv) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// CHECK: template <typename T = int, int C = 5> int tmain(int argc, int *argv) {
|
||||
// CHECK: template <typename T, int C> T tmain(T argc, T *argv) {
|
||||
// CHECK-NEXT: T b = argc, c, d, e, f, g;
|
||||
// CHECK-NEXT: static T h;
|
||||
// CHECK-NEXT: S<T> 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(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(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(C)
|
||||
// CHECK-NEXT: foo()
|
||||
// CHECK-NEXT: #pragma omp target parallel map(tofrom: i)
|
||||
// CHECK-NEXT: foo()
|
||||
// CHECK-NEXT: #pragma omp target parallel map(tofrom: a[0:10],i)
|
||||
// CHECK-NEXT: foo()
|
||||
// CHECK-NEXT: #pragma omp target parallel map(to: i) map(from: j)
|
||||
// CHECK-NEXT: foo()
|
||||
// CHECK-NEXT: #pragma omp target parallel map(always,alloc: i)
|
||||
// CHECK-NEXT: foo()
|
||||
// CHECK-NEXT: #pragma omp target parallel nowait
|
||||
// CHECK-NEXT: foo()
|
||||
// CHECK-NEXT: #pragma omp target parallel depend(in : argc,argv[i:argc],a[:])
|
||||
// CHECK-NEXT: foo()
|
||||
// CHECK-NEXT: #pragma omp target parallel defaultmap(tofrom: scalar)
|
||||
// CHECK-NEXT: foo()
|
||||
// CHECK: template<> int tmain<int, 5>(int argc, int *argv) {
|
||||
// CHECK-NEXT: int b = argc, c, d, e, f, g;
|
||||
// CHECK-NEXT: static int h;
|
||||
// CHECK-NEXT: S<int> s;
|
||||
@ -96,7 +128,7 @@ T tmain(T argc, T *argv) {
|
||||
// CHECK-NEXT: foo()
|
||||
// CHECK-NEXT: #pragma omp target parallel defaultmap(tofrom: scalar)
|
||||
// CHECK-NEXT: foo()
|
||||
// CHECK: template <typename T = char, int C = 1> char tmain(char argc, char *argv) {
|
||||
// CHECK: template<> char tmain<char, 1>(char argc, char *argv) {
|
||||
// CHECK-NEXT: char b = argc, c, d, e, f, g;
|
||||
// CHECK-NEXT: static char h;
|
||||
// CHECK-NEXT: S<char> s;
|
||||
@ -128,38 +160,6 @@ T tmain(T argc, T *argv) {
|
||||
// CHECK-NEXT: foo()
|
||||
// CHECK-NEXT: #pragma omp target parallel defaultmap(tofrom: scalar)
|
||||
// CHECK-NEXT: foo()
|
||||
// CHECK: template <typename T, int C> T tmain(T argc, T *argv) {
|
||||
// CHECK-NEXT: T b = argc, c, d, e, f, g;
|
||||
// CHECK-NEXT: static T h;
|
||||
// CHECK-NEXT: S<T> 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(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(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(C)
|
||||
// CHECK-NEXT: foo()
|
||||
// CHECK-NEXT: #pragma omp target parallel map(tofrom: i)
|
||||
// CHECK-NEXT: foo()
|
||||
// CHECK-NEXT: #pragma omp target parallel map(tofrom: a[0:10],i)
|
||||
// CHECK-NEXT: foo()
|
||||
// CHECK-NEXT: #pragma omp target parallel map(to: i) map(from: j)
|
||||
// CHECK-NEXT: foo()
|
||||
// CHECK-NEXT: #pragma omp target parallel map(always,alloc: i)
|
||||
// CHECK-NEXT: foo()
|
||||
// CHECK-NEXT: #pragma omp target parallel nowait
|
||||
// CHECK-NEXT: foo()
|
||||
// CHECK-NEXT: #pragma omp target parallel depend(in : argc,argv[i:argc],a[:])
|
||||
// CHECK-NEXT: foo()
|
||||
// CHECK-NEXT: #pragma omp target parallel defaultmap(tofrom: scalar)
|
||||
// CHECK-NEXT: foo()
|
||||
|
||||
// CHECK-LABEL: int main(int argc, char **argv) {
|
||||
int main (int argc, char **argv) {
|
||||
|
@ -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<S> {
|
||||
S8() {}
|
||||
|
@ -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<S> {
|
||||
S8() {}
|
||||
|
@ -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<S> {
|
||||
S8() {}
|
||||
|
@ -18,6 +18,11 @@ 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 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 int a;
|
||||
// CHECK-NEXT: float b;
|
||||
// CHECK-NEXT: int l;
|
||||
@ -28,11 +33,6 @@ T foo(T targ, U uarg) {
|
||||
// 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-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)
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
static int a;
|
||||
|
@ -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<S1> {
|
||||
S8() {}
|
||||
@ -66,18 +66,18 @@ struct S {
|
||||
#pragma omp threadprivate(TS)
|
||||
};
|
||||
|
||||
// CHECK: template <class T = int> struct S {
|
||||
// CHECK: static int TS;
|
||||
// CHECK-NEXT: #pragma omp threadprivate(S<int>::TS)
|
||||
// CHECK-NEXT: }
|
||||
// CHECK: template <class T = long> struct S {
|
||||
// CHECK: static long TS;
|
||||
// CHECK-NEXT: #pragma omp threadprivate(S<long>::TS)
|
||||
// CHECK-NEXT: }
|
||||
// CHECK: template <class T> struct S {
|
||||
// CHECK: static T TS;
|
||||
// CHECK-NEXT: #pragma omp threadprivate(S::TS)
|
||||
// CHECK: };
|
||||
// CHECK: template<> struct S<int> {
|
||||
// CHECK: static int TS;
|
||||
// CHECK-NEXT: #pragma omp threadprivate(S<int>::TS)
|
||||
// CHECK-NEXT: }
|
||||
// CHECK: template<> struct S<long> {
|
||||
// CHECK: static long TS;
|
||||
// CHECK-NEXT: #pragma omp threadprivate(S<long>::TS)
|
||||
// CHECK-NEXT: }
|
||||
|
||||
template <typename T, int C>
|
||||
T tmain(T argc, T *argv) {
|
||||
@ -94,28 +94,6 @@ T tmain(T argc, T *argv) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// CHECK: template <typename T = int, int C = 5> int tmain(int argc, int *argv) {
|
||||
// CHECK-NEXT: int b = argc, c, d, e, f, g;
|
||||
// CHECK-NEXT: static int a;
|
||||
// CHECK-NEXT: S<int> s;
|
||||
// CHECK-NEXT: int 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<int>::TS > 0) priority(argc)
|
||||
// CHECK-NEXT: foo()
|
||||
// CHECK-NEXT: #pragma omp task if(5) mergeable priority(5)
|
||||
// CHECK-NEXT: foo()
|
||||
// CHECK: template <typename T = long, int C = 1> long tmain(long argc, long *argv) {
|
||||
// CHECK-NEXT: long b = argc, c, d, e, f, g;
|
||||
// CHECK-NEXT: static long a;
|
||||
// CHECK-NEXT: S<long> s;
|
||||
// CHECK-NEXT: long 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<long>::TS > 0) priority(argc)
|
||||
// CHECK-NEXT: foo()
|
||||
// CHECK-NEXT: #pragma omp task if(1) mergeable priority(1)
|
||||
// CHECK-NEXT: foo()
|
||||
// CHECK: template <typename T, int C> T tmain(T argc, T *argv) {
|
||||
// CHECK-NEXT: T b = argc, c, d, e, f, g;
|
||||
// CHECK-NEXT: static T a;
|
||||
@ -127,6 +105,28 @@ T tmain(T argc, T *argv) {
|
||||
// CHECK-NEXT: foo()
|
||||
// CHECK-NEXT: #pragma omp task if(C) mergeable priority(C)
|
||||
// CHECK-NEXT: foo()
|
||||
// CHECK: template<> int tmain<int, 5>(int argc, int *argv) {
|
||||
// CHECK-NEXT: int b = argc, c, d, e, f, g;
|
||||
// CHECK-NEXT: static int a;
|
||||
// CHECK-NEXT: S<int> s;
|
||||
// CHECK-NEXT: int 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<int>::TS > 0) priority(argc)
|
||||
// CHECK-NEXT: foo()
|
||||
// CHECK-NEXT: #pragma omp task if(5) mergeable priority(5)
|
||||
// CHECK-NEXT: foo()
|
||||
// CHECK: template<> long tmain<long, 1>(long argc, long *argv) {
|
||||
// CHECK-NEXT: long b = argc, c, d, e, f, g;
|
||||
// CHECK-NEXT: static long a;
|
||||
// CHECK-NEXT: S<long> s;
|
||||
// CHECK-NEXT: long 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<long>::TS > 0) priority(argc)
|
||||
// CHECK-NEXT: foo()
|
||||
// CHECK-NEXT: #pragma omp task if(1) mergeable priority(1)
|
||||
// CHECK-NEXT: foo()
|
||||
|
||||
enum Enum {};
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -15,18 +15,18 @@ struct S {
|
||||
#pragma omp threadprivate(TS)
|
||||
};
|
||||
|
||||
// CHECK: template <class T = int> struct S {
|
||||
// CHECK: static int TS;
|
||||
// CHECK-NEXT: #pragma omp threadprivate(S<int>::TS)
|
||||
// CHECK-NEXT: }
|
||||
// CHECK: template <class T = long> struct S {
|
||||
// CHECK: static long TS;
|
||||
// CHECK-NEXT: #pragma omp threadprivate(S<long>::TS)
|
||||
// CHECK-NEXT: }
|
||||
// CHECK: template <class T> struct S {
|
||||
// CHECK: static T TS;
|
||||
// CHECK-NEXT: #pragma omp threadprivate(S::TS)
|
||||
// CHECK: };
|
||||
// CHECK: template<> struct S<int> {
|
||||
// CHECK: static int TS;
|
||||
// CHECK-NEXT: #pragma omp threadprivate(S<int>::TS)
|
||||
// CHECK-NEXT: }
|
||||
// CHECK: template<> struct S<long> {
|
||||
// CHECK: static long TS;
|
||||
// CHECK-NEXT: #pragma omp threadprivate(S<long>::TS)
|
||||
// CHECK-NEXT: }
|
||||
|
||||
template <typename T, int C>
|
||||
T tmain(T argc, T *argv) {
|
||||
@ -45,7 +45,20 @@ T tmain(T argc, T *argv) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// CHECK: template <typename T = int, int C = 5> int tmain(int argc, int *argv) {
|
||||
// CHECK: template <typename T, int C> T tmain(T argc, T *argv) {
|
||||
// CHECK-NEXT: T b = argc, c, d, e, f, g;
|
||||
// CHECK-NEXT: static T a;
|
||||
// CHECK-NEXT: S<T> 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: foo()
|
||||
// CHECK-NEXT: #pragma omp target
|
||||
// CHECK-NEXT: #pragma omp teams reduction(^: e,f) reduction(&&: g)
|
||||
// CHECK-NEXT: foo()
|
||||
// CHECK: template<> int tmain<int, 5>(int argc, int *argv) {
|
||||
// CHECK-NEXT: int b = argc, c, d, e, f, g;
|
||||
// CHECK-NEXT: static int a;
|
||||
// CHECK-NEXT: S<int> s;
|
||||
@ -58,7 +71,7 @@ T tmain(T argc, T *argv) {
|
||||
// CHECK-NEXT: #pragma omp target
|
||||
// CHECK-NEXT: #pragma omp teams reduction(^: e,f) reduction(&&: g)
|
||||
// CHECK-NEXT: foo()
|
||||
// CHECK: template <typename T = long, int C = 1> long tmain(long argc, long *argv) {
|
||||
// CHECK: template<> long tmain<long, 1>(long argc, long *argv) {
|
||||
// CHECK-NEXT: long b = argc, c, d, e, f, g;
|
||||
// CHECK-NEXT: static long a;
|
||||
// CHECK-NEXT: S<long> s;
|
||||
@ -71,19 +84,6 @@ T tmain(T argc, T *argv) {
|
||||
// CHECK-NEXT: #pragma omp target
|
||||
// CHECK-NEXT: #pragma omp teams reduction(^: e,f) reduction(&&: g)
|
||||
// CHECK-NEXT: foo()
|
||||
// CHECK: template <typename T, int C> T tmain(T argc, T *argv) {
|
||||
// CHECK-NEXT: T b = argc, c, d, e, f, g;
|
||||
// CHECK-NEXT: static T a;
|
||||
// CHECK-NEXT: S<T> 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: foo()
|
||||
// CHECK-NEXT: #pragma omp target
|
||||
// CHECK-NEXT: #pragma omp teams reduction(^: e,f) reduction(&&: g)
|
||||
// CHECK-NEXT: foo()
|
||||
|
||||
enum Enum { };
|
||||
|
||||
|
@ -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<S> {
|
||||
S8() {}
|
||||
|
@ -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<S> {
|
||||
S8() {}
|
||||
|
@ -43,12 +43,12 @@ template <class T> T foo() {
|
||||
v = ST<T>::m;
|
||||
return v;
|
||||
}
|
||||
//CHECK: template <class T = int> int foo() {
|
||||
//CHECK-NEXT: static int v;
|
||||
//CHECK-NEXT: #pragma omp threadprivate(v)
|
||||
//CHECK: template <class T> T foo() {
|
||||
//CHECK-NEXT: static T v;
|
||||
//CHECK-NEXT: #pragma omp threadprivate(v)
|
||||
//CHECK: template<> int foo<int>() {
|
||||
//CHECK-NEXT: static int v;
|
||||
//CHECK-NEXT: #pragma omp threadprivate(v)
|
||||
|
||||
namespace ns{
|
||||
int a;
|
||||
|
@ -13,11 +13,11 @@ template <NamedEnum E>
|
||||
void foo();
|
||||
|
||||
void test() {
|
||||
// CHECK: template <NamedEnumNS::NamedEnum E = NamedEnumNS::NamedEnum::Val0>
|
||||
// CHECK: template<> void foo<NamedEnumNS::NamedEnum::Val0>()
|
||||
NamedEnumNS::foo<Val0>();
|
||||
// CHECK: template <NamedEnumNS::NamedEnum E = NamedEnumNS::NamedEnum::Val1>
|
||||
// CHECK: template<> void foo<NamedEnumNS::NamedEnum::Val1>()
|
||||
NamedEnumNS::foo<(NamedEnum)1>();
|
||||
// CHECK: template <NamedEnumNS::NamedEnum E = 2>
|
||||
// CHECK: template<> void foo<2>()
|
||||
NamedEnumNS::foo<(NamedEnum)2>();
|
||||
}
|
||||
|
||||
|
@ -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()));
|
||||
}
|
||||
|
||||
|
@ -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>(int N)"));
|
||||
}
|
||||
|
||||
|
||||
@ -555,7 +531,6 @@ TEST(DeclPrinter, TestCXXConstructorDecl10) {
|
||||
"};",
|
||||
cxxConstructorDecl(ofClass(hasName("A"))).bind("id"),
|
||||
"A<T...>(const A<T...> &a)"));
|
||||
// WRONG; Should be: "A(const A<T...> &a);"
|
||||
}
|
||||
|
||||
TEST(DeclPrinter, TestCXXConstructorDecl11) {
|
||||
@ -565,8 +540,7 @@ TEST(DeclPrinter, TestCXXConstructorDecl11) {
|
||||
" A(T&&... ts) : T(ts)... {}"
|
||||
"};",
|
||||
cxxConstructorDecl(ofClass(hasName("A"))).bind("id"),
|
||||
"A<T...>(T &&...ts) : T(ts)..."));
|
||||
// WRONG; Should be: "A(T &&...ts) : T(ts)... {}"
|
||||
"A<T...>(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<typename T>"
|
||||
"struct A { T a; };",
|
||||
classTemplateDecl(hasName("A")).bind("id"),
|
||||
"template <typename T> struct A {\n}"));
|
||||
// Should be: with semicolon, with { ... }
|
||||
"template <typename T> struct A {}"));
|
||||
}
|
||||
|
||||
TEST(DeclPrinter, TestClassTemplateDecl2) {
|
||||
@ -951,8 +905,7 @@ TEST(DeclPrinter, TestClassTemplateDecl2) {
|
||||
"template<typename T = int>"
|
||||
"struct A { T a; };",
|
||||
classTemplateDecl(hasName("A")).bind("id"),
|
||||
"template <typename T = int> struct A {\n}"));
|
||||
// Should be: with semicolon, with { ... }
|
||||
"template <typename T = int> struct A {}"));
|
||||
}
|
||||
|
||||
TEST(DeclPrinter, TestClassTemplateDecl3) {
|
||||
@ -960,8 +913,7 @@ TEST(DeclPrinter, TestClassTemplateDecl3) {
|
||||
"template<class T>"
|
||||
"struct A { T a; };",
|
||||
classTemplateDecl(hasName("A")).bind("id"),
|
||||
"template <class T> struct A {\n}"));
|
||||
// Should be: with semicolon, with { ... }
|
||||
"template <class T> struct A {}"));
|
||||
}
|
||||
|
||||
TEST(DeclPrinter, TestClassTemplateDecl4) {
|
||||
@ -969,8 +921,7 @@ TEST(DeclPrinter, TestClassTemplateDecl4) {
|
||||
"template<typename T, typename U>"
|
||||
"struct A { T a; U b; };",
|
||||
classTemplateDecl(hasName("A")).bind("id"),
|
||||
"template <typename T, typename U> struct A {\n}"));
|
||||
// Should be: with semicolon, with { ... }
|
||||
"template <typename T, typename U> struct A {}"));
|
||||
}
|
||||
|
||||
TEST(DeclPrinter, TestClassTemplateDecl5) {
|
||||
@ -978,8 +929,7 @@ TEST(DeclPrinter, TestClassTemplateDecl5) {
|
||||
"template<int N>"
|
||||
"struct A { int a[N]; };",
|
||||
classTemplateDecl(hasName("A")).bind("id"),
|
||||
"template <int N> struct A {\n}"));
|
||||
// Should be: with semicolon, with { ... }
|
||||
"template <int N> struct A {}"));
|
||||
}
|
||||
|
||||
TEST(DeclPrinter, TestClassTemplateDecl6) {
|
||||
@ -987,8 +937,7 @@ TEST(DeclPrinter, TestClassTemplateDecl6) {
|
||||
"template<int N = 42>"
|
||||
"struct A { int a[N]; };",
|
||||
classTemplateDecl(hasName("A")).bind("id"),
|
||||
"template <int N = 42> struct A {\n}"));
|
||||
// Should be: with semicolon, with { ... }
|
||||
"template <int N = 42> struct A {}"));
|
||||
}
|
||||
|
||||
TEST(DeclPrinter, TestClassTemplateDecl7) {
|
||||
@ -997,16 +946,14 @@ TEST(DeclPrinter, TestClassTemplateDecl7) {
|
||||
"template<MyInt N>"
|
||||
"struct A { int a[N]; };",
|
||||
classTemplateDecl(hasName("A")).bind("id"),
|
||||
"template <MyInt N> struct A {\n}"));
|
||||
// Should be: with semicolon, with { ... }
|
||||
"template <MyInt N> struct A {}"));
|
||||
}
|
||||
|
||||
TEST(DeclPrinter, TestClassTemplateDecl8) {
|
||||
ASSERT_TRUE(PrintedDeclCXX98Matches(
|
||||
"template<template<typename U> class T> struct A { };",
|
||||
classTemplateDecl(hasName("A")).bind("id"),
|
||||
"template <template <typename U> class T> struct A {\n}"));
|
||||
// Should be: with semicolon, with { ... }
|
||||
"template <template <typename U> class T> struct A {}"));
|
||||
}
|
||||
|
||||
TEST(DeclPrinter, TestClassTemplateDecl9) {
|
||||
@ -1014,8 +961,7 @@ TEST(DeclPrinter, TestClassTemplateDecl9) {
|
||||
"template<typename T> struct Z { };"
|
||||
"template<template<typename U> class T = Z> struct A { };",
|
||||
classTemplateDecl(hasName("A")).bind("id"),
|
||||
"template <template <typename U> class T> struct A {\n}"));
|
||||
// Should be: with semicolon, with { ... }
|
||||
"template <template <typename U> class T> struct A {}"));
|
||||
}
|
||||
|
||||
TEST(DeclPrinter, TestClassTemplateDecl10) {
|
||||
@ -1023,8 +969,7 @@ TEST(DeclPrinter, TestClassTemplateDecl10) {
|
||||
"template<typename... T>"
|
||||
"struct A { int a; };",
|
||||
classTemplateDecl(hasName("A")).bind("id"),
|
||||
"template <typename ...T> struct A {\n}"));
|
||||
// Should be: with semicolon, with { ... }
|
||||
"template <typename ...T> struct A {}"));
|
||||
}
|
||||
|
||||
TEST(DeclPrinter, TestClassTemplateDecl11) {
|
||||
@ -1032,8 +977,7 @@ TEST(DeclPrinter, TestClassTemplateDecl11) {
|
||||
"template<typename... T>"
|
||||
"struct A : public T... { int a; };",
|
||||
classTemplateDecl(hasName("A")).bind("id"),
|
||||
"template <typename ...T> struct A : public T... {\n}"));
|
||||
// Should be: with semicolon, with { ... }
|
||||
"template <typename ...T> struct A : public T... {}"));
|
||||
}
|
||||
|
||||
TEST(DeclPrinter, TestClassTemplatePartialSpecializationDecl1) {
|
||||
@ -1043,8 +987,7 @@ TEST(DeclPrinter, TestClassTemplatePartialSpecializationDecl1) {
|
||||
"template<typename T>"
|
||||
"struct A<T, int> { T a; };",
|
||||
classTemplateSpecializationDecl().bind("id"),
|
||||
"struct A {\n}"));
|
||||
// WRONG; Should be: "template<typename T> struct A<T, int> { ... }"
|
||||
"template <typename T> struct A<T, int> {}"));
|
||||
}
|
||||
|
||||
TEST(DeclPrinter, TestClassTemplatePartialSpecializationDecl2) {
|
||||
@ -1054,7 +997,7 @@ TEST(DeclPrinter, TestClassTemplatePartialSpecializationDecl2) {
|
||||
"template<typename T>"
|
||||
"struct A<T *> { T a; };",
|
||||
classTemplateSpecializationDecl().bind("id"),
|
||||
"struct A {\n}"));
|
||||
"template <typename T> struct A<type-parameter-0-0 *> {}"));
|
||||
// WRONG; Should be: "template<typename T> struct A<T *> { ... }"
|
||||
}
|
||||
|
||||
@ -1065,8 +1008,7 @@ TEST(DeclPrinter, TestClassTemplateSpecializationDecl1) {
|
||||
"template<>"
|
||||
"struct A<int> { int a; };",
|
||||
classTemplateSpecializationDecl().bind("id"),
|
||||
"struct A {\n}"));
|
||||
// WRONG; Should be: "template<> struct A<int> { ... }"
|
||||
"template<> struct A<int> {}"));
|
||||
}
|
||||
|
||||
TEST(DeclPrinter, TestFunctionTemplateDecl1) {
|
||||
@ -1075,7 +1017,6 @@ TEST(DeclPrinter, TestFunctionTemplateDecl1) {
|
||||
"void A(T &t);",
|
||||
functionTemplateDecl(hasName("A")).bind("id"),
|
||||
"template <typename T> void A(T &t)"));
|
||||
// Should be: with semicolon
|
||||
}
|
||||
|
||||
TEST(DeclPrinter, TestFunctionTemplateDecl2) {
|
||||
@ -1084,7 +1025,6 @@ TEST(DeclPrinter, TestFunctionTemplateDecl2) {
|
||||
"void A(T &t) { }",
|
||||
functionTemplateDecl(hasName("A")).bind("id"),
|
||||
"template <typename T> void A(T &t)"));
|
||||
// Should be: with semicolon
|
||||
}
|
||||
|
||||
TEST(DeclPrinter, TestFunctionTemplateDecl3) {
|
||||
@ -1093,7 +1033,6 @@ TEST(DeclPrinter, TestFunctionTemplateDecl3) {
|
||||
"void A(T... a);",
|
||||
functionTemplateDecl(hasName("A")).bind("id"),
|
||||
"template <typename ...T> void A(T ...a)"));
|
||||
// Should be: with semicolon.
|
||||
}
|
||||
|
||||
TEST(DeclPrinter, TestFunctionTemplateDecl4) {
|
||||
@ -1101,7 +1040,6 @@ TEST(DeclPrinter, TestFunctionTemplateDecl4) {
|
||||
"struct Z { template<typename T> void A(T t); };",
|
||||
functionTemplateDecl(hasName("A")).bind("id"),
|
||||
"template <typename T> void A(T t)"));
|
||||
// Should be: with semicolon
|
||||
}
|
||||
|
||||
TEST(DeclPrinter, TestFunctionTemplateDecl5) {
|
||||
@ -1109,7 +1047,6 @@ TEST(DeclPrinter, TestFunctionTemplateDecl5) {
|
||||
"struct Z { template<typename T> void A(T t) {} };",
|
||||
functionTemplateDecl(hasName("A")).bind("id"),
|
||||
"template <typename T> void A(T t)"));
|
||||
// Should be: with semicolon
|
||||
}
|
||||
|
||||
TEST(DeclPrinter, TestFunctionTemplateDecl6) {
|
||||
@ -1119,7 +1056,6 @@ TEST(DeclPrinter, TestFunctionTemplateDecl6) {
|
||||
"};",
|
||||
functionTemplateDecl(hasName("A")).bind("id"),
|
||||
"template <typename U> void A(U t)"));
|
||||
// Should be: with semicolon
|
||||
}
|
||||
|
||||
TEST(DeclPrinter, TestTemplateArgumentList1) {
|
||||
|
Loading…
Reference in New Issue
Block a user