Skip to content

Commit

Permalink
Merged master:e951a489962 into amd-gfx:e67cd8b6bf1
Browse files Browse the repository at this point in the history
Local branch amd-gfx e67cd8b Merged master:472d282046d into amd-gfx:56d934d52a0
Remote branch master e951a48 Add freeze(and x, const) case to codegenprepare's freeze-cmp.ll
  • Loading branch information
Sw authored and Sw committed Mar 25, 2020
2 parents e67cd8b + e951a48 commit 7fbfb2b
Show file tree
Hide file tree
Showing 104 changed files with 11,209 additions and 5,861 deletions.
4 changes: 3 additions & 1 deletion clang-tools-extra/clangd/unittests/CodeCompleteTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1195,7 +1195,9 @@ TEST(SignatureHelpTest, OpeningParen) {
int foo(int a, int b, int c);
int main() {
#define ID(X) X
ID(foo $p^( foo(10), ^ ))
// FIXME: figure out why ID(foo (foo(10), )) doesn't work when preserving
// the recovery expression.
ID(foo $p^( 10, ^ ))
})cpp"};

for (auto Test : Tests) {
Expand Down
2 changes: 1 addition & 1 deletion clang/include/clang/Basic/LangOptions.def
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ LANGOPT(RelaxedTemplateTemplateArgs, 1, 0, "C++17 relaxed matching of template t

LANGOPT(DoubleSquareBracketAttributes, 1, 0, "'[[]]' attributes extension for all language standard modes")

COMPATIBLE_LANGOPT(RecoveryAST, 1, 0, "Preserve expressions in AST when encountering errors")
COMPATIBLE_LANGOPT(RecoveryAST, 1, CPlusPlus, "Preserve expressions in AST when encountering errors")

BENIGN_LANGOPT(ThreadsafeStatics , 1, 1, "thread-safe static initializers")
LANGOPT(POSIXThreads , 1, 0, "POSIX thread support")
Expand Down
17 changes: 7 additions & 10 deletions clang/lib/CodeGen/CGDecl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1050,13 +1050,13 @@ static llvm::Constant *constWithPadding(CodeGenModule &CGM, IsPattern isPattern,
llvm::Type *OrigTy = constant->getType();
if (const auto STy = dyn_cast<llvm::StructType>(OrigTy))
return constStructWithPadding(CGM, isPattern, STy, constant);
if (auto *STy = dyn_cast<llvm::SequentialType>(OrigTy)) {
if (auto *ArrayTy = dyn_cast<llvm::ArrayType>(OrigTy)) {
llvm::SmallVector<llvm::Constant *, 8> Values;
unsigned Size = STy->getNumElements();
uint64_t Size = ArrayTy->getNumElements();
if (!Size)
return constant;
llvm::Type *ElemTy = STy->getElementType();
bool ZeroInitializer = constant->isZeroValue();
llvm::Type *ElemTy = ArrayTy->getElementType();
bool ZeroInitializer = constant->isNullValue();
llvm::Constant *OpValue, *PaddedOp;
if (ZeroInitializer) {
OpValue = llvm::Constant::getNullValue(ElemTy);
Expand All @@ -1072,13 +1072,10 @@ static llvm::Constant *constWithPadding(CodeGenModule &CGM, IsPattern isPattern,
auto *NewElemTy = Values[0]->getType();
if (NewElemTy == ElemTy)
return constant;
if (OrigTy->isArrayTy()) {
auto *ArrayTy = llvm::ArrayType::get(NewElemTy, Size);
return llvm::ConstantArray::get(ArrayTy, Values);
} else {
return llvm::ConstantVector::get(Values);
}
auto *NewArrayTy = llvm::ArrayType::get(NewElemTy, Size);
return llvm::ConstantArray::get(NewArrayTy, Values);
}
// FIXME: Do we need to handle tail padding in vectors?
return constant;
}

Expand Down
2 changes: 1 addition & 1 deletion clang/lib/Frontend/CompilerInvocation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2909,7 +2909,7 @@ static void ParseLangArgs(LangOptions &Opts, ArgList &Args, InputKind IK,
if (Args.hasArg(OPT_fconcepts_ts))
Diags.Report(diag::warn_fe_concepts_ts_flag);
Opts.RecoveryAST =
Args.hasFlag(OPT_frecovery_ast, OPT_fno_recovery_ast, false);
Args.hasFlag(OPT_frecovery_ast, OPT_fno_recovery_ast, Opts.CPlusPlus);
Opts.HeinousExtensions = Args.hasArg(OPT_fheinous_gnu_extensions);
Opts.AccessControl = !Args.hasArg(OPT_fno_access_control);
Opts.ElideConstructors = !Args.hasArg(OPT_fno_elide_constructors);
Expand Down
4 changes: 2 additions & 2 deletions clang/lib/Sema/SemaExpr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18437,8 +18437,8 @@ bool Sema::IsDependentFunctionNameExpr(Expr *E) {

ExprResult Sema::CreateRecoveryExpr(SourceLocation Begin, SourceLocation End,
ArrayRef<Expr *> SubExprs) {
// FIXME: enable it for C++, RecoveryExpr is type-dependent to suppress
// bogus diagnostics and this trick does not work in C.
// RecoveryExpr is type-dependent to suppress bogus diagnostics and this trick
// does not work in C.
// FIXME: use containsErrors() to suppress unwanted diags in C.
if (!Context.getLangOpts().RecoveryAST)
return ExprError();
Expand Down
19 changes: 19 additions & 0 deletions clang/test/CodeGenCXX/auto-var-init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1610,5 +1610,24 @@ TEST_CUSTOM(doublevec32, double __attribute__((vector_size(32))), { 3.141592653
// CHECK-NEXT: store <4 x double> <double 0x400921FB54442D18, double 0x400921FB54442D18, double 0x400921FB54442D18, double 0x400921FB54442D18>, <4 x double>* %custom, align [[ALIGN]]
// CHECK-NEXT: call void @{{.*}}used{{.*}}%custom)

// TODO: This vector has tail padding
TEST_UNINIT(doublevec24, double __attribute__((vector_size(24))));
// CHECK-LABEL: @test_doublevec24_uninit()
// CHECK: %uninit = alloca <3 x double>, align
// CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
// PATTERN-LABEL: @test_doublevec24_uninit()
// PATTERN: store <3 x double> <double 0xFFFFFFFFFFFFFFFF, double 0xFFFFFFFFFFFFFFFF, double 0xFFFFFFFFFFFFFFFF>, <3 x double>* %uninit, align 32
// ZERO-LABEL: @test_doublevec24_uninit()
// ZERO: store <3 x double> zeroinitializer, <3 x double>* %uninit, align 32

// TODO: This vector has tail padding
TEST_UNINIT(longdoublevec32, long double __attribute__((vector_size(sizeof(long double)*2))));
// CHECK-LABEL: @test_longdoublevec32_uninit()
// CHECK: %uninit = alloca <2 x x86_fp80>, align
// CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
// PATTERN-LABEL: @test_longdoublevec32_uninit()
// PATTERN: store <2 x x86_fp80> <x86_fp80 0xKFFFFFFFFFFFFFFFFFFFF, x86_fp80 0xKFFFFFFFFFFFFFFFFFFFF>, <2 x x86_fp80>* %uninit, align 32
// ZERO-LABEL: @test_longdoublevec32_uninit()
// ZERO: store <2 x x86_fp80> zeroinitializer, <2 x x86_fp80>* %uninit, align 32

} // extern "C"
3 changes: 3 additions & 0 deletions clang/test/Driver/save-temps.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// REQUIRES: x86-registered-target
// REQUIRES: arm-registered-target

// RUN: %clang -target x86_64-apple-darwin -save-temps -arch x86_64 %s -### 2>&1 \
// RUN: | FileCheck %s
// CHECK: "-o" "save-temps.i"
Expand Down
6 changes: 3 additions & 3 deletions clang/test/OpenMP/target_update_from_messages.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ struct S8 {
#pragma omp target update from(*(this->S->i+this->S->s6[0].pp)) // le45-error {{expected expression containing only member accesses and/or array sections based on named variables}} le45-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}}
#pragma omp target update from(*(a+this->ptr)) // le45-error {{expected expression containing only member accesses and/or array sections based on named variables}} le45-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}}
#pragma omp target update from(*(*(this->ptr)+a+this->ptr)) // le45-error {{expected expression containing only member accesses and/or array sections based on named variables}} le45-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}}
#pragma omp target update from(*(this+this)) // expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}} expected-error {{invalid operands to binary expression ('S8 *' and 'S8 *')}}
#pragma omp target update from(*(this+this)) // expected-error {{invalid operands to binary expression ('S8 *' and 'S8 *')}}
}
};

Expand Down Expand Up @@ -198,8 +198,8 @@ int main(int argc, char **argv) {
#pragma omp target update from(**(-(*offset)+BB+*m)) // le45-error {{expected expression containing only member accesses and/or array sections based on named variables}} le45-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}}
#pragma omp target update from(**(*(*(&offset))+BB-*m)) // le45-error {{expected expression containing only member accesses and/or array sections based on named variables}} le45-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}}
#pragma omp target update from(*(x+*(y+*(**BB+BBB)+s7.i))) // le45-error {{expected expression containing only member accesses and/or array sections based on named variables}} le45-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}}
#pragma omp target update from(*(m+(m))) // expected-error {{invalid operands to binary expression ('int *' and 'int *')}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}}
#pragma omp target update from(*(1+y+y)) // expected-error {{indirection requires pointer operand ('int' invalid)}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}}
#pragma omp target update from(*(m+(m))) // expected-error {{invalid operands to binary expression ('int *' and 'int *')}}
#pragma omp target update from(*(1+y+y)) // expected-error {{indirection requires pointer operand ('int' invalid)}}
#pragma omp target data map(to: s7.i)
{
#pragma omp target update from(s7.x)
Expand Down
6 changes: 3 additions & 3 deletions clang/test/OpenMP/target_update_to_messages.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ struct S8 {
#pragma omp target update to(*(this->S->i+this->S->s6[0].pp)) // le45-error {{expected expression containing only member accesses and/or array sections based on named variables}} le45-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}}
#pragma omp target update to(*(a+this->ptr)) // le45-error {{expected expression containing only member accesses and/or array sections based on named variables}} le45-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}}
#pragma omp target update to(*(*(this->ptr)+a+this->ptr)) // le45-error {{expected expression containing only member accesses and/or array sections based on named variables}} le45-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}}
#pragma omp target update to(*(this+this)) // expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}} expected-error {{invalid operands to binary expression ('S8 *' and 'S8 *')}}
#pragma omp target update to(*(this+this)) // expected-error {{invalid operands to binary expression ('S8 *' and 'S8 *')}}
{}
}
};
Expand Down Expand Up @@ -205,8 +205,8 @@ int main(int argc, char **argv) {
#pragma omp target update to(**(*offset+BB+*m)) // le45-error {{expected expression containing only member accesses and/or array sections based on named variables}} le45-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}}
#pragma omp target update to(**(*(*(&offset))+BB+*m)) // le45-error {{expected expression containing only member accesses and/or array sections based on named variables}} le45-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}}
#pragma omp target update to(*(x+*(y+*(**BB+BBB)+s7.i))) // le45-error {{expected expression containing only member accesses and/or array sections based on named variables}} le45-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}}
#pragma omp target update to(*(m+(m))) // expected-error {{invalid operands to binary expression ('int *' and 'int *')}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}}
#pragma omp target update to(*(1+y+y)) // expected-error {{indirection requires pointer operand ('int' invalid)}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}}
#pragma omp target update to(*(m+(m))) // expected-error {{invalid operands to binary expression ('int *' and 'int *')}}
#pragma omp target update to(*(1+y+y)) // expected-error {{indirection requires pointer operand ('int' invalid)}}
{}
return tmain<int, 3>(argc)+tmain<from, 4>(argc); // expected-note {{in instantiation of function template specialization 'tmain<int, 3>' requested here}} expected-note {{in instantiation of function template specialization 'tmain<int, 4>' requested here}}
}
Expand Down
6 changes: 4 additions & 2 deletions clang/test/Parser/objcxx0x-lambda-expressions.mm
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ void f() {

[]; // expected-error {{expected body of lambda expression}}
[=,foo+] {}; // expected-error {{expected ',' or ']' in lambda capture list}}
[&this] {}; // expected-error {{cannot take the address of an rvalue of type 'C *'}}
[&this] {}; // expected-error {{cannot take the address of an rvalue of type 'C *'}} \
// expected-error {{expected identifier}}
[] {};
[=] (int i) {};
[&] (int) mutable -> void {};
Expand All @@ -24,7 +25,8 @@ void f() {
[foo{bar}] () {};
[foo = {bar}] () {}; // expected-error {{<initializer_list>}}

[foo(bar) baz] () {}; // expected-error {{called object type 'int' is not a function}}
[foo(bar) baz] () {}; // expected-error {{called object type 'int' is not a function}} \
// expected-error {{expected ';'}}
[foo(bar), baz] () {}; // ok

[foo = bar baz]; // expected-warning {{receiver type 'int'}} expected-warning {{instance method '-baz'}}
Expand Down
9 changes: 5 additions & 4 deletions clang/test/Parser/objcxx11-invalid-lambda.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
// RUN: %clang_cc1 -fsyntax-only -verify -x objective-c++ -std=c++11 %s

void foo() { // expected-note {{to match this '{'}}
void foo() {
int bar;
auto baz = [
bar( // expected-note {{to match this '('}} expected-note {{to match this '('}}
bar( // expected-note 2{{to match this '('}}\
// expected-warning {{captures are a C++14 extension}}
foo_undeclared() // expected-error{{use of undeclared identifier 'foo_undeclared'}}
/* ) */
] () { }; // expected-error{{expected ')'}}
} // expected-error{{expected ')'}} expected-error {{expected ',' or ']'}} expected-error{{expected ';' at end of declaration}} expected-error{{expected '}'}}
] () { }; // expected-error 2{{expected ')'}}
}
4 changes: 2 additions & 2 deletions clang/test/SemaCXX/builtins.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ template<int (*Compare)(const char *s1, const char *s2)>
int equal(const char *s1, const char *s2) {
return Compare(s1, s2) == 0;
}
// FIXME: Our error recovery here sucks
template int equal<&__builtin_strcmp>(const char*, const char*); // expected-error {{builtin functions must be directly called}} expected-error {{expected unqualified-id}} expected-error {{expected ')'}} expected-note {{to match this '('}}

template int equal<&__builtin_strcmp>(const char*, const char*); // expected-error {{builtin functions must be directly called}}

// PR13195
void f2() {
Expand Down
2 changes: 1 addition & 1 deletion clang/test/SemaCXX/cast-conversion.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %clang_cc1 -fsyntax-only -triple x86_64-unknown-unknown -verify %s -std=c++11
// RUN: %clang_cc1 -fsyntax-only -triple x86_64-unknown-unknown -verify %s -std=c++11 -Wno-unused

struct R {
R(int);
Expand Down
8 changes: 5 additions & 3 deletions clang/test/SemaCXX/cxx1z-copy-omission.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %clang_cc1 -std=c++1z -verify %s
// RUN: %clang_cc1 -std=c++1z -verify -Wno-unused %s

struct Noncopyable {
Noncopyable();
Expand Down Expand Up @@ -107,8 +107,10 @@ void test_expressions(bool b) {
sizeof(make_indestructible()); // expected-error {{deleted}}
sizeof(make_incomplete()); // expected-error {{incomplete}}
typeid(Indestructible{}); // expected-error {{deleted}}
typeid(make_indestructible()); // expected-error {{deleted}}
typeid(make_incomplete()); // expected-error {{incomplete}}
typeid(make_indestructible()); // expected-error {{deleted}} \
// expected-error {{need to include <typeinfo>}}
typeid(make_incomplete()); // expected-error {{incomplete}} \
// expected-error {{need to include <typeinfo>}}

// FIXME: The first two cases here are now also valid in C++17 onwards.
using I = decltype(Indestructible()); // expected-error {{deleted}}
Expand Down
5 changes: 4 additions & 1 deletion clang/test/SemaCXX/decltype-crash.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,8 @@
int& a();

void f() {
decltype(a()) c; // expected-warning {{'decltype' is a keyword in C++11}} expected-error {{use of undeclared identifier 'decltype'}}
decltype(a()) c; // expected-warning {{'decltype' is a keyword in C++11}} \
// expected-error {{use of undeclared identifier 'decltype'}} \
// expected-error {{expected ';' after expression}} \
// expected-error {{use of undeclared identifier 'c'}}
}
3 changes: 2 additions & 1 deletion clang/test/SemaCXX/varargs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ void no_params(...) {
// default ctor.
void record_context(int a, ...) {
struct Foo {
// expected-error@+1 {{'va_start' cannot be used outside a function}}
// expected-error@+2 {{'va_start' cannot be used outside a function}}
// expected-error@+1 {{default argument references parameter 'a'}}
void meth(int a, int b = (__builtin_va_start(ap, a), 0)) {}
};
}
Expand Down
2 changes: 1 addition & 1 deletion clang/test/SemaOpenCLCXX/address-space-references.cl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ int bar(const __global unsigned int &i); // expected-note{{passing argument to p
int bar(const unsigned int &i);

void foo() {
bar(1) // expected-error{{binding reference of type 'const __global unsigned int' to value of type 'int' changes address space}}
bar(1); // expected-error{{binding reference of type 'const __global unsigned int' to value of type 'int' changes address space}}
}

// Test addr space conversion with nested pointers
Expand Down
2 changes: 1 addition & 1 deletion clang/test/SemaTemplate/instantiate-init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ namespace PR7985 {
integral_c<1> ic1 = array_lengthof(Description<int>::data);
(void)sizeof(array_lengthof(Description<float>::data));

sizeof(array_lengthof( // expected-error{{no matching function for call to 'array_lengthof'}}
(void)sizeof(array_lengthof( // expected-error{{no matching function for call to 'array_lengthof'}}
Description<int*>::data // expected-note{{in instantiation of static data member 'PR7985::Description<int *>::data' requested here}}
));

Expand Down
3 changes: 2 additions & 1 deletion clang/unittests/Sema/CodeCompleteTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -487,6 +487,7 @@ TEST(PreferredTypeTest, NoCrashOnInvalidTypes) {
auto x = decltype(&1)(^);
auto y = new decltype(&1)(^);
)cpp";
EXPECT_THAT(collectPreferredTypes(Code), Each("NULL TYPE"));
EXPECT_THAT(collectPreferredTypes(Code),
Each("decltype(<recovery-expr>(1))"));
}
} // namespace
Loading

0 comments on commit 7fbfb2b

Please sign in to comment.