From b100410365acb4c8c8b5a13f7ebb8b78244e9ff5 Mon Sep 17 00:00:00 2001 From: David Majnemer Date: Sun, 2 Mar 2014 18:46:05 +0000 Subject: [PATCH] Normalize line endings Some files had CRLF line terminators, some only had a mixture of CRLF and LF. Switch to LF. llvm-svn: 202659 --- clang/include/clang/Sema/ScopeInfo.h | 20 +- clang/include/clang/Sema/SemaInternal.h | 74 ++--- clang/include/clang/Sema/SemaLambda.h | 72 ++--- clang/lib/AST/ASTDiagnostic.cpp | 14 +- clang/lib/Sema/SemaTemplateInstantiate.cpp | 2 +- .../test/Analysis/NewDeleteLeaks-PR18394.cpp | 32 +-- .../expr.prim.lambda/p2-generic-lambda-1y.cpp | 50 ++-- .../expr.prim.lambda/p5-generic-lambda-1y.cpp | 262 +++++++++--------- .../microsoft-abi-alignment-fail.cpp | 4 +- clang/test/CodeGenCXX/microsoft-new.cpp | 78 +++--- clang/test/FixIt/fixit-include.h | 2 +- clang/test/SemaCXX/abstract.cpp | 20 +- clang/test/SemaCXX/cxx-altivec.cpp | 10 +- clang/test/SemaTemplate/ms-if-exists.cpp | 10 +- 14 files changed, 325 insertions(+), 325 deletions(-) diff --git a/clang/include/clang/Sema/ScopeInfo.h b/clang/include/clang/Sema/ScopeInfo.h index e2231a5983c9..98af3715bfa7 100644 --- a/clang/include/clang/Sema/ScopeInfo.h +++ b/clang/include/clang/Sema/ScopeInfo.h @@ -727,10 +727,10 @@ public: /// act of analyzing the enclosing full expression (ActOnFinishFullExpr) /// if we can determine that the full expression is not instantiation- /// dependent, then we can entirely avoid its capture. - /// - /// const int n = 0; - /// [&] (auto x) { - /// (void)+n + x; + /// + /// const int n = 0; + /// [&] (auto x) { + /// (void)+n + x; /// }; /// Interestingly, this strategy would involve a capture of n, even though /// it's obviously not odr-used here, because the full-expression is @@ -744,12 +744,12 @@ public: /// Before anyone is tempted to implement a strategy for not-capturing 'n', /// consider the insightful warning in: /// /cfe-commits/Week-of-Mon-20131104/092596.html - /// "The problem is that the set of captures for a lambda is part of the ABI - /// (since lambda layout can be made visible through inline functions and the - /// like), and there are no guarantees as to which cases we'll manage to build - /// an lvalue-to-rvalue conversion in, when parsing a template -- some - /// seemingly harmless change elsewhere in Sema could cause us to start or stop - /// building such a node. So we need a rule that anyone can implement and get + /// "The problem is that the set of captures for a lambda is part of the ABI + /// (since lambda layout can be made visible through inline functions and the + /// like), and there are no guarantees as to which cases we'll manage to build + /// an lvalue-to-rvalue conversion in, when parsing a template -- some + /// seemingly harmless change elsewhere in Sema could cause us to start or stop + /// building such a node. So we need a rule that anyone can implement and get /// exactly the same result". /// void markVariableExprAsNonODRUsed(Expr *CapturingVarExpr) { diff --git a/clang/include/clang/Sema/SemaInternal.h b/clang/include/clang/Sema/SemaInternal.h index 01d4cc9679ef..0b3d32b25ca5 100644 --- a/clang/include/clang/Sema/SemaInternal.h +++ b/clang/include/clang/Sema/SemaInternal.h @@ -24,43 +24,43 @@ namespace clang { inline PartialDiagnostic Sema::PDiag(unsigned DiagID) { return PartialDiagnostic(DiagID, Context.getDiagAllocator()); } - - -// This requires the variable to be non-dependent and the initializer -// to not be value dependent. -inline bool IsVariableAConstantExpression(VarDecl *Var, ASTContext &Context) { - const VarDecl *DefVD = 0; - return !isa(Var) && - Var->isUsableInConstantExpressions(Context) && - Var->getAnyInitializer(DefVD) && DefVD->checkInitIsICE(); -} - -// Directly mark a variable odr-used. Given a choice, prefer to use -// MarkVariableReferenced since it does additional checks and then -// calls MarkVarDeclODRUsed. -// If the variable must be captured: -// - if FunctionScopeIndexToStopAt is null, capture it in the CurContext -// - else capture it in the DeclContext that maps to the -// *FunctionScopeIndexToStopAt on the FunctionScopeInfo stack. -inline void MarkVarDeclODRUsed(VarDecl *Var, - SourceLocation Loc, Sema &SemaRef, - const unsigned *const FunctionScopeIndexToStopAt) { - // Keep track of used but undefined variables. - // FIXME: We shouldn't suppress this warning for static data members. - if (Var->hasDefinition(SemaRef.Context) == VarDecl::DeclarationOnly && - !Var->isExternallyVisible() && - !(Var->isStaticDataMember() && Var->hasInit())) { - SourceLocation &old = SemaRef.UndefinedButUsed[Var->getCanonicalDecl()]; - if (old.isInvalid()) old = Loc; - } - QualType CaptureType, DeclRefType; - SemaRef.tryCaptureVariable(Var, Loc, Sema::TryCapture_Implicit, - /*EllipsisLoc*/ SourceLocation(), - /*BuildAndDiagnose*/ true, - CaptureType, DeclRefType, - FunctionScopeIndexToStopAt); - - Var->markUsed(SemaRef.Context); + + +// This requires the variable to be non-dependent and the initializer +// to not be value dependent. +inline bool IsVariableAConstantExpression(VarDecl *Var, ASTContext &Context) { + const VarDecl *DefVD = 0; + return !isa(Var) && + Var->isUsableInConstantExpressions(Context) && + Var->getAnyInitializer(DefVD) && DefVD->checkInitIsICE(); +} + +// Directly mark a variable odr-used. Given a choice, prefer to use +// MarkVariableReferenced since it does additional checks and then +// calls MarkVarDeclODRUsed. +// If the variable must be captured: +// - if FunctionScopeIndexToStopAt is null, capture it in the CurContext +// - else capture it in the DeclContext that maps to the +// *FunctionScopeIndexToStopAt on the FunctionScopeInfo stack. +inline void MarkVarDeclODRUsed(VarDecl *Var, + SourceLocation Loc, Sema &SemaRef, + const unsigned *const FunctionScopeIndexToStopAt) { + // Keep track of used but undefined variables. + // FIXME: We shouldn't suppress this warning for static data members. + if (Var->hasDefinition(SemaRef.Context) == VarDecl::DeclarationOnly && + !Var->isExternallyVisible() && + !(Var->isStaticDataMember() && Var->hasInit())) { + SourceLocation &old = SemaRef.UndefinedButUsed[Var->getCanonicalDecl()]; + if (old.isInvalid()) old = Loc; + } + QualType CaptureType, DeclRefType; + SemaRef.tryCaptureVariable(Var, Loc, Sema::TryCapture_Implicit, + /*EllipsisLoc*/ SourceLocation(), + /*BuildAndDiagnose*/ true, + CaptureType, DeclRefType, + FunctionScopeIndexToStopAt); + + Var->markUsed(SemaRef.Context); } } diff --git a/clang/include/clang/Sema/SemaLambda.h b/clang/include/clang/Sema/SemaLambda.h index df0a14913376..f6367505f866 100644 --- a/clang/include/clang/Sema/SemaLambda.h +++ b/clang/include/clang/Sema/SemaLambda.h @@ -1,36 +1,36 @@ -//===--- SemaLambda.h - Lambda Helper Functions --------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -/// -/// \file -/// \brief This file provides some common utility functions for processing -/// Lambdas. -/// -//===----------------------------------------------------------------------===// - -#ifndef LLVM_CLANG_SEMA_LAMBDA_H -#define LLVM_CLANG_SEMA_LAMBDA_H -#include "clang/AST/ASTLambda.h" -#include "clang/Sema/ScopeInfo.h" -namespace clang { - - -/// \brief Examines the FunctionScopeInfo stack to determine the nearest -/// enclosing lambda (to the current lambda) that is 'capture-capable' for -/// the variable referenced in the current lambda (i.e. \p VarToCapture). -/// If successful, returns the index into Sema's FunctionScopeInfo stack -/// of the capture-capable lambda's LambdaScopeInfo. -/// See Implementation for more detailed comments. - -Optional getStackIndexOfNearestEnclosingCaptureCapableLambda( - ArrayRef FunctionScopes, - VarDecl *VarToCapture, Sema &S); - -} // clang - -#endif // LLVM_CLANG_SEMA_LAMBDA_H +//===--- SemaLambda.h - Lambda Helper Functions --------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +/// +/// \file +/// \brief This file provides some common utility functions for processing +/// Lambdas. +/// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_CLANG_SEMA_LAMBDA_H +#define LLVM_CLANG_SEMA_LAMBDA_H +#include "clang/AST/ASTLambda.h" +#include "clang/Sema/ScopeInfo.h" +namespace clang { + + +/// \brief Examines the FunctionScopeInfo stack to determine the nearest +/// enclosing lambda (to the current lambda) that is 'capture-capable' for +/// the variable referenced in the current lambda (i.e. \p VarToCapture). +/// If successful, returns the index into Sema's FunctionScopeInfo stack +/// of the capture-capable lambda's LambdaScopeInfo. +/// See Implementation for more detailed comments. + +Optional getStackIndexOfNearestEnclosingCaptureCapableLambda( + ArrayRef FunctionScopes, + VarDecl *VarToCapture, Sema &S); + +} // clang + +#endif // LLVM_CLANG_SEMA_LAMBDA_H diff --git a/clang/lib/AST/ASTDiagnostic.cpp b/clang/lib/AST/ASTDiagnostic.cpp index f3c2b224e1df..7c6bec4503f3 100644 --- a/clang/lib/AST/ASTDiagnostic.cpp +++ b/clang/lib/AST/ASTDiagnostic.cpp @@ -360,13 +360,13 @@ void clang::FormatASTNodeDiagnosticArgument( NeedQuotes = false; break; } - case DiagnosticsEngine::ak_attr: { - const Attr *At = reinterpret_cast(Val); - assert(At && "Received null Attr object!"); - OS << '\'' << At->getSpelling() << '\''; - NeedQuotes = false; - break; - } + case DiagnosticsEngine::ak_attr: { + const Attr *At = reinterpret_cast(Val); + assert(At && "Received null Attr object!"); + OS << '\'' << At->getSpelling() << '\''; + NeedQuotes = false; + break; + } } diff --git a/clang/lib/Sema/SemaTemplateInstantiate.cpp b/clang/lib/Sema/SemaTemplateInstantiate.cpp index 20f3a1adb685..0fdf48ba74c4 100644 --- a/clang/lib/Sema/SemaTemplateInstantiate.cpp +++ b/clang/lib/Sema/SemaTemplateInstantiate.cpp @@ -950,7 +950,7 @@ namespace { return inherited::TransformLambdaScope(E, NewCallOperator, InitCaptureExprsAndTypes); } - TemplateParameterList *TransformTemplateParameterList( + TemplateParameterList *TransformTemplateParameterList( TemplateParameterList *OrigTPL) { if (!OrigTPL || !OrigTPL->size()) return OrigTPL; diff --git a/clang/test/Analysis/NewDeleteLeaks-PR18394.cpp b/clang/test/Analysis/NewDeleteLeaks-PR18394.cpp index 452781d07a5b..dfd94561628f 100644 --- a/clang/test/Analysis/NewDeleteLeaks-PR18394.cpp +++ b/clang/test/Analysis/NewDeleteLeaks-PR18394.cpp @@ -1,16 +1,16 @@ -// RUN: %clang_cc1 -analyzer-config graph-trim-interval=1 -analyzer-max-loop 1 -analyze -analyzer-checker=core,alpha.cplusplus.NewDeleteLeaks -verify %s -// expected-no-diagnostics - -class A { -public: - void f() {}; - ~A() { - for (int i=0; i<3; i++) - f(); - } -}; - -void error() { - A *a = new A(); - delete a; -} +// RUN: %clang_cc1 -analyzer-config graph-trim-interval=1 -analyzer-max-loop 1 -analyze -analyzer-checker=core,alpha.cplusplus.NewDeleteLeaks -verify %s +// expected-no-diagnostics + +class A { +public: + void f() {}; + ~A() { + for (int i=0; i<3; i++) + f(); + } +}; + +void error() { + A *a = new A(); + delete a; +} diff --git a/clang/test/CXX/expr/expr.prim/expr.prim.lambda/p2-generic-lambda-1y.cpp b/clang/test/CXX/expr/expr.prim/expr.prim.lambda/p2-generic-lambda-1y.cpp index d41c4507a850..03147a692dd5 100644 --- a/clang/test/CXX/expr/expr.prim/expr.prim.lambda/p2-generic-lambda-1y.cpp +++ b/clang/test/CXX/expr/expr.prim/expr.prim.lambda/p2-generic-lambda-1y.cpp @@ -1,25 +1,25 @@ -// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++1y -DCXX1Y - -// prvalue -void prvalue() { - auto&& x = [](auto a)->void { }; - auto& y = [](auto *a)->void { }; // expected-error{{cannot bind to a temporary of type}} -} - -namespace std { - class type_info; -} - -struct P { - virtual ~P(); -}; - -void unevaluated_operand(P &p, int i) { //expected-note{{declared here}} - // FIXME: this should only emit one error. - int i2 = sizeof([](auto a, auto b)->void{}(3, '4')); // expected-error{{lambda expression in an unevaluated operand}} \ - // expected-error{{invalid application of 'sizeof'}} - const std::type_info &ti1 = typeid([](auto &a) -> P& { static P p; return p; }(i)); - const std::type_info &ti2 = typeid([](auto) -> int { return i; }(i)); // expected-error{{lambda expression in an unevaluated operand}}\ - // expected-error{{cannot be implicitly captured}}\ - // expected-note{{begins here}} -} +// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++1y -DCXX1Y + +// prvalue +void prvalue() { + auto&& x = [](auto a)->void { }; + auto& y = [](auto *a)->void { }; // expected-error{{cannot bind to a temporary of type}} +} + +namespace std { + class type_info; +} + +struct P { + virtual ~P(); +}; + +void unevaluated_operand(P &p, int i) { //expected-note{{declared here}} + // FIXME: this should only emit one error. + int i2 = sizeof([](auto a, auto b)->void{}(3, '4')); // expected-error{{lambda expression in an unevaluated operand}} \ + // expected-error{{invalid application of 'sizeof'}} + const std::type_info &ti1 = typeid([](auto &a) -> P& { static P p; return p; }(i)); + const std::type_info &ti2 = typeid([](auto) -> int { return i; }(i)); // expected-error{{lambda expression in an unevaluated operand}}\ + // expected-error{{cannot be implicitly captured}}\ + // expected-note{{begins here}} +} diff --git a/clang/test/CXX/expr/expr.prim/expr.prim.lambda/p5-generic-lambda-1y.cpp b/clang/test/CXX/expr/expr.prim/expr.prim.lambda/p5-generic-lambda-1y.cpp index c5d3bf6d1bcf..415c3d84560e 100644 --- a/clang/test/CXX/expr/expr.prim/expr.prim.lambda/p5-generic-lambda-1y.cpp +++ b/clang/test/CXX/expr/expr.prim/expr.prim.lambda/p5-generic-lambda-1y.cpp @@ -1,131 +1,131 @@ -// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++1y -DCXX1Y - -namespace test_factorial { - -auto Fact = [](auto Self, unsigned n) -> unsigned { - return !n ? 1 : Self(Self, n - 1) * n; -}; - -auto six = Fact(Fact, 3); - -} - -namespace overload_generic_lambda { - template struct overload : F1, F2 { - using F1::operator(); - using F2::operator(); - overload(F1 f1, F2 f2) : F1(f1), F2(f2) { } - }; - - auto NumParams = [](auto Self, auto h, auto ... rest) -> unsigned { - return 1 + Self(Self, rest...); - }; - auto Base = [](auto Self, auto h) -> unsigned { - return 1; - }; - overload O(Base, NumParams); - int num_params = O(O, 5, 3, "abc", 3.14, 'a'); -} - - -namespace overload_generic_lambda_return_type_deduction { - template struct overload : F1, F2 { - using F1::operator(); - using F2::operator(); - overload(F1 f1, F2 f2) : F1(f1), F2(f2) { } - }; - - auto NumParams = [](auto Self, auto h, auto ... rest) { - return 1 + Self(Self, rest...); - }; - auto Base = [](auto Self, auto h) { - return 1; - }; - overload O(Base, NumParams); - int num_params = O(O, 5, 3, "abc", 3.14, 'a'); -} - -namespace test_standard_p5 { -// FIXME: This test should eventually compile without an explicit trailing return type -auto glambda = [](auto a, auto&& b) ->bool { return a < b; }; -bool b = glambda(3, 3.14); // OK - -} -namespace test_deduction_failure { - int test() { - auto g = [](auto *a) { //expected-note{{candidate template ignored}} - return a; - }; - struct X { }; - X *x; - g(x); - g(3); //expected-error{{no matching function}} - return 0; - } - -} - -namespace test_instantiation_or_sfinae_failure { -int test2() { - { - auto L = [](auto *a) { - return (*a)(a); }; //expected-error{{called object type 'double' is not a function}} - double d; - L(&d); //expected-note{{in instantiation of}} - auto M = [](auto b) { return b; }; - L(&M); // ok - } - { - auto L = [](auto *a) ->decltype (a->foo()) { //expected-note2{{candidate template ignored:}} - return (*a)(a); }; - double d; - L(&d); //expected-error{{no matching function for call}} - auto M = [](auto b) { return b; }; - L(&M); //expected-error{{no matching function for call}} - - } - return 0; -} - - -} - -namespace test_misc { -auto GL = [](auto a, decltype(a) b) //expected-note{{candidate function}} - -> int { return a + b; }; - -void test() { - struct X { }; - GL(3, X{}); //expected-error{{no matching function}} -} - -void test2() { - auto l = [](auto *a) -> int { - (*a)(a); return 0; }; //expected-error{{called object type 'double' is not a function}} - l(&l); - double d; - l(&d); //expected-note{{in instantiation of}} -} - -} - -namespace nested_lambdas { - int test() { - auto L = [](auto a) { - return [=](auto b) { - return a + b; - }; - }; - } - auto get_lambda() { - return [](auto a) { - return a; - }; - }; - - int test2() { - auto L = get_lambda(); - L(3); - } -} - +// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++1y -DCXX1Y + +namespace test_factorial { + +auto Fact = [](auto Self, unsigned n) -> unsigned { + return !n ? 1 : Self(Self, n - 1) * n; +}; + +auto six = Fact(Fact, 3); + +} + +namespace overload_generic_lambda { + template struct overload : F1, F2 { + using F1::operator(); + using F2::operator(); + overload(F1 f1, F2 f2) : F1(f1), F2(f2) { } + }; + + auto NumParams = [](auto Self, auto h, auto ... rest) -> unsigned { + return 1 + Self(Self, rest...); + }; + auto Base = [](auto Self, auto h) -> unsigned { + return 1; + }; + overload O(Base, NumParams); + int num_params = O(O, 5, 3, "abc", 3.14, 'a'); +} + + +namespace overload_generic_lambda_return_type_deduction { + template struct overload : F1, F2 { + using F1::operator(); + using F2::operator(); + overload(F1 f1, F2 f2) : F1(f1), F2(f2) { } + }; + + auto NumParams = [](auto Self, auto h, auto ... rest) { + return 1 + Self(Self, rest...); + }; + auto Base = [](auto Self, auto h) { + return 1; + }; + overload O(Base, NumParams); + int num_params = O(O, 5, 3, "abc", 3.14, 'a'); +} + +namespace test_standard_p5 { +// FIXME: This test should eventually compile without an explicit trailing return type +auto glambda = [](auto a, auto&& b) ->bool { return a < b; }; +bool b = glambda(3, 3.14); // OK + +} +namespace test_deduction_failure { + int test() { + auto g = [](auto *a) { //expected-note{{candidate template ignored}} + return a; + }; + struct X { }; + X *x; + g(x); + g(3); //expected-error{{no matching function}} + return 0; + } + +} + +namespace test_instantiation_or_sfinae_failure { +int test2() { + { + auto L = [](auto *a) { + return (*a)(a); }; //expected-error{{called object type 'double' is not a function}} + double d; + L(&d); //expected-note{{in instantiation of}} + auto M = [](auto b) { return b; }; + L(&M); // ok + } + { + auto L = [](auto *a) ->decltype (a->foo()) { //expected-note2{{candidate template ignored:}} + return (*a)(a); }; + double d; + L(&d); //expected-error{{no matching function for call}} + auto M = [](auto b) { return b; }; + L(&M); //expected-error{{no matching function for call}} + + } + return 0; +} + + +} + +namespace test_misc { +auto GL = [](auto a, decltype(a) b) //expected-note{{candidate function}} + -> int { return a + b; }; + +void test() { + struct X { }; + GL(3, X{}); //expected-error{{no matching function}} +} + +void test2() { + auto l = [](auto *a) -> int { + (*a)(a); return 0; }; //expected-error{{called object type 'double' is not a function}} + l(&l); + double d; + l(&d); //expected-note{{in instantiation of}} +} + +} + +namespace nested_lambdas { + int test() { + auto L = [](auto a) { + return [=](auto b) { + return a + b; + }; + }; + } + auto get_lambda() { + return [](auto a) { + return a; + }; + }; + + int test2() { + auto L = get_lambda(); + L(3); + } +} + diff --git a/clang/test/CodeGenCXX/microsoft-abi-alignment-fail.cpp b/clang/test/CodeGenCXX/microsoft-abi-alignment-fail.cpp index 92bc0fcac2ec..c8477f4cbdd3 100644 --- a/clang/test/CodeGenCXX/microsoft-abi-alignment-fail.cpp +++ b/clang/test/CodeGenCXX/microsoft-abi-alignment-fail.cpp @@ -6,5 +6,5 @@ struct A : virtual B {} a; // The <> indicate that the pointer is packed, which is required to support // microsoft layout in 32 bit mode, but not 64 bit mode. -// CHECK: %struct.A = type <{ i32*, %struct.B }> -// CHECK-X64: %struct.A = type { i32*, %struct.B } +// CHECK: %struct.A = type <{ i32*, %struct.B }> +// CHECK-X64: %struct.A = type { i32*, %struct.B } diff --git a/clang/test/CodeGenCXX/microsoft-new.cpp b/clang/test/CodeGenCXX/microsoft-new.cpp index 4c3d72e9f4c7..7857e478ef82 100644 --- a/clang/test/CodeGenCXX/microsoft-new.cpp +++ b/clang/test/CodeGenCXX/microsoft-new.cpp @@ -1,39 +1,39 @@ -// RUN: %clang_cc1 -triple i686-pc-win32 -fms-compatibility %s -emit-llvm -o - | FileCheck %s - -#include - -struct arbitrary_t {} arbitrary; -void *operator new(size_t size, arbitrary_t); - -struct arbitrary2_t {} arbitrary2; -void *operator new[](size_t size, arbitrary2_t); - -namespace PR13164 { - void f() { - // MSVC will fall back on the non-array operator new. - void *a; - int *p = new(arbitrary) int[4]; - // CHECK: call i8* @"\01??2@YAPAXIUarbitrary_t@@@Z"(i32 16, %struct.arbitrary_t* - } - - struct S { - void *operator new[](size_t size, arbitrary_t); - }; - - void g() { - S *s = new(arbitrary) S[2]; - // CHECK: call i8* @"\01??_US@PR13164@@SAPAXIUarbitrary_t@@@Z"(i32 2, %struct.arbitrary_t* - S *s1 = new(arbitrary) S; - // CHECK: call i8* @"\01??2@YAPAXIUarbitrary_t@@@Z"(i32 1, %struct.arbitrary_t* - } - - struct T { - void *operator new(size_t size, arbitrary2_t); - }; - - void h() { - // This should still call the global operator new[]. - T *t = new(arbitrary2) T[2]; - // CHECK: call i8* @"\01??_U@YAPAXIUarbitrary2_t@@@Z"(i32 2, %struct.arbitrary2_t* - } -} +// RUN: %clang_cc1 -triple i686-pc-win32 -fms-compatibility %s -emit-llvm -o - | FileCheck %s + +#include + +struct arbitrary_t {} arbitrary; +void *operator new(size_t size, arbitrary_t); + +struct arbitrary2_t {} arbitrary2; +void *operator new[](size_t size, arbitrary2_t); + +namespace PR13164 { + void f() { + // MSVC will fall back on the non-array operator new. + void *a; + int *p = new(arbitrary) int[4]; + // CHECK: call i8* @"\01??2@YAPAXIUarbitrary_t@@@Z"(i32 16, %struct.arbitrary_t* + } + + struct S { + void *operator new[](size_t size, arbitrary_t); + }; + + void g() { + S *s = new(arbitrary) S[2]; + // CHECK: call i8* @"\01??_US@PR13164@@SAPAXIUarbitrary_t@@@Z"(i32 2, %struct.arbitrary_t* + S *s1 = new(arbitrary) S; + // CHECK: call i8* @"\01??2@YAPAXIUarbitrary_t@@@Z"(i32 1, %struct.arbitrary_t* + } + + struct T { + void *operator new(size_t size, arbitrary2_t); + }; + + void h() { + // This should still call the global operator new[]. + T *t = new(arbitrary2) T[2]; + // CHECK: call i8* @"\01??_U@YAPAXIUarbitrary2_t@@@Z"(i32 2, %struct.arbitrary2_t* + } +} diff --git a/clang/test/FixIt/fixit-include.h b/clang/test/FixIt/fixit-include.h index 6a22d2e88eb3..358609b4066d 100644 --- a/clang/test/FixIt/fixit-include.h +++ b/clang/test/FixIt/fixit-include.h @@ -1 +1 @@ -// This file is purposefully left empty +// This file is purposefully left empty diff --git a/clang/test/SemaCXX/abstract.cpp b/clang/test/SemaCXX/abstract.cpp index d7e2d0a3dcf9..b521196c23b6 100644 --- a/clang/test/SemaCXX/abstract.cpp +++ b/clang/test/SemaCXX/abstract.cpp @@ -268,16 +268,16 @@ namespace pr9247 { } namespace pr12658 { - class C { - public: - C(int v){} - virtual void f() = 0; // expected-note {{unimplemented pure virtual method 'f' in 'C'}} - }; - - void foo( C& c ) {} - - void bar( void ) { - foo(C(99)); // expected-error {{allocating an object of abstract class type 'pr12658::C'}} + class C { + public: + C(int v){} + virtual void f() = 0; // expected-note {{unimplemented pure virtual method 'f' in 'C'}} + }; + + void foo( C& c ) {} + + void bar( void ) { + foo(C(99)); // expected-error {{allocating an object of abstract class type 'pr12658::C'}} } } diff --git a/clang/test/SemaCXX/cxx-altivec.cpp b/clang/test/SemaCXX/cxx-altivec.cpp index 15b5d0d315e8..baacbac7d036 100644 --- a/clang/test/SemaCXX/cxx-altivec.cpp +++ b/clang/test/SemaCXX/cxx-altivec.cpp @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -triple=powerpc-apple-darwin8 -faltivec -fsyntax-only -verify %s - -struct Vector { - __vector float xyzw; -} __attribute__((vecreturn)) __attribute__((vecreturn)); // expected-error {{'vecreturn' attribute cannot be repeated}} +// RUN: %clang_cc1 -triple=powerpc-apple-darwin8 -faltivec -fsyntax-only -verify %s + +struct Vector { + __vector float xyzw; +} __attribute__((vecreturn)) __attribute__((vecreturn)); // expected-error {{'vecreturn' attribute cannot be repeated}} diff --git a/clang/test/SemaTemplate/ms-if-exists.cpp b/clang/test/SemaTemplate/ms-if-exists.cpp index 04f4a6362361..9b95bba5068a 100644 --- a/clang/test/SemaTemplate/ms-if-exists.cpp +++ b/clang/test/SemaTemplate/ms-if-exists.cpp @@ -48,11 +48,11 @@ void f(T t) { { } } - int array2[] = { - 0, - __if_exists(T::bar) {2, }// expected-warning{{dependent __if_exists declarations are ignored}} - 3 - }; + int array2[] = { + 0, + __if_exists(T::bar) {2, }// expected-warning{{dependent __if_exists declarations are ignored}} + 3 + }; } template void f(HasFoo); // expected-note{{in instantiation of function template specialization 'f' requested here}}