Normalize line endings

Some files had CRLF line terminators, some only had a mixture of
CRLF and LF.  Switch to LF.

llvm-svn: 202659
This commit is contained in:
David Majnemer 2014-03-02 18:46:05 +00:00
parent f7a07a5010
commit b100410365
14 changed files with 325 additions and 325 deletions

View File

@ -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) {

View File

@ -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<ParmVarDecl>(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<ParmVarDecl>(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);
}
}

View File

@ -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<unsigned> getStackIndexOfNearestEnclosingCaptureCapableLambda(
ArrayRef<const sema::FunctionScopeInfo *> 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<unsigned> getStackIndexOfNearestEnclosingCaptureCapableLambda(
ArrayRef<const sema::FunctionScopeInfo *> FunctionScopes,
VarDecl *VarToCapture, Sema &S);
} // clang
#endif // LLVM_CLANG_SEMA_LAMBDA_H

View File

@ -360,13 +360,13 @@ void clang::FormatASTNodeDiagnosticArgument(
NeedQuotes = false;
break;
}
case DiagnosticsEngine::ak_attr: {
const Attr *At = reinterpret_cast<Attr *>(Val);
assert(At && "Received null Attr object!");
OS << '\'' << At->getSpelling() << '\'';
NeedQuotes = false;
break;
}
case DiagnosticsEngine::ak_attr: {
const Attr *At = reinterpret_cast<Attr *>(Val);
assert(At && "Received null Attr object!");
OS << '\'' << At->getSpelling() << '\'';
NeedQuotes = false;
break;
}
}

View File

@ -950,7 +950,7 @@ namespace {
return inherited::TransformLambdaScope(E, NewCallOperator,
InitCaptureExprsAndTypes);
}
TemplateParameterList *TransformTemplateParameterList(
TemplateParameterList *TransformTemplateParameterList(
TemplateParameterList *OrigTPL) {
if (!OrigTPL || !OrigTPL->size()) return OrigTPL;

View File

@ -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;
}

View File

@ -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}}
}

View File

@ -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 <class F1, class F2> 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<decltype(Base), decltype(NumParams)> O(Base, NumParams);
int num_params = O(O, 5, 3, "abc", 3.14, 'a');
}
namespace overload_generic_lambda_return_type_deduction {
template <class F1, class F2> 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<decltype(Base), decltype(NumParams)> 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 <class F1, class F2> 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<decltype(Base), decltype(NumParams)> O(Base, NumParams);
int num_params = O(O, 5, 3, "abc", 3.14, 'a');
}
namespace overload_generic_lambda_return_type_deduction {
template <class F1, class F2> 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<decltype(Base), decltype(NumParams)> 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);
}
}

View File

@ -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 }

View File

@ -1,39 +1,39 @@
// RUN: %clang_cc1 -triple i686-pc-win32 -fms-compatibility %s -emit-llvm -o - | FileCheck %s
#include <stddef.h>
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 <stddef.h>
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*
}
}

View File

@ -1 +1 @@
// This file is purposefully left empty
// This file is purposefully left empty

View File

@ -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'}}
}
}

View File

@ -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}}

View File

@ -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<HasFoo>' requested here}}