diff options
Diffstat (limited to 'test')
139 files changed, 4394 insertions, 297 deletions
| diff --git a/test/Analysis/misc-ps-eager-assume.m b/test/Analysis/misc-ps-eager-assume.m index 818922eba925..db1a80b8efd9 100644 --- a/test/Analysis/misc-ps-eager-assume.m +++ b/test/Analysis/misc-ps-eager-assume.m @@ -77,3 +77,46 @@ void pr3836(int *a, int *b) {    *a = 1; // no-warning    *b = 1; // no-warning  } + + +//===---------------------------------------------------------------------===// +// <rdar://problem/7342806> +// This false positive occured because the symbolic constraint on a short was +// not maintained via sign extension.  The analyzer doesn't properly handle +// the sign extension, but now tracks the constraint.  This particular +// case relies on -analyzer-eagerly-assume because of the expression +// 'Flag1 != Count > 0'. +//===---------------------------------------------------------------------===// + +void rdar7342806_aux(short x); + +void rdar7342806() { +  extern short Count; +  extern short Flag1; + +  short *Pointer = 0; +  short  Flag2   = !!Pointer;   // Flag2 is false (0). +  short  Ok      = 1; +  short  Which; + +  if( Flag1 != Count > 0 ) +    // Static analyzer skips this so either +    //   Flag1 is true and Count > 0 +    // or +    //   Flag1 is false and Count <= 0 +    Ok = 0; + +  if( Flag1 != Flag2 ) +    // Analyzer skips this so Flag1 and Flag2 have the +    // same value, both are false because Flag2 is false. And +    // from that we know Count must be <= 0. +    Ok = 0; + +  for( Which = 0; +         Which < Count && Ok; +           Which++ ) +    // This statement can only execute if Count > 0 which can only +    // happen when Flag1 and Flag2 are both true and Flag2 will only +    // be true when Pointer is not NULL. +    rdar7342806_aux(*Pointer); // no-warning +} diff --git a/test/Analysis/misc-ps-region-store.m b/test/Analysis/misc-ps-region-store.m index b6fff102a701..4cde7726b49b 100644 --- a/test/Analysis/misc-ps-region-store.m +++ b/test/Analysis/misc-ps-region-store.m @@ -372,3 +372,62 @@ void doSomething_7312221_with_struct(struct rdar_7312221_container *Self) {    }  } +//===----------------------------------------------------------------------===// +// <rdar://problem/7332673> - Just more tests cases for regions +//===----------------------------------------------------------------------===// + +void rdar_7332673_test1() { +    char value[1]; +    if ( *(value) != 1 ) {} // expected-warning{{The left operand of '!=' is a garbage value}} +} +void rdar_rdar_7332673_test2_aux(char *x); +void rdar_7332673_test2() { +    char *value; +    if ( rdar_7332673_test2_aux(value) != 1 ) {} // expected-warning{{Pass-by-value argument in function call is undefined}} +} + +//===----------------------------------------------------------------------===// +// <rdar://problem/7347252>: Because of a bug in +//   RegionStoreManager::RemoveDeadBindings(), the symbol for s->session->p +//   would incorrectly be pruned from the state after the call to +//   rdar7347252_malloc1(), and would incorrectly result in a warning about +//   passing a null pointer to rdar7347252_memcpy(). +//===----------------------------------------------------------------------===// + +struct rdar7347252_AA { char *p;}; +typedef struct { + struct rdar7347252_AA *session; + int t; + char *q; +} rdar7347252_SSL1; + +int rdar7347252_f(rdar7347252_SSL1 *s); +char *rdar7347252_malloc1(int); +char *rdar7347252_memcpy1(char *d, char *s, int n) __attribute__((nonnull (1,2))); + +int rdar7347252(rdar7347252_SSL1 *s) { + rdar7347252_f(s);  // the SymbolicRegion of 's' is set a default binding of conjured symbol + if (s->session->p == ((void*)0)) { +   if ((s->session->p = rdar7347252_malloc1(10)) == ((void*)0)) { +     return 0; +   } +   rdar7347252_memcpy1(s->session->p, "aa", 2); // no-warning + } + return 0; +} + +//===----------------------------------------------------------------------===// +// PR 5316 - "crash when accessing field of lazy compound value" +//  Previously this caused a crash at the MemberExpr '.chr' when loading +//  a field value from a LazyCompoundVal +//===----------------------------------------------------------------------===// + +typedef unsigned int pr5316_wint_t; +typedef pr5316_wint_t pr5316_REFRESH_CHAR; +typedef struct { +  pr5316_REFRESH_CHAR chr; +} +pr5316_REFRESH_ELEMENT; +static void pr5316(pr5316_REFRESH_ELEMENT *dst, const pr5316_REFRESH_ELEMENT *src) { +  while ((*dst++ = *src++).chr != L'\0')  ; +} diff --git a/test/Analysis/misc-ps.m b/test/Analysis/misc-ps.m index fcc13a39a461..947b41ae794c 100644 --- a/test/Analysis/misc-ps.m +++ b/test/Analysis/misc-ps.m @@ -121,12 +121,12 @@ void check_zero_sized_VLA(int x) {    if (x)      return; -  int vla[x]; // expected-warning{{Variable-length array 'vla' has zero elements (undefined behavior)}} +  int vla[x]; // expected-warning{{Declare variable-length array (VLA) of zero size}}  }  void check_uninit_sized_VLA() {    int x; -  int vla[x]; // expected-warning{{Variable-length array 'vla' garbage value for array size}} +  int vla[x]; // expected-warning{{Declare variable-length array (VLA) of undefined size}}  }  // sizeof(void) @@ -154,6 +154,12 @@ void handle_sizeof_void(unsigned flag) {    *p = 1; // no-warning  } +// check deference of undefined values +void check_deref_undef(void) { +  int *p; +  *p = 0xDEADBEEF; // expected-warning{{Dereference of undefined pointer value}} +} +  // PR 3422  void pr3422_helper(char *p);  void pr3422() { diff --git a/test/Analysis/outofbound.c b/test/Analysis/outofbound.c index 568f14329e9b..e676ea3b3889 100644 --- a/test/Analysis/outofbound.c +++ b/test/Analysis/outofbound.c @@ -1,5 +1,5 @@  // RUN: clang-cc -analyze -checker-cfref -analyzer-store=region -verify %s -// XFAIL +// XFAIL: *  char f1() {    char* s = "abcd"; diff --git a/test/Analysis/retain-release-gc-only.m b/test/Analysis/retain-release-gc-only.m index 2833b02f0771..e27cfe758aaf 100644 --- a/test/Analysis/retain-release-gc-only.m +++ b/test/Analysis/retain-release-gc-only.m @@ -92,6 +92,7 @@ typedef struct _NSZone NSZone;  + (id)allocWithZone:(NSZone *)zone;  + (id)alloc;  - (void)dealloc; +- (void)release;  @end  @interface NSObject (NSCoderMethods)  - (id)awakeAfterUsingCoder:(NSCoder *)aDecoder; @@ -322,6 +323,16 @@ void rdar_7174400(QCView *view, QCRenderer *renderer, CIContext *context,  }  //===----------------------------------------------------------------------===// +// <rdar://problem/6250216> Warn against using -[NSAutoreleasePool release] in  +//  GC mode +//===----------------------------------------------------------------------===// + +void rdar_6250216(void) { +    NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; +    [pool release]; // expected-warning{{Use -drain instead of -release when using NSAutoreleasePool and garbage collection}} +} + +//===----------------------------------------------------------------------===//  // Tests of ownership attributes.  //===----------------------------------------------------------------------===// diff --git a/test/Analysis/retain-release.m b/test/Analysis/retain-release.m index e620037b2c14..879e8a0413b4 100644 --- a/test/Analysis/retain-release.m +++ b/test/Analysis/retain-release.m @@ -1098,6 +1098,32 @@ CVReturn rdar_7283567_2(CFAllocatorRef allocator, size_t width, size_t height,  }  //===----------------------------------------------------------------------===// +// <rdar://problem/7358899> False leak associated with  +//  CGBitmapContextCreateWithData +//===----------------------------------------------------------------------===// +typedef uint32_t CGBitmapInfo; +typedef void (*CGBitmapContextReleaseDataCallback)(void *releaseInfo, void *data); +     +CGContextRef CGBitmapContextCreateWithData(void *data, +    size_t width, size_t height, size_t bitsPerComponent, +    size_t bytesPerRow, CGColorSpaceRef space, CGBitmapInfo bitmapInfo, +    CGBitmapContextReleaseDataCallback releaseCallback, void *releaseInfo); + +void rdar_7358899(void *data, +      size_t width, size_t height, size_t bitsPerComponent, +      size_t bytesPerRow, CGColorSpaceRef space, CGBitmapInfo bitmapInfo, +      CGBitmapContextReleaseDataCallback releaseCallback) { + +    // For the allocated object, it doesn't really matter what type it is +    // for the purpose of this test.  All we want to show is that +    // this is freed later by the callback. +    NSNumber *number = [[NSNumber alloc] initWithInt:5]; // no-warning + +  CGBitmapContextCreateWithData(data, width, height, bitsPerComponent, // expected-warning{{leak}} +    bytesPerRow, space, bitmapInfo, releaseCallback, number); +} + +//===----------------------------------------------------------------------===//  // <rdar://problem/7265711> allow 'new', 'copy', 'alloc', 'init' prefix to  //  start before '_' when determining Cocoa fundamental rule  // diff --git a/test/Analysis/uninit-vals-ps-region.c b/test/Analysis/uninit-vals-ps-region.c index 1561f11c9937..e927a92576e2 100644 --- a/test/Analysis/uninit-vals-ps-region.c +++ b/test/Analysis/uninit-vals-ps-region.c @@ -24,9 +24,20 @@ void test_uninit_pos() {    struct TestUninit v1 = { 0, 0 };    struct TestUninit v2 = test_uninit_aux();    int z; -  v1.y = z; -  test_unit_aux2(v2.x + v1.y);  // expected-warning{{The right operand of '+' is a garbage value}} +  v1.y = z; // expected-warning{{Assigned value is garbage or undefined}} +  test_unit_aux2(v2.x + v1.y);  } +void test_uninit_pos_2() { +  struct TestUninit v1 = { 0, 0 }; +  struct TestUninit v2; +  test_unit_aux2(v2.x + v1.y);  // expected-warning{{The left operand of '+' is a garbage value}} +} +void test_uninit_pos_3() { +  struct TestUninit v1 = { 0, 0 }; +  struct TestUninit v2; +  test_unit_aux2(v1.y + v2.x);  // expected-warning{{The right operand of '+' is a garbage value}} +} +  void test_uninit_neg() {    struct TestUninit v1 = { 0, 0 };    struct TestUninit v2 = test_uninit_aux(); diff --git a/test/Analysis/unused-ivars.m b/test/Analysis/unused-ivars.m index aacd44e7e677..9e9360da50c6 100644 --- a/test/Analysis/unused-ivars.m +++ b/test/Analysis/unused-ivars.m @@ -43,3 +43,25 @@    b();  }  @end + +//===----------------------------------------------------------------------===// +// <rdar://problem/6260004> Detect that ivar is in use, if used in category  +//  in the same file as the implementation +//===----------------------------------------------------------------------===// + +@protocol Protocol6260004 +- (id) getId; +@end + +@interface RDar6260004 { +@private +  id x; // no-warning +} +@end +@implementation RDar6260004 @end +@implementation RDar6260004 (Protocol6260004) +- (id) getId { +  return x; +} +@end + diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 66f05bff6994..a83a1993c8f0 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -24,6 +24,7 @@ set(CLANG_TEST_DIRECTORIES  include(FindPythonInterp)  if(PYTHONINTERP_FOUND) +  get_target_triple(TARGET_TRIPLE)    get_target_property(LLVM_TOOLS_PATH clang RUNTIME_OUTPUT_DIRECTORY)    get_target_property(LLVM_LIBS_PATH clang LIBRARY_OUTPUT_DIRECTORY)    set(CLANG_TEST_EXTRA_ARGS) @@ -32,16 +33,17 @@ if(PYTHONINTERP_FOUND)    endif()    foreach(testdir ${CLANG_TEST_DIRECTORIES}) -    add_custom_target(clang-test-${testdir}  +    add_custom_target(clang-test-${testdir}        COMMAND sed -e "s#\@LLVM_SOURCE_DIR\@#${LLVM_MAIN_SRC_DIR}#"                    -e "s#\@LLVM_BINARY_DIR\@#${LLVM_BINARY_DIR}#"                    -e "s#\@LLVM_TOOLS_DIR\@#${LLVM_TOOLS_PATH}/${CMAKE_CFG_INTDIR}#"                    -e "s#\@LLVM_LIBS_DIR\@#${LLVM_LIBS_PATH}/${CMAKE_CFG_INTDIR}#"                    -e "s#\@CLANG_SOURCE_DIR\@#${CMAKE_CURRENT_SOURCE_DIR}/..#"                    -e "s#\@CLANG_BINARY_DIR\@#${CMAKE_CURRENT_BINARY_DIR}/..#" +                  -e "s#\@TARGET_TRIPLE\@#${TARGET_TRIPLE}#"                    ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in >                    ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg -      COMMAND ${PYTHON_EXECUTABLE}  +      COMMAND ${PYTHON_EXECUTABLE}                    ${LLVM_SOURCE_DIR}/utils/lit/lit.py                    -sv ${CLANG_TEST_EXTRA_ARGS}                    ${CMAKE_CURRENT_BINARY_DIR}/${testdir} @@ -56,9 +58,10 @@ if(PYTHONINTERP_FOUND)                  -e "s#\@LLVM_LIBS_DIR\@#${LLVM_LIBS_PATH}/${CMAKE_CFG_INTDIR}#"                  -e "s#\@CLANG_SOURCE_DIR\@#${CMAKE_CURRENT_SOURCE_DIR}/..#"                  -e "s#\@CLANG_BINARY_DIR\@#${CMAKE_CURRENT_BINARY_DIR}/..#" +                -e "s#\@TARGET_TRIPLE\@#${TARGET_TRIPLE}#"                  ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in >                  ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg -    COMMAND ${PYTHON_EXECUTABLE}  +    COMMAND ${PYTHON_EXECUTABLE}                  ${LLVM_SOURCE_DIR}/utils/lit/lit.py                  -sv ${CLANG_TEST_EXTRA_ARGS}                  ${CMAKE_CURRENT_BINARY_DIR} @@ -72,12 +75,13 @@ if(PYTHONINTERP_FOUND)                  -e "s#\@LLVM_LIBS_DIR\@#${LLVM_LIBS_PATH}/${CMAKE_CFG_INTDIR}#"                  -e "s#\@CLANG_SOURCE_DIR\@#${CMAKE_CURRENT_SOURCE_DIR}/..#"                  -e "s#\@CLANG_BINARY_DIR\@#${CMAKE_CURRENT_BINARY_DIR}/..#" +                -e "s#\@TARGET_TRIPLE\@#${TARGET_TRIPLE}#"                  ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in >                  ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg -    COMMAND ${PYTHON_EXECUTABLE}  +    COMMAND ${PYTHON_EXECUTABLE}                  ${LLVM_SOURCE_DIR}/utils/lit/lit.py                  -sv ${CLANG_TEST_EXTRA_ARGS}                  ${CMAKE_CURRENT_SOURCE_DIR}/../utils/C++Tests                  DEPENDS clang clang-cc index-test c-index-test                  COMMENT "Running Clang regression tests") -endif()   +endif() diff --git a/test/CXX/basic/basic.lookup/basic.lookup.unqual/p14.cpp b/test/CXX/basic/basic.lookup/basic.lookup.unqual/p14.cpp index b9b136c5061b..141a5732c1d3 100644 --- a/test/CXX/basic/basic.lookup/basic.lookup.unqual/p14.cpp +++ b/test/CXX/basic/basic.lookup/basic.lookup.unqual/p14.cpp @@ -1,5 +1,5 @@  // RUN: clang-cc -fsyntax-only -verify %s -// XFAIL +// XFAIL: *  namespace N {     struct S {}; diff --git a/test/CXX/basic/basic.lookup/basic.lookup.unqual/p15.cpp b/test/CXX/basic/basic.lookup/basic.lookup.unqual/p15.cpp index 9572aaa14273..cebc3e99d09f 100644 --- a/test/CXX/basic/basic.lookup/basic.lookup.unqual/p15.cpp +++ b/test/CXX/basic/basic.lookup/basic.lookup.unqual/p15.cpp @@ -1,5 +1,5 @@  // RUN: clang-cc -fsyntax-only -verify %s -// XFAIL +// XFAIL: *  class C {  public: diff --git a/test/CXX/class/class.union/p1.cpp b/test/CXX/class/class.union/p1.cpp index 15c263467367..9c969c5b7552 100644 --- a/test/CXX/class/class.union/p1.cpp +++ b/test/CXX/class/class.union/p1.cpp @@ -16,6 +16,9 @@ class VirtualBase : virtual Okay { // expected-note 3 {{because type 'class Virt  class Ctor {    Ctor() { abort(); } // expected-note 3 {{because type 'class Ctor' has a user-declared constructor}}  }; +class Ctor2 { +  Ctor2(); // expected-note 3 {{because type 'class Ctor2' has a user-declared constructor}} +};  class CopyCtor {    CopyCtor(CopyCtor &cc) { abort(); } // expected-note 3 {{because type 'class CopyCtor' has a user-declared copy constructor}} @@ -34,6 +37,7 @@ union U1 {    Virtual v; // expected-error {{union member 'v' has a non-trivial copy constructor}}    VirtualBase vbase; // expected-error {{union member 'vbase' has a non-trivial copy constructor}}    Ctor ctor; // expected-error {{union member 'ctor' has a non-trivial constructor}} +  Ctor2 ctor2; // expected-error {{union member 'ctor2' has a non-trivial constructor}}    CopyCtor copyctor; // expected-error {{union member 'copyctor' has a non-trivial copy constructor}}    CopyAssign copyassign; // expected-error {{union member 'copyassign' has a non-trivial copy assignment operator}}    Dtor dtor; // expected-error {{union member 'dtor' has a non-trivial destructor}} @@ -51,6 +55,9 @@ union U2 {      Ctor ctor; // expected-note {{because type 'struct U2::<anonymous>' has a member with a non-trivial constructor}}    } m3; // expected-error {{union member 'm3' has a non-trivial constructor}}    struct { +    Ctor2 ctor2; // expected-note {{because type 'struct U2::<anonymous>' has a member with a non-trivial constructor}} +  } m3a; // expected-error {{union member 'm3a' has a non-trivial constructor}} +  struct {      CopyCtor copyctor; // expected-note {{because type 'struct U2::<anonymous>' has a member with a non-trivial copy constructor}}    } m4; // expected-error {{union member 'm4' has a non-trivial copy constructor}}    struct { @@ -71,6 +78,8 @@ union U3 {    } m2; // expected-error {{union member 'm2' has a non-trivial copy constructor}}    struct s3 : Ctor { // expected-note {{because type 'struct U3::s3' has a base class with a non-trivial constructor}}    } m3; // expected-error {{union member 'm3' has a non-trivial constructor}} +  struct s3a : Ctor2 { // expected-note {{because type 'struct U3::s3a' has a base class with a non-trivial constructor}} +  } m3a; // expected-error {{union member 'm3a' has a non-trivial constructor}}    struct s4 : CopyCtor { // expected-note {{because type 'struct U3::s4' has a base class with a non-trivial copy constructor}}    } m4; // expected-error {{union member 'm4' has a non-trivial copy constructor}}    struct s5 : CopyAssign { // expected-note {{because type 'struct U3::s5' has a base class with a non-trivial copy assignment operator}} diff --git a/test/CXX/dcl.dcl/dcl.spec/dcl.fct.spec/p3.cpp b/test/CXX/dcl.dcl/dcl.spec/dcl.fct.spec/p3.cpp index 3b0e345f0172..dabe13a0ff66 100644 --- a/test/CXX/dcl.dcl/dcl.spec/dcl.fct.spec/p3.cpp +++ b/test/CXX/dcl.dcl/dcl.spec/dcl.fct.spec/p3.cpp @@ -1,5 +1,5 @@  // RUN: clang-cc -verify %s -// XFAIL +// XFAIL: *  void f0(void) {    inline void f1(); // expected-error {{'inline' is not allowed on block scope function declaration}} diff --git a/test/CXX/dcl.dcl/dcl.spec/dcl.fct.spec/p4.cpp b/test/CXX/dcl.dcl/dcl.spec/dcl.fct.spec/p4.cpp index 0142dcbb055c..7dc65c77d4a9 100644 --- a/test/CXX/dcl.dcl/dcl.spec/dcl.fct.spec/p4.cpp +++ b/test/CXX/dcl.dcl/dcl.spec/dcl.fct.spec/p4.cpp @@ -1,5 +1,5 @@  // RUN: clang-cc -verify %s -// XFAIL +// XFAIL: *  void f0() {  } diff --git a/test/CXX/dcl.dcl/dcl.spec/dcl.fct.spec/p6.cpp b/test/CXX/dcl.dcl/dcl.spec/dcl.fct.spec/p6.cpp index c5f0a51b22e5..7a1ba3e389ba 100644 --- a/test/CXX/dcl.dcl/dcl.spec/dcl.fct.spec/p6.cpp +++ b/test/CXX/dcl.dcl/dcl.spec/dcl.fct.spec/p6.cpp @@ -1,5 +1,5 @@  // RUN: clang-cc -verify %s -// XFAIL +// XFAIL: *  class A {  public: diff --git a/test/CXX/dcl.dcl/dcl.spec/dcl.stc/p10.cpp b/test/CXX/dcl.dcl/dcl.spec/dcl.stc/p10.cpp index 62ae7bfded14..d1251490ac1a 100644 --- a/test/CXX/dcl.dcl/dcl.spec/dcl.stc/p10.cpp +++ b/test/CXX/dcl.dcl/dcl.spec/dcl.stc/p10.cpp @@ -1,5 +1,5 @@  // RUN: clang-cc -verify %s -// XFAIL +// XFAIL: *  typedef const int T0;  typedef int& T1; diff --git a/test/CXX/dcl.dcl/dcl.spec/dcl.typedef/p4.cpp b/test/CXX/dcl.dcl/dcl.spec/dcl.typedef/p4.cpp index f1413f9b41b8..69e843796ff7 100644 --- a/test/CXX/dcl.dcl/dcl.spec/dcl.typedef/p4.cpp +++ b/test/CXX/dcl.dcl/dcl.spec/dcl.typedef/p4.cpp @@ -1,5 +1,5 @@  // RUN: clang-cc -verify %s -// XFAIL +// XFAIL: *  struct S {    typedef struct A {} A; // expected-note {{previous definition is here}} diff --git a/test/CXX/dcl.decl/dcl.meaning/dcl.ref/p5.cpp b/test/CXX/dcl.decl/dcl.meaning/dcl.ref/p5.cpp new file mode 100644 index 000000000000..98e1d302a717 --- /dev/null +++ b/test/CXX/dcl.decl/dcl.meaning/dcl.ref/p5.cpp @@ -0,0 +1,145 @@ +// RUN: clang-cc -fsyntax-only -verify %s + +// C++ [dcl.ref]p5: +//   There shall be no references to references, no arrays of +//   references, and no pointers to references. + +// The crazy formatting in here is to enforce the exact report locations. + +typedef int &intref; +typedef intref &intrefref; + +template <class T> class RefMem { +  T +    & +      member; +}; + +struct RefRef { +  int +      & +        &             // expected-error {{declared as a reference to a reference}} +          refref0; + +  intref +         & +           refref1; // collapses + +  intrefref +            & +              refref2; // collapses + +  RefMem +        < +         int +            & +             > +               refref3; // collapses +}; + + +template <class T> class PtrMem { +  T +    *                   // expected-error {{declared as a pointer to a reference}} +      member; +}; + +struct RefPtr { +  typedef +          int +              & +                *       // expected-error {{declared as a pointer to a reference}} +                  intrefptr; + +  typedef +          intref +                 *      // expected-error {{declared as a pointer to a reference}} +                   intrefptr2; + +  int +      & +        *               // expected-error {{declared as a pointer to a reference}} +          refptr0; + +  intref +         *              // expected-error {{declared as a pointer to a reference}} +           refptr1; + +  PtrMem +        < +         int +            & +             > +               refptr2; // expected-note {{in instantiation}} +}; + +template <class T> class ArrMem { +  T +    member +           [ // expected-error {{declared as array of references}} +            10 +              ]; +}; +template <class T, unsigned N> class DepArrMem { +  T +    member +           [ // expected-error {{declared as array of references}} +            N +             ]; +}; + +struct RefArr { +  typedef  +          int +              & +                intrefarr +                         [ // expected-error {{declared as array of references}} +                          2 +                           ]; + +  typedef +          intref +                 intrefarr +                          [ // expected-error {{declared as array of references}} +                           2 +                            ]; + +  int +      & +        refarr0 +               [ // expected-error {{declared as array of references}} +                2 +                 ]; +  intref +         refarr1 +                [ // expected-error {{declared as array of references}} +                 2 +                  ]; +  ArrMem +        < +         int +            & +             > +               refarr2; // expected-note {{in instantiation}} +  DepArrMem +           < +            int +               &, +                  10 +                    > +                      refarr3; // expected-note {{in instantiation}} +}; + + +//   The declaration of a reference shall contain an initializer +//   (8.5.3) except when the declaration contains an explicit extern +//   specifier (7.1.1), is a class member (9.2) declaration within a +//   class definition, or is the declaration of a parameter or a +//   return type (8.3.5); see 3.1. A reference shall be initialized to +//   refer to a valid object or function. [ Note: in particular, a +//   null reference cannot exist in a well-defined program, because +//   the only way to create such a reference would be to bind it to +//   the "object" obtained by dereferencing a null pointer, which +//   causes undefined behavior. As described in 9.6, a reference +//   cannot be bound directly to a bit-field. + diff --git a/test/CXX/temp/temp.decls/temp.class.spec/p6.cpp b/test/CXX/temp/temp.decls/temp.class.spec/p6.cpp index afe6ab2b968e..79d6c54e29f0 100644 --- a/test/CXX/temp/temp.decls/temp.class.spec/p6.cpp +++ b/test/CXX/temp/temp.decls/temp.class.spec/p6.cpp @@ -1,5 +1,6 @@  // RUN: clang-cc -fsyntax-only -verify %s +// Test class template partial specializations of member templates.  template<typename T>  struct X0 {    template<typename U> struct Inner0 { @@ -16,5 +17,39 @@ struct X0<T>::Inner0<const U*> {    static const unsigned value = 2;  }; -// FIXME: Test instantiation of these partial specializations (once they are -// implemented). +int array0[X0<int>::Inner0<int>::value == 0? 1 : -1]; +int array1[X0<int>::Inner0<int*>::value == 1? 1 : -1]; +int array2[X0<int>::Inner0<const int*>::value == 2? 1 : -1]; + +// Make sure we can provide out-of-line class template partial specializations +// for member templates (and instantiate them). +template<class T> struct A {  +  struct C { +    template<class T2> struct B; +  }; +}; + +// partial specialization of A<T>::C::B<T2>  +template<class T> template<class T2> struct A<T>::C::B<T2*> { };  + +A<short>::C::B<int*> absip; + +// Check for conflicts during template instantiation.  +template<typename T, typename U> +struct Outer { +  template<typename X, typename Y> struct Inner; +  template<typename Y> struct Inner<T, Y> {}; // expected-note{{previous}} +  template<typename Y> struct Inner<U, Y> {}; // expected-error{{cannot be redeclared}} +}; + +Outer<int, int> outer; // expected-note{{instantiation}} + +// Test specialization of class template partial specialization members. +template<> template<typename Z> +struct X0<float>::Inner0<Z*> { +  static const unsigned value = 3; +}; + +int array3[X0<float>::Inner0<int>::value == 0? 1 : -1]; +int array4[X0<float>::Inner0<int*>::value == 3? 1 : -1]; +int array5[X0<float>::Inner0<const int*>::value == 2? 1 : -1]; diff --git a/test/CXX/temp/temp.decls/temp.friend/p5.cpp b/test/CXX/temp/temp.decls/temp.friend/p5.cpp index f1142a4129b2..74895c490623 100644 --- a/test/CXX/temp/temp.decls/temp.friend/p5.cpp +++ b/test/CXX/temp/temp.decls/temp.friend/p5.cpp @@ -9,3 +9,5 @@ class B {    template <class T> friend class A<T>::Member;  }; +A<int> a; +B b; diff --git a/test/CXX/temp/temp.param/p14.cpp b/test/CXX/temp/temp.param/p14.cpp index 07e6bfe40983..150e0ad636be 100644 --- a/test/CXX/temp/temp.param/p14.cpp +++ b/test/CXX/temp/temp.param/p14.cpp @@ -1,5 +1,5 @@  // RUN: clang-cc -fsyntax-only -verify %s  -// XFAIL +// XFAIL: *  // A template-parameter shall not be used in its own default argument.  template<typename T = typename T::type> struct X; // expected-error{{default}} diff --git a/test/CXX/temp/temp.res/temp.dep.res/temp.point/p1.cpp b/test/CXX/temp/temp.res/temp.dep.res/temp.point/p1.cpp index 650501069cc5..a41b46ff5c9b 100644 --- a/test/CXX/temp/temp.res/temp.dep.res/temp.point/p1.cpp +++ b/test/CXX/temp/temp.res/temp.dep.res/temp.point/p1.cpp @@ -1,5 +1,5 @@  // RUN: clang-cc -fsyntax-only -verify %s -// XFAIL +// XFAIL: *  // Note: we fail this test because we perform template instantiation  // at the end of the translation unit, so argument-dependent lookup diff --git a/test/CXX/temp/temp.spec/temp.expl.spec/p3.cpp b/test/CXX/temp/temp.spec/temp.expl.spec/p3.cpp index 2bd1400faefb..33fb93bacfaf 100644 --- a/test/CXX/temp/temp.spec/temp.expl.spec/p3.cpp +++ b/test/CXX/temp/temp.spec/temp.expl.spec/p3.cpp @@ -4,8 +4,7 @@ namespace N {    template<class T> class X;  } -// FIXME: this diagnostic is terrible (PR3844). -template<> class X<int> { /* ... */ };	// expected-error {{unqualified-id}} +template<> class X<int> { /* ... */ };	// expected-error {{non-template class 'X'}}  namespace N { diff --git a/test/CXX/temp/temp.spec/temp.explicit/p10.cpp b/test/CXX/temp/temp.spec/temp.explicit/p10.cpp new file mode 100644 index 000000000000..900b0b309277 --- /dev/null +++ b/test/CXX/temp/temp.spec/temp.explicit/p10.cpp @@ -0,0 +1,33 @@ +// RUN: clang-cc -fsyntax-only -verify %s + +template<typename T> +struct X0 { +  void f(T&); +   +  struct Inner; +   +  static T static_var; +}; + +template<typename T> +void X0<T>::f(T& t) {  +  t = 1; // expected-error{{incompatible type}} +} + +template<typename T> +struct X0<T>::Inner { +  T member; +}; + +template<typename T> +T X0<T>::static_var = 1; // expected-error{{incompatible type}} + +extern template struct X0<void*>; +template struct X0<void*>; // expected-note 2{{instantiation}} + +template struct X0<int>; // expected-note 4{{explicit instantiation definition is here}} + +extern template void X0<int>::f(int&); // expected-error{{follows explicit instantiation definition}} +extern template struct X0<int>::Inner; // expected-error{{follows explicit instantiation definition}} +extern template int X0<int>::static_var; // expected-error{{follows explicit instantiation definition}} +extern template struct X0<int>; // expected-error{{follows explicit instantiation definition}} diff --git a/test/CXX/temp/temp.spec/temp.explicit/p12.cpp b/test/CXX/temp/temp.spec/temp.explicit/p12.cpp new file mode 100644 index 000000000000..fdf4393d4385 --- /dev/null +++ b/test/CXX/temp/temp.spec/temp.explicit/p12.cpp @@ -0,0 +1,6 @@ +// RUN: clang-cc -fsyntax-only -verify %s + +char* p = 0;  +template<class T> T g(T x = &p) { return x; } +template int g<int>(int);	// OK even though &p isn’t an int. + diff --git a/test/CXX/temp/temp.spec/temp.explicit/p3.cpp b/test/CXX/temp/temp.spec/temp.explicit/p3.cpp index 2bd781bbed28..9057971a5bb4 100644 --- a/test/CXX/temp/temp.spec/temp.explicit/p3.cpp +++ b/test/CXX/temp/temp.spec/temp.explicit/p3.cpp @@ -9,15 +9,13 @@ template void f0(int); // okay  // template shall be in scope at the point of the explicit instantiation of   // the member function template.  struct X0; // expected-note 2{{forward declaration}} -template<typename> struct X1; // expected-note 2{{declared here}} \ -                              // expected-note 3{{forward declaration}} +template<typename> struct X1; // expected-note 5{{declared here}}  // FIXME: Repeated diagnostics here!  template void X0::f0<int>(int); // expected-error 2{{incomplete type}} \ -  // expected-error{{invalid token after}} -template void X1<int>::f0<int>(int); // expected-error{{implicit instantiation of undefined template}} \ -  // expected-error{{incomplete type}} \\ -  // expected-error{{invalid token}} +  // expected-error{{does not refer}} +template void X1<int>::f0<int>(int); // expected-error 2{{implicit instantiation of undefined template}} \ +  // expected-error{{does not refer}}  // A definition of a class template or class member template shall be in scope   // at the point of the explicit instantiation of the class template or class  @@ -37,10 +35,10 @@ template struct X2<int>::Inner<float>; // expected-error{{explicit instantiation  // A definition of a class template shall be in scope at the point of an   // explicit instantiation of a member function or a static data member of the  // class template. -template void X1<int>::f1(int); // expected-error{{incomplete type}} \ +template void X1<int>::f1(int); // expected-error{{undefined template}} \                                  // expected-error{{does not refer}} -template int X1<int>::member; // expected-error{{incomplete type}} \ +template int X1<int>::member; // expected-error{{undefined template}} \                                // expected-error{{does not refer}}  // A definition of a member class of a class template shall be in scope at the  diff --git a/test/CXX/temp/temp.spec/temp.explicit/p5.cpp b/test/CXX/temp/temp.spec/temp.explicit/p5.cpp new file mode 100644 index 000000000000..a992648d7c48 --- /dev/null +++ b/test/CXX/temp/temp.spec/temp.explicit/p5.cpp @@ -0,0 +1,17 @@ +// RUN: clang-cc -fsyntax-only -verify %s + +namespace N { +  template<class T> class Y { // expected-note{{explicit instantiation refers here}} +    void mf() { }  +  }; +} + +template class Z<int>; // expected-error{{explicit instantiation of non-template class 'Z'}} + +// FIXME: This example from the standard is wrong; note posted to CWG reflector +// on 10/27/2009 +using N::Y;  +template class Y<int>; // expected-error{{must occur in}} + +template class N::Y<char*>;  +template void N::Y<double>::mf(); diff --git a/test/CXX/temp/temp.spec/temp.explicit/p6.cpp b/test/CXX/temp/temp.spec/temp.explicit/p6.cpp new file mode 100644 index 000000000000..763d679db7bb --- /dev/null +++ b/test/CXX/temp/temp.spec/temp.explicit/p6.cpp @@ -0,0 +1,14 @@ +// RUN: clang-cc -fsyntax-only -verify %s + +template<class T> class Array { /* ... */ };  +template<class T> void sort(Array<T>& v) { } + +// instantiate sort(Array<int>&) - template-argument deduced +template void sort<>(Array<int>&); + +template void sort(Array<long>&); + +template<typename T, typename U> void f0(T, U*) { } + +template void f0<int>(int, float*); +template void f0<>(double, float*); diff --git a/test/CXX/temp/temp.spec/temp.explicit/p7.cpp b/test/CXX/temp/temp.spec/temp.explicit/p7.cpp new file mode 100644 index 000000000000..ffd653dbaa4f --- /dev/null +++ b/test/CXX/temp/temp.spec/temp.explicit/p7.cpp @@ -0,0 +1,36 @@ +// RUN: clang-cc -fsyntax-only -verify %s + +template<typename T> +struct X0 { +  struct MemberClass { +    T member; // expected-error{{with function type}} +  }; +   +  T* f0(T* ptr) {  +    return ptr + 1; // expected-error{{pointer to function}} +  }  +   +  static T* static_member; +}; + +template<typename T> +T* X0<T>::static_member = ((T*)0) + 1; // expected-error{{pointer to function}} + +template class X0<int>; // okay + +template class X0<int(int)>; // expected-note 3{{requested here}} + +// Specialize everything, so that the explicit instantiation does not trigger +// any diagnostics. +template<> +struct X0<int(long)>::MemberClass { }; + +typedef int int_long_func(long); +template<> +int_long_func *X0<int_long_func>::f0(int_long_func *) { return 0; } + +template<> +int_long_func *X0<int(long)>::static_member; + +template class X0<int(long)>; + diff --git a/test/CXX/temp/temp.spec/temp.explicit/p8.cpp b/test/CXX/temp/temp.spec/temp.explicit/p8.cpp new file mode 100644 index 000000000000..9a5bd3245c78 --- /dev/null +++ b/test/CXX/temp/temp.spec/temp.explicit/p8.cpp @@ -0,0 +1,27 @@ +// RUN: clang-cc -fsyntax-only -verify %s + +template<typename T> +struct X0 { +  struct MemberClass; +   +  T* f0(T* ptr); +   +  static T* static_member; +}; + +template class X0<int>; // okay +template class X0<int(int)>; // okay; nothing gets instantiated. + +template<typename T> +struct X0<T>::MemberClass { +  T member; +}; + +template<typename T> +T* X0<T>::f0(T* ptr) { +  return ptr + 1; +} + +template<typename T> +T* X0<T>::static_member = 0; + diff --git a/test/CXX/temp/temp.spec/temp.explicit/p9-linkage.cpp b/test/CXX/temp/temp.spec/temp.explicit/p9-linkage.cpp new file mode 100644 index 000000000000..59705d8a20e7 --- /dev/null +++ b/test/CXX/temp/temp.spec/temp.explicit/p9-linkage.cpp @@ -0,0 +1,66 @@ +// RUN: clang-cc -emit-llvm -std=c++0x -o - %s | FileCheck %s + +template<typename T> +struct X0 { +  void f(T &t) { +    t = 0; +  } +   +  void g(T &t); +   +  void h(T &t); +   +  static T static_var; +}; + +template<typename T> +inline void X0<T>::g(T & t) { +  t = 0; +} + +template<typename T> +void X0<T>::h(T & t) { +  t = 0; +} + +template<typename T> +T X0<T>::static_var = 0; + +extern template struct X0<int*>; + +int *&test(X0<int*> xi, int *ip) { +  // CHECK: define available_externally void @_ZN2X0IPiE1fERS0_ +  xi.f(ip); +  // CHECK: define available_externally void @_ZN2X0IPiE1gERS0_ +  xi.g(ip); +  // CHECK: declare void @_ZN2X0IPiE1hERS0_ +  xi.h(ip); +  return X0<int*>::static_var; +} + +template<typename T> +void f0(T& t) { +  t = 0; +} + +template<typename T> +inline void f1(T& t) { +  t = 0; +} + +extern template void f0<>(int *&); +extern template void f1<>(int *&); + +void test_f0(int *ip, float *fp) { +  // CHECK: declare void @_Z2f0IPiEvRT_ +  f0(ip); +  // CHECK: define linkonce_odr void @_Z2f0IPfEvRT_ +  f0(fp); +} + +void test_f1(int *ip, float *fp) { +  // CHECK: define available_externally void @_Z2f1IPiEvRT_ +  f1(ip); +  // CHECK: define linkonce_odr void @_Z2f1IPfEvRT_ +  f1(fp); +} diff --git a/test/CXX/temp/temp.spec/temp.explicit/p9.cpp b/test/CXX/temp/temp.spec/temp.explicit/p9.cpp new file mode 100644 index 000000000000..a53113fb969e --- /dev/null +++ b/test/CXX/temp/temp.spec/temp.explicit/p9.cpp @@ -0,0 +1,59 @@ +// RUN: clang-cc -fsyntax-only -std=c++0x -verify %s + +template<typename T> +struct X0 { +  void f(T &t) { +    t = 1; // expected-error{{incompatible type}} +  } +   +  void g(T &t); +   +  void h(T &t); +   +  static T static_var; +}; + +template<typename T> +inline void X0<T>::g(T & t) { +  t = 1; // expected-error{{incompatible type}} +} + +template<typename T> +void X0<T>::h(T & t) { +  t = 1; +} + +template<typename T> +T X0<T>::static_var = 1; + +extern template struct X0<int*>; + +int *&test(X0<int*> xi, int *ip) { +  xi.f(ip); // expected-note{{instantiation}} +  xi.g(ip); // expected-note{{instantiation}} +  xi.h(ip); +  return X0<int*>::static_var; +} + +template<typename T> +void f0(T& t) { +  t = 1; // expected-error{{incompatible type}} +} + +template<typename T> +inline void f1(T& t) { +  t = 1; // expected-error 2{{incompatible type}} +} + +extern template void f0<>(int *&); +extern template void f1<>(int *&); + +void test_f0(int *ip, float *fp) { +  f0(ip); +  f0(fp); // expected-note{{instantiation}} +} + +void test_f1(int *ip, float *fp) { +  f1(ip); // expected-note{{instantiation}} +  f1(fp); // expected-note{{instantiation}} +} diff --git a/test/CodeCompletion/macros.c b/test/CodeCompletion/macros.c new file mode 100644 index 000000000000..d5c1f8f17fce --- /dev/null +++ b/test/CodeCompletion/macros.c @@ -0,0 +1,37 @@ +#define FOO +#define BAR(X, Y) X, Y +#define IDENTITY(X) X +#define WIBBLE(...) + +enum Color { +  Red, Green, Blue +}; + +struct Point { +  float x, y, z; +  enum Color color; +}; + +void test(struct Point *p) { +  // RUN: clang-cc -fsyntax-only -code-completion-at=%s:17:14 %s -o - | FileCheck -check-prefix=CC1 %s && +  switch (p->IDENTITY(color)) { +  // RUN: clang-cc -fsyntax-only -code-completion-at=%s:19:9 %s -o - | FileCheck -check-prefix=CC2 %s && +    case  +  } +  // CC1: color +  // CC1: x +  // CC1: y +  // CC1: z +  // CC1: BAR(<#X#>, <#Y#>) +  // CC1: FOO +  // CC1: IDENTITY(<#X#>) +  // CC1: WIBBLE +  // CC2: Blue +  // CC2: Green +  // CC2: Red +  // CC2: BAR(<#X#>, <#Y#>) +  // CC2: FOO +  // CC2: IDENTITY(<#X#>) +  // CC2: WIBBLE +  // RUN: true +} diff --git a/test/CodeGen/2008-07-21-mixed-var-fn-decl.c b/test/CodeGen/2008-07-21-mixed-var-fn-decl.c index c55c86b2fc6c..59a3f3884951 100644 --- a/test/CodeGen/2008-07-21-mixed-var-fn-decl.c +++ b/test/CodeGen/2008-07-21-mixed-var-fn-decl.c @@ -1,5 +1,8 @@ -// RUN: clang-cc -emit-llvm -o - %s | grep -e "@g[0-9] " | count 2 +// RUN: clang-cc -emit-llvm -o - %s | FileCheck %s  int g0, f0();  int f1(), g1; +// CHECK: @g0 = common global i32 0, align 4 +// CHECK: @g1 = common global i32 0, align 4 + diff --git a/test/CodeGen/2008-07-29-override-alias-decl.c b/test/CodeGen/2008-07-29-override-alias-decl.c index 4a36e0f13d5c..872950029618 100644 --- a/test/CodeGen/2008-07-29-override-alias-decl.c +++ b/test/CodeGen/2008-07-29-override-alias-decl.c @@ -1,7 +1,13 @@ -// RUN: clang-cc -emit-llvm -o - %s | grep -e "^@f" | count 1 +// RUN: clang-cc -emit-llvm -o - %s | FileCheck %s  int x() { return 1; } +// CHECK:  %retval = alloca i32 +// CHECK:  store i32 1, i32* %retval +// CHECK:  %0 = load i32* %retval +// CHECK:  ret i32 %0 + +  int f() __attribute__((weak, alias("x")));  /* Test that we link to the alias correctly instead of making a new @@ -10,3 +16,10 @@ int f();  int h() {    return f();  } + +// CHECK:  %retval = alloca i32 +// CHECK:  %call = call i32 (...)* @f() +// CHECK:  store i32 %call, i32* %retval +// CHECK:  %0 = load i32* %retval +// CHECK:  ret i32 %0 + diff --git a/test/CodeGen/asm-inout.c b/test/CodeGen/asm-inout.c index 0d8dbdfb9d38..bd287ad0ee69 100644 --- a/test/CodeGen/asm-inout.c +++ b/test/CodeGen/asm-inout.c @@ -1,6 +1,6 @@  // RUN: clang-cc -triple i386-unknown-unknown -emit-llvm %s -o %t &&  // RUN: grep "load i8\*\*\* %p.addr"  %t | count 1 -// XFAIL +// XFAIL: *  // PR3800  void f(void **p) diff --git a/test/CodeGen/blocks-2.c b/test/CodeGen/blocks-2.c index bc6c2b916abd..acbaafd95605 100644 --- a/test/CodeGen/blocks-2.c +++ b/test/CodeGen/blocks-2.c @@ -1,7 +1,7 @@  // RUN: clang-cc -g %s -emit-llvm -o %t -fblocks &&  // RUN: grep "func.start" %t | count 4  // 1 declaration, 1 bar, 1 test_block_dbg and 1 for the block. -// XFAIL +// XFAIL: *  static __inline__ __attribute__((always_inline)) int bar(int va, int vb) { return (va == vb); } diff --git a/test/CodeGen/builtin-unwind-init.c b/test/CodeGen/builtin-unwind-init.c index 49a016a304f0..56872f7434ee 100644 --- a/test/CodeGen/builtin-unwind-init.c +++ b/test/CodeGen/builtin-unwind-init.c @@ -1,4 +1,5 @@ -// RUN: clang-cc -emit-llvm < %s -o - | grep -F "llvm.eh.unwind.init" +// RUN: clang-cc -emit-llvm < %s -o - | FileCheck %s -int a() { __builtin_unwind_init(); } +void a() { __builtin_unwind_init(); } +// CHECK:  call void @llvm.eh.unwind.init() diff --git a/test/CodeGen/cast-to-union.c b/test/CodeGen/cast-to-union.c index 674299294928..1f7e0457706d 100644 --- a/test/CodeGen/cast-to-union.c +++ b/test/CodeGen/cast-to-union.c @@ -1,5 +1,5 @@  // RUN: clang-cc -emit-llvm  %s -o - | FileCheck %s -// CHECK: w = global %0 { i32 2, [4 x i8] zeroinitializer } +// CHECK: w = global %0 { i32 2, [4 x i8] undef }  // CHECK: y = global %union.u { double 7.300000e+0{{[0]*}}1 }  // CHECK: store i32 351, i32 diff --git a/test/CodeGen/function-attributes.c b/test/CodeGen/function-attributes.c index d2d3b031a83b..b09b28b8d93d 100644 --- a/test/CodeGen/function-attributes.c +++ b/test/CodeGen/function-attributes.c @@ -1,12 +1,12 @@ -// RUN: clang-cc -triple i386-unknown-unknown -emit-llvm -o %t %s && -// RUN: grep 'define signext i8 @f0(i32 %x) nounwind' %t && -// RUN: grep 'define zeroext i8 @f1(i32 %x) nounwind' %t && -// RUN: grep 'define void @f2(i8 signext %x) nounwind' %t && -// RUN: grep 'define void @f3(i8 zeroext %x) nounwind' %t && -// RUN: grep 'define signext i16 @f4(i32 %x) nounwind' %t && -// RUN: grep 'define zeroext i16 @f5(i32 %x) nounwind' %t && -// RUN: grep 'define void @f6(i16 signext %x) nounwind' %t && -// RUN: grep 'define void @f7(i16 zeroext %x) nounwind' %t && +// RUN: clang-cc -triple i386-unknown-unknown -emit-llvm -Os -o - %s | FileCheck %s +// CHECK: define signext i8 @f0(i32 %x) nounwind +// CHECK: define zeroext i8 @f1(i32 %x) nounwind +// CHECK: define void @f2(i8 signext %x) nounwind +// CHECK: define void @f3(i8 zeroext %x) nounwind +// CHECK: define signext i16 @f4(i32 %x) nounwind +// CHECK: define zeroext i16 @f5(i32 %x) nounwind +// CHECK: define void @f6(i16 signext %x) nounwind +// CHECK: define void @f7(i16 zeroext %x) nounwind  signed char f0(int x) { return x; } @@ -24,15 +24,22 @@ void f6(signed short x) { }  void f7(unsigned short x) { } -// RUN: grep 'define void @f8() nounwind alwaysinline' %t && +// CHECK: define void @f8() +// CHECK: nounwind +// CHECK: alwaysinline +// CHECK: {  void __attribute__((always_inline)) f8(void) { } -// RUN: grep 'call void @f9_t() noreturn' %t && +// CHECK: call void @f9_t() +// CHECK: noreturn +// CHECK: {  void __attribute__((noreturn)) f9_t(void);  void f9(void) { f9_t(); }  // FIXME: We should be setting nounwind on calls. -// RUN: grep 'call i32 @f10_t() readnone' %t && +// CHECK: call i32 @f10_t() +// CHECK: readnone +// CHECK: {  int __attribute__((const)) f10_t(void);  int f10(void) { return f10_t(); }  int f11(void) { @@ -43,13 +50,15 @@ int f12(int arg) {    return arg ? 0 : f10_t();  } -// RUN: grep 'define void @f13() nounwind readnone' %t && +// CHECK: define void @f13() nounwind readnone  void f13(void) __attribute__((pure)) __attribute__((const));  void f13(void){}  // Ensure that these get inlined: rdar://6853279 -// RUN: not grep '@ai_' %t && +// CHECK: define void @f14 +// CHECK-NOT: @ai_ +// CHECK: call void @f14_end  static __inline__ __attribute__((always_inline))  int ai_1() {  return 4; } @@ -58,12 +67,17 @@ struct {    int a, b, c, d, e;  } ai_2() { while (1) {} } - -int foo() { -  ai_2(); -  return ai_1(); +void f14(int a) { +  extern void f14_end(void); +  if (a) +    ai_2(); +  ai_1(); +  f14_end();  } - - -// RUN: true +// <rdar://problem/7102668> [irgen] clang isn't setting the optsize bit on functions +// CHECK: define void @f15 +// CHECK: optsize +// CHECK: { +void f15(void) { +} diff --git a/test/CodeGen/indirect-goto.c b/test/CodeGen/indirect-goto.c index b9a601953877..6804f5739bbf 100644 --- a/test/CodeGen/indirect-goto.c +++ b/test/CodeGen/indirect-goto.c @@ -1,9 +1,7 @@ -// RUN: clang-cc -triple i386-unknown-unknown -emit-llvm-bc -o - %s | opt -std-compile-opts | llvm-dis > %t && -// RUN: grep "ret i32" %t | count 1 && -// RUN: grep "ret i32 210" %t | count 1 +// RUN: clang-cc -triple i386-unknown-unknown -emit-llvm-bc -o - %s | opt -std-compile-opts -S | grep "ret i32 2520"  static int foo(unsigned i) { -  const void *addrs[] = { &&L1, &&L2, &&L3, &&L4, &&L5 }; +  void *addrs[] = { &&L1, &&L2, &&L3, &&L4, &&L5 };    int res = 1;    goto *addrs[i]; @@ -15,6 +13,19 @@ static int foo(unsigned i) {    return res;  } -int bar() { -  return foo(3); +static int foo2(unsigned i) { +  static const void *addrs[] = { &&L1, &&L2, &&L3, &&L4, &&L5 }; +  int res = 1; +   +  goto *addrs[i]; +L5: res *= 11; +L4: res *= 7; +L3: res *= 5; +L2: res *= 3; +L1: res *= 2;  +  return res; +} + +int main() { +  return foo(3)+foo2(4);  } diff --git a/test/CodeGen/mangle.c b/test/CodeGen/mangle.c index 17d74ba71f0c..6f42f6f6496c 100644 --- a/test/CodeGen/mangle.c +++ b/test/CodeGen/mangle.c @@ -1,22 +1,20 @@ -// RUN: clang-cc -triple i386-pc-linux-gnu -emit-llvm -o %t %s && -// RUN: grep '@_Z2f0i' %t && -// RUN: grep '@_Z2f0l' %t && +// RUN: clang-cc -triple i386-pc-linux-gnu -emit-llvm -o - %s | FileCheck %s -// Make sure we mangle overloadable, even in C system headers. +// CHECK: @"\01foo" +// Make sure we mangle overloadable, even in C system headers.  # 1 "somesystemheader.h" 1 3 4 +// CHECK: @_Z2f0i  void __attribute__((__overloadable__)) f0(int a) {} +// CHECK: @_Z2f0l  void __attribute__((__overloadable__)) f0(long b) {} - +// CHECK: @"\01bar"  // These should get merged.  void foo() __asm__("bar");  void foo2() __asm__("bar"); -// RUN: grep '@"\\01foo"' %t && -// RUN: grep '@"\\01bar"' %t -  int nux __asm__("foo");  extern float nux2 __asm__("foo"); @@ -52,3 +50,12 @@ void foo6() {  int foo7 __asm__("foo7") __attribute__((used));  float foo8 __asm__("foo7") = 42; + +// PR4412 +int func(void); +extern int func (void) __asm__ ("FUNC"); + +// CHECK: @"\01FUNC" +int func(void) { +  return 42; +} diff --git a/test/CodeGen/object-size.c b/test/CodeGen/object-size.c new file mode 100644 index 000000000000..61d85419fc69 --- /dev/null +++ b/test/CodeGen/object-size.c @@ -0,0 +1,126 @@ +// RUN: clang-cc -triple x86_64-apple-darwin -S %s -o - | FileCheck %s + +#define strcpy(dest, src) \ +  ((__builtin_object_size(dest, 0) != -1ULL) \ +   ? __builtin___strcpy_chk (dest, src, __builtin_object_size(dest, 1)) \ +   : __inline_strcpy_chk(dest, src)) + +static char *__inline_strcpy_chk (char *dest, const char *src) { +  return __builtin___strcpy_chk(dest, src, __builtin_object_size(dest, 1)); +} + +char gbuf[63]; +char *gp; +int gi, gj; + +void test1() { +  // CHECK:       movabsq $59, %rdx +  // CHECK-NEXT:  movq    %rax, %rdi +  // CHECK-NEXT:  movq    %rcx, %rsi +  // CHECK-NEXT:  call    ___strcpy_chk +  strcpy(&gbuf[4], "Hi there"); +} + +void test2() { +  // CHECK:       movabsq $63, %rdx +  // CHECK-NEXT:  movq    %rax, %rdi +  // CHECK-NEXT:  movq    %rcx, %rsi +  // CHECK-NEXT:  call    ___strcpy_chk +  strcpy(gbuf, "Hi there"); +} + +void test3() { +  // CHECK:       movabsq $0, %rdx +  // CHECK-NEXT:  movq    %rax, %rdi +  // CHECK-NEXT:  movq    %rcx, %rsi +  // CHECK-NEXT:  call    ___strcpy_chk +  strcpy(&gbuf[100], "Hi there"); +} + +void test4() { +  // CHECK:       movabsq $0, %rdx +  // CHECK-NEXT:  movq    %rax, %rdi +  // CHECK-NEXT:  movq    %rcx, %rsi +  // CHECK-NEXT:  call    ___strcpy_chk +  strcpy((char*)(void*)&gbuf[-1], "Hi there"); +} + +void test5() { +  // CHECK:       movb    $0, %al +  // CHECK-NEXT:  testb   %al, %al +  // CHECK:       call    ___inline_strcpy_chk +  strcpy(gp, "Hi there"); +} + +void test6() { +  char buf[57]; + +  // CHECK:       movabsq $53, %rdx +  // CHECK-NEXT:  movq    %rax, %rdi +  // CHECK-NEXT:  movq    %rcx, %rsi +  // CHECK-NEXT:  call    ___strcpy_chk +  strcpy(&buf[4], "Hi there"); +} + +void test7() { +  int i; +  // CHECK-NOT:   call    ___strcpy_chk +  // CHECK:       call    ___inline_strcpy_chk +  strcpy((++i, gbuf), "Hi there"); +} + +void test8() { +  char *buf[50]; +  // CHECK-NOT:   call    ___strcpy_chk +  // CHECK:       call    ___inline_strcpy_chk +  strcpy(buf[++gi], "Hi there"); +} + +void test9() { +  // CHECK-NOT:   call    ___strcpy_chk +  // CHECK:       call    ___inline_strcpy_chk +  strcpy((char *)((++gi) + gj), "Hi there"); +} + +char **p; +void test10() { +  // CHECK-NOT:   call    ___strcpy_chk +  // CHECK:       call    ___inline_strcpy_chk +  strcpy(*(++p), "Hi there"); +} + +void test11() { +  // CHECK-NOT:   call    ___strcpy_chk +  // CHECK:       call    ___inline_strcpy_chk +  strcpy(gp = gbuf, "Hi there"); +} + +void test12() { +  // CHECK-NOT:   call    ___strcpy_chk +  // CHECK:       call    ___inline_strcpy_chk +  strcpy(++gp, "Hi there"); +} + +void test13() { +  // CHECK-NOT:   call    ___strcpy_chk +  // CHECK:       call    ___inline_strcpy_chk +  strcpy(gp++, "Hi there"); +} + +void test14() { +  // CHECK-NOT:   call    ___strcpy_chk +  // CHECK:       call    ___inline_strcpy_chk +  strcpy(--gp, "Hi there"); +} + +void test15() { +  // CHECK-NOT:   call    ___strcpy_chk +  // CHECK:       call    ___inline_strcpy_chk +  strcpy(gp--, "Hi there"); +} + +void test16() { +  // CHECK-NOT:   call    ___strcpy_chk +  // CHECK:       call    ___inline_strcpy_chk +  strcpy(gp += 1, "Hi there"); +} diff --git a/test/CodeGen/union-init2.c b/test/CodeGen/union-init2.c index 184d75f47156..e782425cf2b1 100644 --- a/test/CodeGen/union-init2.c +++ b/test/CodeGen/union-init2.c @@ -1,4 +1,4 @@ -// RUN: clang-cc -emit-llvm %s -o - -triple i686-pc-linux-gnu | grep "bitcast (%0\* @r to %union.x\*), \[4 x i8\] zeroinitializer" +// RUN: clang-cc -emit-llvm %s -o - -triple i686-pc-linux-gnu | grep "bitcast (%0\* @r to %union.x\*), \[4 x i8\] undef"  // Make sure we generate something sane instead of a ptrtoint  union x {long long b;union x* a;} r = {.a = &r}; diff --git a/test/CodeGen/volatile.c b/test/CodeGen/volatile.c index 87cb5ff4eb4f..e17669008a39 100644 --- a/test/CodeGen/volatile.c +++ b/test/CodeGen/volatile.c @@ -1,8 +1,8 @@  // RUN: clang-cc -emit-llvm < %s -o %t && -// RUN: grep volatile %t | count 25 && +// RUN: grep volatile %t | count 29 &&  // RUN: grep memcpy %t | count 7 -// The number 25 comes from the current codegen for volatile loads; +// The number 29 comes from the current codegen for volatile loads;  // if this number changes, it's not necessarily something wrong, but  // something has changed to affect volatile load/store codegen @@ -38,6 +38,9 @@ volatile extv4 vVE;  volatile struct {int x;} aggFct(void); +typedef volatile int volatile_int; +volatile_int vtS; +  int main() {    int i; @@ -62,6 +65,7 @@ int main() {    i=VE.yx[1];    i=vVE.zy[1];    i = aggFct().x; +  i=vtS;    // store @@ -81,12 +85,14 @@ int main() {    vBF.x=i;    V[3]=i;    vV[3]=i; +  vtS=i;    // other ops:    ++S;    ++vS;    i+=S;    i+=vS; +  ++vtS;    (void)vF2;    vF2 = vF2;    vF2 = vF2 = vF2; diff --git a/test/CodeGenCXX/array-construction.cpp b/test/CodeGenCXX/array-construction.cpp new file mode 100644 index 000000000000..b444221533d3 --- /dev/null +++ b/test/CodeGenCXX/array-construction.cpp @@ -0,0 +1,40 @@ +// RUN: clang-cc -triple x86_64-apple-darwin -std=c++0x -S %s -o %t-64.s && +// RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s && +// RUN: clang-cc -triple i386-apple-darwin -std=c++0x -S %s -o %t-32.s && +// RUN: FileCheck -check-prefix LP32 --input-file=%t-32.s %s && +// RUN: true + +extern "C" int printf(...); + +static int count; +static float fcount; + +class xpto { +public: +  xpto() : i(count++), f(fcount++) { +    printf("xpto::xpto()\n"); +  } +  int i; +  float f; + +/** +  NYI +  ~xpto() { +    printf("xpto::~xpto()\n"); +  } +*/ +}; + +int main() { +  xpto array[2][3][4]; +  for (int h = 0; h < 2; h++) +   for (int i = 0; i < 3; i++) +    for (int j = 0; j < 4; j++) +       printf("array[%d][%d][%d] = {%d, %f}\n",  +              h, i, j, array[h][i][j].i, array[h][i][j].f); +} + +// CHECK-LP64: call     __ZN4xptoC1Ev + +// CHECK-LP32: call     L__ZN4xptoC1Ev + diff --git a/test/CodeGenCXX/ptr-to-datamember.cpp b/test/CodeGenCXX/ptr-to-datamember.cpp index eee03c060f91..a7b4cc2f7afb 100644 --- a/test/CodeGenCXX/ptr-to-datamember.cpp +++ b/test/CodeGenCXX/ptr-to-datamember.cpp @@ -51,6 +51,21 @@ void test_aggr_pdata(A& a1) {    pr(a1.*af);  } +void test_aggr_pdata_1(A* pa) { +  F A::* af = &A::Af; +  pr(pa->*af); + +  (pa->*af).iF = 100; +  (pa->*af).fF = 200.00; +  printf(" %d %f\n", (pa->*af).iF, (pa->*af).fF); +  pr(pa->*af); + +  (pa->*af).iF++; +  (pa->*af).fF--; +  --(pa->*af).fF; +  pr(pa->*af); +} +  int main()   {    A a1; @@ -67,4 +82,5 @@ int main()    printf("%d\n", &A::B1::V::iV);    printf("%d, %f, %f  \n", a1.*pa, a1.*pf, a1.*pd);    test_aggr_pdata(a1); +  test_aggr_pdata_1(&a1);  } diff --git a/test/CodeGenCXX/ptr-to-member-function.cpp b/test/CodeGenCXX/ptr-to-member-function.cpp new file mode 100644 index 000000000000..1e396e976575 --- /dev/null +++ b/test/CodeGenCXX/ptr-to-member-function.cpp @@ -0,0 +1,53 @@ +// RUN: clang-cc -triple x86_64-apple-darwin -std=c++0x -S %s -o %t-64.s && +// RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s && +// RUN: clang-cc -triple i386-apple-darwin -std=c++0x -S %s -o %t-32.s && +// RUN: FileCheck -check-prefix LP32 --input-file=%t-32.s %s && +// RUN: true +// 13.3.3.2 Ranking implicit conversion sequences + +extern "C" int printf(...); + +struct A { +int Ai; +};  + +struct B : public A { +  void bf() { printf("B::bf called\n"); } +};  + +struct C : public B { };  + +// conversion of B::* to C::* is better than conversion of A::* to C::* +typedef void (A::*pmfa)(); +typedef void (B::*pmfb)(); +typedef void (C::*pmfc)(); + +struct X { +	operator pmfa(); +	operator pmfb() { +	  return &B::bf; +        } +}; + + +void g(pmfc pm) { +  C c; +  (c.*pm)(); +} + +void test2(X x)  +{ +    g(x); +} + +int main() +{ +	X x; +	test2(x); +} + +// CHECK-LP64: call	__ZN1XcvM1BFvvEEv +// CHECK-LP64: call	__Z1gM1CFvvE + +// CHECK-LP32: call	L__ZN1XcvM1BFvvEEv +// CHECK-LP32: call	__Z1gM1CFvvE diff --git a/test/CodeGenCXX/temporaries.cpp b/test/CodeGenCXX/temporaries.cpp index d622193f5986..e9ed0f7690bc 100644 --- a/test/CodeGenCXX/temporaries.cpp +++ b/test/CodeGenCXX/temporaries.cpp @@ -53,9 +53,9 @@ struct D {  };  void f4() { -  // CHECK call void @_ZN1DC1Ev -  // CHECK call void @_ZN1DD1Ev -  // CHECK call void @_ZN1DD1Ev +  // CHECK: call void @_ZN1DC1Ev +  // CHECK: call void @_ZN1DD1Ev +  // CHECK: call void @_ZN1DD1Ev    D()();  } diff --git a/test/CodeGenCXX/virt.cpp b/test/CodeGenCXX/virt.cpp index 21fecac11e7b..7911940c6dab 100644 --- a/test/CodeGenCXX/virt.cpp +++ b/test/CodeGenCXX/virt.cpp @@ -91,6 +91,50 @@ int main() {  // CHECK-LP64: movl $1, 12(%rax)  // CHECK-LP64: movl $2, 8(%rax) +// FIXME: This is the wrong thunk, but until these issues are fixed, better +// than nothing. +// CHECK-LP64:     __ZTcvn16_n72_v16_n32_N8test16_D4foo1Ev: +// CHECK-LP64-NEXT:Leh_func_begin43: +// CHECK-LP64-NEXT:    subq    $24, %rsp +// CHECK-LP64-NEXT:Llabel43: +// CHECK-LP64-NEXT:    movq    %rdi, %rax +// CHECK-LP64-NEXT:    movq    %rax, 8(%rsp) +// CHECK-LP64-NEXT:    movq    8(%rsp), %rax +// CHECK-LP64-NEXT:    movq    %rax, %rcx +// CHECK-LP64-NEXT:    movabsq $-16, %rdx +// CHECK-LP64-NEXT:    addq    %rdx, %rcx +// CHECK-LP64-NEXT:    movq    -16(%rax), %rax +// CHECK-LP64-NEXT:    movq    -72(%rax), %rax +// CHECK-LP64-NEXT:    addq    %rax, %rcx +// CHECK-LP64-NEXT:    movq    %rcx, %rax +// CHECK-LP64-NEXT:    movq    %rax, %rdi +// CHECK-LP64-NEXT:    call    __ZTch0_v16_n32_N8test16_D4foo1Ev +// CHECK-LP64-NEXT:    movq    %rax, 16(%rsp) +// CHECK-LP64-NEXT:    movq    16(%rsp), %rax +// CHECK-LP64-NEXT:    addq    $24, %rsp +// CHECK-LP64-NEXT:    ret + +// CHECK-LP64:     __ZTch0_v16_n32_N8test16_D4foo1Ev: +// CHECK-LP64-NEXT:Leh_func_begin44: +// CHECK-LP64-NEXT:    subq    $24, %rsp +// CHECK-LP64-NEXT:Llabel44: +// CHECK-LP64-NEXT:    movq    %rdi, %rax +// CHECK-LP64-NEXT:    movq    %rax, 8(%rsp) +// CHECK-LP64-NEXT:    movq    8(%rsp), %rax +// CHECK-LP64-NEXT:    movq    %rax, %rdi +// CHECK-LP64-NEXT:    call    __ZN8test16_D4foo1Ev +// CHECK-LP64-NEXT:    movq    %rax, %rcx +// CHECK-LP64-NEXT:    movabsq $16, %rdx +// CHECK-LP64-NEXT:    addq    %rdx, %rcx +// CHECK-LP64-NEXT:    movq    16(%rax), %rax +// CHECK-LP64-NEXT:    movq    -32(%rax), %rax +// CHECK-LP64-NEXT:    addq    %rax, %rcx +// CHECK-LP64-NEXT:    movq    %rcx, %rax +// CHECK-LP64-NEXT:    movq    %rax, 16(%rsp) +// CHECK-LP64-NEXT:    movq    16(%rsp), %rax +// CHECK-LP64-NEXT:    addq    $24, %rsp +// CHECK-LP64-NEXT:    ret +  struct test12_A {    virtual void foo0() { }    virtual void foo(); @@ -306,10 +350,10 @@ struct test5_D  : virtual test5_B1, virtual test5_B21, virtual test5_B31 {  // CHECK-LP32-NEXT: .long __ZN9test5_B227funcB22Ev  // CHECK-LP32-NEXT: .long __ZN9test5_B217funcB21Ev  // CHECK-LP32-NEXT: .space 4 -// CHECK-LP32: .long 8 -// CHECK-LP32 .space 4 -// CHECK-LP32 .space 4                       FIXME -// CHECK-LP32: .long 4 +// CHECK-LP32-NEXT: .long 8 +// CHECK-LP32-NEXT: .space 4 +// CHECK-LP32-NEXT: .space 4 +// CHECK-LP32-NEXT: .long 4  // CHECK-LP32-NEXT: .space 4  // CHECK-LP32-NEXT: .space 4  // CHECK-LP32-NEXT: .long 4294967288 @@ -358,10 +402,10 @@ struct test5_D  : virtual test5_B1, virtual test5_B21, virtual test5_B31 {  // CHECK-LP64-NEXT: .quad __ZN9test5_B227funcB22Ev  // CHECK-LP64-NEXT: .quad __ZN9test5_B217funcB21Ev  // CHECK-LP64-NEXT: .space 8 -// CHECK-LP64: .quad 16 -// CHECK-LP64 .space 8 -// CHECK-LP64 .space 8 -// CHECK-LP64: .quad 8 +// CHECK-LP64-NEXT: .quad 16 +// CHECK-LP64-NEXT: .space 8 +// CHECK-LP64-NEXT: .space 8 +// CHECK-LP64-NEXT: .quad 8  // CHECK-LP64-NEXT: .space 8  // CHECK-LP64-NEXT: .space 8  // CHECK-LP64-NEXT: .quad 18446744073709551600 @@ -1049,6 +1093,151 @@ struct test16_D : test16_NV1, virtual test16_B2 {  // CHECK-LP32-NEXT: .long __ZN10test16_NV28foo_NV2bEv +class test17_B1 { +  virtual void foo() = 0; +  virtual void bar() { } +}; + +class test17_B2 : public test17_B1 { +  void foo() { } +  virtual void bar() = 0; +}; + +class test17_D : public test17_B2 { +  void bar() { } +}; + + +// CHECK-LP64:__ZTV8test17_D: +// CHECK-LP64-NEXT: .space 8 +// CHECK-LP64-NEXT: .quad __ZTI8test17_D +// CHECK-LP64-NEXT: .quad __ZN9test17_B23fooEv +// CHECK-LP64-NEXT: .quad __ZN8test17_D3barEv + +// CHECK-LP64:__ZTV9test17_B2: +// CHECK-LP64-NEXT: .space 8 +// CHECK-LP64-NEXT: .quad __ZTI9test17_B2 +// CHECK-LP64-NEXT: .quad __ZN9test17_B23fooEv +// CHECK-LP64-NEXT: .quad ___cxa_pure_virtual + +// CHECK-LP64:__ZTV9test17_B1: +// CHECK-LP64-NEXT: .space 8 +// CHECK-LP64-NEXT: .quad __ZTI9test17_B1 +// CHECK-LP64-NEXT: .quad ___cxa_pure_virtual +// CHECK-LP64-NEXT: .quad __ZN9test17_B13barEv + + +struct test18_NV1 { +  virtual void fooNV1() { } +virtual void foo_NV1() { } +  int i; +}; + +struct test18_NV2 { +  virtual test18_NV2& foo1() { return *this; } +virtual void foo_NV2() { } +virtual void foo_NV2b() { } +  int i; +}; + +struct test18_B : public test18_NV1, test18_NV2 { +  virtual test18_B& foo1() { return *this; } +  virtual test18_B *foo2() { return 0; } +  virtual test18_B *foo3() { return 0; } +virtual void foo_B() { } +  int i; +}; + +struct test18_B2 : test18_NV1, virtual test18_B { +  virtual test18_B2& foo1() { return *this; } +  virtual test18_B2 *foo2() { return 0; } +virtual void foo_B2() { } +  int i; +}; + +struct test18_D : test18_NV1, virtual test18_B2 { +  virtual test18_D& foo1() { return *this; } +}; + + +struct test19_VB1 { }; +struct test19_B1 : public virtual test19_VB1 { +  virtual void fB1() { } +  virtual void foB1B2() { } +  virtual void foB1B3() { } +  virtual void foB1B4() { } +}; + +struct test19_VB2 { }; +struct test19_B2: public test19_B1, public virtual test19_VB2 { +  virtual void foB1B2() { } +  virtual void foB1B3() { } +  virtual void foB1B4() { } + +  virtual void fB2() { } +  virtual void foB2B3() { } +  virtual void foB2B4() { } +}; + +struct test19_VB3 { }; +struct test19_B3: virtual public test19_B2, public virtual test19_VB3 { +  virtual void foB1B3() { } +  virtual void foB1B4() { } + +  virtual void foB2B3() { } +  virtual void foB2B4() { } + +  virtual void fB3() { } +  virtual void foB3B4() { } +}; + +struct test19_VB4 { }; +struct test19_B4: public test19_B3, public virtual test19_VB4 { +  virtual void foB1B4() { } + +  virtual void foB2B4() { } + +  virtual void foB3B4() { } + +  virtual void fB4() { } +}; + +struct test19_D : virtual test19_B4 { +}; + + +// CHECK-LP64: __ZTV8test19_D: +// CHECK-LP64-NEXT: .space 8 +// CHECK-LP64-NEXT: .space 8 +// CHECK-LP64-NEXT: .space 8 +// CHECK-LP64-NEXT: .space 8 +// CHECK-LP64-NEXT: .space 8 +// CHECK-LP64-NEXT: .space 8 +// CHECK-LP64-NEXT: .space 8 +// CHECK-LP64-NEXT: .space 8 +// CHECK-LP64-NEXT: .space 8 +// CHECK-LP64-NEXT: .space 8 +// CHECK-LP64-NEXT: .space 8 +// CHECK-LP64-NEXT: .space 8 +// CHECK-LP64-NEXT: .space 8 +// CHECK-LP64-NEXT: .space 8 +// CHECK-LP64-NEXT: .space 8 +// CHECK-LP64-NEXT: .space 8 +// CHECK-LP64-NEXT: .space 8 +// CHECK-LP64-NEXT: .quad __ZTI8test19_D +// CHECK-LP64-NEXT .quad __ZN9test19_B13fB1Ev +// CHECK-LP64-NEXT .quad __ZN9test19_B26foB1B2Ev +// CHECK-LP64-NEXT .quad __ZN9test19_B36foB1B3Ev +// CHECK-LP64-NEXT .quad __ZN9test19_B46foB1B4Ev +// CHECK-LP64-NEXT .quad __ZN9test19_B23fB2Ev +// CHECK-LP64-NEXT .quad __ZN9test19_B36foB2B3Ev +// CHECK-LP64-NEXT .quad __ZN9test19_B46foB2B4Ev +// CHECK-LP64-NEXT .quad __ZN9test19_B33fB3Ev +// CHECK-LP64-NEXT .quad __ZN9test19_B46foB3B4Ev +// CHECK-LP64-NEXT .quad __ZN9test19_B43fB4Ev + + +  // CHECK-LP64: __ZTV1B:  // CHECK-LP64-NEXT: .space 8  // CHECK-LP64-NEXT: .quad __ZTI1B @@ -1127,6 +1316,9 @@ struct test16_D : test16_NV1, virtual test16_B2 {  // CHECK-LP64-NEXT: .quad __ZN2D14bar4Ev  // CHECK-LP64-NEXT: .quad __ZN2D14bar5Ev +test19_D d19; +test18_D d18; +test17_D d17;  test16_D d16;  test15_D d15;  test13_D d13; diff --git a/test/CodeGenObjC/PR4894-recursive-debug-crash.m b/test/CodeGenObjC/PR4894-recursive-debug-crash.m index c5f901c2680e..d7379111c11a 100644 --- a/test/CodeGenObjC/PR4894-recursive-debug-crash.m +++ b/test/CodeGenObjC/PR4894-recursive-debug-crash.m @@ -3,7 +3,7 @@  //  // This test is actually just making sure we can generate the debug info for the  // return type from im0 without crashing. -// XFAIL +// XFAIL: *  @interface I0 {    I0 *_iv0; diff --git a/test/CodeGenObjC/encode-test-2.m b/test/CodeGenObjC/encode-test-2.m index 6901168b1d09..07a53367557a 100644 --- a/test/CodeGenObjC/encode-test-2.m +++ b/test/CodeGenObjC/encode-test-2.m @@ -3,7 +3,7 @@  // RUN: grep -e "@\\\22<X><Y>\\\22" %t  &&  // RUN: grep -e "@\\\22<X><Y><Z>\\\22" %t  &&  // RUN: grep -e "@\\\22Foo<X><Y><Z>\\\22" %t  && -// RUN: grep -e "{Intf=@@@@}" %t   +// RUN: grep -e "{Intf=@@@@#}" %t    @protocol X, Y, Z;  @class Foo; @@ -17,6 +17,7 @@ id <X> IVAR_x;  id <X, Y> IVAR_xy;  id <X, Y, Z> IVAR_xyz;  Foo <X, Y, Z> *IVAR_Fooxyz; +Class <X> IVAR_Classx;  }  @end diff --git a/test/CodeGenObjC/synthesize_ivar.m b/test/CodeGenObjC/synthesize_ivar.m index 7646f707bf76..e1746f1da136 100644 --- a/test/CodeGenObjC/synthesize_ivar.m +++ b/test/CodeGenObjC/synthesize_ivar.m @@ -1,8 +1,6 @@  // RUN: clang-cc -triple x86_64-apple-darwin10 -emit-llvm -o %t %s  @interface I -{ -}  @property int IP;  @end @@ -25,3 +23,16 @@  @implementation OrganizerViolatorView  @synthesize bindingInfo;  @end + +// <rdar://problem/7336352> [irgen] crash in synthesized property construction + +@interface I0 @end +@protocol P0 @end +@interface I1 { +  I0<P0> *iv0; +} +@property (assign, readwrite) id p0; +@end +@implementation I1 +@synthesize p0 = iv0; +@end diff --git a/test/Coverage/objc-language-features.inc b/test/Coverage/objc-language-features.inc index dd57dfbedd03..dbbf205fcd6b 100644 --- a/test/Coverage/objc-language-features.inc +++ b/test/Coverage/objc-language-features.inc @@ -14,6 +14,7 @@  @interface A : Root <P1> {    int iv0;    B *iv1; +  B<P1> *iv2;  }  @property(readonly) int p0; @@ -21,11 +22,16 @@  @property(copy) id p2;  @property(retain) id p3;  @property(assign, getter=getme, setter=setme:) id p4; +@property(assign, readwrite) id p5;  @end  @implementation A  @dynamic p0;  @synthesize p1 = iv0; + +// Property type can differ from ivar type. +@synthesize p5 = iv2; +  +(void) fm0 {    [super fm0];  } diff --git a/test/Coverage/targets.c b/test/Coverage/targets.c index 5a87b4dcc554..c4f030fff3d0 100644 --- a/test/Coverage/targets.c +++ b/test/Coverage/targets.c @@ -16,4 +16,8 @@  // RUN: clang-cc -g -triple x86_64-apple-darwin9 -emit-llvm -o %t %s &&  // RUN: clang-cc -g -triple x86_64-pc-linux-gnu -emit-llvm -o %t %s &&  // RUN: clang-cc -g -triple x86_64-unknown-unknown -emit-llvm -o %t %s && + +// <rdar://problem/7181838> clang 1.0 fails to compile Python 2.6 +// RUN: clang -ccc-host-triple x86_64-apple-darwin9 -### -S %s -mmacosx-version-min=10.4 && +  // RUN: true diff --git a/test/Driver/analyze.c b/test/Driver/analyze.c index 5ca890f9ab48..03810688d1f7 100644 --- a/test/Driver/analyze.c +++ b/test/Driver/analyze.c @@ -2,8 +2,8 @@  // (at least for a few key ones).  // RUN: env MACOSX_DEPLOYMENT_TARGET=10.5 clang -ccc-host-triple i386-apple-darwin9  -### --analyze -o /dev/null %s -msse 2> %t.log && -// RUN: grep '"-analyze"' %t.log && -// RUN: grep '"--fmath-errno=0"' %t.log && -// RUN: grep '"-target-feature" "+sse"' %t.log && -// RUN: grep '"-mmacosx-version-min=10.5"' %t.log +// RUN: FileCheck --input-file=%t.log %s +// CHECK: "-analyze" +// CHECK: "-target-feature" "+sse" +// CHECK: "--fmath-errno=0" diff --git a/test/Driver/ccc-add-args.c b/test/Driver/ccc-add-args.c index b504b0b42933..21e4471c1276 100644 --- a/test/Driver/ccc-add-args.c +++ b/test/Driver/ccc-add-args.c @@ -1,3 +1,3 @@ -// RUN: env CCC_ADD_ARGS="-ccc-echo,-ccc-print-options,,-v" clang -### 2> %t && -// RUN: grep -F 'Option 0 - Name: "-v", Values: {}' %t && -// RUN: grep -F 'Option 1 - Name: "-###", Values: {}' %t +// RUN: env CCC_ADD_ARGS="-ccc-echo,-ccc-print-options,,-v" clang -### 2>&1 | FileCheck %s +// CHECK: Option 0 - Name: "-v", Values: {} +// CHECK: Option 1 - Name: "-###", Values: {} diff --git a/test/Driver/hello.c b/test/Driver/hello.c index 7dbe9c74f9c5..ead0d07b57ce 100644 --- a/test/Driver/hello.c +++ b/test/Driver/hello.c @@ -6,6 +6,10 @@  // RUN: %t > %t.out &&  // RUN: grep "I'm a little driver, short and stout." %t.out +// FIXME: We don't have a usable assembler on Windows, so we can't build real +// apps yet. +// XFAIL: win32 +  #include <stdio.h>  int main() { diff --git a/test/Driver/phases.c b/test/Driver/phases.c index 0967d33816fe..61f68c452835 100644 --- a/test/Driver/phases.c +++ b/test/Driver/phases.c @@ -1,79 +1,79 @@  // Basic compilation for various types of files. -// RUN: clang -ccc-host-triple i386-unknown-unknown -ccc-print-phases -x c %s -x objective-c %s -x c++ %s -x objective-c++ -x assembler %s -x assembler-with-cpp %s -x none %s 2> %t && -// RUN: grep '0: input, ".*phases.c", c' %t && -// RUN: grep -F '1: preprocessor, {0}, cpp-output' %t && -// RUN: grep -F '2: compiler, {1}, assembler' %t && -// RUN: grep -F '3: assembler, {2}, object' %t && -// RUN: grep '4: input, ".*phases.c", objective-c' %t && -// RUN: grep -F '5: preprocessor, {4}, objective-c-cpp-output' %t && -// RUN: grep -F '6: compiler, {5}, assembler' %t && -// RUN: grep -F '7: assembler, {6}, object' %t && -// RUN: grep '8: input, ".*phases.c", c++' %t && -// RUN: grep -F '9: preprocessor, {8}, c++-cpp-output' %t && -// RUN: grep -F '10: compiler, {9}, assembler' %t && -// RUN: grep -F '11: assembler, {10}, object' %t && -// RUN: grep '12: input, ".*phases.c", assembler' %t && -// RUN: grep -F '13: assembler, {12}, object' %t && -// RUN: grep '14: input, ".*phases.c", assembler-with-cpp' %t && -// RUN: grep -F '15: preprocessor, {14}, assembler' %t && -// RUN: grep -F '16: assembler, {15}, object' %t && -// RUN: grep '17: input, ".*phases.c", c' %t && -// RUN: grep -F '18: preprocessor, {17}, cpp-output' %t && -// RUN: grep -F '19: compiler, {18}, assembler' %t && -// RUN: grep -F '20: assembler, {19}, object' %t && -// RUN: grep -F '21: linker, {3, 7, 11, 13, 16, 20}, image' %t && +// RUN: clang -ccc-host-triple i386-unknown-unknown -ccc-print-phases -x c %s -x objective-c %s -x c++ %s -x objective-c++ -x assembler %s -x assembler-with-cpp %s -x none %s 2>&1 | FileCheck -check-prefix=BASIC %s && +// BASIC: 0: input, "{{.*}}phases.c", c +// BASIC: 1: preprocessor, {0}, cpp-output +// BASIC: 2: compiler, {1}, assembler +// BASIC: 3: assembler, {2}, object +// BASIC: 4: input, "{{.*}}phases.c", objective-c +// BASIC: 5: preprocessor, {4}, objective-c-cpp-output +// BASIC: 6: compiler, {5}, assembler +// BASIC: 7: assembler, {6}, object +// BASIC: 8: input, "{{.*}}phases.c", c++ +// BASIC: 9: preprocessor, {8}, c++-cpp-output +// BASIC: 10: compiler, {9}, assembler +// BASIC: 11: assembler, {10}, object +// BASIC: 12: input, "{{.*}}phases.c", assembler +// BASIC: 13: assembler, {12}, object +// BASIC: 14: input, "{{.*}}phases.c", assembler-with-cpp +// BASIC: 15: preprocessor, {14}, assembler +// BASIC: 16: assembler, {15}, object +// BASIC: 17: input, "{{.*}}phases.c", c +// BASIC: 18: preprocessor, {17}, cpp-output +// BASIC: 19: compiler, {18}, assembler +// BASIC: 20: assembler, {19}, object +// BASIC: 21: linker, {3, 7, 11, 13, 16, 20}, image  // Universal linked image. -// RUN: clang -ccc-host-triple i386-apple-darwin9 -ccc-print-phases -x c %s -arch ppc -arch i386 2> %t && -// RUN: grep '0: input, ".*phases.c", c' %t && -// RUN: grep -F '1: preprocessor, {0}, cpp-output' %t && -// RUN: grep -F '2: compiler, {1}, assembler' %t && -// RUN: grep -F '3: assembler, {2}, object' %t && -// RUN: grep -F '4: linker, {3}, image' %t && -// RUN: grep -F '5: bind-arch, "ppc", {4}, image' %t && -// RUN: grep -F '6: bind-arch, "i386", {4}, image' %t && -// RUN: grep -F '7: lipo, {5, 6}, image' %t && +// RUN: clang -ccc-host-triple i386-apple-darwin9 -ccc-print-phases -x c %s -arch ppc -arch i386 2>&1 | FileCheck -check-prefix=ULI %s && +// ULI: 0: input, "{{.*}}phases.c", c +// ULI: 1: preprocessor, {0}, cpp-output +// ULI: 2: compiler, {1}, assembler +// ULI: 3: assembler, {2}, object +// ULI: 4: linker, {3}, image +// ULI: 5: bind-arch, "ppc", {4}, image +// ULI: 6: bind-arch, "i386", {4}, image +// ULI: 7: lipo, {5, 6}, image  // Universal object file. -// RUN: clang -ccc-host-triple i386-apple-darwin9 -ccc-print-phases -c -x c %s -arch ppc -arch i386 2> %t && -// RUN: grep '0: input, ".*phases.c", c' %t && -// RUN: grep -F '1: preprocessor, {0}, cpp-output' %t && -// RUN: grep -F '2: compiler, {1}, assembler' %t && -// RUN: grep -F '3: assembler, {2}, object' %t && -// RUN: grep -F '4: bind-arch, "ppc", {3}, object' %t && -// RUN: grep -F '5: bind-arch, "i386", {3}, object' %t && -// RUN: grep -F '6: lipo, {4, 5}, object' %t && +// RUN: clang -ccc-host-triple i386-apple-darwin9 -ccc-print-phases -c -x c %s -arch ppc -arch i386 2>&1 | FileCheck -check-prefix=UOF %s && +// UOF: 0: input, "{{.*}}phases.c", c +// UOF: 1: preprocessor, {0}, cpp-output +// UOF: 2: compiler, {1}, assembler +// UOF: 3: assembler, {2}, object +// UOF: 4: bind-arch, "ppc", {3}, object +// UOF: 5: bind-arch, "i386", {3}, object +// UOF: 6: lipo, {4, 5}, object  // Arch defaulting -// RUN: clang -ccc-host-triple i386-apple-darwin9 -ccc-print-phases -c -x assembler %s 2> %t && -// RUN: grep -F '2: bind-arch, "i386", {1}, object' %t && -// RUN: clang -ccc-host-triple i386-apple-darwin9 -ccc-print-phases -c -x assembler %s -m32 -m64 2> %t && -// RUN: grep -F '2: bind-arch, "x86_64", {1}, object' %t && -// RUN: clang -ccc-host-triple x86_64-apple-darwin9 -ccc-print-phases -c -x assembler %s 2> %t && -// RUN: grep -F '2: bind-arch, "x86_64", {1}, object' %t && -// RUN: clang -ccc-host-triple x86_64-apple-darwin9 -ccc-print-phases -c -x assembler %s -m64 -m32 2> %t && -// RUN: grep -F '2: bind-arch, "i386", {1}, object' %t && +// RUN: clang -ccc-host-triple i386-apple-darwin9 -ccc-print-phases -c -x assembler %s 2>&1 | FileCheck -check-prefix=ARCH1 %s && +// ARCH1: 2: bind-arch, "i386", {1}, object +// RUN: clang -ccc-host-triple i386-apple-darwin9 -ccc-print-phases -c -x assembler %s -m32 -m64 2>&1 | FileCheck -check-prefix=ARCH2 %s && +// ARCH2: 2: bind-arch, "x86_64", {1}, object +// RUN: clang -ccc-host-triple x86_64-apple-darwin9 -ccc-print-phases -c -x assembler %s 2>&1 | FileCheck -check-prefix=ARCH3 %s && +// ARCH3: 2: bind-arch, "x86_64", {1}, object +// RUN: clang -ccc-host-triple x86_64-apple-darwin9 -ccc-print-phases -c -x assembler %s -m64 -m32 2>&1 | FileCheck -check-prefix=ARCH4 %s && +// ARCH4: 2: bind-arch, "i386", {1}, object  // Analyzer -// RUN: clang -ccc-host-triple i386-unknown-unknown -ccc-print-phases --analyze %s 2> %t && -// RUN: grep '0: input, ".*phases.c", c' %t && -// RUN: grep -F '1: preprocessor, {0}, cpp-output' %t && -// RUN: grep -F '2: analyzer, {1}, plist' %t && +// RUN: clang -ccc-host-triple i386-unknown-unknown -ccc-print-phases --analyze %s 2>&1 | FileCheck -check-prefix=ANALYZE %s && +// ANALYZE: 0: input, "{{.*}}phases.c", c +// ANALYZE: 1: preprocessor, {0}, cpp-output +// ANALYZE: 2: analyzer, {1}, plist  // Precompiler -// RUN: clang -ccc-host-triple i386-unknown-unknown -ccc-print-phases -x c-header %s 2> %t && -// RUN: grep '0: input, ".*phases.c", c-header' %t && -// RUN: grep -F '1: preprocessor, {0}, c-header-cpp-output' %t && -// RUN: grep -F '2: precompiler, {1}, precompiled-header' %t && +// RUN: clang -ccc-host-triple i386-unknown-unknown -ccc-print-phases -x c-header %s 2>&1 | FileCheck -check-prefix=PCH %s && +// PCH: 0: input, "{{.*}}phases.c", c-header +// PCH: 1: preprocessor, {0}, c-header-cpp-output +// PCH: 2: precompiler, {1}, precompiled-header  // Darwin overrides the handling for .s  // RUN: touch %t.s && -// RUN: clang -ccc-host-triple i386-unknown-unknown -ccc-print-phases -c %t.s 2> %t && -// RUN: grep '0: input, ".*\.s", assembler' %t && -// RUN: grep -F '1: assembler, {0}, object' %t && -// RUN: clang -ccc-host-triple i386-apple-darwin9 -ccc-print-phases -c %t.s 2> %t && -// RUN: grep '0: input, ".*\.s", assembler-with-cpp' %t && -// RUN: grep -F '1: preprocessor, {0}, assembler' %t && -// RUN: grep -F '2: assembler, {1}, object' %t && +// RUN: clang -ccc-host-triple i386-unknown-unknown -ccc-print-phases -c %t.s 2>&1 | FileCheck -check-prefix=DARWIN1 %s && +// DARWIN1: 0: input, "{{.*}}.s", assembler +// DARWIN1: 1: assembler, {0}, object +// RUN: clang -ccc-host-triple i386-apple-darwin9 -ccc-print-phases -c %t.s 2>&1 | FileCheck -check-prefix=DARWIN2 %s && +// DARWIN2: 0: input, "{{.*}}.s", assembler-with-cpp +// DARWIN2: 1: preprocessor, {0}, assembler +// DARWIN2: 2: assembler, {1}, object  // RUN: true diff --git a/test/Driver/qa_override.c b/test/Driver/qa_override.c index 46e150c74fdc..6f72078f12af 100644 --- a/test/Driver/qa_override.c +++ b/test/Driver/qa_override.c @@ -1,7 +1,5 @@ -// RUN: env QA_OVERRIDE_GCC3_OPTIONS="#+-Os +-Oz +-O +-O3 +-Oignore +a +b +c xb Xa Omagic ^-ccc-print-options  " clang x -O2 b -O3 2> %t && -// RUN: grep '### ' %t | count 0 && -// RUN: grep -F 'Option 0 - Name: "<input>", Values: {"x"}' %t && -// RUN: grep -F 'Option 1 - Name: "-O", Values: {"ignore"}' %t && -// RUN: grep -F 'Option 2 - Name: "-O", Values: {"magic"}' %t && -// RUN: true - +// RUN: env QA_OVERRIDE_GCC3_OPTIONS="#+-Os +-Oz +-O +-O3 +-Oignore +a +b +c xb Xa Omagic ^-ccc-print-options  " clang x -O2 b -O3 2>&1 | FileCheck %s +// CHECK-NOT: ### +// CHECK: Option 0 - Name: "<input>", Values: {"x"} +// CHECK-NEXT: Option 1 - Name: "-O", Values: {"ignore"} +// CHECK-NEXT: Option 2 - Name: "-O", Values: {"magic"} diff --git a/test/Driver/std.c b/test/Driver/std.c index ef6d8f197754..04113d5af134 100644 --- a/test/Driver/std.c +++ b/test/Driver/std.c @@ -1,8 +1,8 @@ -// RUN: clang -std=c99 -trigraphs -std=gnu99 %s -E -o %t && -// RUN: grep '??(??)' %t && -// RUN: clang -ansi %s -E -o %t && -// RUN: grep -F '[]' %t && -// RUN: clang -std=gnu99 -trigraphs %s -E -o %t && -// RUN: grep -F '[]' %t +// RUN: clang -std=c99 -trigraphs -std=gnu99 %s -E -o - | FileCheck -check-prefix=OVERRIDE %s && +// OVERRIDE: ??(??) +// RUN: clang -ansi %s -E -o - | FileCheck -check-prefix=ANSI %s && +// ANSI: [] +// RUN: clang -std=gnu99 -trigraphs %s -E -o - | FileCheck -check-prefix=EXPLICIT %s +// EXPLICIT: []  ??(??) diff --git a/test/FixIt/fixit-pmem.cpp b/test/FixIt/fixit-pmem.cpp new file mode 100644 index 000000000000..bb36f7fa9343 --- /dev/null +++ b/test/FixIt/fixit-pmem.cpp @@ -0,0 +1,23 @@ +// RUN: clang-cc -fsyntax-only -pedantic -fixit %s -o - | clang-cc -fsyntax-only -pedantic -Werror -x c++ - + +/* This is a test of the various code modification hints that are +   provided as part of warning or extension diagnostics. All of the +   warnings will be fixed by -fixit, and the resulting file should +   compile cleanly with -Werror -pedantic. */ + +struct  S { +	int i; +}; + +int foo(int S::* ps, S s, S* p) +{ +  p.*ps = 1; +  return s->*ps; +} + +void foo1(int (S::*ps)(), S s, S* p) +{ +  (p.*ps)(); +  (s->*ps)(); +} + diff --git a/test/Frontend/darwin-version.c b/test/Frontend/darwin-version.c index 513ea197e847..3217b9ad5e3b 100644 --- a/test/Frontend/darwin-version.c +++ b/test/Frontend/darwin-version.c @@ -1,23 +1,23 @@ -// RUN: clang-cc -triple armv6-apple-darwin9 -dM -E -o %t - < /dev/null && -// RUN: grep '__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__' %t | grep '10000' | count 1 && +// RUN: clang -ccc-host-triple armv6-apple-darwin9 -dM -E -o %t %s && +// RUN: grep '__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__' %t | grep '30000' | count 1 &&  // RUN: grep '__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__' %t | count 0 && -// RUN: clang-cc -triple armv6-apple-darwin9 -miphoneos-version-min=2.0 -dM -E -o %t - < /dev/null && +// RUN: clang -ccc-host-triple armv6-apple-darwin9 -miphoneos-version-min=2.0 -dM -E -o %t %s &&  // RUN: grep '__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__' %t | grep '20000' | count 1 &&  // RUN: grep '__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__' %t | count 0 && -// RUN: clang-cc -triple armv6-apple-darwin9 -miphoneos-version-min=2.2 -dM -E -o %t - < /dev/null && +// RUN: clang -ccc-host-triple armv6-apple-darwin9 -miphoneos-version-min=2.2 -dM -E -o %t %s &&  // RUN: grep '__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__' %t | grep '20200' | count 1 && -// RUN: clang-cc -triple i686-apple-darwin8 -dM -E -o %t - < /dev/null && +// RUN: clang -ccc-host-triple i686-apple-darwin8 -dM -E -o %t %s &&  // RUN: grep '__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__' %t | count 0 &&  // RUN: grep '__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__' %t | grep '1040' | count 1 && -// RUN: clang-cc -triple i686-apple-darwin9 -dM -E -o %t - < /dev/null && +// RUN: clang -ccc-host-triple i686-apple-darwin9 -dM -E -o %t %s &&  // RUN: grep '__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__' %t | grep '1050' | count 1 && -// RUN: clang-cc -triple i686-apple-darwin10 -dM -E -o %t - < /dev/null && +// RUN: clang -ccc-host-triple i686-apple-darwin10 -dM -E -o %t %s &&  // RUN: grep '__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__' %t | grep '1060' | count 1 && -// RUN: clang-cc -triple i686-apple-darwin9 -mmacosx-version-min=10.4 -dM -E -o %t - < /dev/null && +// RUN: clang -ccc-host-triple i686-apple-darwin9 -mmacosx-version-min=10.4 -dM -E -o %t %s &&  // RUN: grep '__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__' %t | count 0 &&  // RUN: grep '__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__' %t | grep '1040' | count 1 && -// RUN: clang-cc -triple i686-apple-darwin9 -mmacosx-version-min=10.5 -dM -E -o %t - < /dev/null && +// RUN: clang -ccc-host-triple i686-apple-darwin9 -mmacosx-version-min=10.5 -dM -E -o %t %s &&  // RUN: grep '__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__' %t | grep '1050' | count 1 && -// RUN: clang-cc -triple i686-apple-darwin9 -mmacosx-version-min=10.6 -dM -E -o %t - < /dev/null && +// RUN: clang -ccc-host-triple i686-apple-darwin9 -mmacosx-version-min=10.6 -dM -E -o %t %s &&  // RUN: grep '__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__' %t | grep '1060' | count 1 &&  // RUN: true diff --git a/test/Frontend/dependency-gen.c b/test/Frontend/dependency-gen.c index 4a1611aecff0..953869912bbb 100644 --- a/test/Frontend/dependency-gen.c +++ b/test/Frontend/dependency-gen.c @@ -1,7 +1,8 @@  // rdar://6533411 -// RUN: clang -MD -MF %t.d -c -x c -o %t.o /dev/null &&  +// RUN: clang -MD -MF %t.d -c -x c -o %t.o %s &&   // RUN: grep '.*dependency-gen.*:' %t.d && -// RUN: grep '/dev/null' %t.d && +// RUN: grep 'dependency-gen.c' %t.d && -// RUN: clang -M -x c /dev/null -o %t.deps && -// RUN: grep 'null.o: /dev/null' %t.deps +// RUN: clang -M -x c %s -o %t.d && +// RUN: grep '.*dependency-gen.*:' %t.d && +// RUN: grep 'dependency-gen.c' %t.d diff --git a/test/Lexer/block_cmt_end.c b/test/Lexer/block_cmt_end.c index d85cf81f214a..83d6cf189243 100644 --- a/test/Lexer/block_cmt_end.c +++ b/test/Lexer/block_cmt_end.c @@ -17,7 +17,7 @@ next comment ends with normal escaped newline:  /* expected-warning {{escaped newline}} expected-warning {{backslash and newline}}  *\    / -int bar +int bar /* expected-error {{invalid token after top level declarator}} */  /* xyz @@ -26,7 +26,7 @@ next comment ends with a trigraph escaped newline: */  /* expected-warning {{escaped newline between}}   expected-warning {{backslash and newline separated by space}}    expected-warning {{trigraph ends block comment}}   *??/      / -foo /* expected-error {{invalid token after top level declarator}} */ +foo  // rdar://6060752 - We should not get warnings about trigraphs in comments: diff --git a/test/Makefile b/test/Makefile index 8543d431442b..fdb9d8f713d9 100644 --- a/test/Makefile +++ b/test/Makefile @@ -40,9 +40,10 @@ lit.site.cfg: FORCE  	     -e "s#@LLVM_LIBS_DIR@#$(LibDir)#g" \  	     -e "s#@CLANG_SOURCE_DIR@#$(PROJ_SRC_DIR)/..#g" \  	     -e "s#@CLANG_BINARY_DIR@#$(PROJ_OBJ_DIR)/..#g" \ +	     -e "s#@TARGET_TRIPLE@#$(TARGET_TRIPLE)#g" \  	     $(PROJ_SRC_DIR)/lit.site.cfg.in > $@  clean:: -	@ rm -rf Output/ +	@ find . -name Output | xargs rm -fr  .PHONY: all report clean diff --git a/test/Misc/message-length.c b/test/Misc/message-length.c index 9f4d66fe71c0..4502951dbf62 100644 --- a/test/Misc/message-length.c +++ b/test/Misc/message-length.c @@ -29,4 +29,4 @@ void a_very_long_line(int *ip, float *FloatPointer) {  // CHECK: FILE:23:78 -// CHECK: {{^  ...// some long comment text and a brace, eh {} $}} +// CHECK: {{^  ...// some long comment text and a brace, eh {} }} diff --git a/test/PCH/pr4489.c b/test/PCH/pr4489.c index 7730819e9213..d05d5cd7ddab 100644 --- a/test/PCH/pr4489.c +++ b/test/PCH/pr4489.c @@ -1,5 +1,6 @@  // RUN: clang -x c-header -o %t.pch %s && -// RUN: clang -include %t -x c /dev/null -emit-llvm -S -o - +// RUN: echo > %t.empty.c && +// RUN: clang -include %t -x c %t.empty.c -emit-llvm -S -o -  // PR 4489: Crash with PCH  // PR 4492: Crash with PCH (round two)  // PR 4509: Crash with PCH (round three) @@ -37,4 +38,4 @@ void y1(void)  {    extern char e;    fprintf (0, "asdf"); -}
\ No newline at end of file +} diff --git a/test/Parser/cxx-parse-member-pointer-op.cpp b/test/Parser/cxx-parse-member-pointer-op.cpp new file mode 100644 index 000000000000..cc2e8b142fcb --- /dev/null +++ b/test/Parser/cxx-parse-member-pointer-op.cpp @@ -0,0 +1,13 @@ +// RUN: clang-cc -fsyntax-only -pedantic -verify %s + +struct C {}; + +typedef void (C::*pmfc)(); + +void g(pmfc) { +  C *c; +  c->*pmfc(); // expected-error {{invalid use of pointer to member type after '->*'}} +  C c1; +  c1.*pmfc(); // expected-error {{invalid use of pointer to member type after '.*'}} +} + diff --git a/test/Parser/cxx-template-decl.cpp b/test/Parser/cxx-template-decl.cpp index 9309b72a556e..2b2d3de50497 100644 --- a/test/Parser/cxx-template-decl.cpp +++ b/test/Parser/cxx-template-decl.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang-cc -fsyntax-only -verify -fms-extensions=0 %s  // Errors  export class foo { };   // expected-error {{expected template}} @@ -92,3 +92,7 @@ void f2() {    int x;    A< typeof(x>1) > a;  } + + +// PR3844 +template <> struct S<int> { }; // expected-error{{explicit specialization of non-template struct 'S'}} diff --git a/test/Preprocessor/assembler-with-cpp.c b/test/Preprocessor/assembler-with-cpp.c index f7706ca676ce..4f1c443fc042 100644 --- a/test/Preprocessor/assembler-with-cpp.c +++ b/test/Preprocessor/assembler-with-cpp.c @@ -1,4 +1,4 @@ -// RUN: clang-cc -x assembler-with-cpp -fdollars-in-identifiers=0 -E %s > %t && +// RUN: clang-cc -x assembler-with-cpp -fdollars-in-identifiers=0 -E %s -o - | FileCheck -strict-whitespace -check-prefix=CHECK-Identifiers-False %s &&  #ifndef __ASSEMBLER__  #error "__ASSEMBLER__ not defined" @@ -6,72 +6,70 @@  // Invalid token pasting is ok.  -// RUN: grep '1: X .' %t &&  #define A X ## .  1: A +// CHECK-Identifiers-False: 1: X .  // Line markers are not linemarkers in .S files, they are passed through. -// RUN: grep '# 321' %t &&  # 321 +// CHECK-Identifiers-False: # 321  // Unknown directives are passed through. -// RUN: grep '# B C' %t &&  # B C +// CHECK-Identifiers-False: # B C  // Unknown directives are expanded. -// RUN: grep '# BAR42' %t &&  #define D(x) BAR ## x  # D(42) +// CHECK-Identifiers-False: # BAR42  // Unmatched quotes are permitted. -// RUN: grep "2: '" %t && -// RUN: grep '3: "' %t &&  2: '  3: " +// CHECK-Identifiers-False: 2: ' +// CHECK-Identifiers-False: 3: "  // (balance quotes to keep editors happy): "'  // Empty char literals are ok. -// RUN: grep "4: ''" %t &&  4: '' +// CHECK-Identifiers-False: 4: ''  // Portions of invalid pasting should still expand as macros.  // rdar://6709206 -// RUN: grep "5: expanded (" %t &&  #define M4 expanded  #define M5() M4 ## (  5: M5() +// CHECK-Identifiers-False: 5: expanded (  // rdar://6804322 -// RUN: grep -F "6: blarg $foo" %t &&  #define FOO(name)  name ## $foo  6: FOO(blarg) +// CHECK-Identifiers-False: 6: blarg $foo -// RUN: clang-cc -x assembler-with-cpp -fdollars-in-identifiers=1 -E %s > %t && -// RUN: grep -F "7: blarg$foo" %t && +// RUN: clang-cc -x assembler-with-cpp -fdollars-in-identifiers=1 -E %s -o - | FileCheck -check-prefix=CHECK-Identifiers-True -strict-whitespace %s &&  #define FOO(name)  name ## $foo  7: FOO(blarg) - +// CHECK-Identifiers-True: 7: blarg$foo  //   #define T6() T6 #nostring  #define T7(x) T7 #x  8: T6()  9: T7(foo) -// RUN: grep '8: T6 #nostring' %t && -// RUN: grep '9: T7 "foo"' %t && +// CHECK-Identifiers-True: 8: T6 #nostring +// CHECK-Identifiers-True: 9: T7 "foo"  // Concatenation with period doesn't leave a space -// RUN: grep -F '10: .T8' %t &&  #define T8(A,B) A ## B  10: T8(.,T8) - +// CHECK-Identifiers-True: 10: .T8  // This should not crash. -// RUN: grep '11: #0' %t &&  #define T11(a) #0  11: T11(b) +// CHECK-Identifiers-True: 11: #0  // RUN: true diff --git a/test/Preprocessor/c99-6_10_3_3_p4.c b/test/Preprocessor/c99-6_10_3_3_p4.c index 89660549b9a1..99ad6e88a3f9 100644 --- a/test/Preprocessor/c99-6_10_3_3_p4.c +++ b/test/Preprocessor/c99-6_10_3_3_p4.c @@ -1,6 +1,10 @@ -// RUN: clang-cc -E %s | grep -F 'char p[] = "x ## y";' +// RUN: clang-cc -E %s | FileCheck -strict-whitespace %s +  #define hash_hash # ## #   #define mkstr(a) # a   #define in_between(a) mkstr(a)   #define join(c, d) in_between(c hash_hash d)   char p[] = join(x, y); + +// CHECK: char p[] = "x ## y"; + diff --git a/test/Preprocessor/c99-6_10_3_4_p5.c b/test/Preprocessor/c99-6_10_3_4_p5.c index 22bdf8258cbe..08b2c423601f 100644 --- a/test/Preprocessor/c99-6_10_3_4_p5.c +++ b/test/Preprocessor/c99-6_10_3_4_p5.c @@ -1,10 +1,5 @@  // Example from C99 6.10.3.4p5 - -// RUN: clang-cc -E %s | grep -F 'f(2 * (y+1)) + f(2 * (f(2 * (z[0])))) % f(2 * (0)) + t(1);' && -// RUN: clang-cc -E %s | grep -F 'f(2 * (2 +(3,4)-0,1)) | f(2 * (~ 5)) & f(2 * (0,1))^m(0,1);' && -// RUN: clang-cc -E %s | grep -F 'int i[] = { 1, 23, 4, 5, };' && -// RUN: clang-cc -E %s | grep -F 'char c[2][6] = { "hello", "" };' - +// RUN: clang-cc -E %s | FileCheck -strict-whitespace %s  #define x 3   #define f(a) f(x * (a))  @@ -26,4 +21,8 @@  p() i[q()] = { q(1), r(2,3), r(4,), r(,5), r(,) };   char c[2][6] = { str(hello), str() };  +// CHECK: f(2 * (y+1)) + f(2 * (f(2 * (z[0])))) % f(2 * (0)) + t(1); +// CHECK: f(2 * (2 +(3,4)-0,1)) | f(2 * (~ 5)) & f(2 * (0,1))^m(0,1); +// CHECK: int i[] = { 1, 23, 4, 5, }; +// CHECK: char c[2][6] = { "hello", "" }; diff --git a/test/Preprocessor/c99-6_10_3_4_p6.c b/test/Preprocessor/c99-6_10_3_4_p6.c index c48d2efd2eff..8072d7b87bf2 100644 --- a/test/Preprocessor/c99-6_10_3_4_p6.c +++ b/test/Preprocessor/c99-6_10_3_4_p6.c @@ -1,10 +1,6 @@  // Example from C99 6.10.3.4p6 -// RUN: clang-cc -E %s | grep -F 'printf("x" "1" "= %d, x" "2" "= s" x1, x2);' && -// RUN: clang-cc -E %s | grep 'fputs("strncmp(\\"abc\\\\0d\\" \\"abc\\", .\\\\4.) == 0" ": @\\n", s);' && -// RUN: clang-cc -E %s | grep -F 'include "vers2.h"' && -// RUN: clang-cc -E %s | grep -F '"hello";' && -// RUN: clang-cc -E %s | grep -F '"hello" ", world"' +// RUN: clang-cc -E %s | FileCheck -strict-whitespace %s  #define str(s) # s   #define xstr(s) str(s)  @@ -22,3 +18,10 @@ include xstr(INCFILE(2).h)  glue(HIGH, LOW);   xglue(HIGH, LOW)  + +// CHECK: printf("x" "1" "= %d, x" "2" "= s" x1, x2); +// CHECK: fputs("strncmp(\"abc\\0d\" \"abc\", '\\4') == 0" ": @\n", s); +// CHECK: include "vers2.h" +// CHECK: "hello"; +// CHECK: "hello" ", world" + diff --git a/test/Preprocessor/c99-6_10_3_4_p7.c b/test/Preprocessor/c99-6_10_3_4_p7.c index a53df8263f19..6a7eb48173b8 100644 --- a/test/Preprocessor/c99-6_10_3_4_p7.c +++ b/test/Preprocessor/c99-6_10_3_4_p7.c @@ -1,9 +1,10 @@  // Example from C99 6.10.3.4p7 -// RUN: clang-cc -E %s | grep -F 'int j[] = { 123, 45, 67, 89,' && -// RUN: clang-cc -E %s | grep -F '10, 11, 12, };' +// RUN: clang-cc -E %s | FileCheck -strict-whitespace %s  #define t(x,y,z) x ## y ## z   int j[] = { t(1,2,3), t(,4,5), t(6,,7), t(8,9,),   t(10,,), t(,11,), t(,,12), t(,,) };  +// CHECK: int j[] = { 123, 45, 67, 89, +// CHECK: 10, 11, 12, }; diff --git a/test/Preprocessor/c99-6_10_3_4_p9.c b/test/Preprocessor/c99-6_10_3_4_p9.c index 39c34546ad4d..704241e46e3f 100644 --- a/test/Preprocessor/c99-6_10_3_4_p9.c +++ b/test/Preprocessor/c99-6_10_3_4_p9.c @@ -1,16 +1,20 @@  // Example from C99 6.10.3.4p9 -// RUN: clang-cc -E %s | grep -F 'fprintf(stderr, "Flag");' && -// RUN: clang-cc -E %s | grep -F 'fprintf(stderr, "X = %d\n", x);' && -// RUN: clang-cc -E %s | grep -F 'puts("The first, second, and third items.");' && -// RUN: clang-cc -E %s | grep -F '((x>y)?puts("x>y"): printf("x is %d but y is %d", x, y));' +// RUN: clang-cc -E %s | FileCheck -strict-whitespace %s  #define debug(...) fprintf(stderr, __VA_ARGS__)   #define showlist(...) puts(#__VA_ARGS__)   #define report(test, ...) ((test)?puts(#test):\                             printf(__VA_ARGS__))  -debug("Flag");  -debug("X = %d\n", x);  -showlist(The first, second, and third items.);  -report(x>y, "x is %d but y is %d", x, y);  +debug("Flag"); +// CHECK: fprintf(stderr, "Flag"); + +debug("X = %d\n", x); +// CHECK: fprintf(stderr, "X = %d\n", x); + +showlist(The first, second, and third items.); +// CHECK: puts("The first, second, and third items."); + +report(x>y, "x is %d but y is %d", x, y); +// CHECK: ((x>y)?puts("x>y"): printf("x is %d but y is %d", x, y)); diff --git a/test/Preprocessor/comment_save.c b/test/Preprocessor/comment_save.c index 30b043433c97..ae609b117e7e 100644 --- a/test/Preprocessor/comment_save.c +++ b/test/Preprocessor/comment_save.c @@ -1,7 +1,8 @@ -// RUN: clang-cc -E -C %s | grep '^// foo$' && -// RUN: clang-cc -E -C %s | grep -F '^/* bar */$' +// RUN: clang-cc -E -C %s | FileCheck -strict-whitespace %s  // foo -/* bar */ +// CHECK: // foo +/* bar */ +// CHECK: /* bar */ diff --git a/test/Preprocessor/comment_save_macro.c b/test/Preprocessor/comment_save_macro.c index 66b59d136d73..b9a25ed2e7f3 100644 --- a/test/Preprocessor/comment_save_macro.c +++ b/test/Preprocessor/comment_save_macro.c @@ -1,6 +1,11 @@ -// RUN: clang-cc -E -C %s | grep '^boo bork bar // zot$' && -// RUN: clang-cc -E -CC %s | grep -F '^boo bork /* blah*/ bar // zot$' && -// RUN: clang-cc -E %s | grep '^boo bork bar$' +// RUN: clang-cc -E -C %s | FileCheck -check-prefix=CHECK-C -strict-whitespace %s && +// CHECK-C: boo bork bar // zot + +// RUN: clang-cc -E -CC %s | FileCheck -check-prefix=CHECK-CC -strict-whitespace %s && +// CHECK-CC: boo bork /* blah*/ bar // zot + +// RUN: clang-cc -E %s | FileCheck -check-prefix=CHECK -strict-whitespace %s +// CHECK: boo bork bar  #define FOO bork // blah diff --git a/test/Preprocessor/has_include.c b/test/Preprocessor/has_include.c new file mode 100644 index 000000000000..40697c099f4f --- /dev/null +++ b/test/Preprocessor/has_include.c @@ -0,0 +1,83 @@ +// RUN: clang-cc -Eonly -verify %s + +// Try different path permutations of __has_include with existing file. +#if __has_include("stdio.h") +#else +  #error "__has_include failed (1)." +#endif + +#if __has_include(<stdio.h>) +#else +  #error "__has_include failed (2)." +#endif + +// Try unary expression. +#if !__has_include("stdio.h") +  #error "__has_include failed (5)." +#endif + +// Try binary expression. +#if __has_include("stdio.h") && __has_include("stddef.h") +#else +  #error "__has_include failed (6)." +#endif + +// Try non-existing file. +#if __has_include("blahblah.h") +  #error "__has_include failed (7)." +#endif + +// Try defined. +#if !defined(__has_include) +  #error "defined(__has_include) failed (8)." +#endif + +// Try different path permutations of __has_include_next with existing file. +#if __has_include_next("stddef.h") // expected-warning {{#include_next in primary source file}} +#else +  #error "__has_include failed (1)." +#endif + +#if __has_include_next(<stddef.h>) // expected-warning {{#include_next in primary source file}} +#else +  #error "__has_include failed (2)." +#endif + +// Try unary expression. +#if !__has_include_next("stdio.h") // expected-warning {{#include_next in primary source file}} +  #error "__has_include_next failed (5)." +#endif + +// Try binary expression. +#if __has_include_next("stdio.h") && __has_include("stddef.h") // expected-warning {{#include_next in primary source file}} +#else +  #error "__has_include_next failed (6)." +#endif + +// Try non-existing file. +#if __has_include_next("blahblah.h") // expected-warning {{#include_next in primary source file}} +  #error "__has_include_next failed (7)." +#endif + +// Try defined. +#if !defined(__has_include_next) +  #error "defined(__has_include_next) failed (8)." +#endif + +// Try badly formed expressions. +// FIXME: I don't quite know how to avoid preprocessor side effects. +// Use FileCheck? +// It also assert due to unterminated #if's. +//#if __has_include("stdio.h" +//#if __has_include "stdio.h") +//#if __has_include(stdio.h) +//#if __has_include() +//#if __has_include( +//#if __has_include) +//#if __has_include +//#if __has_include(<stdio.h> +//#if __has_include<stdio.h>) +//#if __has_include("stdio.h) +//#if __has_include(stdio.h") +//#if __has_include(<stdio.h) +//#if __has_include(stdio.h>) diff --git a/test/Preprocessor/init.c b/test/Preprocessor/init.c new file mode 100644 index 000000000000..800b7506f4c2 --- /dev/null +++ b/test/Preprocessor/init.c @@ -0,0 +1,945 @@ +// RUN: clang-cc -E -dM -x=assembler-with-cpp < /dev/null | FileCheck -check-prefix ASM %s && +// +// ASM:#define __ASSEMBLER__ 1 +// +//  +// RUN: clang-cc -fblocks -E -dM < /dev/null | FileCheck -check-prefix BLOCKS %s && +// +// BLOCKS:#define __BLOCKS__ 1 +// BLOCKS:#define __block __attribute__((__blocks__(byref))) +// +//  +// RUN: clang-cc -x=c++ -std=c++0x -E -dM < /dev/null | FileCheck -check-prefix CXX0X %s && +// +// CXX0X:#define _GNU_SOURCE 1 +// CXX0X:#define __DEPRECATED 1 +// CXX0X:#define __GNUG__ +// CXX0X:#define __GXX_EXPERIMENTAL_CXX0X__ 1 +// CXX0X:#define __GXX_WEAK__ 1 +// CXX0X:#define __cplusplus 199711L +// CXX0X:#define __private_extern__ extern +// +//  +// RUN: clang-cc -x=c++ -std=c++98 -E -dM < /dev/null | FileCheck -check-prefix CXX98 %s && +//  +// CXX98:#define _GNU_SOURCE 1 +// CXX98:#define __DEPRECATED 1 +// CXX98:#define __GNUG__ +// CXX98:#define __GXX_WEAK__ 1 +// CXX98:#define __cplusplus 199711L +// CXX98:#define __private_extern__ extern +// +//  +// RUN: clang-cc -std=c99 -E -dM < /dev/null | FileCheck -check-prefix C99 %s && +// +// C99:#define __STDC_VERSION__ 199901L +// C99:#define __STRICT_ANSI__ 1 +// +//  +// RUN: clang-cc -E -dM -fms-extensions=0 < /dev/null | FileCheck -check-prefix COMMON %s && +// +// COMMON:#define __CONSTANT_CFSTRINGS__ 1 +// COMMON:#define __FINITE_MATH_ONLY__ 0 +// COMMON:#define __GNUC_MINOR__ +// COMMON:#define __GNUC_PATCHLEVEL__ +// COMMON:#define __GNUC_STDC_INLINE__ 1 +// COMMON:#define __GNUC__ +// COMMON:#define __GXX_ABI_VERSION +// COMMON:#define __STDC_HOSTED__ 1 +// COMMON:#define __STDC_VERSION__ +// COMMON:#define __STDC__ 1 +// COMMON:#define __VERSION__ +// COMMON:#define __clang__ 1 +// COMMON:#define __llvm__ 1 +// +//  +// RUN: clang-cc -ffreestanding -E -dM < /dev/null | FileCheck -check-prefix FREESTANDING %s && +// FREESTANDING:#define __STDC_HOSTED__ 0 +//  +// RUN: clang-cc -x=c++ -std=gnu++98 -E -dM < /dev/null | FileCheck -check-prefix GXX98 %s && +// +// GXX98:#define _GNU_SOURCE 1 +// GXX98:#define __DEPRECATED 1 +// GXX98:#define __GNUG__ +// GXX98:#define __GXX_WEAK__ 1 +// GXX98:#define __cplusplus 1 +// GXX98:#define __private_extern__ extern +// +//  +// RUN: clang-cc -std=iso9899:199409 -E -dM < /dev/null | FileCheck -check-prefix C94 %s && +// +// C94:#define __STDC_VERSION__ 199409L +// +//  +// RUN: clang-cc -fms-extensions -E -dM < /dev/null | FileCheck -check-prefix MSEXT %s && +// +// MSEXT-NOT:#define __STDC__ +// MSEXT:#define __int16 __INT16_TYPE__ +// MSEXT:#define __int32 __INT32_TYPE__ +// MSEXT:#define __int64 __INT64_TYPE__ +// MSEXT:#define __int8 __INT8_TYPE__ +// +//  +// RUN: clang-cc -x=objective-c -E -dM < /dev/null | FileCheck -check-prefix OBJC %s && +// +// OBJC:#define OBJC_NEW_PROPERTIES 1 +// OBJC:#define __OBJC__ 1 +// +//  +// RUN: clang-cc -x=objective-c -fobjc-gc -E -dM < /dev/null | FileCheck -check-prefix OBJCGC %s && +// +// OBJCGC:#define __OBJC_GC__ 1 +// +//  +// RUN: clang-cc -x=objective-c -fnext-runtime -E -dM < /dev/null | FileCheck -check-prefix NEXTRT %s && +// +// NEXTRT:#define __NEXT_RUNTIME__ 1 +// +//  +// RUN: clang-cc -x=objective-c -fobjc-nonfragile-abi -E -dM < /dev/null | FileCheck -check-prefix NONFRAGILE %s && +// +// NONFRAGILE:#define OBJC_ZEROCOST_EXCEPTIONS 1 +// NONFRAGILE:#define __OBJC2__ 1 +// +//  +// RUN: clang-cc -O1 -E -dM < /dev/null | FileCheck -check-prefix O1 %s && +// +// O1:#define __OPTIMIZE__ 1 +// +//  +// RUN: clang-cc -fpascal-strings -E -dM < /dev/null | FileCheck -check-prefix PASCAL %s && +// +// PASCAL:#define __PASCAL_STRINGS__ 1 +// +//  +// RUN: clang-cc -fsigned-char -E -dM -fms-extensions=0 < /dev/null | FileCheck -check-prefix SCHAR %s && +//  +// SCHAR:#define __STDC__ 1 +// SCHAR-NOT:#define __UNSIGNED_CHAR__ +// SCHAR:#define __clang__ 1 +// +// RUN: clang-cc -E -dM -ffreestanding -triple=arm-none-none < /dev/null | FileCheck -check-prefix ARM %s && +// +// ARM:#define __APCS_32__ 1 +// ARM:#define __ARMEL__ 1 +// ARM:#define __ARM_ARCH_6K__ 1 +// ARM:#define __CHAR_BIT__ 8 +// ARM:#define __DBL_DENORM_MIN__ 4.9406564584124654e-324 +// ARM:#define __DBL_DIG__ 15 +// ARM:#define __DBL_EPSILON__ 2.2204460492503131e-16 +// ARM:#define __DBL_HAS_DENORM__ 1 +// ARM:#define __DBL_HAS_INFINITY__ 1 +// ARM:#define __DBL_HAS_QUIET_NAN__ 1 +// ARM:#define __DBL_MANT_DIG__ 53 +// ARM:#define __DBL_MAX_10_EXP__ 308 +// ARM:#define __DBL_MAX_EXP__ 1024 +// ARM:#define __DBL_MAX__ 1.7976931348623157e+308 +// ARM:#define __DBL_MIN_10_EXP__ (-307) +// ARM:#define __DBL_MIN_EXP__ (-1021) +// ARM:#define __DBL_MIN__ 2.2250738585072014e-308 +// ARM:#define __DECIMAL_DIG__ 17 +// ARM:#define __FLT_DENORM_MIN__ 1.40129846e-45F +// ARM:#define __FLT_DIG__ 6 +// ARM:#define __FLT_EPSILON__ 1.19209290e-7F +// ARM:#define __FLT_EVAL_METHOD__ 0 +// ARM:#define __FLT_HAS_DENORM__ 1 +// ARM:#define __FLT_HAS_INFINITY__ 1 +// ARM:#define __FLT_HAS_QUIET_NAN__ 1 +// ARM:#define __FLT_MANT_DIG__ 24 +// ARM:#define __FLT_MAX_10_EXP__ 38 +// ARM:#define __FLT_MAX_EXP__ 128 +// ARM:#define __FLT_MAX__ 3.40282347e+38F +// ARM:#define __FLT_MIN_10_EXP__ (-37) +// ARM:#define __FLT_MIN_EXP__ (-125) +// ARM:#define __FLT_MIN__ 1.17549435e-38F +// ARM:#define __FLT_RADIX__ 2 +// ARM:#define __INT16_TYPE__ short +// ARM:#define __INT32_TYPE__ int +// ARM:#define __INT64_TYPE__ long long int +// ARM:#define __INT8_TYPE__ char +// ARM:#define __INTMAX_MAX__ 9223372036854775807LL +// ARM:#define __INTMAX_TYPE__ long long int +// ARM:#define __INTPTR_TYPE__ long int +// ARM:#define __INT_MAX__ 2147483647 +// ARM:#define __LDBL_DENORM_MIN__ 4.9406564584124654e-324 +// ARM:#define __LDBL_DIG__ 15 +// ARM:#define __LDBL_EPSILON__ 2.2204460492503131e-16 +// ARM:#define __LDBL_HAS_DENORM__ 1 +// ARM:#define __LDBL_HAS_INFINITY__ 1 +// ARM:#define __LDBL_HAS_QUIET_NAN__ 1 +// ARM:#define __LDBL_MANT_DIG__ 53 +// ARM:#define __LDBL_MAX_10_EXP__ 308 +// ARM:#define __LDBL_MAX_EXP__ 1024 +// ARM:#define __LDBL_MAX__ 1.7976931348623157e+308 +// ARM:#define __LDBL_MIN_10_EXP__ (-307) +// ARM:#define __LDBL_MIN_EXP__ (-1021) +// ARM:#define __LDBL_MIN__ 2.2250738585072014e-308 +// ARM:#define __LITTLE_ENDIAN__ 1 +// ARM:#define __LONG_LONG_MAX__ 9223372036854775807LL +// ARM:#define __LONG_MAX__ 2147483647L +// ARM:#define __NO_INLINE__ 1 +// ARM:#define __POINTER_WIDTH__ 32 +// ARM:#define __PTRDIFF_TYPE__ int +// ARM:#define __SCHAR_MAX__ 127 +// ARM:#define __SHRT_MAX__ 32767 +// ARM:#define __SIZE_TYPE__ unsigned int +// ARM:#define __THUMB_INTERWORK__ 1 +// ARM:#define __UINTMAX_TYPE__ long long unsigned int +// ARM:#define __USER_LABEL_PREFIX__ _ +// ARM:#define __VFP_FP__ 1 +// ARM:#define __WCHAR_MAX__ 2147483647 +// ARM:#define __WCHAR_TYPE__ int +// ARM:#define __WINT_TYPE__ int +// ARM:#define __arm 1 +// ARM:#define __arm__ 1 +// +// RUN: clang-cc -E -dM -ffreestanding -triple=bfin-none-none < /dev/null | FileCheck -check-prefix BFIN %s && +// +// BFIN:#define BFIN 1 +// BFIN:#define __ADSPBLACKFIN__ 1 +// BFIN:#define __ADSPLPBLACKFIN__ 1 +// BFIN:#define __BFIN 1 +// BFIN:#define __BFIN__ 1 +// BFIN:#define __CHAR_BIT__ 8 +// BFIN:#define __DBL_DENORM_MIN__ 4.9406564584124654e-324 +// BFIN:#define __DBL_DIG__ 15 +// BFIN:#define __DBL_EPSILON__ 2.2204460492503131e-16 +// BFIN:#define __DBL_HAS_DENORM__ 1 +// BFIN:#define __DBL_HAS_INFINITY__ 1 +// BFIN:#define __DBL_HAS_QUIET_NAN__ 1 +// BFIN:#define __DBL_MANT_DIG__ 53 +// BFIN:#define __DBL_MAX_10_EXP__ 308 +// BFIN:#define __DBL_MAX_EXP__ 1024 +// BFIN:#define __DBL_MAX__ 1.7976931348623157e+308 +// BFIN:#define __DBL_MIN_10_EXP__ (-307) +// BFIN:#define __DBL_MIN_EXP__ (-1021) +// BFIN:#define __DBL_MIN__ 2.2250738585072014e-308 +// BFIN:#define __DECIMAL_DIG__ 17 +// BFIN:#define __FLT_DENORM_MIN__ 1.40129846e-45F +// BFIN:#define __FLT_DIG__ 6 +// BFIN:#define __FLT_EPSILON__ 1.19209290e-7F +// BFIN:#define __FLT_EVAL_METHOD__ 0 +// BFIN:#define __FLT_HAS_DENORM__ 1 +// BFIN:#define __FLT_HAS_INFINITY__ 1 +// BFIN:#define __FLT_HAS_QUIET_NAN__ 1 +// BFIN:#define __FLT_MANT_DIG__ 24 +// BFIN:#define __FLT_MAX_10_EXP__ 38 +// BFIN:#define __FLT_MAX_EXP__ 128 +// BFIN:#define __FLT_MAX__ 3.40282347e+38F +// BFIN:#define __FLT_MIN_10_EXP__ (-37) +// BFIN:#define __FLT_MIN_EXP__ (-125) +// BFIN:#define __FLT_MIN__ 1.17549435e-38F +// BFIN:#define __FLT_RADIX__ 2 +// BFIN:#define __INT16_TYPE__ short +// BFIN:#define __INT32_TYPE__ int +// BFIN:#define __INT64_TYPE__ long long int +// BFIN:#define __INT8_TYPE__ char +// BFIN:#define __INTMAX_MAX__ 9223372036854775807LL +// BFIN:#define __INTMAX_TYPE__ long long int +// BFIN:#define __INTPTR_TYPE__ long int +// BFIN:#define __INT_MAX__ 2147483647 +// BFIN:#define __LDBL_DENORM_MIN__ 4.9406564584124654e-324 +// BFIN:#define __LDBL_DIG__ 15 +// BFIN:#define __LDBL_EPSILON__ 2.2204460492503131e-16 +// BFIN:#define __LDBL_HAS_DENORM__ 1 +// BFIN:#define __LDBL_HAS_INFINITY__ 1 +// BFIN:#define __LDBL_HAS_QUIET_NAN__ 1 +// BFIN:#define __LDBL_MANT_DIG__ 53 +// BFIN:#define __LDBL_MAX_10_EXP__ 308 +// BFIN:#define __LDBL_MAX_EXP__ 1024 +// BFIN:#define __LDBL_MAX__ 1.7976931348623157e+308 +// BFIN:#define __LDBL_MIN_10_EXP__ (-307) +// BFIN:#define __LDBL_MIN_EXP__ (-1021) +// BFIN:#define __LDBL_MIN__ 2.2250738585072014e-308 +// BFIN:#define __LONG_LONG_MAX__ 9223372036854775807LL +// BFIN:#define __LONG_MAX__ 2147483647L +// BFIN:#define __NO_INLINE__ 1 +// BFIN:#define __POINTER_WIDTH__ 32 +// BFIN:#define __PTRDIFF_TYPE__ long int +// BFIN:#define __SCHAR_MAX__ 127 +// BFIN:#define __SHRT_MAX__ 32767 +// BFIN:#define __SIZE_TYPE__ long unsigned int +// BFIN:#define __UINTMAX_TYPE__ long long unsigned int +// BFIN:#define __USER_LABEL_PREFIX__ _ +// BFIN:#define __WCHAR_MAX__ 2147483647 +// BFIN:#define __WCHAR_TYPE__ int +// BFIN:#define __WINT_TYPE__ int +// BFIN:#define __bfin 1 +// BFIN:#define __bfin__ 1 +// BFIN:#define bfin 1 +// +// RUN: clang-cc -E -dM -ffreestanding -triple=i386-none-none < /dev/null | FileCheck -check-prefix I386 %s && +// +// I386:#define __CHAR_BIT__ 8 +// I386:#define __DBL_DENORM_MIN__ 4.9406564584124654e-324 +// I386:#define __DBL_DIG__ 15 +// I386:#define __DBL_EPSILON__ 2.2204460492503131e-16 +// I386:#define __DBL_HAS_DENORM__ 1 +// I386:#define __DBL_HAS_INFINITY__ 1 +// I386:#define __DBL_HAS_QUIET_NAN__ 1 +// I386:#define __DBL_MANT_DIG__ 53 +// I386:#define __DBL_MAX_10_EXP__ 308 +// I386:#define __DBL_MAX_EXP__ 1024 +// I386:#define __DBL_MAX__ 1.7976931348623157e+308 +// I386:#define __DBL_MIN_10_EXP__ (-307) +// I386:#define __DBL_MIN_EXP__ (-1021) +// I386:#define __DBL_MIN__ 2.2250738585072014e-308 +// I386:#define __DECIMAL_DIG__ 21 +// I386:#define __FLT_DENORM_MIN__ 1.40129846e-45F +// I386:#define __FLT_DIG__ 6 +// I386:#define __FLT_EPSILON__ 1.19209290e-7F +// I386:#define __FLT_EVAL_METHOD__ 0 +// I386:#define __FLT_HAS_DENORM__ 1 +// I386:#define __FLT_HAS_INFINITY__ 1 +// I386:#define __FLT_HAS_QUIET_NAN__ 1 +// I386:#define __FLT_MANT_DIG__ 24 +// I386:#define __FLT_MAX_10_EXP__ 38 +// I386:#define __FLT_MAX_EXP__ 128 +// I386:#define __FLT_MAX__ 3.40282347e+38F +// I386:#define __FLT_MIN_10_EXP__ (-37) +// I386:#define __FLT_MIN_EXP__ (-125) +// I386:#define __FLT_MIN__ 1.17549435e-38F +// I386:#define __FLT_RADIX__ 2 +// I386:#define __INT16_TYPE__ short +// I386:#define __INT32_TYPE__ int +// I386:#define __INT64_TYPE__ long long int +// I386:#define __INT8_TYPE__ char +// I386:#define __INTMAX_MAX__ 9223372036854775807LL +// I386:#define __INTMAX_TYPE__ long long int +// I386:#define __INTPTR_TYPE__ int +// I386:#define __INT_MAX__ 2147483647 +// I386:#define __LDBL_DENORM_MIN__ 3.64519953188247460253e-4951L +// I386:#define __LDBL_DIG__ 18 +// I386:#define __LDBL_EPSILON__ 1.08420217248550443401e-19L +// I386:#define __LDBL_HAS_DENORM__ 1 +// I386:#define __LDBL_HAS_INFINITY__ 1 +// I386:#define __LDBL_HAS_QUIET_NAN__ 1 +// I386:#define __LDBL_MANT_DIG__ 64 +// I386:#define __LDBL_MAX_10_EXP__ 4932 +// I386:#define __LDBL_MAX_EXP__ 16384 +// I386:#define __LDBL_MAX__ 1.18973149535723176502e+4932L +// I386:#define __LDBL_MIN_10_EXP__ (-4931) +// I386:#define __LDBL_MIN_EXP__ (-16381) +// I386:#define __LDBL_MIN__ 3.36210314311209350626e-4932L +// I386:#define __LITTLE_ENDIAN__ 1 +// I386:#define __LONG_LONG_MAX__ 9223372036854775807LL +// I386:#define __LONG_MAX__ 2147483647L +// I386:#define __NO_INLINE__ 1 +// I386:#define __NO_MATH_INLINES 1 +// I386:#define __POINTER_WIDTH__ 32 +// I386:#define __PTRDIFF_TYPE__ int +// I386:#define __REGISTER_PREFIX__  +// I386:#define __SCHAR_MAX__ 127 +// I386:#define __SHRT_MAX__ 32767 +// I386:#define __SIZE_TYPE__ unsigned int +// I386:#define __UINTMAX_TYPE__ long long unsigned int +// I386:#define __USER_LABEL_PREFIX__ _ +// I386:#define __WCHAR_MAX__ 2147483647 +// I386:#define __WCHAR_TYPE__ int +// I386:#define __WINT_TYPE__ int +// I386:#define __i386 1 +// I386:#define __i386__ 1 +// I386:#define __nocona 1 +// I386:#define __nocona__ 1 +// I386:#define __tune_nocona__ 1 +// I386:#define i386 1 +// +// RUN: clang-cc -E -dM -ffreestanding -triple=msp430-none-none < /dev/null | FileCheck -check-prefix MSP430 %s && +// +// MSP430:#define MSP430 1 +// MSP430:#define __CHAR_BIT__ 8 +// MSP430:#define __DBL_DENORM_MIN__ 4.9406564584124654e-324 +// MSP430:#define __DBL_DIG__ 15 +// MSP430:#define __DBL_EPSILON__ 2.2204460492503131e-16 +// MSP430:#define __DBL_HAS_DENORM__ 1 +// MSP430:#define __DBL_HAS_INFINITY__ 1 +// MSP430:#define __DBL_HAS_QUIET_NAN__ 1 +// MSP430:#define __DBL_MANT_DIG__ 53 +// MSP430:#define __DBL_MAX_10_EXP__ 308 +// MSP430:#define __DBL_MAX_EXP__ 1024 +// MSP430:#define __DBL_MAX__ 1.7976931348623157e+308 +// MSP430:#define __DBL_MIN_10_EXP__ (-307) +// MSP430:#define __DBL_MIN_EXP__ (-1021) +// MSP430:#define __DBL_MIN__ 2.2250738585072014e-308 +// MSP430:#define __DECIMAL_DIG__ 17 +// MSP430:#define __FLT_DENORM_MIN__ 1.40129846e-45F +// MSP430:#define __FLT_DIG__ 6 +// MSP430:#define __FLT_EPSILON__ 1.19209290e-7F +// MSP430:#define __FLT_EVAL_METHOD__ 0 +// MSP430:#define __FLT_HAS_DENORM__ 1 +// MSP430:#define __FLT_HAS_INFINITY__ 1 +// MSP430:#define __FLT_HAS_QUIET_NAN__ 1 +// MSP430:#define __FLT_MANT_DIG__ 24 +// MSP430:#define __FLT_MAX_10_EXP__ 38 +// MSP430:#define __FLT_MAX_EXP__ 128 +// MSP430:#define __FLT_MAX__ 3.40282347e+38F +// MSP430:#define __FLT_MIN_10_EXP__ (-37) +// MSP430:#define __FLT_MIN_EXP__ (-125) +// MSP430:#define __FLT_MIN__ 1.17549435e-38F +// MSP430:#define __FLT_RADIX__ 2 +// MSP430:#define __INT16_TYPE__ short +// MSP430:#define __INT32_TYPE__ long long +// MSP430:#define __INT8_TYPE__ char +// MSP430:#define __INTMAX_MAX__ 2147483647L +// MSP430:#define __INTMAX_TYPE__ long int +// MSP430:#define __INTPTR_TYPE__ short +// MSP430:#define __INT_MAX__ 32767 +// MSP430:#define __LDBL_DENORM_MIN__ 4.9406564584124654e-324 +// MSP430:#define __LDBL_DIG__ 15 +// MSP430:#define __LDBL_EPSILON__ 2.2204460492503131e-16 +// MSP430:#define __LDBL_HAS_DENORM__ 1 +// MSP430:#define __LDBL_HAS_INFINITY__ 1 +// MSP430:#define __LDBL_HAS_QUIET_NAN__ 1 +// MSP430:#define __LDBL_MANT_DIG__ 53 +// MSP430:#define __LDBL_MAX_10_EXP__ 308 +// MSP430:#define __LDBL_MAX_EXP__ 1024 +// MSP430:#define __LDBL_MAX__ 1.7976931348623157e+308 +// MSP430:#define __LDBL_MIN_10_EXP__ (-307) +// MSP430:#define __LDBL_MIN_EXP__ (-1021) +// MSP430:#define __LDBL_MIN__ 2.2250738585072014e-308 +// MSP430:#define __LONG_LONG_MAX__ 2147483647LL +// MSP430:#define __LONG_MAX__ 2147483647L +// MSP430:#define __MSP430__ 1 +// MSP430:#define __NO_INLINE__ 1 +// MSP430:#define __POINTER_WIDTH__ 16 +// MSP430:#define __PTRDIFF_TYPE__ int +// MSP430:#define __SCHAR_MAX__ 127 +// MSP430:#define __SHRT_MAX__ 32767 +// MSP430:#define __SIZE_TYPE__ unsigned int +// MSP430:#define __UINTMAX_TYPE__ long unsigned int +// MSP430:#define __USER_LABEL_PREFIX__ _ +// MSP430:#define __WCHAR_MAX__ 2147483647 +// MSP430:#define __WCHAR_TYPE__ int +// MSP430:#define __WINT_TYPE__ int +// MSP430:#define __clang__ 1 +// +// RUN: clang-cc -E -dM -ffreestanding -triple=pic16-none-none < /dev/null | FileCheck -check-prefix PIC16 %s && +// +// PIC16:#define _CONFIG(conf) asm("CONFIG "#conf) +// PIC16:#define __CHAR_BIT__ 8 +// PIC16:#define __DBL_DENORM_MIN__ 1.40129846e-45F +// PIC16:#define __DBL_DIG__ 6 +// PIC16:#define __DBL_EPSILON__ 1.19209290e-7F +// PIC16:#define __DBL_HAS_DENORM__ 1 +// PIC16:#define __DBL_HAS_INFINITY__ 1 +// PIC16:#define __DBL_HAS_QUIET_NAN__ 1 +// PIC16:#define __DBL_MANT_DIG__ 24 +// PIC16:#define __DBL_MAX_10_EXP__ 38 +// PIC16:#define __DBL_MAX_EXP__ 128 +// PIC16:#define __DBL_MAX__ 3.40282347e+38F +// PIC16:#define __DBL_MIN_10_EXP__ (-37) +// PIC16:#define __DBL_MIN_EXP__ (-125) +// PIC16:#define __DBL_MIN__ 1.17549435e-38F +// PIC16:#define __DECIMAL_DIG__ -1 +// PIC16:#define __FLT_DENORM_MIN__ 1.40129846e-45F +// PIC16:#define __FLT_DIG__ 6 +// PIC16:#define __FLT_EPSILON__ 1.19209290e-7F +// PIC16:#define __FLT_EVAL_METHOD__ 0 +// PIC16:#define __FLT_HAS_DENORM__ 1 +// PIC16:#define __FLT_HAS_INFINITY__ 1 +// PIC16:#define __FLT_HAS_QUIET_NAN__ 1 +// PIC16:#define __FLT_MANT_DIG__ 24 +// PIC16:#define __FLT_MAX_10_EXP__ 38 +// PIC16:#define __FLT_MAX_EXP__ 128 +// PIC16:#define __FLT_MAX__ 3.40282347e+38F +// PIC16:#define __FLT_MIN_10_EXP__ (-37) +// PIC16:#define __FLT_MIN_EXP__ (-125) +// PIC16:#define __FLT_MIN__ 1.17549435e-38F +// PIC16:#define __FLT_RADIX__ 2 +// PIC16:#define __INT16_TYPE__ short +// PIC16:#define __INT32_TYPE__ long long +// PIC16:#define __INT8_TYPE__ char +// PIC16:#define __INTMAX_MAX__ 2147483647L +// PIC16:#define __INTMAX_TYPE__ long int +// PIC16:#define __INTPTR_TYPE__ short +// PIC16:#define __INT_MAX__ 32767 +// PIC16:#define __LDBL_DENORM_MIN__ 1.40129846e-45F +// PIC16:#define __LDBL_DIG__ 6 +// PIC16:#define __LDBL_EPSILON__ 1.19209290e-7F +// PIC16:#define __LDBL_HAS_DENORM__ 1 +// PIC16:#define __LDBL_HAS_INFINITY__ 1 +// PIC16:#define __LDBL_HAS_QUIET_NAN__ 1 +// PIC16:#define __LDBL_MANT_DIG__ 24 +// PIC16:#define __LDBL_MAX_10_EXP__ 38 +// PIC16:#define __LDBL_MAX_EXP__ 128 +// PIC16:#define __LDBL_MAX__ 3.40282347e+38F +// PIC16:#define __LDBL_MIN_10_EXP__ (-37) +// PIC16:#define __LDBL_MIN_EXP__ (-125) +// PIC16:#define __LDBL_MIN__ 1.17549435e-38F +// PIC16:#define __LONG_LONG_MAX__ 2147483647LL +// PIC16:#define __LONG_MAX__ 2147483647L +// PIC16:#define __NO_INLINE__ 1 +// PIC16:#define __POINTER_WIDTH__ 16 +// PIC16:#define __PTRDIFF_TYPE__ int +// PIC16:#define __SCHAR_MAX__ 127 +// PIC16:#define __SHRT_MAX__ 32767 +// PIC16:#define __SIZE_TYPE__ unsigned int +// PIC16:#define __UINTMAX_TYPE__ long unsigned int +// PIC16:#define __USER_LABEL_PREFIX__ _ +// PIC16:#define __WCHAR_MAX__ 2147483647 +// PIC16:#define __WCHAR_TYPE__ int +// PIC16:#define __WINT_TYPE__ int +// PIC16:#define __clang__ 1 +// PIC16:#define __llvm__ 1 +// PIC16:#define __pic16 1 +// PIC16:#define _address(Addr) __attribute__((section("Address="#Addr))) +// PIC16:#define _interrupt __attribute__((section("interrupt=0x4"))) __attribute__((used)) +// PIC16:#define _section(SectName) __attribute__((section(SectName))) +// PIC16:#define ram __attribute__((address_space(0))) +// PIC16:#define rom __attribute__((address_space(1))) +// +// RUN: clang-cc -E -dM -ffreestanding -triple=powerpc64-none-none < /dev/null | FileCheck -check-prefix PPC64 %s && +// +// PPC64:#define _ARCH_PPC 1 +// PPC64:#define _ARCH_PPC64 1 +// PPC64:#define _BIG_ENDIAN 1 +// PPC64:#define _LP64 1 +// PPC64:#define __BIG_ENDIAN__ 1 +// PPC64:#define __CHAR_BIT__ 8 +// PPC64:#define __CHAR_UNSIGNED__ 1 +// PPC64:#define __DBL_DENORM_MIN__ 4.9406564584124654e-324 +// PPC64:#define __DBL_DIG__ 15 +// PPC64:#define __DBL_EPSILON__ 2.2204460492503131e-16 +// PPC64:#define __DBL_HAS_DENORM__ 1 +// PPC64:#define __DBL_HAS_INFINITY__ 1 +// PPC64:#define __DBL_HAS_QUIET_NAN__ 1 +// PPC64:#define __DBL_MANT_DIG__ 53 +// PPC64:#define __DBL_MAX_10_EXP__ 308 +// PPC64:#define __DBL_MAX_EXP__ 1024 +// PPC64:#define __DBL_MAX__ 1.7976931348623157e+308 +// PPC64:#define __DBL_MIN_10_EXP__ (-307) +// PPC64:#define __DBL_MIN_EXP__ (-1021) +// PPC64:#define __DBL_MIN__ 2.2250738585072014e-308 +// PPC64:#define __DECIMAL_DIG__ 17 +// PPC64:#define __FLT_DENORM_MIN__ 1.40129846e-45F +// PPC64:#define __FLT_DIG__ 6 +// PPC64:#define __FLT_EPSILON__ 1.19209290e-7F +// PPC64:#define __FLT_EVAL_METHOD__ 0 +// PPC64:#define __FLT_HAS_DENORM__ 1 +// PPC64:#define __FLT_HAS_INFINITY__ 1 +// PPC64:#define __FLT_HAS_QUIET_NAN__ 1 +// PPC64:#define __FLT_MANT_DIG__ 24 +// PPC64:#define __FLT_MAX_10_EXP__ 38 +// PPC64:#define __FLT_MAX_EXP__ 128 +// PPC64:#define __FLT_MAX__ 3.40282347e+38F +// PPC64:#define __FLT_MIN_10_EXP__ (-37) +// PPC64:#define __FLT_MIN_EXP__ (-125) +// PPC64:#define __FLT_MIN__ 1.17549435e-38F +// PPC64:#define __FLT_RADIX__ 2 +// PPC64:#define __INT16_TYPE__ short +// PPC64:#define __INT32_TYPE__ int +// PPC64:#define __INT64_TYPE__ long int +// PPC64:#define __INT8_TYPE__ char +// PPC64:#define __INTMAX_MAX__ 9223372036854775807L +// PPC64:#define __INTMAX_TYPE__ long int +// PPC64:#define __INTPTR_TYPE__ long int +// PPC64:#define __INT_MAX__ 2147483647 +// PPC64:#define __LDBL_DENORM_MIN__ 4.9406564584124654e-324 +// PPC64:#define __LDBL_DIG__ 15 +// PPC64:#define __LDBL_EPSILON__ 2.2204460492503131e-16 +// PPC64:#define __LDBL_HAS_DENORM__ 1 +// PPC64:#define __LDBL_HAS_INFINITY__ 1 +// PPC64:#define __LDBL_HAS_QUIET_NAN__ 1 +// PPC64:#define __LDBL_MANT_DIG__ 53 +// PPC64:#define __LDBL_MAX_10_EXP__ 308 +// PPC64:#define __LDBL_MAX_EXP__ 1024 +// PPC64:#define __LDBL_MAX__ 1.7976931348623157e+308 +// PPC64:#define __LDBL_MIN_10_EXP__ (-307) +// PPC64:#define __LDBL_MIN_EXP__ (-1021) +// PPC64:#define __LDBL_MIN__ 2.2250738585072014e-308 +// PPC64:#define __LONG_DOUBLE_128__ 1 +// PPC64:#define __LONG_LONG_MAX__ 9223372036854775807LL +// PPC64:#define __LONG_MAX__ 9223372036854775807L +// PPC64:#define __LP64__ 1 +// PPC64:#define __NATURAL_ALIGNMENT__ 1 +// PPC64:#define __NO_INLINE__ 1 +// PPC64:#define __POINTER_WIDTH__ 64 +// PPC64:#define __POWERPC__ 1 +// PPC64:#define __PTRDIFF_TYPE__ long int +// PPC64:#define __REGISTER_PREFIX__  +// PPC64:#define __SCHAR_MAX__ 127 +// PPC64:#define __SHRT_MAX__ 32767 +// PPC64:#define __SIZE_TYPE__ long unsigned int +// PPC64:#define __UINTMAX_TYPE__ long unsigned int +// PPC64:#define __USER_LABEL_PREFIX__ _ +// PPC64:#define __WCHAR_MAX__ 2147483647 +// PPC64:#define __WCHAR_TYPE__ int +// PPC64:#define __WINT_TYPE__ int +// PPC64:#define __ppc64__ 1 +// PPC64:#define __ppc__ 1 +// +// RUN: clang-cc -E -dM -ffreestanding -triple=powerpc-none-none < /dev/null | FileCheck -check-prefix PPC %s && +// +// PPC:#define _ARCH_PPC 1 +// PPC:#define _BIG_ENDIAN 1 +// PPC:#define __BIG_ENDIAN__ 1 +// PPC:#define __CHAR_BIT__ 8 +// PPC:#define __CHAR_UNSIGNED__ 1 +// PPC:#define __DBL_DENORM_MIN__ 4.9406564584124654e-324 +// PPC:#define __DBL_DIG__ 15 +// PPC:#define __DBL_EPSILON__ 2.2204460492503131e-16 +// PPC:#define __DBL_HAS_DENORM__ 1 +// PPC:#define __DBL_HAS_INFINITY__ 1 +// PPC:#define __DBL_HAS_QUIET_NAN__ 1 +// PPC:#define __DBL_MANT_DIG__ 53 +// PPC:#define __DBL_MAX_10_EXP__ 308 +// PPC:#define __DBL_MAX_EXP__ 1024 +// PPC:#define __DBL_MAX__ 1.7976931348623157e+308 +// PPC:#define __DBL_MIN_10_EXP__ (-307) +// PPC:#define __DBL_MIN_EXP__ (-1021) +// PPC:#define __DBL_MIN__ 2.2250738585072014e-308 +// PPC:#define __DECIMAL_DIG__ 17 +// PPC:#define __FLT_DENORM_MIN__ 1.40129846e-45F +// PPC:#define __FLT_DIG__ 6 +// PPC:#define __FLT_EPSILON__ 1.19209290e-7F +// PPC:#define __FLT_EVAL_METHOD__ 0 +// PPC:#define __FLT_HAS_DENORM__ 1 +// PPC:#define __FLT_HAS_INFINITY__ 1 +// PPC:#define __FLT_HAS_QUIET_NAN__ 1 +// PPC:#define __FLT_MANT_DIG__ 24 +// PPC:#define __FLT_MAX_10_EXP__ 38 +// PPC:#define __FLT_MAX_EXP__ 128 +// PPC:#define __FLT_MAX__ 3.40282347e+38F +// PPC:#define __FLT_MIN_10_EXP__ (-37) +// PPC:#define __FLT_MIN_EXP__ (-125) +// PPC:#define __FLT_MIN__ 1.17549435e-38F +// PPC:#define __FLT_RADIX__ 2 +// PPC:#define __INT16_TYPE__ short +// PPC:#define __INT32_TYPE__ int +// PPC:#define __INT64_TYPE__ long long int +// PPC:#define __INT8_TYPE__ char +// PPC:#define __INTMAX_MAX__ 9223372036854775807LL +// PPC:#define __INTMAX_TYPE__ long long int +// PPC:#define __INTPTR_TYPE__ long int +// PPC:#define __INT_MAX__ 2147483647 +// PPC:#define __LDBL_DENORM_MIN__ 4.9406564584124654e-324 +// PPC:#define __LDBL_DIG__ 15 +// PPC:#define __LDBL_EPSILON__ 2.2204460492503131e-16 +// PPC:#define __LDBL_HAS_DENORM__ 1 +// PPC:#define __LDBL_HAS_INFINITY__ 1 +// PPC:#define __LDBL_HAS_QUIET_NAN__ 1 +// PPC:#define __LDBL_MANT_DIG__ 53 +// PPC:#define __LDBL_MAX_10_EXP__ 308 +// PPC:#define __LDBL_MAX_EXP__ 1024 +// PPC:#define __LDBL_MAX__ 1.7976931348623157e+308 +// PPC:#define __LDBL_MIN_10_EXP__ (-307) +// PPC:#define __LDBL_MIN_EXP__ (-1021) +// PPC:#define __LDBL_MIN__ 2.2250738585072014e-308 +// PPC:#define __LONG_DOUBLE_128__ 1 +// PPC:#define __LONG_LONG_MAX__ 9223372036854775807LL +// PPC:#define __LONG_MAX__ 2147483647L +// PPC:#define __NATURAL_ALIGNMENT__ 1 +// PPC:#define __NO_INLINE__ 1 +// PPC:#define __POINTER_WIDTH__ 32 +// PPC:#define __POWERPC__ 1 +// PPC:#define __PTRDIFF_TYPE__ long int +// PPC:#define __REGISTER_PREFIX__  +// PPC:#define __SCHAR_MAX__ 127 +// PPC:#define __SHRT_MAX__ 32767 +// PPC:#define __SIZE_TYPE__ long unsigned int +// PPC:#define __UINTMAX_TYPE__ long long unsigned int +// PPC:#define __USER_LABEL_PREFIX__ _ +// PPC:#define __WCHAR_MAX__ 2147483647 +// PPC:#define __WCHAR_TYPE__ int +// PPC:#define __WINT_TYPE__ int +// PPC:#define __ppc__ 1 +// +// RUN: clang-cc -E -dM -ffreestanding -triple=s390x-none-none < /dev/null | FileCheck -check-prefix S390X %s && +// +// S390X:#define __CHAR_BIT__ 8 +// S390X:#define __CHAR_UNSIGNED__ 1 +// S390X:#define __DBL_DENORM_MIN__ 4.9406564584124654e-324 +// S390X:#define __DBL_DIG__ 15 +// S390X:#define __DBL_EPSILON__ 2.2204460492503131e-16 +// S390X:#define __DBL_HAS_DENORM__ 1 +// S390X:#define __DBL_HAS_INFINITY__ 1 +// S390X:#define __DBL_HAS_QUIET_NAN__ 1 +// S390X:#define __DBL_MANT_DIG__ 53 +// S390X:#define __DBL_MAX_10_EXP__ 308 +// S390X:#define __DBL_MAX_EXP__ 1024 +// S390X:#define __DBL_MAX__ 1.7976931348623157e+308 +// S390X:#define __DBL_MIN_10_EXP__ (-307) +// S390X:#define __DBL_MIN_EXP__ (-1021) +// S390X:#define __DBL_MIN__ 2.2250738585072014e-308 +// S390X:#define __DECIMAL_DIG__ 17 +// S390X:#define __FLT_DENORM_MIN__ 1.40129846e-45F +// S390X:#define __FLT_DIG__ 6 +// S390X:#define __FLT_EPSILON__ 1.19209290e-7F +// S390X:#define __FLT_EVAL_METHOD__ 0 +// S390X:#define __FLT_HAS_DENORM__ 1 +// S390X:#define __FLT_HAS_INFINITY__ 1 +// S390X:#define __FLT_HAS_QUIET_NAN__ 1 +// S390X:#define __FLT_MANT_DIG__ 24 +// S390X:#define __FLT_MAX_10_EXP__ 38 +// S390X:#define __FLT_MAX_EXP__ 128 +// S390X:#define __FLT_MAX__ 3.40282347e+38F +// S390X:#define __FLT_MIN_10_EXP__ (-37) +// S390X:#define __FLT_MIN_EXP__ (-125) +// S390X:#define __FLT_MIN__ 1.17549435e-38F +// S390X:#define __FLT_RADIX__ 2 +// S390X:#define __INT16_TYPE__ short +// S390X:#define __INT32_TYPE__ int +// S390X:#define __INT64_TYPE__ long long int +// S390X:#define __INT8_TYPE__ char +// S390X:#define __INTMAX_MAX__ 9223372036854775807LL +// S390X:#define __INTMAX_TYPE__ long long int +// S390X:#define __INTPTR_TYPE__ long int +// S390X:#define __INT_MAX__ 2147483647 +// S390X:#define __LDBL_DENORM_MIN__ 4.9406564584124654e-324 +// S390X:#define __LDBL_DIG__ 15 +// S390X:#define __LDBL_EPSILON__ 2.2204460492503131e-16 +// S390X:#define __LDBL_HAS_DENORM__ 1 +// S390X:#define __LDBL_HAS_INFINITY__ 1 +// S390X:#define __LDBL_HAS_QUIET_NAN__ 1 +// S390X:#define __LDBL_MANT_DIG__ 53 +// S390X:#define __LDBL_MAX_10_EXP__ 308 +// S390X:#define __LDBL_MAX_EXP__ 1024 +// S390X:#define __LDBL_MAX__ 1.7976931348623157e+308 +// S390X:#define __LDBL_MIN_10_EXP__ (-307) +// S390X:#define __LDBL_MIN_EXP__ (-1021) +// S390X:#define __LDBL_MIN__ 2.2250738585072014e-308 +// S390X:#define __LONG_LONG_MAX__ 9223372036854775807LL +// S390X:#define __LONG_MAX__ 9223372036854775807L +// S390X:#define __NO_INLINE__ 1 +// S390X:#define __POINTER_WIDTH__ 64 +// S390X:#define __PTRDIFF_TYPE__ long int +// S390X:#define __SCHAR_MAX__ 127 +// S390X:#define __SHRT_MAX__ 32767 +// S390X:#define __SIZE_TYPE__ long unsigned int +// S390X:#define __UINTMAX_TYPE__ long long unsigned int +// S390X:#define __USER_LABEL_PREFIX__ _ +// S390X:#define __WCHAR_MAX__ 2147483647 +// S390X:#define __WCHAR_TYPE__ int +// S390X:#define __WINT_TYPE__ int +// S390X:#define __s390__ 1 +// S390X:#define __s390x__ 1 +// +// RUN: clang-cc -E -dM -ffreestanding -triple=sparc-none-none < /dev/null | FileCheck -check-prefix SPARC %s && +// +// SPARC:#define __CHAR_BIT__ 8 +// SPARC:#define __DBL_DENORM_MIN__ 4.9406564584124654e-324 +// SPARC:#define __DBL_DIG__ 15 +// SPARC:#define __DBL_EPSILON__ 2.2204460492503131e-16 +// SPARC:#define __DBL_HAS_DENORM__ 1 +// SPARC:#define __DBL_HAS_INFINITY__ 1 +// SPARC:#define __DBL_HAS_QUIET_NAN__ 1 +// SPARC:#define __DBL_MANT_DIG__ 53 +// SPARC:#define __DBL_MAX_10_EXP__ 308 +// SPARC:#define __DBL_MAX_EXP__ 1024 +// SPARC:#define __DBL_MAX__ 1.7976931348623157e+308 +// SPARC:#define __DBL_MIN_10_EXP__ (-307) +// SPARC:#define __DBL_MIN_EXP__ (-1021) +// SPARC:#define __DBL_MIN__ 2.2250738585072014e-308 +// SPARC:#define __DECIMAL_DIG__ 17 +// SPARC:#define __FLT_DENORM_MIN__ 1.40129846e-45F +// SPARC:#define __FLT_DIG__ 6 +// SPARC:#define __FLT_EPSILON__ 1.19209290e-7F +// SPARC:#define __FLT_EVAL_METHOD__ 0 +// SPARC:#define __FLT_HAS_DENORM__ 1 +// SPARC:#define __FLT_HAS_INFINITY__ 1 +// SPARC:#define __FLT_HAS_QUIET_NAN__ 1 +// SPARC:#define __FLT_MANT_DIG__ 24 +// SPARC:#define __FLT_MAX_10_EXP__ 38 +// SPARC:#define __FLT_MAX_EXP__ 128 +// SPARC:#define __FLT_MAX__ 3.40282347e+38F +// SPARC:#define __FLT_MIN_10_EXP__ (-37) +// SPARC:#define __FLT_MIN_EXP__ (-125) +// SPARC:#define __FLT_MIN__ 1.17549435e-38F +// SPARC:#define __FLT_RADIX__ 2 +// SPARC:#define __INT16_TYPE__ short +// SPARC:#define __INT32_TYPE__ int +// SPARC:#define __INT64_TYPE__ long long int +// SPARC:#define __INT8_TYPE__ char +// SPARC:#define __INTMAX_MAX__ 9223372036854775807LL +// SPARC:#define __INTMAX_TYPE__ long long int +// SPARC:#define __INTPTR_TYPE__ long int +// SPARC:#define __INT_MAX__ 2147483647 +// SPARC:#define __LDBL_DENORM_MIN__ 4.9406564584124654e-324 +// SPARC:#define __LDBL_DIG__ 15 +// SPARC:#define __LDBL_EPSILON__ 2.2204460492503131e-16 +// SPARC:#define __LDBL_HAS_DENORM__ 1 +// SPARC:#define __LDBL_HAS_INFINITY__ 1 +// SPARC:#define __LDBL_HAS_QUIET_NAN__ 1 +// SPARC:#define __LDBL_MANT_DIG__ 53 +// SPARC:#define __LDBL_MAX_10_EXP__ 308 +// SPARC:#define __LDBL_MAX_EXP__ 1024 +// SPARC:#define __LDBL_MAX__ 1.7976931348623157e+308 +// SPARC:#define __LDBL_MIN_10_EXP__ (-307) +// SPARC:#define __LDBL_MIN_EXP__ (-1021) +// SPARC:#define __LDBL_MIN__ 2.2250738585072014e-308 +// SPARC:#define __LONG_LONG_MAX__ 9223372036854775807LL +// SPARC:#define __LONG_MAX__ 2147483647L +// SPARC:#define __NO_INLINE__ 1 +// SPARC:#define __POINTER_WIDTH__ 32 +// SPARC:#define __PTRDIFF_TYPE__ long int +// SPARC:#define __REGISTER_PREFIX__  +// SPARC:#define __SCHAR_MAX__ 127 +// SPARC:#define __SHRT_MAX__ 32767 +// SPARC:#define __SIZE_TYPE__ long unsigned int +// SPARC:#define __UINTMAX_TYPE__ long long unsigned int +// SPARC:#define __USER_LABEL_PREFIX__ _ +// SPARC:#define __VERSION__ "4.2.1 Compatible Clang Compiler" +// SPARC:#define __WCHAR_MAX__ 2147483647 +// SPARC:#define __WCHAR_TYPE__ int +// SPARC:#define __WINT_TYPE__ int +// SPARC:#define __sparc 1 +// SPARC:#define __sparc__ 1 +// SPARC:#define __sparcv8 1 +// SPARC:#define sparc 1 +//  +// RUN: clang-cc -E -dM -ffreestanding -triple=tce-none-none < /dev/null | FileCheck -check-prefix TCE %s && +// +// TCE:#define __CHAR_BIT__ 8 +// TCE:#define __DBL_DENORM_MIN__ 1.40129846e-45F +// TCE:#define __DBL_DIG__ 6 +// TCE:#define __DBL_EPSILON__ 1.19209290e-7F +// TCE:#define __DBL_HAS_DENORM__ 1 +// TCE:#define __DBL_HAS_INFINITY__ 1 +// TCE:#define __DBL_HAS_QUIET_NAN__ 1 +// TCE:#define __DBL_MANT_DIG__ 24 +// TCE:#define __DBL_MAX_10_EXP__ 38 +// TCE:#define __DBL_MAX_EXP__ 128 +// TCE:#define __DBL_MAX__ 3.40282347e+38F +// TCE:#define __DBL_MIN_10_EXP__ (-37) +// TCE:#define __DBL_MIN_EXP__ (-125) +// TCE:#define __DBL_MIN__ 1.17549435e-38F +// TCE:#define __DECIMAL_DIG__ -1 +// TCE:#define __FLT_DENORM_MIN__ 1.40129846e-45F +// TCE:#define __FLT_DIG__ 6 +// TCE:#define __FLT_EPSILON__ 1.19209290e-7F +// TCE:#define __FLT_EVAL_METHOD__ 0 +// TCE:#define __FLT_HAS_DENORM__ 1 +// TCE:#define __FLT_HAS_INFINITY__ 1 +// TCE:#define __FLT_HAS_QUIET_NAN__ 1 +// TCE:#define __FLT_MANT_DIG__ 24 +// TCE:#define __FLT_MAX_10_EXP__ 38 +// TCE:#define __FLT_MAX_EXP__ 128 +// TCE:#define __FLT_MAX__ 3.40282347e+38F +// TCE:#define __FLT_MIN_10_EXP__ (-37) +// TCE:#define __FLT_MIN_EXP__ (-125) +// TCE:#define __FLT_MIN__ 1.17549435e-38F +// TCE:#define __FLT_RADIX__ 2 +// TCE:#define __INT16_TYPE__ short +// TCE:#define __INT32_TYPE__ int +// TCE:#define __INT8_TYPE__ char +// TCE:#define __INTMAX_MAX__ 2147483647L +// TCE:#define __INTMAX_TYPE__ long int +// TCE:#define __INTPTR_TYPE__ int +// TCE:#define __INT_MAX__ 2147483647 +// TCE:#define __LDBL_DENORM_MIN__ 1.40129846e-45F +// TCE:#define __LDBL_DIG__ 6 +// TCE:#define __LDBL_EPSILON__ 1.19209290e-7F +// TCE:#define __LDBL_HAS_DENORM__ 1 +// TCE:#define __LDBL_HAS_INFINITY__ 1 +// TCE:#define __LDBL_HAS_QUIET_NAN__ 1 +// TCE:#define __LDBL_MANT_DIG__ 24 +// TCE:#define __LDBL_MAX_10_EXP__ 38 +// TCE:#define __LDBL_MAX_EXP__ 128 +// TCE:#define __LDBL_MAX__ 3.40282347e+38F +// TCE:#define __LDBL_MIN_10_EXP__ (-37) +// TCE:#define __LDBL_MIN_EXP__ (-125) +// TCE:#define __LDBL_MIN__ 1.17549435e-38F +// TCE:#define __LONG_LONG_MAX__ 2147483647LL +// TCE:#define __LONG_MAX__ 2147483647L +// TCE:#define __NO_INLINE__ 1 +// TCE:#define __POINTER_WIDTH__ 32 +// TCE:#define __PTRDIFF_TYPE__ int +// TCE:#define __SCHAR_MAX__ 127 +// TCE:#define __SHRT_MAX__ 32767 +// TCE:#define __SIZE_TYPE__ unsigned int +// TCE:#define __TCE_V1__ 1 +// TCE:#define __TCE__ 1 +// TCE:#define __UINTMAX_TYPE__ long unsigned int +// TCE:#define __USER_LABEL_PREFIX__ _ +// TCE:#define __WCHAR_MAX__ 2147483647 +// TCE:#define __WCHAR_TYPE__ int +// TCE:#define __WINT_TYPE__ int +// TCE:#define __tce 1 +// TCE:#define __tce__ 1 +// TCE:#define tce 1 +// +// RUN: clang-cc -E -dM -ffreestanding -triple=x86_64-none-none < /dev/null | FileCheck -check-prefix X86_64 %s && +// +// X86_64:#define _LP64 1 +// X86_64:#define __CHAR_BIT__ 8 +// X86_64:#define __DBL_DENORM_MIN__ 4.9406564584124654e-324 +// X86_64:#define __DBL_DIG__ 15 +// X86_64:#define __DBL_EPSILON__ 2.2204460492503131e-16 +// X86_64:#define __DBL_HAS_DENORM__ 1 +// X86_64:#define __DBL_HAS_INFINITY__ 1 +// X86_64:#define __DBL_HAS_QUIET_NAN__ 1 +// X86_64:#define __DBL_MANT_DIG__ 53 +// X86_64:#define __DBL_MAX_10_EXP__ 308 +// X86_64:#define __DBL_MAX_EXP__ 1024 +// X86_64:#define __DBL_MAX__ 1.7976931348623157e+308 +// X86_64:#define __DBL_MIN_10_EXP__ (-307) +// X86_64:#define __DBL_MIN_EXP__ (-1021) +// X86_64:#define __DBL_MIN__ 2.2250738585072014e-308 +// X86_64:#define __DECIMAL_DIG__ 21 +// X86_64:#define __FLT_DENORM_MIN__ 1.40129846e-45F +// X86_64:#define __FLT_DIG__ 6 +// X86_64:#define __FLT_EPSILON__ 1.19209290e-7F +// X86_64:#define __FLT_EVAL_METHOD__ 0 +// X86_64:#define __FLT_HAS_DENORM__ 1 +// X86_64:#define __FLT_HAS_INFINITY__ 1 +// X86_64:#define __FLT_HAS_QUIET_NAN__ 1 +// X86_64:#define __FLT_MANT_DIG__ 24 +// X86_64:#define __FLT_MAX_10_EXP__ 38 +// X86_64:#define __FLT_MAX_EXP__ 128 +// X86_64:#define __FLT_MAX__ 3.40282347e+38F +// X86_64:#define __FLT_MIN_10_EXP__ (-37) +// X86_64:#define __FLT_MIN_EXP__ (-125) +// X86_64:#define __FLT_MIN__ 1.17549435e-38F +// X86_64:#define __FLT_RADIX__ 2 +// X86_64:#define __INT16_TYPE__ short +// X86_64:#define __INT32_TYPE__ int +// X86_64:#define __INT64_TYPE__ long int +// X86_64:#define __INT8_TYPE__ char +// X86_64:#define __INTMAX_MAX__ 9223372036854775807L +// X86_64:#define __INTMAX_TYPE__ long int +// X86_64:#define __INTPTR_TYPE__ long int +// X86_64:#define __INT_MAX__ 2147483647 +// X86_64:#define __LDBL_DENORM_MIN__ 3.64519953188247460253e-4951L +// X86_64:#define __LDBL_DIG__ 18 +// X86_64:#define __LDBL_EPSILON__ 1.08420217248550443401e-19L +// X86_64:#define __LDBL_HAS_DENORM__ 1 +// X86_64:#define __LDBL_HAS_INFINITY__ 1 +// X86_64:#define __LDBL_HAS_QUIET_NAN__ 1 +// X86_64:#define __LDBL_MANT_DIG__ 64 +// X86_64:#define __LDBL_MAX_10_EXP__ 4932 +// X86_64:#define __LDBL_MAX_EXP__ 16384 +// X86_64:#define __LDBL_MAX__ 1.18973149535723176502e+4932L +// X86_64:#define __LDBL_MIN_10_EXP__ (-4931) +// X86_64:#define __LDBL_MIN_EXP__ (-16381) +// X86_64:#define __LDBL_MIN__ 3.36210314311209350626e-4932L +// X86_64:#define __LITTLE_ENDIAN__ 1 +// X86_64:#define __LONG_LONG_MAX__ 9223372036854775807LL +// X86_64:#define __LONG_MAX__ 9223372036854775807L +// X86_64:#define __LP64__ 1 +// X86_64:#define __MMX__ 1 +// X86_64:#define __NO_INLINE__ 1 +// X86_64:#define __NO_MATH_INLINES 1 +// X86_64:#define __POINTER_WIDTH__ 64 +// X86_64:#define __PTRDIFF_TYPE__ long int +// X86_64:#define __REGISTER_PREFIX__  +// X86_64:#define __SCHAR_MAX__ 127 +// X86_64:#define __SHRT_MAX__ 32767 +// X86_64:#define __SIZE_TYPE__ long unsigned int +// X86_64:#define __SSE2_MATH__ 1 +// X86_64:#define __SSE2__ 1 +// X86_64:#define __SSE_MATH__ 1 +// X86_64:#define __SSE__ 1 +// X86_64:#define __UINTMAX_TYPE__ long unsigned int +// X86_64:#define __USER_LABEL_PREFIX__ _ +// X86_64:#define __WCHAR_MAX__ 2147483647 +// X86_64:#define __WCHAR_TYPE__ int +// X86_64:#define __WINT_TYPE__ int +// X86_64:#define __amd64 1 +// X86_64:#define __amd64__ 1 +// X86_64:#define __nocona 1 +// X86_64:#define __nocona__ 1 +// X86_64:#define __tune_nocona__ 1 +// X86_64:#define __x86_64 1 +// X86_64:#define __x86_64__ 1 +// +// RUN: true diff --git a/test/Preprocessor/line-directive.c b/test/Preprocessor/line-directive.c index ed9a6c40e5d7..4ebf95bab44c 100644 --- a/test/Preprocessor/line-directive.c +++ b/test/Preprocessor/line-directive.c @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify -pedantic %s && +// RUN: clang-cc -fsyntax-only -verify -pedantic -fms-extensions=0 %s &&  // RUN: clang-cc -E %s 2>&1 | grep 'blonk.c:92:2: error: #error ABC' &&  // RUN: clang-cc -E %s 2>&1 | grep 'blonk.c:93:2: error: #error DEF' diff --git a/test/Preprocessor/macro_disable3.c b/test/Preprocessor/macro_disable3.c index 011de3beed3d..d4a5664ae999 100644 --- a/test/Preprocessor/macro_disable3.c +++ b/test/Preprocessor/macro_disable3.c @@ -1,4 +1,4 @@ -// RUN: clang-cc %s -E | grep -F 'f(2 * (f(2 * (z[0]))));' +// RUN: clang-cc %s -E | FileCheck -strict-whitespace %s  // Check for C99 6.10.3.4p2.  #define f(a) f(x * (a))  @@ -6,3 +6,5 @@  #define z z[0]   f(f(z));  +// CHECK: f(2 * (f(2 * (z[0])))); + diff --git a/test/Preprocessor/macro_paste_mscomment.c b/test/Preprocessor/macro_paste_mscomment.c index d6ead91068cf..ecd0b9d6a850 100644 --- a/test/Preprocessor/macro_paste_mscomment.c +++ b/test/Preprocessor/macro_paste_mscomment.c @@ -1,5 +1,4 @@ -// RUN: clang-cc -P -E -fms-extensions %s | sed '/^#.\+/d' | tr -d '\n' > %t && -// RUN: grep '^int foo;int bar;int baz;$' %t | count 1 +// RUN: clang-cc -P -E -fms-extensions %s | FileCheck -strict-whitespace %s  // This horrible stuff should preprocess into (other than whitespace):  //   int foo;  //   int bar; @@ -7,14 +6,21 @@  int foo; +// CHECK: int foo; +  #define comment /##/  dead tokens live here  comment This is stupidity  int bar; +// CHECK: int bar; +  #define nested(x) int x comment cute little dead tokens...  nested(baz)  rise of the dead tokens  ; +// CHECK: int baz +// CHECK: ; + diff --git a/test/Preprocessor/macro_rescan_varargs.c b/test/Preprocessor/macro_rescan_varargs.c index ed1056ab1b3f..8a3ad151141f 100644 --- a/test/Preprocessor/macro_rescan_varargs.c +++ b/test/Preprocessor/macro_rescan_varargs.c @@ -1,5 +1,5 @@ -// RUN: clang-cc -E %s | grep -F "1: F, (, 'a', 'b', );" && -// RUN: clang-cc -E %s | grep -F "2: 'a' + 'b';" +// RUN: clang-cc -E %s | FileCheck -strict-whitespace %s +  #define LPAREN (   #define RPAREN )   #define F(x, y) x + y  @@ -8,3 +8,6 @@  1: ELLIP_FUNC(F, LPAREN, 'a', 'b', RPAREN); /* 1st invocation */   2: ELLIP_FUNC(F LPAREN 'a', 'b' RPAREN); /* 2nd invocation */  +// CHECK: 1: F, (, 'a', 'b', ); +// CHECK: 2: 'a' + 'b'; + diff --git a/test/Preprocessor/macro_rparen_scan2.c b/test/Preprocessor/macro_rparen_scan2.c index 41748ac459b9..c7fb9e3b08c9 100644 --- a/test/Preprocessor/macro_rparen_scan2.c +++ b/test/Preprocessor/macro_rparen_scan2.c @@ -1,4 +1,4 @@ -// RUN: clang-cc -E %s | grep -F 'static int glob = (1 + 1 );' +// RUN: clang-cc -E %s | FileCheck -strict-whitespace %s  #define R_PAREN )  @@ -6,3 +6,5 @@  static int glob = (1 + FUNC(1 R_PAREN );  +// CHECK: static int glob = (1 + 1 ); + diff --git a/test/Preprocessor/macro_undef.c b/test/Preprocessor/macro_undef.c new file mode 100644 index 000000000000..4507cddcb796 --- /dev/null +++ b/test/Preprocessor/macro_undef.c @@ -0,0 +1,4 @@ +// RUN: clang-cc -dM -undef -Dfoo=1 -E %s | FileCheck %s + +// CHECK-NOT: #define __clang__ +// CHECK: #define foo 1 diff --git a/test/Preprocessor/output_paste_avoid.c b/test/Preprocessor/output_paste_avoid.c index ff8afc3e47ac..200ced9fba7a 100644 --- a/test/Preprocessor/output_paste_avoid.c +++ b/test/Preprocessor/output_paste_avoid.c @@ -1,23 +1,26 @@ -// RUN: clang-cc -E %s -o %t && -// This should print as ".. ." to avoid turning into ... -// RUN: grep -F 'A: . . .' %t && +// RUN: clang-cc -E %s -o - | FileCheck -strict-whitespace %s + +  #define y(a) ..a  A: y(.) +// This should print as ".. ." to avoid turning into ... +// CHECK: A: . . . + -// RUN: grep -F 'C: .. .' %t &&  #define DOT .  C: ..DOT +// CHECK: C: .. . -// RUN: grep -F 'D: + + - - + + = = =' %t &&  #define PLUS +  #define EMPTY  #define f(x) =x=  D: +PLUS -EMPTY- PLUS+ f(=) +// CHECK: D: + + - - + + = = = -// RUN: grep -F 'E: L "str"' %t -// Should expand to L "str" not L"str"  #define test(x) L#x  E: test(str) +// Should expand to L "str" not L"str" +// CHECK: E: L "str" diff --git a/test/Preprocessor/stdint.c b/test/Preprocessor/stdint.c new file mode 100644 index 000000000000..e292bd3ec7e5 --- /dev/null +++ b/test/Preprocessor/stdint.c @@ -0,0 +1,1244 @@ +// RUN: clang-cc -E -ffreestanding -triple=arm-none-none %s | FileCheck -check-prefix ARM %s && +// +// ARM:typedef signed char int8_t; +// ARM:typedef short int16_t; +// ARM:typedef int int32_t; +// ARM:typedef long long int int64_t; +// +// ARM:typedef unsigned char uint8_t; +// ARM:typedef int8_t int_least8_t; +// ARM:typedef uint8_t uint_least8_t; +// ARM:typedef int8_t int_fast8_t; +// ARM:typedef uint8_t uint_fast8_t; +// +// ARM:typedef unsigned short uint16_t; +// ARM:typedef int16_t int_least16_t; +// ARM:typedef uint16_t uint_least16_t; +// ARM:typedef int16_t int_fast16_t; +// ARM:typedef uint16_t uint_fast16_t; +// +// ARM:typedef unsigned int uint32_t; +// ARM:typedef int32_t int_least32_t; +// ARM:typedef uint32_t uint_least32_t; +// ARM:typedef int32_t int_fast32_t; +// ARM:typedef uint32_t uint_fast32_t; +// +// ARM:typedef unsigned long long int uint64_t; +// ARM:typedef int64_t int_least64_t; +// ARM:typedef uint64_t uint_least64_t; +// ARM:typedef int64_t int_fast64_t; +// ARM:typedef uint64_t uint_fast64_t; +//  +// ARM:typedef long int intptr_t; +// ARM:typedef unsigned long int uintptr_t; +//  +// ARM:typedef long long int intmax_t; +// ARM:typedef long long unsigned int uintmax_t; +// +// ARM:INT8_MAX_ 127 +// ARM:INT8_MIN_ (-128) +// ARM:UINT8_MAX_ 255 +// ARM:INT_LEAST8_MIN_ (-128) +// ARM:INT_LEAST8_MAX_ 127 +// ARM:UINT_LEAST8_MAX_ 255 +// ARM:INT_FAST8_MIN_ (-128) +// ARM:INT_FAST8_MAX_ 127 +// ARM:UINT_FAST8_MAX_ 255 +// +// ARM:INT16_MAX_ 32767 +// ARM:INT16_MIN_ (-32768) +// ARM:UINT16_MAX_ 65535 +// ARM:INT_LEAST16_MIN_ (-32768) +// ARM:INT_LEAST16_MAX_ 32767 +// ARM:UINT_LEAST16_MAX_ 65535 +// ARM:INT_FAST16_MIN_ (-32768) +// ARM:INT_FAST16_MAX_ 32767 +// ARM:UINT_FAST16_MAX_ 65535 +// +// ARM:INT32_MAX_ 2147483647 +// ARM:INT32_MIN_ (-2147483647 -1) +// ARM:UINT32_MAX_ 4294967295U +// ARM:INT_LEAST32_MIN_ (-2147483647 -1) +// ARM:INT_LEAST32_MAX_ 2147483647 +// ARM:UINT_LEAST32_MAX_ 4294967295U +// ARM:INT_FAST32_MIN_ (-2147483647 -1) +// ARM:INT_FAST32_MAX_ 2147483647 +// ARM:UINT_FAST32_MAX_ 4294967295U +// +// ARM:INT64_MAX_ 9223372036854775807LL +// ARM:INT64_MIN_ (-9223372036854775807LL -1) +// ARM:UINT64_MAX_ 18446744073709551615ULL +// ARM:INT_LEAST64_MIN_ (-9223372036854775807LL -1) +// ARM:INT_LEAST64_MAX_ 9223372036854775807LL +// ARM:UINT_LEAST64_MAX_ 18446744073709551615ULL +// ARM:INT_FAST64_MIN_ (-9223372036854775807LL -1) +// ARM:INT_FAST64_MAX_ 9223372036854775807LL +// ARM:UINT_FAST64_MAX_ 18446744073709551615ULL +// +// ARM:INTPTR_MIN_ (-2147483647 -1) +// ARM:INTPTR_MAX_ 2147483647 +// ARM:UINTPTR_MAX_ 4294967295U +// ARM:PTRDIFF_MIN_ (-2147483647 -1) +// ARM:PTRDIFF_MAX_ 2147483647 +// ARM:SIZE_MAX_ 4294967295U +// +// ARM:INTMAX_MIN_ (-9223372036854775807LL -1) +// ARM:INTMAX_MAX_ 9223372036854775807LL +// ARM:UINTMAX_MAX_ (9223372036854775807LL*2ULL +1ULL) +// +// ARM:SIG_ATOMIC_MIN_ (-2147483647 -1) +// ARM:SIG_ATOMIC_MAX_ 2147483647 +// ARM:WINT_MIN_ (-2147483647 -1) +// ARM:WINT_MAX_ 2147483647 +// +// ARM:WCHAR_MAX_ 2147483647 +// ARM:WCHAR_MIN_ (-2147483647 -1) +// +// ARM:INT8_C_(0) (0) +// ARM:UINT8_C_(0) (0U) +// ARM:INT16_C_(0) (0) +// ARM:UINT16_C_(0) (0U) +// ARM:INT32_C_(0) (0) +// ARM:UINT32_C_(0) (0U) +// ARM:INT64_C_(0) (0LL) +// ARM:UINT64_C_(0) (0ULL) +// +// ARM:INTMAX_C_(0) (0LL) +// ARM:UINTMAX_C_(0) (0ULL) +// +// +// RUN: clang-cc -E -ffreestanding -triple=bfin-none-none %s | FileCheck -check-prefix BFIN %s && +// +// BFIN:typedef signed char int8_t; +// BFIN:typedef short int16_t; +// BFIN:typedef int int32_t; +// +// BFIN:typedef long long int int64_t; +// +// BFIN:typedef unsigned char uint8_t; +// BFIN:typedef int8_t int_least8_t; +// BFIN:typedef uint8_t uint_least8_t; +// BFIN:typedef int8_t int_fast8_t; +// BFIN:typedef uint8_t uint_fast8_t; +// +// BFIN:typedef unsigned short uint16_t; +// BFIN:typedef int16_t int_least16_t; +// BFIN:typedef uint16_t uint_least16_t; +// BFIN:typedef int16_t int_fast16_t; +// BFIN:typedef uint16_t uint_fast16_t; +// +// BFIN:typedef unsigned int uint32_t; +// BFIN:typedef int32_t int_least32_t; +// BFIN:typedef uint32_t uint_least32_t; +// BFIN:typedef int32_t int_fast32_t; +// BFIN:typedef uint32_t uint_fast32_t; +// +// BFIN:typedef unsigned long long int uint64_t; +// BFIN:typedef int64_t int_least64_t; +// BFIN:typedef uint64_t uint_least64_t; +// BFIN:typedef int64_t int_fast64_t; +// BFIN:typedef uint64_t uint_fast64_t; +// +// BFIN:typedef long int intptr_t; +// BFIN:typedef unsigned long int uintptr_t; +// +// BFIN:typedef long long int intmax_t; +// BFIN:typedef long long unsigned int uintmax_t; +// +// BFIN:INT8_MAX_ 127 +// BFIN:INT8_MIN_ (-128) +// BFIN:UINT8_MAX_ 255 +// BFIN:INT_LEAST8_MIN_ (-128) +// BFIN:INT_LEAST8_MAX_ 127 +// BFIN:UINT_LEAST8_MAX_ 255 +// BFIN:INT_FAST8_MIN_ (-128) +// BFIN:INT_FAST8_MAX_ 127 +// BFIN:UINT_FAST8_MAX_ 255 +// +// BFIN:INT16_MAX_ 32767 +// BFIN:INT16_MIN_ (-32768) +// BFIN:UINT16_MAX_ 65535 +// BFIN:INT_LEAST16_MIN_ (-32768) +// BFIN:INT_LEAST16_MAX_ 32767 +// BFIN:UINT_LEAST16_MAX_ 65535 +// BFIN:INT_FAST16_MIN_ (-32768) +// BFIN:INT_FAST16_MAX_ 32767 +// BFIN:UINT_FAST16_MAX_ 65535 +// +// BFIN:INT32_MAX_ 2147483647 +// BFIN:INT32_MIN_ (-2147483647 -1) +// BFIN:UINT32_MAX_ 4294967295U +// BFIN:INT_LEAST32_MIN_ (-2147483647 -1) +// BFIN:INT_LEAST32_MAX_ 2147483647 +// BFIN:UINT_LEAST32_MAX_ 4294967295U +// BFIN:INT_FAST32_MIN_ (-2147483647 -1) +// BFIN:INT_FAST32_MAX_ 2147483647 +// BFIN:UINT_FAST32_MAX_ 4294967295U +// +// BFIN:INT64_MAX_ 9223372036854775807LL +// BFIN:INT64_MIN_ (-9223372036854775807LL -1) +// BFIN:UINT64_MAX_ 18446744073709551615ULL +// BFIN:INT_LEAST64_MIN_ (-9223372036854775807LL -1) +// BFIN:INT_LEAST64_MAX_ 9223372036854775807LL +// BFIN:UINT_LEAST64_MAX_ 18446744073709551615ULL +// BFIN:INT_FAST64_MIN_ (-9223372036854775807LL -1) +// BFIN:INT_FAST64_MAX_ 9223372036854775807LL +// BFIN:UINT_FAST64_MAX_ 18446744073709551615ULL +// +// BFIN:INTPTR_MIN_ (-2147483647 -1) +// BFIN:INTPTR_MAX_ 2147483647 +// BFIN:UINTPTR_MAX_ 4294967295U +// BFIN:PTRDIFF_MIN_ (-2147483647 -1) +// BFIN:PTRDIFF_MAX_ 2147483647 +// BFIN:SIZE_MAX_ 4294967295U +// +// BFIN:INTMAX_MIN_ (-9223372036854775807LL -1) +// BFIN:INTMAX_MAX_ 9223372036854775807LL +// BFIN:UINTMAX_MAX_ (9223372036854775807LL*2ULL +1ULL) +// +// BFIN:SIG_ATOMIC_MIN_ (-2147483647 -1) +// BFIN:SIG_ATOMIC_MAX_ 2147483647 +// BFIN:WINT_MIN_ (-2147483647 -1) +// BFIN:WINT_MAX_ 2147483647 +// +// BFIN:WCHAR_MAX_ 2147483647 +// BFIN:WCHAR_MIN_ (-2147483647 -1) +// +// BFIN:INT8_C_(0) (0) +// BFIN:UINT8_C_(0) (0U) +// BFIN:INT16_C_(0) (0) +// BFIN:UINT16_C_(0) (0U) +// BFIN:INT32_C_(0) (0) +// BFIN:UINT32_C_(0) (0U) +// BFIN:INT64_C_(0) (0LL) +// BFIN:UINT64_C_(0) (0ULL) +//  +// BFIN:INTMAX_C_(0) (0LL) +// BFIN:UINTMAX_C_(0) (0ULL) +// +// +// RUN: clang-cc -E -ffreestanding -triple=i386-none-none %s | FileCheck -check-prefix I386 %s && +// +// I386:typedef signed char int8_t; +// I386:typedef short int16_t; +// I386:typedef int int32_t; +// I386:typedef long long int int64_t; +// +// I386:typedef unsigned char uint8_t; +// I386:typedef int8_t int_least8_t; +// I386:typedef uint8_t uint_least8_t; +// I386:typedef int8_t int_fast8_t; +// I386:typedef uint8_t uint_fast8_t; +// +// I386:typedef unsigned short uint16_t; +// I386:typedef int16_t int_least16_t; +// I386:typedef uint16_t uint_least16_t; +// I386:typedef int16_t int_fast16_t; +// I386:typedef uint16_t uint_fast16_t; +// +// I386:typedef unsigned int uint32_t; +// I386:typedef int32_t int_least32_t; +// I386:typedef uint32_t uint_least32_t; +// I386:typedef int32_t int_fast32_t; +// I386:typedef uint32_t uint_fast32_t; +// +// I386:typedef unsigned long long int uint64_t; +// I386:typedef int64_t int_least64_t; +// I386:typedef uint64_t uint_least64_t; +// I386:typedef int64_t int_fast64_t; +// I386:typedef uint64_t uint_fast64_t; +// +// I386:typedef int intptr_t; +// I386:typedef unsigned int uintptr_t; +// +// I386:typedef long long int intmax_t; +// I386:typedef long long unsigned int uintmax_t; +// +// I386:INT8_MAX_ 127 +// I386:INT8_MIN_ (-128) +// I386:UINT8_MAX_ 255 +// I386:INT_LEAST8_MIN_ (-128) +// I386:INT_LEAST8_MAX_ 127 +// I386:UINT_LEAST8_MAX_ 255 +// I386:INT_FAST8_MIN_ (-128) +// I386:INT_FAST8_MAX_ 127 +// I386:UINT_FAST8_MAX_ 255 +// +// I386:INT16_MAX_ 32767 +// I386:INT16_MIN_ (-32768) +// I386:UINT16_MAX_ 65535 +// I386:INT_LEAST16_MIN_ (-32768) +// I386:INT_LEAST16_MAX_ 32767 +// I386:UINT_LEAST16_MAX_ 65535 +// I386:INT_FAST16_MIN_ (-32768) +// I386:INT_FAST16_MAX_ 32767 +// I386:UINT_FAST16_MAX_ 65535 +// +// I386:INT32_MAX_ 2147483647 +// I386:INT32_MIN_ (-2147483647 -1) +// I386:UINT32_MAX_ 4294967295U +// I386:INT_LEAST32_MIN_ (-2147483647 -1) +// I386:INT_LEAST32_MAX_ 2147483647 +// I386:UINT_LEAST32_MAX_ 4294967295U +// I386:INT_FAST32_MIN_ (-2147483647 -1) +// I386:INT_FAST32_MAX_ 2147483647 +// I386:UINT_FAST32_MAX_ 4294967295U +// +// I386:INT64_MAX_ 9223372036854775807LL +// I386:INT64_MIN_ (-9223372036854775807LL -1) +// I386:UINT64_MAX_ 18446744073709551615ULL +// I386:INT_LEAST64_MIN_ (-9223372036854775807LL -1) +// I386:INT_LEAST64_MAX_ 9223372036854775807LL +// I386:UINT_LEAST64_MAX_ 18446744073709551615ULL +// I386:INT_FAST64_MIN_ (-9223372036854775807LL -1) +// I386:INT_FAST64_MAX_ 9223372036854775807LL +// I386:UINT_FAST64_MAX_ 18446744073709551615ULL +// +// I386:INTPTR_MIN_ (-2147483647 -1) +// I386:INTPTR_MAX_ 2147483647 +// I386:UINTPTR_MAX_ 4294967295U +// I386:PTRDIFF_MIN_ (-2147483647 -1) +// I386:PTRDIFF_MAX_ 2147483647 +// I386:SIZE_MAX_ 4294967295U +// +// I386:INTMAX_MIN_ (-9223372036854775807LL -1) +// I386:INTMAX_MAX_ 9223372036854775807LL +// I386:UINTMAX_MAX_ (9223372036854775807LL*2ULL +1ULL) +// +// I386:SIG_ATOMIC_MIN_ (-2147483647 -1) +// I386:SIG_ATOMIC_MAX_ 2147483647 +// I386:WINT_MIN_ (-2147483647 -1) +// I386:WINT_MAX_ 2147483647 +// +// I386:WCHAR_MAX_ 2147483647 +// I386:WCHAR_MIN_ (-2147483647 -1) +// +// I386:INT8_C_(0) (0) +// I386:UINT8_C_(0) (0U) +// I386:INT16_C_(0) (0) +// I386:UINT16_C_(0) (0U) +// I386:INT32_C_(0) (0) +// I386:UINT32_C_(0) (0U) +// I386:INT64_C_(0) (0LL) +// I386:UINT64_C_(0) (0ULL) +// +// I386:INTMAX_C_(0) (0LL) +// I386:UINTMAX_C_(0) (0ULL) +// +// RUN: clang-cc -E -ffreestanding -triple=msp430-none-none %s | FileCheck -check-prefix MSP430 %s && +// +// MSP430:typedef signed char int8_t; +// MSP430:typedef short int16_t; +// MSP430:typedef long long int32_t; +// +// MSP430:typedef unsigned char uint8_t; +// MSP430:typedef int8_t int_least8_t; +// MSP430:typedef uint8_t uint_least8_t; +// MSP430:typedef int8_t int_fast8_t; +// MSP430:typedef uint8_t uint_fast8_t; +// +// MSP430:typedef unsigned short uint16_t; +// MSP430:typedef int16_t int_least16_t; +// MSP430:typedef uint16_t uint_least16_t; +// MSP430:typedef int16_t int_fast16_t; +// MSP430:typedef uint16_t uint_fast16_t; +// +// MSP430:typedef unsigned long long uint32_t; +// MSP430:typedef int32_t int_least32_t; +// MSP430:typedef uint32_t uint_least32_t; +// MSP430:typedef int32_t int_fast32_t; +// MSP430:typedef uint32_t uint_fast32_t; +// +// MSP430:typedef short intptr_t; +// MSP430:typedef unsigned short uintptr_t; +// +// MSP430:typedef long int intmax_t; +// MSP430:typedef long unsigned int uintmax_t; +// +// MSP430:INT8_MAX_ 127 +// MSP430:INT8_MIN_ (-128) +// MSP430:UINT8_MAX_ 255 +// MSP430:INT_LEAST8_MIN_ (-128) +// MSP430:INT_LEAST8_MAX_ 127 +// MSP430:UINT_LEAST8_MAX_ 255 +// MSP430:INT_FAST8_MIN_ (-128) +// MSP430:INT_FAST8_MAX_ 127 +// MSP430:UINT_FAST8_MAX_ 255 +// +// MSP430:INT16_MAX_ 32767 +// MSP430:INT16_MIN_ (-32768) +// MSP430:UINT16_MAX_ 65535 +// MSP430:INT_LEAST16_MIN_ (-32768) +// MSP430:INT_LEAST16_MAX_ 32767 +// MSP430:UINT_LEAST16_MAX_ 65535 +// MSP430:INT_FAST16_MIN_ (-32768) +// MSP430:INT_FAST16_MAX_ 32767 +// MSP430:UINT_FAST16_MAX_ 65535 +// +// MSP430:INT32_MAX_ 2147483647 +// MSP430:INT32_MIN_ (-2147483647 -1) +// MSP430:UINT32_MAX_ 4294967295U +// MSP430:INT_LEAST32_MIN_ (-2147483647 -1) +// MSP430:INT_LEAST32_MAX_ 2147483647 +// MSP430:UINT_LEAST32_MAX_ 4294967295U +// MSP430:INT_FAST32_MIN_ (-2147483647 -1) +// MSP430:INT_FAST32_MAX_ 2147483647 +// MSP430:UINT_FAST32_MAX_ 4294967295U +// +// MSP430:INT64_MAX_ INT64_MAX +// MSP430:INT64_MIN_ INT64_MIN +// MSP430:UINT64_MAX_ UINT64_MAX +// MSP430:INT_LEAST64_MIN_ INT_LEAST64_MIN +// MSP430:INT_LEAST64_MAX_ INT_LEAST64_MAX +// MSP430:UINT_LEAST64_MAX_ UINT_LEAST64_MAX +// MSP430:INT_FAST64_MIN_ INT_FAST64_MIN +// MSP430:INT_FAST64_MAX_ INT_FAST64_MAX +// MSP430:UINT_FAST64_MAX_ UINT_FAST64_MAX +// +// MSP430:INTPTR_MIN_ (-32768) +// MSP430:INTPTR_MAX_ 32767 +// MSP430:UINTPTR_MAX_ 65535 +// MSP430:PTRDIFF_MIN_ (-32768) +// MSP430:PTRDIFF_MAX_ 32767 +// MSP430:SIZE_MAX_ 65535 +// +// MSP430:INTMAX_MIN_ (-2147483647L -1) +// MSP430:INTMAX_MAX_ 2147483647L +// MSP430:UINTMAX_MAX_ (2147483647L*2ULL +1ULL) +// +// MSP430:SIG_ATOMIC_MIN_ (-2147483647 -1) +// MSP430:SIG_ATOMIC_MAX_ 2147483647 +// MSP430:WINT_MIN_ (-2147483647 -1) +// MSP430:WINT_MAX_ 2147483647 +// +// MSP430:WCHAR_MAX_ 2147483647 +// MSP430:WCHAR_MIN_ (-2147483647 -1) +// +// MSP430:INT8_C_(0) (0) +// MSP430:UINT8_C_(0) (0U) +// MSP430:INT16_C_(0) (0) +// MSP430:UINT16_C_(0) (0U) +// MSP430:INT32_C_(0) (0) +// MSP430:UINT32_C_(0) (0U) +// MSP430:INT64_C_(0) INT64_C(0) +// MSP430:UINT64_C_(0) UINT64_C(0) +// +// MSP430:INTMAX_C_(0) (0LL) +// MSP430:UINTMAX_C_(0) (0ULL) +// +// RUN: clang-cc -E -ffreestanding -triple=pic16-none-none %s | FileCheck -check-prefix PIC16 %s && +//  +// PIC16:typedef signed char int8_t; +// PIC16:typedef short int16_t; +// PIC16:typedef long long int32_t; +// +// PIC16:typedef unsigned char uint8_t; +// PIC16:typedef int8_t int_least8_t; +// PIC16:typedef uint8_t uint_least8_t; +// PIC16:typedef int8_t int_fast8_t; +// PIC16:typedef uint8_t uint_fast8_t; +// +// PIC16:typedef unsigned short uint16_t; +// PIC16:typedef int16_t int_least16_t; +// PIC16:typedef uint16_t uint_least16_t; +// PIC16:typedef int16_t int_fast16_t; +// PIC16:typedef uint16_t uint_fast16_t; +// +// PIC16:typedef unsigned long long uint32_t; +// PIC16:typedef int32_t int_least32_t; +// PIC16:typedef uint32_t uint_least32_t; +// PIC16:typedef int32_t int_fast32_t; +// PIC16:typedef uint32_t uint_fast32_t; +// +// PIC16:typedef short intptr_t; +// PIC16:typedef unsigned short uintptr_t; +// +// PIC16:typedef long int intmax_t; +// PIC16:typedef long unsigned int uintmax_t; +// +// PIC16:INT8_MAX_ 127 +// PIC16:INT8_MIN_ (-128) +// PIC16:UINT8_MAX_ 255 +// PIC16:INT_LEAST8_MIN_ (-128) +// PIC16:INT_LEAST8_MAX_ 127 +// PIC16:UINT_LEAST8_MAX_ 255 +// PIC16:INT_FAST8_MIN_ (-128) +// PIC16:INT_FAST8_MAX_ 127 +// PIC16:UINT_FAST8_MAX_ 255 +// +// PIC16:INT16_MAX_ 32767 +// PIC16:INT16_MIN_ (-32768) +// PIC16:UINT16_MAX_ 65535 +// PIC16:INT_LEAST16_MIN_ (-32768) +// PIC16:INT_LEAST16_MAX_ 32767 +// PIC16:UINT_LEAST16_MAX_ 65535 +// PIC16:INT_FAST16_MIN_ (-32768) +// PIC16:INT_FAST16_MAX_ 32767 +// PIC16:UINT_FAST16_MAX_ 65535 +// +// PIC16:INT32_MAX_ 2147483647 +// PIC16:INT32_MIN_ (-2147483647 -1) +// PIC16:UINT32_MAX_ 4294967295U +// PIC16:INT_LEAST32_MIN_ (-2147483647 -1) +// PIC16:INT_LEAST32_MAX_ 2147483647 +// PIC16:UINT_LEAST32_MAX_ 4294967295U +// PIC16:INT_FAST32_MIN_ (-2147483647 -1) +// PIC16:INT_FAST32_MAX_ 2147483647 +// PIC16:UINT_FAST32_MAX_ 4294967295U +// +// PIC16:INT64_MAX_ INT64_MAX +// PIC16:INT64_MIN_ INT64_MIN +// PIC16:UINT64_MAX_ UINT64_MAX +// PIC16:INT_LEAST64_MIN_ INT_LEAST64_MIN +// PIC16:INT_LEAST64_MAX_ INT_LEAST64_MAX +// PIC16:UINT_LEAST64_MAX_ UINT_LEAST64_MAX +// PIC16:INT_FAST64_MIN_ INT_FAST64_MIN +// PIC16:INT_FAST64_MAX_ INT_FAST64_MAX +// PIC16:UINT_FAST64_MAX_ UINT_FAST64_MAX +// +// PIC16:INTPTR_MIN_ (-32768) +// PIC16:INTPTR_MAX_ 32767 +// PIC16:UINTPTR_MAX_ 65535 +// PIC16:PTRDIFF_MIN_ (-32768) +// PIC16:PTRDIFF_MAX_ 32767 +// PIC16:SIZE_MAX_ 65535 +// +// PIC16:INTMAX_MIN_ (-2147483647L -1) +// PIC16:INTMAX_MAX_ 2147483647L +// PIC16:UINTMAX_MAX_ (2147483647L*2ULL +1ULL) +// +// PIC16:SIG_ATOMIC_MIN_ (-2147483647 -1) +// PIC16:SIG_ATOMIC_MAX_ 2147483647 +// PIC16:WINT_MIN_ (-2147483647 -1) +// PIC16:WINT_MAX_ 2147483647 +// +// PIC16:WCHAR_MAX_ 2147483647 +// PIC16:WCHAR_MIN_ (-2147483647 -1) +// +// PIC16:INT8_C_(0) (0) +// PIC16:UINT8_C_(0) (0U) +// PIC16:INT16_C_(0) (0) +// PIC16:UINT16_C_(0) (0U) +// PIC16:INT32_C_(0) (0) +// PIC16:UINT32_C_(0) (0U) +// PIC16:INT64_C_(0) INT64_C(0) +// PIC16:UINT64_C_(0) UINT64_C(0) +// +// PIC16:INTMAX_C_(0) (0LL) +// PIC16:UINTMAX_C_(0) (0ULL) +// +// RUN: clang-cc -E -ffreestanding -triple=powerpc64-none-none %s | FileCheck -check-prefix PPC64 %s && +// +// PPC64:typedef signed char int8_t; +// PPC64:typedef short int16_t; +// PPC64:typedef int int32_t; +// PPC64:typedef long int int64_t; +// +// PPC64:typedef unsigned char uint8_t; +// PPC64:typedef int8_t int_least8_t; +// PPC64:typedef uint8_t uint_least8_t; +// PPC64:typedef int8_t int_fast8_t; +// PPC64:typedef uint8_t uint_fast8_t; +// +// PPC64:typedef unsigned short uint16_t; +// PPC64:typedef int16_t int_least16_t; +// PPC64:typedef uint16_t uint_least16_t; +// PPC64:typedef int16_t int_fast16_t; +// PPC64:typedef uint16_t uint_fast16_t; +// +// PPC64:typedef unsigned int uint32_t; +// PPC64:typedef int32_t int_least32_t; +// PPC64:typedef uint32_t uint_least32_t; +// PPC64:typedef int32_t int_fast32_t; +// PPC64:typedef uint32_t uint_fast32_t; +// +// PPC64:typedef unsigned long int uint64_t; +// PPC64:typedef int64_t int_least64_t; +// PPC64:typedef uint64_t uint_least64_t; +// PPC64:typedef int64_t int_fast64_t; +// PPC64:typedef uint64_t uint_fast64_t; +// +// PPC64:typedef long int intptr_t; +// PPC64:typedef unsigned long int uintptr_t; +// +// PPC64:typedef long int intmax_t; +// PPC64:typedef long unsigned int uintmax_t; +// +// PPC64:INT8_MAX_ 127 +// PPC64:INT8_MIN_ (-128) +// PPC64:UINT8_MAX_ 255 +// PPC64:INT_LEAST8_MIN_ (-128) +// PPC64:INT_LEAST8_MAX_ 127 +// PPC64:UINT_LEAST8_MAX_ 255 +// PPC64:INT_FAST8_MIN_ (-128) +// PPC64:INT_FAST8_MAX_ 127 +// PPC64:UINT_FAST8_MAX_ 255 +// +// PPC64:INT16_MAX_ 32767 +// PPC64:INT16_MIN_ (-32768) +// PPC64:UINT16_MAX_ 65535 +// PPC64:INT_LEAST16_MIN_ (-32768) +// PPC64:INT_LEAST16_MAX_ 32767 +// PPC64:UINT_LEAST16_MAX_ 65535 +// PPC64:INT_FAST16_MIN_ (-32768) +// PPC64:INT_FAST16_MAX_ 32767 +// PPC64:UINT_FAST16_MAX_ 65535 +// +// PPC64:INT32_MAX_ 2147483647 +// PPC64:INT32_MIN_ (-2147483647 -1) +// PPC64:UINT32_MAX_ 4294967295U +// PPC64:INT_LEAST32_MIN_ (-2147483647 -1) +// PPC64:INT_LEAST32_MAX_ 2147483647 +// PPC64:UINT_LEAST32_MAX_ 4294967295U +// PPC64:INT_FAST32_MIN_ (-2147483647 -1) +// PPC64:INT_FAST32_MAX_ 2147483647 +// PPC64:UINT_FAST32_MAX_ 4294967295U +// +// PPC64:INT64_MAX_ 9223372036854775807LL +// PPC64:INT64_MIN_ (-9223372036854775807LL -1) +// PPC64:UINT64_MAX_ 18446744073709551615ULL +// PPC64:INT_LEAST64_MIN_ (-9223372036854775807LL -1) +// PPC64:INT_LEAST64_MAX_ 9223372036854775807LL +// PPC64:UINT_LEAST64_MAX_ 18446744073709551615ULL +// PPC64:INT_FAST64_MIN_ (-9223372036854775807LL -1) +// PPC64:INT_FAST64_MAX_ 9223372036854775807LL +// PPC64:UINT_FAST64_MAX_ 18446744073709551615ULL +// +// PPC64:INTPTR_MIN_ (-9223372036854775807LL -1) +// PPC64:INTPTR_MAX_ 9223372036854775807LL +// PPC64:UINTPTR_MAX_ 18446744073709551615ULL +// PPC64:PTRDIFF_MIN_ (-9223372036854775807LL -1) +// PPC64:PTRDIFF_MAX_ 9223372036854775807LL +// PPC64:SIZE_MAX_ 18446744073709551615ULL +// +// PPC64:INTMAX_MIN_ (-9223372036854775807L -1) +// PPC64:INTMAX_MAX_ 9223372036854775807L +// PPC64:UINTMAX_MAX_ (9223372036854775807L*2ULL +1ULL) +// +// PPC64:SIG_ATOMIC_MIN_ (-2147483647 -1) +// PPC64:SIG_ATOMIC_MAX_ 2147483647 +// PPC64:WINT_MIN_ (-2147483647 -1) +// PPC64:WINT_MAX_ 2147483647 +// +// PPC64:WCHAR_MAX_ 2147483647 +// PPC64:WCHAR_MIN_ (-2147483647 -1) +// +// PPC64:INT8_C_(0) (0) +// PPC64:UINT8_C_(0) (0U) +// PPC64:INT16_C_(0) (0) +// PPC64:UINT16_C_(0) (0U) +// PPC64:INT32_C_(0) (0) +// PPC64:UINT32_C_(0) (0U) +// PPC64:INT64_C_(0) (0LL) +// PPC64:UINT64_C_(0) (0ULL) +// +// PPC64:INTMAX_C_(0) (0LL) +// PPC64:UINTMAX_C_(0) (0ULL) +// +// RUN: clang-cc -E -ffreestanding -triple=powerpc-none-none %s | FileCheck -check-prefix PPC %s && +// +// PPC:typedef signed char int8_t; +// PPC:typedef short int16_t; +// PPC:typedef int int32_t; +// PPC:typedef long long int int64_t; +// +// PPC:typedef unsigned char uint8_t; +// PPC:typedef int8_t int_least8_t; +// PPC:typedef uint8_t uint_least8_t; +// PPC:typedef int8_t int_fast8_t; +// PPC:typedef uint8_t uint_fast8_t; +// +// PPC:typedef unsigned short uint16_t; +// PPC:typedef int16_t int_least16_t; +// PPC:typedef uint16_t uint_least16_t; +// PPC:typedef int16_t int_fast16_t; +// PPC:typedef uint16_t uint_fast16_t; +// +// PPC:typedef unsigned int uint32_t; +// PPC:typedef int32_t int_least32_t; +// PPC:typedef uint32_t uint_least32_t; +// PPC:typedef int32_t int_fast32_t; +// PPC:typedef uint32_t uint_fast32_t; +// +// PPC:typedef unsigned long long int uint64_t; +// PPC:typedef int64_t int_least64_t; +// PPC:typedef uint64_t uint_least64_t; +// PPC:typedef int64_t int_fast64_t; +// PPC:typedef uint64_t uint_fast64_t; +// +// PPC:typedef long int intptr_t; +// PPC:typedef unsigned long int uintptr_t; +// +// PPC:typedef long long int intmax_t; +// PPC:typedef long long unsigned int uintmax_t; +// +// PPC:INT8_MAX_ 127 +// PPC:INT8_MIN_ (-128) +// PPC:UINT8_MAX_ 255 +// PPC:INT_LEAST8_MIN_ (-128) +// PPC:INT_LEAST8_MAX_ 127 +// PPC:UINT_LEAST8_MAX_ 255 +// PPC:INT_FAST8_MIN_ (-128) +// PPC:INT_FAST8_MAX_ 127 +// PPC:UINT_FAST8_MAX_ 255 +// +// PPC:INT16_MAX_ 32767 +// PPC:INT16_MIN_ (-32768) +// PPC:UINT16_MAX_ 65535 +// PPC:INT_LEAST16_MIN_ (-32768) +// PPC:INT_LEAST16_MAX_ 32767 +// PPC:UINT_LEAST16_MAX_ 65535 +// PPC:INT_FAST16_MIN_ (-32768) +// PPC:INT_FAST16_MAX_ 32767 +// PPC:UINT_FAST16_MAX_ 65535 +// +// PPC:INT32_MAX_ 2147483647 +// PPC:INT32_MIN_ (-2147483647 -1) +// PPC:UINT32_MAX_ 4294967295U +// PPC:INT_LEAST32_MIN_ (-2147483647 -1) +// PPC:INT_LEAST32_MAX_ 2147483647 +// PPC:UINT_LEAST32_MAX_ 4294967295U +// PPC:INT_FAST32_MIN_ (-2147483647 -1) +// PPC:INT_FAST32_MAX_ 2147483647 +// PPC:UINT_FAST32_MAX_ 4294967295U +// +// PPC:INT64_MAX_ 9223372036854775807LL +// PPC:INT64_MIN_ (-9223372036854775807LL -1) +// PPC:UINT64_MAX_ 18446744073709551615ULL +// PPC:INT_LEAST64_MIN_ (-9223372036854775807LL -1) +// PPC:INT_LEAST64_MAX_ 9223372036854775807LL +// PPC:UINT_LEAST64_MAX_ 18446744073709551615ULL +// PPC:INT_FAST64_MIN_ (-9223372036854775807LL -1) +// PPC:INT_FAST64_MAX_ 9223372036854775807LL +// PPC:UINT_FAST64_MAX_ 18446744073709551615ULL +// +// PPC:INTPTR_MIN_ (-2147483647 -1) +// PPC:INTPTR_MAX_ 2147483647 +// PPC:UINTPTR_MAX_ 4294967295U +// PPC:PTRDIFF_MIN_ (-2147483647 -1) +// PPC:PTRDIFF_MAX_ 2147483647 +// PPC:SIZE_MAX_ 4294967295U +// +// PPC:INTMAX_MIN_ (-9223372036854775807LL -1) +// PPC:INTMAX_MAX_ 9223372036854775807LL +// PPC:UINTMAX_MAX_ (9223372036854775807LL*2ULL +1ULL) +// +// PPC:SIG_ATOMIC_MIN_ (-2147483647 -1) +// PPC:SIG_ATOMIC_MAX_ 2147483647 +// PPC:WINT_MIN_ (-2147483647 -1) +// PPC:WINT_MAX_ 2147483647 +// +// PPC:WCHAR_MAX_ 2147483647 +// PPC:WCHAR_MIN_ (-2147483647 -1) +// +// PPC:INT8_C_(0) (0) +// PPC:UINT8_C_(0) (0U) +// PPC:INT16_C_(0) (0) +// PPC:UINT16_C_(0) (0U) +// PPC:INT32_C_(0) (0) +// PPC:UINT32_C_(0) (0U) +// PPC:INT64_C_(0) (0LL) +// PPC:UINT64_C_(0) (0ULL) +// +// PPC:INTMAX_C_(0) (0LL) +// PPC:UINTMAX_C_(0) (0ULL) +// +// RUN: clang-cc -E -ffreestanding -triple=s390x-none-none %s | FileCheck -check-prefix S390X %s && +// +// S390X:typedef signed char int8_t; +// S390X:typedef short int16_t; +// S390X:typedef int int32_t; +// S390X:typedef long long int int64_t; +// +// S390X:typedef unsigned char uint8_t; +// S390X:typedef int8_t int_least8_t; +// S390X:typedef uint8_t uint_least8_t; +// S390X:typedef int8_t int_fast8_t; +// S390X:typedef uint8_t uint_fast8_t; +// +// S390X:typedef unsigned short uint16_t; +// S390X:typedef int16_t int_least16_t; +// S390X:typedef uint16_t uint_least16_t; +// S390X:typedef int16_t int_fast16_t; +// S390X:typedef uint16_t uint_fast16_t; +// +// S390X:typedef unsigned int uint32_t; +// S390X:typedef int32_t int_least32_t; +// S390X:typedef uint32_t uint_least32_t; +// S390X:typedef int32_t int_fast32_t; +// S390X:typedef uint32_t uint_fast32_t; +// +// S390X:typedef unsigned long long int uint64_t; +// S390X:typedef int64_t int_least64_t; +// S390X:typedef uint64_t uint_least64_t; +// S390X:typedef int64_t int_fast64_t; +// S390X:typedef uint64_t uint_fast64_t; +// +// S390X:typedef long int intptr_t; +// S390X:typedef unsigned long int uintptr_t; +// +// S390X:typedef long long int intmax_t; +// S390X:typedef long long unsigned int uintmax_t; +// +// S390X:INT8_MAX_ 127 +// S390X:INT8_MIN_ (-128) +// S390X:UINT8_MAX_ 255 +// S390X:INT_LEAST8_MIN_ (-128) +// S390X:INT_LEAST8_MAX_ 127 +// S390X:UINT_LEAST8_MAX_ 255 +// S390X:INT_FAST8_MIN_ (-128) +// S390X:INT_FAST8_MAX_ 127 +// S390X:UINT_FAST8_MAX_ 255 +// +// S390X:INT16_MAX_ 32767 +// S390X:INT16_MIN_ (-32768) +// S390X:UINT16_MAX_ 65535 +// S390X:INT_LEAST16_MIN_ (-32768) +// S390X:INT_LEAST16_MAX_ 32767 +// S390X:UINT_LEAST16_MAX_ 65535 +// S390X:INT_FAST16_MIN_ (-32768) +// S390X:INT_FAST16_MAX_ 32767 +// S390X:UINT_FAST16_MAX_ 65535 +// +// S390X:INT32_MAX_ 2147483647 +// S390X:INT32_MIN_ (-2147483647 -1) +// S390X:UINT32_MAX_ 4294967295U +// S390X:INT_LEAST32_MIN_ (-2147483647 -1) +// S390X:INT_LEAST32_MAX_ 2147483647 +// S390X:UINT_LEAST32_MAX_ 4294967295U +// S390X:INT_FAST32_MIN_ (-2147483647 -1) +// S390X:INT_FAST32_MAX_ 2147483647 +// S390X:UINT_FAST32_MAX_ 4294967295U +// +// S390X:INT64_MAX_ 9223372036854775807LL +// S390X:INT64_MIN_ (-9223372036854775807LL -1) +// S390X:UINT64_MAX_ 18446744073709551615ULL +// S390X:INT_LEAST64_MIN_ (-9223372036854775807LL -1) +// S390X:INT_LEAST64_MAX_ 9223372036854775807LL +// S390X:UINT_LEAST64_MAX_ 18446744073709551615ULL +// S390X:INT_FAST64_MIN_ (-9223372036854775807LL -1) +// S390X:INT_FAST64_MAX_ 9223372036854775807LL +// S390X:UINT_FAST64_MAX_ 18446744073709551615ULL +// +// S390X:INTPTR_MIN_ (-9223372036854775807LL -1) +// S390X:INTPTR_MAX_ 9223372036854775807LL +// S390X:UINTPTR_MAX_ 18446744073709551615ULL +// S390X:PTRDIFF_MIN_ (-9223372036854775807LL -1) +// S390X:PTRDIFF_MAX_ 9223372036854775807LL +// S390X:SIZE_MAX_ 18446744073709551615ULL +// +// S390X:INTMAX_MIN_ (-9223372036854775807LL -1) +// S390X:INTMAX_MAX_ 9223372036854775807LL +// S390X:UINTMAX_MAX_ (9223372036854775807LL*2ULL +1ULL) +// +// S390X:SIG_ATOMIC_MIN_ (-2147483647 -1) +// S390X:SIG_ATOMIC_MAX_ 2147483647 +// S390X:WINT_MIN_ (-2147483647 -1) +// S390X:WINT_MAX_ 2147483647 +// +// S390X:WCHAR_MAX_ 2147483647 +// S390X:WCHAR_MIN_ (-2147483647 -1) +// +// S390X:INT8_C_(0) (0) +// S390X:UINT8_C_(0) (0U) +// S390X:INT16_C_(0) (0) +// S390X:UINT16_C_(0) (0U) +// S390X:INT32_C_(0) (0) +// S390X:UINT32_C_(0) (0U) +// S390X:INT64_C_(0) (0LL) +// S390X:UINT64_C_(0) (0ULL) +// +// S390X:INTMAX_C_(0) (0LL) +// S390X:UINTMAX_C_(0) (0ULL) +// +// RUN: clang-cc -E -ffreestanding -triple=sparc-none-none %s | FileCheck -check-prefix SPARC %s && +// +// SPARC:typedef signed char int8_t; +// SPARC:typedef short int16_t; +// SPARC:typedef int int32_t; +// SPARC:typedef long long int int64_t; +// +// SPARC:typedef unsigned char uint8_t; +// SPARC:typedef int8_t int_least8_t; +// SPARC:typedef uint8_t uint_least8_t; +// SPARC:typedef int8_t int_fast8_t; +// SPARC:typedef uint8_t uint_fast8_t; +// +// SPARC:typedef unsigned short uint16_t; +// SPARC:typedef int16_t int_least16_t; +// SPARC:typedef uint16_t uint_least16_t; +// SPARC:typedef int16_t int_fast16_t; +// SPARC:typedef uint16_t uint_fast16_t; +// +// SPARC:typedef unsigned int uint32_t; +// SPARC:typedef int32_t int_least32_t; +// SPARC:typedef uint32_t uint_least32_t; +// SPARC:typedef int32_t int_fast32_t; +// SPARC:typedef uint32_t uint_fast32_t; +// +// SPARC:typedef unsigned long long int uint64_t; +// SPARC:typedef int64_t int_least64_t; +// SPARC:typedef uint64_t uint_least64_t; +// SPARC:typedef int64_t int_fast64_t; +// SPARC:typedef uint64_t uint_fast64_t; +// +// SPARC:typedef long int intptr_t; +// SPARC:typedef unsigned long int uintptr_t; +// +// SPARC:typedef long long int intmax_t; +// SPARC:typedef long long unsigned int uintmax_t; +// +// SPARC:INT8_MAX_ 127 +// SPARC:INT8_MIN_ (-128) +// SPARC:UINT8_MAX_ 255 +// SPARC:INT_LEAST8_MIN_ (-128) +// SPARC:INT_LEAST8_MAX_ 127 +// SPARC:UINT_LEAST8_MAX_ 255 +// SPARC:INT_FAST8_MIN_ (-128) +// SPARC:INT_FAST8_MAX_ 127 +// SPARC:UINT_FAST8_MAX_ 255 +// +// SPARC:INT16_MAX_ 32767 +// SPARC:INT16_MIN_ (-32768) +// SPARC:UINT16_MAX_ 65535 +// SPARC:INT_LEAST16_MIN_ (-32768) +// SPARC:INT_LEAST16_MAX_ 32767 +// SPARC:UINT_LEAST16_MAX_ 65535 +// SPARC:INT_FAST16_MIN_ (-32768) +// SPARC:INT_FAST16_MAX_ 32767 +// SPARC:UINT_FAST16_MAX_ 65535 +// +// SPARC:INT32_MAX_ 2147483647 +// SPARC:INT32_MIN_ (-2147483647 -1) +// SPARC:UINT32_MAX_ 4294967295U +// SPARC:INT_LEAST32_MIN_ (-2147483647 -1) +// SPARC:INT_LEAST32_MAX_ 2147483647 +// SPARC:UINT_LEAST32_MAX_ 4294967295U +// SPARC:INT_FAST32_MIN_ (-2147483647 -1) +// SPARC:INT_FAST32_MAX_ 2147483647 +// SPARC:UINT_FAST32_MAX_ 4294967295U +// +// SPARC:INT64_MAX_ 9223372036854775807LL +// SPARC:INT64_MIN_ (-9223372036854775807LL -1) +// SPARC:UINT64_MAX_ 18446744073709551615ULL +// SPARC:INT_LEAST64_MIN_ (-9223372036854775807LL -1) +// SPARC:INT_LEAST64_MAX_ 9223372036854775807LL +// SPARC:UINT_LEAST64_MAX_ 18446744073709551615ULL +// SPARC:INT_FAST64_MIN_ (-9223372036854775807LL -1) +// SPARC:INT_FAST64_MAX_ 9223372036854775807LL +// SPARC:UINT_FAST64_MAX_ 18446744073709551615ULL +// +// SPARC:INTPTR_MIN_ (-2147483647 -1) +// SPARC:INTPTR_MAX_ 2147483647 +// SPARC:UINTPTR_MAX_ 4294967295U +// SPARC:PTRDIFF_MIN_ (-2147483647 -1) +// SPARC:PTRDIFF_MAX_ 2147483647 +// SPARC:SIZE_MAX_ 4294967295U +// +// SPARC:INTMAX_MIN_ (-9223372036854775807LL -1) +// SPARC:INTMAX_MAX_ 9223372036854775807LL +// SPARC:UINTMAX_MAX_ (9223372036854775807LL*2ULL +1ULL) +// +// SPARC:SIG_ATOMIC_MIN_ (-2147483647 -1) +// SPARC:SIG_ATOMIC_MAX_ 2147483647 +// SPARC:WINT_MIN_ (-2147483647 -1) +// SPARC:WINT_MAX_ 2147483647 +// +// SPARC:WCHAR_MAX_ 2147483647 +// SPARC:WCHAR_MIN_ (-2147483647 -1) +// +// SPARC:INT8_C_(0) (0) +// SPARC:UINT8_C_(0) (0U) +// SPARC:INT16_C_(0) (0) +// SPARC:UINT16_C_(0) (0U) +// SPARC:INT32_C_(0) (0) +// SPARC:UINT32_C_(0) (0U) +// SPARC:INT64_C_(0) (0LL) +// SPARC:UINT64_C_(0) (0ULL) +// +// SPARC:INTMAX_C_(0) (0LL) +// SPARC:UINTMAX_C_(0) (0ULL) +// +// RUN: clang-cc -E -ffreestanding -triple=tce-none-none %s | FileCheck -check-prefix TCE %s && +// +// TCE:typedef signed char int8_t; +// TCE:typedef short int16_t; +// TCE:typedef int int32_t; +// +// TCE:typedef unsigned char uint8_t; +// TCE:typedef int8_t int_least8_t; +// TCE:typedef uint8_t uint_least8_t; +// TCE:typedef int8_t int_fast8_t; +// TCE:typedef uint8_t uint_fast8_t; +// +// TCE:typedef unsigned short uint16_t; +// TCE:typedef int16_t int_least16_t; +// TCE:typedef uint16_t uint_least16_t; +// TCE:typedef int16_t int_fast16_t; +// TCE:typedef uint16_t uint_fast16_t; +// +// TCE:typedef unsigned int uint32_t; +// TCE:typedef int32_t int_least32_t; +// TCE:typedef uint32_t uint_least32_t; +// TCE:typedef int32_t int_fast32_t; +// TCE:typedef uint32_t uint_fast32_t; +// +// TCE:typedef int intptr_t; +// TCE:typedef unsigned int uintptr_t; +// +// TCE:typedef long int intmax_t; +// TCE:typedef long unsigned int uintmax_t; +// +// TCE:INT8_MAX_ 127 +// TCE:INT8_MIN_ (-128) +// TCE:UINT8_MAX_ 255 +// TCE:INT_LEAST8_MIN_ (-128) +// TCE:INT_LEAST8_MAX_ 127 +// TCE:UINT_LEAST8_MAX_ 255 +// TCE:INT_FAST8_MIN_ (-128) +// TCE:INT_FAST8_MAX_ 127 +// TCE:UINT_FAST8_MAX_ 255 +// +// TCE:INT16_MAX_ 32767 +// TCE:INT16_MIN_ (-32768) +// TCE:UINT16_MAX_ 65535 +// TCE:INT_LEAST16_MIN_ (-32768) +// TCE:INT_LEAST16_MAX_ 32767 +// TCE:UINT_LEAST16_MAX_ 65535 +// TCE:INT_FAST16_MIN_ (-32768) +// TCE:INT_FAST16_MAX_ 32767 +// TCE:UINT_FAST16_MAX_ 65535 +// +// TCE:INT32_MAX_ 2147483647 +// TCE:INT32_MIN_ (-2147483647 -1) +// TCE:UINT32_MAX_ 4294967295U +// TCE:INT_LEAST32_MIN_ (-2147483647 -1) +// TCE:INT_LEAST32_MAX_ 2147483647 +// TCE:UINT_LEAST32_MAX_ 4294967295U +// TCE:INT_FAST32_MIN_ (-2147483647 -1) +// TCE:INT_FAST32_MAX_ 2147483647 +// TCE:UINT_FAST32_MAX_ 4294967295U +// +// TCE:INT64_MAX_ INT64_MAX +// TCE:INT64_MIN_ INT64_MIN +// TCE:UINT64_MAX_ UINT64_MAX +// TCE:INT_LEAST64_MIN_ INT_LEAST64_MIN +// TCE:INT_LEAST64_MAX_ INT_LEAST64_MAX +// TCE:UINT_LEAST64_MAX_ UINT_LEAST64_MAX +// TCE:INT_FAST64_MIN_ INT_FAST64_MIN +// TCE:INT_FAST64_MAX_ INT_FAST64_MAX +// TCE:UINT_FAST64_MAX_ UINT_FAST64_MAX +// +// TCE:INTPTR_MIN_ (-2147483647 -1) +// TCE:INTPTR_MAX_ 2147483647 +// TCE:UINTPTR_MAX_ 4294967295U +// TCE:PTRDIFF_MIN_ (-2147483647 -1) +// TCE:PTRDIFF_MAX_ 2147483647 +// TCE:SIZE_MAX_ 4294967295U +// +// TCE:INTMAX_MIN_ (-2147483647L -1) +// TCE:INTMAX_MAX_ 2147483647L +// TCE:UINTMAX_MAX_ (2147483647L*2ULL +1ULL) +// +// TCE:SIG_ATOMIC_MIN_ (-2147483647 -1) +// TCE:SIG_ATOMIC_MAX_ 2147483647 +// TCE:WINT_MIN_ (-2147483647 -1) +// TCE:WINT_MAX_ 2147483647 +// +// TCE:WCHAR_MAX_ 2147483647 +// TCE:WCHAR_MIN_ (-2147483647 -1) +// +// TCE:INT8_C_(0) (0) +// TCE:UINT8_C_(0) (0U) +// TCE:INT16_C_(0) (0) +// TCE:UINT16_C_(0) (0U) +// TCE:INT32_C_(0) (0) +// TCE:UINT32_C_(0) (0U) +// TCE:INT64_C_(0) INT64_C(0) +// TCE:UINT64_C_(0) UINT64_C(0) +// +// TCE:INTMAX_C_(0) (0LL) +// TCE:UINTMAX_C_(0) (0ULL) +// +// RUN: clang-cc -E -ffreestanding -triple=x86_64-none-none %s | FileCheck -check-prefix X86_64 %s && +// +// X86_64:typedef signed char int8_t; +// X86_64:typedef short int16_t; +// X86_64:typedef int int32_t; +// X86_64:typedef long int int64_t; +// +// X86_64:typedef unsigned char uint8_t; +// X86_64:typedef int8_t int_least8_t; +// X86_64:typedef uint8_t uint_least8_t; +// X86_64:typedef int8_t int_fast8_t; +// X86_64:typedef uint8_t uint_fast8_t; +// +// X86_64:typedef unsigned short uint16_t; +// X86_64:typedef int16_t int_least16_t; +// X86_64:typedef uint16_t uint_least16_t; +// X86_64:typedef int16_t int_fast16_t; +// X86_64:typedef uint16_t uint_fast16_t; +// +// X86_64:typedef unsigned int uint32_t; +// X86_64:typedef int32_t int_least32_t; +// X86_64:typedef uint32_t uint_least32_t; +// X86_64:typedef int32_t int_fast32_t; +// X86_64:typedef uint32_t uint_fast32_t; +// +// X86_64:typedef unsigned long int uint64_t; +// X86_64:typedef int64_t int_least64_t; +// X86_64:typedef uint64_t uint_least64_t; +// X86_64:typedef int64_t int_fast64_t; +// X86_64:typedef uint64_t uint_fast64_t; +// +// X86_64:typedef long int intptr_t; +// X86_64:typedef unsigned long int uintptr_t; +// +// X86_64:typedef long int intmax_t; +// X86_64:typedef long unsigned int uintmax_t; +// +// X86_64:INT8_MAX_ 127 +// X86_64:INT8_MIN_ (-128) +// X86_64:UINT8_MAX_ 255 +// X86_64:INT_LEAST8_MIN_ (-128) +// X86_64:INT_LEAST8_MAX_ 127 +// X86_64:UINT_LEAST8_MAX_ 255 +// X86_64:INT_FAST8_MIN_ (-128) +// X86_64:INT_FAST8_MAX_ 127 +// X86_64:UINT_FAST8_MAX_ 255 +// +// X86_64:INT16_MAX_ 32767 +// X86_64:INT16_MIN_ (-32768) +// X86_64:UINT16_MAX_ 65535 +// X86_64:INT_LEAST16_MIN_ (-32768) +// X86_64:INT_LEAST16_MAX_ 32767 +// X86_64:UINT_LEAST16_MAX_ 65535 +// X86_64:INT_FAST16_MIN_ (-32768) +// X86_64:INT_FAST16_MAX_ 32767 +// X86_64:UINT_FAST16_MAX_ 65535 +// +// X86_64:INT32_MAX_ 2147483647 +// X86_64:INT32_MIN_ (-2147483647 -1) +// X86_64:UINT32_MAX_ 4294967295U +// X86_64:INT_LEAST32_MIN_ (-2147483647 -1) +// X86_64:INT_LEAST32_MAX_ 2147483647 +// X86_64:UINT_LEAST32_MAX_ 4294967295U +// X86_64:INT_FAST32_MIN_ (-2147483647 -1) +// X86_64:INT_FAST32_MAX_ 2147483647 +// X86_64:UINT_FAST32_MAX_ 4294967295U +// +// X86_64:INT64_MAX_ 9223372036854775807LL +// X86_64:INT64_MIN_ (-9223372036854775807LL -1) +// X86_64:UINT64_MAX_ 18446744073709551615ULL +// X86_64:INT_LEAST64_MIN_ (-9223372036854775807LL -1) +// X86_64:INT_LEAST64_MAX_ 9223372036854775807LL +// X86_64:UINT_LEAST64_MAX_ 18446744073709551615ULL +// X86_64:INT_FAST64_MIN_ (-9223372036854775807LL -1) +// X86_64:INT_FAST64_MAX_ 9223372036854775807LL +// X86_64:UINT_FAST64_MAX_ 18446744073709551615ULL +// +// X86_64:INTPTR_MIN_ (-9223372036854775807LL -1) +// X86_64:INTPTR_MAX_ 9223372036854775807LL +// X86_64:UINTPTR_MAX_ 18446744073709551615ULL +// X86_64:PTRDIFF_MIN_ (-9223372036854775807LL -1) +// X86_64:PTRDIFF_MAX_ 9223372036854775807LL +// X86_64:SIZE_MAX_ 18446744073709551615ULL +// +// X86_64:INTMAX_MIN_ (-9223372036854775807L -1) +// X86_64:INTMAX_MAX_ 9223372036854775807L +// X86_64:UINTMAX_MAX_ (9223372036854775807L*2ULL +1ULL) +// +// X86_64:SIG_ATOMIC_MIN_ (-2147483647 -1) +// X86_64:SIG_ATOMIC_MAX_ 2147483647 +// X86_64:WINT_MIN_ (-2147483647 -1) +// X86_64:WINT_MAX_ 2147483647 +// +// X86_64:WCHAR_MAX_ 2147483647 +// X86_64:WCHAR_MIN_ (-2147483647 -1) +// +// X86_64:INT8_C_(0) (0) +// X86_64:UINT8_C_(0) (0U) +// X86_64:INT16_C_(0) (0) +// X86_64:UINT16_C_(0) (0U) +// X86_64:INT32_C_(0) (0) +// X86_64:UINT32_C_(0) (0U) +// X86_64:INT64_C_(0) (0LL) +// X86_64:UINT64_C_(0) (0ULL) +// +// X86_64:INTMAX_C_(0) (0LL) +// X86_64:UINTMAX_C_(0) (0ULL) +// +// RUN: true + +#include <stdint.h> + +INT8_MAX_ INT8_MAX +INT8_MIN_ INT8_MIN +UINT8_MAX_ UINT8_MAX +INT_LEAST8_MIN_ INT_LEAST8_MIN +INT_LEAST8_MAX_ INT_LEAST8_MAX +UINT_LEAST8_MAX_ UINT_LEAST8_MAX +INT_FAST8_MIN_ INT_FAST8_MIN +INT_FAST8_MAX_ INT_FAST8_MAX +UINT_FAST8_MAX_ UINT_FAST8_MAX + +INT16_MAX_ INT16_MAX +INT16_MIN_ INT16_MIN +UINT16_MAX_ UINT16_MAX +INT_LEAST16_MIN_ INT_LEAST16_MIN +INT_LEAST16_MAX_ INT_LEAST16_MAX +UINT_LEAST16_MAX_ UINT_LEAST16_MAX +INT_FAST16_MIN_ INT_FAST16_MIN +INT_FAST16_MAX_ INT_FAST16_MAX +UINT_FAST16_MAX_ UINT_FAST16_MAX + +INT32_MAX_ INT32_MAX +INT32_MIN_ INT32_MIN +UINT32_MAX_ UINT32_MAX +INT_LEAST32_MIN_ INT_LEAST32_MIN +INT_LEAST32_MAX_ INT_LEAST32_MAX +UINT_LEAST32_MAX_ UINT_LEAST32_MAX +INT_FAST32_MIN_ INT_FAST32_MIN +INT_FAST32_MAX_ INT_FAST32_MAX +UINT_FAST32_MAX_ UINT_FAST32_MAX + +INT64_MAX_ INT64_MAX +INT64_MIN_ INT64_MIN +UINT64_MAX_ UINT64_MAX +INT_LEAST64_MIN_ INT_LEAST64_MIN +INT_LEAST64_MAX_ INT_LEAST64_MAX +UINT_LEAST64_MAX_ UINT_LEAST64_MAX +INT_FAST64_MIN_ INT_FAST64_MIN +INT_FAST64_MAX_ INT_FAST64_MAX +UINT_FAST64_MAX_ UINT_FAST64_MAX + +INTPTR_MIN_ INTPTR_MIN +INTPTR_MAX_ INTPTR_MAX +UINTPTR_MAX_ UINTPTR_MAX +PTRDIFF_MIN_ PTRDIFF_MIN +PTRDIFF_MAX_ PTRDIFF_MAX +SIZE_MAX_ SIZE_MAX + +INTMAX_MIN_ INTMAX_MIN +INTMAX_MAX_ INTMAX_MAX +UINTMAX_MAX_ UINTMAX_MAX + +SIG_ATOMIC_MIN_ SIG_ATOMIC_MIN +SIG_ATOMIC_MAX_ SIG_ATOMIC_MAX +WINT_MIN_ WINT_MIN +WINT_MAX_ WINT_MAX + +WCHAR_MAX_ WCHAR_MAX +WCHAR_MIN_ WCHAR_MIN + +INT8_C_(0) INT8_C(0) +UINT8_C_(0) UINT8_C(0) +INT16_C_(0) INT16_C(0) +UINT16_C_(0) UINT16_C(0) +INT32_C_(0) INT32_C(0) +UINT32_C_(0) UINT32_C(0) +INT64_C_(0) INT64_C(0) +UINT64_C_(0) UINT64_C(0) + +INTMAX_C_(0) INTMAX_C(0) +UINTMAX_C_(0) UINTMAX_C(0) diff --git a/test/Preprocessor/stringize_misc.c b/test/Preprocessor/stringize_misc.c index 251116acad66..60d66a0061f6 100644 --- a/test/Preprocessor/stringize_misc.c +++ b/test/Preprocessor/stringize_misc.c @@ -1,20 +1,23 @@ -// RUN: clang-cc -E %s | grep -F '"f(1, 2)" "g((x=y++, y))"' && -// RUN: clang-cc -E %s | grep -F '"{a=1" "b=2;}"' && -// RUN: clang-cc -E %s | grep -F '"<" "["' && -// RUN: clang-cc -E %s | grep -F '"(,)" "(...)"' && -// RUN: clang-cc -E %s | grep -F '{a=1 c=3; b=2;}' && -// RUN: clang-cc -E %s | grep -F '"a COMMA b" "(a, b)"' +// RUN: clang-cc -E %s | FileCheck -strict-whitespace %s  #define M(x, y) #x #y  M( f(1, 2), g((x=y++, y)))  +// CHECK: "f(1, 2)" "g((x=y++, y))" +  M( {a=1 , b=2;} ) /* A semicolon is not a comma */  +// CHECK: "{a=1" "b=2;}" +  M( <, [ ) /* Passes the arguments < and [ */  +// CHECK: "<" "[" +  M( (,), (...) ) /* Passes the arguments (,) and (...) */  +// CHECK: "(,)" "(...)"  #define START_END(start, end) start c=3; end   START_END( {a=1 , b=2;} ) /* braces are not parentheses */  +// CHECK: {a=1 c=3; b=2;}  /*    * To pass a comma token as an argument it is  @@ -23,4 +26,5 @@ START_END( {a=1 , b=2;} ) /* braces are not parentheses */  #define COMMA ,   M(a COMMA b, (a, b))  +// CHECK: "a COMMA b" "(a, b)" diff --git a/test/Sema/attr-deprecated.c b/test/Sema/attr-deprecated.c index e15381e4c6d1..4b889fc8aa4f 100644 --- a/test/Sema/attr-deprecated.c +++ b/test/Sema/attr-deprecated.c @@ -43,3 +43,60 @@ void test1(struct foo *F) {  typedef struct foo foo_dep __attribute__((deprecated));  foo_dep *test2;    // expected-warning {{'foo_dep' is deprecated}} + +struct bar_dep __attribute__((deprecated,  +                              invalid_attribute));  // expected-warning {{'invalid_attribute' attribute ignored}} + +struct bar_dep *test3;   // expected-warning {{'bar_dep' is deprecated}} + + +// These should not warn because the actually declaration itself is deprecated. +// rdar://6756623 +foo_dep *test4 __attribute__((deprecated)); +struct bar_dep *test5 __attribute__((deprecated)); + +typedef foo_dep test6(struct bar_dep*); // expected-warning {{'foo_dep' is deprecated}} \ +                                        // expected-warning {{'bar_dep' is deprecated}} +typedef foo_dep test7(struct bar_dep*) __attribute__((deprecated)); + +int test8(char *p) { +  p += sizeof(foo_dep); // expected-warning {{'foo_dep' is deprecated}} + +  foo_dep *ptr;         // expected-warning {{'foo_dep' is deprecated}} +  ptr = (foo_dep*) p;   // expected-warning {{'foo_dep' is deprecated}} + +  int func(foo_dep *foo); // expected-warning {{'foo_dep' is deprecated}} +  return func(ptr); +} + +foo_dep *test9(void) __attribute__((deprecated)); +foo_dep *test9(void) { +  void* myalloc(unsigned long); + +  foo_dep *ptr +    = (foo_dep*) +        myalloc(sizeof(foo_dep)); +  return ptr; +} + +void test10(void) __attribute__((deprecated)); +void test10(void) { +  if (sizeof(foo_dep) == sizeof(void*)) { +  } +  foo_dep *localfunc(void); +  foo_dep localvar; +} + +char test11[sizeof(foo_dep)] __attribute__((deprecated)); +char test12[sizeof(foo_dep)]; // expected-warning {{'foo_dep' is deprecated}} + +int test13(foo_dep *foo) __attribute__((deprecated)); +int test14(foo_dep *foo); // expected-warning {{'foo_dep' is deprecated}} + +unsigned long test15 = sizeof(foo_dep); // expected-warning {{'foo_dep' is deprecated}} +unsigned long test16 __attribute__((deprecated)) +  = sizeof(foo_dep); + +foo_dep test17, // expected-warning {{'foo_dep' is deprecated}} +        test18 __attribute__((deprecated)), +        test19; diff --git a/test/Sema/callingconv.c b/test/Sema/callingconv.c index cb69c59c403a..102115b3bf2b 100644 --- a/test/Sema/callingconv.c +++ b/test/Sema/callingconv.c @@ -8,3 +8,12 @@ void __attribute__((stdcall)) bar(float *a) {  void __attribute__((fastcall(1))) baz(float *a) { // expected-error {{attribute requires 0 argument(s)}}  } + +void __attribute__((fastcall)) test0() { // expected-error {{function with no prototype cannot use 'fastcall' calling convention}} +} + +void __attribute__((fastcall)) test1(void) { +} + +void __attribute__((fastcall)) test2(int a, ...) { // expected-error {{variadic function cannot use 'fastcall' calling convention}} +} diff --git a/test/Sema/constant-builtins-2.c b/test/Sema/constant-builtins-2.c index 146d9e9bb92b..18dbb1e7c54a 100644 --- a/test/Sema/constant-builtins-2.c +++ b/test/Sema/constant-builtins-2.c @@ -48,3 +48,5 @@ extern int f();  int h0 = __builtin_types_compatible_p(int, float);  //int h1 = __builtin_choose_expr(1, 10, f());  //int h2 = __builtin_expect(0, 0); +extern long int bi0; +extern __typeof__(__builtin_expect(0, 0)) bi0; diff --git a/test/Sema/decl-invalid.c b/test/Sema/decl-invalid.c index 051f0f7ffbcc..823551f02e6f 100644 --- a/test/Sema/decl-invalid.c +++ b/test/Sema/decl-invalid.c @@ -10,8 +10,7 @@ int a() {    int r[x()];  // expected-error {{size of array has non-integer type 'void'}}    static y ?; // expected-error{{unknown type name 'y'}} \ -                 expected-error{{expected identifier or '('}} \ -                 expected-error{{expected ';' at end of declaration}} +                 expected-error{{expected identifier or '('}}  }  int; // expected-error {{declaration does not declare anything}} diff --git a/test/Sema/format-strings.c b/test/Sema/format-strings.c index 1826c7457e30..797e53c1bd22 100644 --- a/test/Sema/format-strings.c +++ b/test/Sema/format-strings.c @@ -8,6 +8,10 @@  char * global_fmt; +#if defined(_WIN32) || defined(_WIN64) +extern int snprintf(char*, size_t, const char*, ...); +#endif +  void check_string_literal( FILE* fp, const char* s, char *buf, ... ) {    char * b; @@ -83,7 +87,7 @@ void check_wide_string(char* b, ...)    va_start(ap,b);    printf(L"foo %d",2); // expected-warning {{incompatible pointer types}}, expected-warning {{should not be a wide string}} -  vasprintf(&b,L"bar %d",ap); // expected-warning {{incompatible pointer types}}, expected-warning {{should not be a wide string}} +  vsprintf(b,L"bar %d",ap); // expected-warning {{incompatible pointer types}}, expected-warning {{should not be a wide string}}  }  void check_asterisk_precision_width(int x) { diff --git a/test/Sema/init.c b/test/Sema/init.c index 1cbcbb7e36f8..840b24fd30b0 100644 --- a/test/Sema/init.c +++ b/test/Sema/init.c @@ -21,7 +21,7 @@ int *h = &x;  int test() {  int a[10];  int b[10] = a; // expected-error {{initialization with '{...}' expected}} -int +; // expected-error {{expected identifier or '('}} expected-error {{expected ';' at end of declaration}} +int +; // expected-error {{expected identifier or '('}}  } diff --git a/test/Sema/offsetof.c b/test/Sema/offsetof.c index f8b9fed03c3c..dfae99216f8a 100644 --- a/test/Sema/offsetof.c +++ b/test/Sema/offsetof.c @@ -48,3 +48,9 @@ int a[__builtin_offsetof(struct sockaddr_un, sun_path[len+1])];  // PR4079  union x {struct {int x;};};  int x[__builtin_offsetof(union x, x)]; + +// rdar://problem/7222956 +struct incomplete; // expected-note 2 {{forward declaration of 'struct incomplete'}} +int test1[__builtin_offsetof(struct incomplete, foo)]; // expected-error {{offsetof of incomplete type 'struct incomplete'}} + +int test1[__builtin_offsetof(struct incomplete[10], [4].foo)]; // expected-error {{array has incomplete element type 'struct incomplete'}} diff --git a/test/Sema/parentheses.c b/test/Sema/parentheses.c new file mode 100644 index 000000000000..a8ad260bf8b5 --- /dev/null +++ b/test/Sema/parentheses.c @@ -0,0 +1,20 @@ +// RUN: clang-cc -Wparentheses -fsyntax-only -verify %s && +// RUN: clang-cc -Wparentheses -fixit %s -o - | clang-cc -Wparentheses -Werror - + +// Test the various warnings under -Wparentheses +void if_assign(void) { +  int i; +  if (i = 4) {} // expected-warning {{assignment as a condition}} +  if ((i = 4)) {} +} + +void bitwise_rel(unsigned i) { +  (void)(i & 0x2 == 0); // expected-warning {{& has lower precedence than ==}} +  (void)(0 == i & 0x2); // expected-warning {{& has lower precedence than ==}} +  (void)(i & 0xff < 30); // expected-warning {{& has lower precedence than <}} +  (void)((i & 0x2) == 0); +  (void)(i & (0x2 == 0)); +  // Eager logical op +  (void)(i == 1 | i == 2 | i == 3); +  (void)(i != 1 & i != 2 & i != 3); +} diff --git a/test/Sema/return-noreturn.c b/test/Sema/return-noreturn.c index e2452f407f4f..8868c9ee0aeb 100644 --- a/test/Sema/return-noreturn.c +++ b/test/Sema/return-noreturn.c @@ -27,3 +27,11 @@ __attribute__((__noreturn__)) void* test3(int arg) {  __attribute__((__noreturn__)) void* test3_positive(int arg) {    while (0) foo_test_3();  } // expected-warning{{function declared 'noreturn' should not return}} + + +// PR5298 - -Wmissing-noreturn shouldn't warn if the function is already +// declared noreturn. +void __attribute__((noreturn)) +test4() { +  test2_positive(); +} diff --git a/test/Sema/return.c b/test/Sema/return.c index 64def306ebc8..cdd31059b3e7 100644 --- a/test/Sema/return.c +++ b/test/Sema/return.c @@ -203,7 +203,11 @@ int test30() {    if (j)      longjmp(test30_j, 1);    else +#if defined(_WIN32) || defined(_WIN64) +    longjmp(test30_j, 2); +#else      _longjmp(test30_j, 1); +#endif  }  typedef void test31_t(int status); diff --git a/test/Sema/statements.c b/test/Sema/statements.c index 9a71a403700d..8eac052a25c7 100644 --- a/test/Sema/statements.c +++ b/test/Sema/statements.c @@ -27,3 +27,9 @@ int test8[({10;})]; // expected-error {{statement expression not allowed at file  void test9(const void *P) {    __builtin_prefetch(P);  } + + +void *test10() {  +bar: +  return &&bar;  // expected-warning {{returning address of label, which is local}} +} diff --git a/test/Sema/stdcall-fastcall.c b/test/Sema/stdcall-fastcall.c index 353bbfc25297..e0db63822fb3 100644 --- a/test/Sema/stdcall-fastcall.c +++ b/test/Sema/stdcall-fastcall.c @@ -5,6 +5,6 @@ int __attribute__((stdcall)) var1; // expected-warning{{'stdcall' attribute only  int __attribute__((fastcall)) var2; // expected-warning{{'fastcall' attribute only applies to function types}}  // Different CC qualifiers are not compatible -void __attribute__((stdcall, fastcall)) foo3(); // expected-error{{stdcall and fastcall attributes are not compatible}} +void __attribute__((stdcall, fastcall)) foo3(void); // expected-error{{stdcall and fastcall attributes are not compatible}}  void __attribute__((stdcall)) foo4(); -void __attribute__((fastcall)) foo4(); // expected-error{{fastcall and stdcall attributes are not compatible}} +void __attribute__((fastcall)) foo4(void); // expected-error{{fastcall and stdcall attributes are not compatible}} diff --git a/test/Sema/vector-init.c b/test/Sema/vector-init.c index 18104d871d6c..9dac6c7114da 100644 --- a/test/Sema/vector-init.c +++ b/test/Sema/vector-init.c @@ -8,7 +8,7 @@ float4 foo = (float4){ 1.0, 2.0, 3.0, 4.0 };  float4 foo2 = (float4){ 1.0, 2.0, 3.0, 4.0 , 5.0 }; // expected-warning{{excess elements in vector initializer}}  float4 array[] = { 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0}; -int array_sizecheck[(sizeof(array) / sizeof(float4)) == 3? 1 : -1]; +int array_sizecheck[(sizeof(array) / sizeof(float4)) == 3 ? 1 : -1];  float4 array2[2] = { 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0,                        9.0 }; // expected-warning {{excess elements in array initializer}} @@ -26,5 +26,5 @@ float f1(void) {  // PR5265  typedef float __attribute__((ext_vector_type (3))) float3; -int test2[(sizeof(float3) == sizeof(float4))*2-1]; +int test2[sizeof(float3) == sizeof(float4) ? 1 : -1]; diff --git a/test/SemaCXX/constructor.cpp b/test/SemaCXX/constructor.cpp index 5ce595cdcece..58d28b55184c 100644 --- a/test/SemaCXX/constructor.cpp +++ b/test/SemaCXX/constructor.cpp @@ -14,7 +14,7 @@ class Foo {    static Foo(short, short); // expected-error{{constructor cannot be declared 'static'}}    virtual Foo(double); // expected-error{{constructor cannot be declared 'virtual'}}    Foo(long) const; // expected-error{{'const' qualifier is not allowed on a constructor}} - +      int Foo(int, int); // expected-error{{constructor cannot have a return type}}  }; diff --git a/test/SemaCXX/implicit-int.cpp b/test/SemaCXX/implicit-int.cpp index 6fa8dd3463d3..723030516dee 100644 --- a/test/SemaCXX/implicit-int.cpp +++ b/test/SemaCXX/implicit-int.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang-cc -fsyntax-only -verify -fms-extensions=0 %s  x; // expected-error{{C++ requires a type specifier for all declarations}} diff --git a/test/SemaCXX/invalid-member-expr.cpp b/test/SemaCXX/invalid-member-expr.cpp index 90932ed65e31..730beb32698b 100644 --- a/test/SemaCXX/invalid-member-expr.cpp +++ b/test/SemaCXX/invalid-member-expr.cpp @@ -5,8 +5,8 @@ class X {};  void test() {    X x; -  x.int; // expected-error{{expected identifier}} -  x.~int(); // expected-error{{expected identifier}} +  x.int; // expected-error{{expected unqualified-id}} +  x.~int(); // expected-error{{expected the class name}}    x.operator; // expected-error{{missing type specifier after 'operator'}}    x.operator typedef; // expected-error{{missing type specifier after 'operator'}}  } @@ -14,8 +14,8 @@ void test() {  void test2() {    X *x; -  x->int; // expected-error{{expected identifier}} -  x->~int(); // expected-error{{expected identifier}} +  x->int; // expected-error{{expected unqualified-id}} +  x->~int(); // expected-error{{expected the class name}}    x->operator; // expected-error{{missing type specifier after 'operator'}}    x->operator typedef; // expected-error{{missing type specifier after 'operator'}}  } diff --git a/test/SemaCXX/invalid-template-specifier.cpp b/test/SemaCXX/invalid-template-specifier.cpp index a3f081ff60b5..034ad73b086a 100644 --- a/test/SemaCXX/invalid-template-specifier.cpp +++ b/test/SemaCXX/invalid-template-specifier.cpp @@ -8,5 +8,5 @@ const template basic_istream<char>; // expected-error {{expected unqualified-id}  namespace S {}  template <class X> class Y {    void x() { S::template y<char>(1); } // expected-error {{does not refer to a template}} \ -                                       // expected-error {{no member named 'y'}} +                                       // expected-error {{unqualified-id}}  }; diff --git a/test/SemaCXX/nested-name-spec.cpp b/test/SemaCXX/nested-name-spec.cpp index 5178557030b7..721758f4cae0 100644 --- a/test/SemaCXX/nested-name-spec.cpp +++ b/test/SemaCXX/nested-name-spec.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -std=c++98 -verify %s  +// RUN: clang-cc -fsyntax-only -std=c++98 -verify -fms-extensions=0 %s   namespace A {    struct C {      static int cx; diff --git a/test/SemaCXX/new-delete.cpp b/test/SemaCXX/new-delete.cpp index c67a3f653900..6f3e9effe538 100644 --- a/test/SemaCXX/new-delete.cpp +++ b/test/SemaCXX/new-delete.cpp @@ -58,6 +58,7 @@ void bad_news(int *ip)    (void)new int[1.1]; // expected-error {{array size expression must have integral or enumerated type, not 'double'}}    (void)new int[1][i]; // expected-error {{only the first dimension}}    (void)new (int[1][i]); // expected-error {{only the first dimension}} +  (void)new (int[i]); // expected-error {{when type is in parentheses}}    (void)new int(*(S*)0); // expected-error {{incompatible type initializing}}    (void)new int(1, 2); // expected-error {{initializer of a builtin type can only take one argument}}    (void)new S(1); // expected-error {{no matching constructor}} diff --git a/test/SemaCXX/overloaded-operator.cpp b/test/SemaCXX/overloaded-operator.cpp index 10b0f5a76804..0f723ad206b9 100644 --- a/test/SemaCXX/overloaded-operator.cpp +++ b/test/SemaCXX/overloaded-operator.cpp @@ -70,6 +70,34 @@ void enum_test(Enum1 enum1, Enum2 enum2, E1 e1, E2 e2) {    float &f4 = (enum1 == enum2);  // expected-error{{non-const lvalue reference to type 'float' cannot be initialized with a temporary of type 'bool'}}  } +// PR5244 - Argument-dependent lookup would include the two operators below, +// which would break later assumptions and lead to a crash. +class pr5244_foo +{ +  pr5244_foo(int); +  pr5244_foo(char); +}; + +bool operator==(const pr5244_foo& s1, const pr5244_foo& s2); +bool operator==(char c, const pr5244_foo& s); + +enum pr5244_bar +{ +    pr5244_BAR +}; + +class pr5244_baz +{ +    pr5244_bar quux; +}; + +void pr5244_barbaz() +{ +  pr5244_baz quuux; +  (void)(pr5244_BAR == quuux.quux); +} + +  struct PostInc {    PostInc operator++(int); diff --git a/test/SemaCXX/ptrtomember-badcall.cpp b/test/SemaCXX/ptrtomember-badcall.cpp new file mode 100644 index 000000000000..42b8e3b6e0c9 --- /dev/null +++ b/test/SemaCXX/ptrtomember-badcall.cpp @@ -0,0 +1,13 @@ +// RUN: clang-cc -fsyntax-only -verify %s -std=c++0x + +struct  S { +	int i; + +	int mem(int); +}; + +int foo(int S::* ps, S *s) +{ +    return (s->*ps)(1); // expected-error {{called object type 'int' is not a function or function pointer}} +} + diff --git a/test/SemaCXX/typedef-redecl.cpp b/test/SemaCXX/typedef-redecl.cpp index e38f47436d1c..85944a661d41 100644 --- a/test/SemaCXX/typedef-redecl.cpp +++ b/test/SemaCXX/typedef-redecl.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s  +// RUN: clang-cc -fsyntax-only -verify -fms-extensions=0 %s   typedef int INT;  typedef INT REALLY_INT; // expected-note {{previous definition is here}}  typedef REALLY_INT REALLY_REALLY_INT; diff --git a/test/SemaCXX/value-initialization.cpp b/test/SemaCXX/value-initialization.cpp new file mode 100644 index 000000000000..29d866fa64de --- /dev/null +++ b/test/SemaCXX/value-initialization.cpp @@ -0,0 +1,10 @@ +// RUN: clang-cc -fsyntax-only -verify %s -std=c++0x + +struct A { +     const int i;	// expected-note {{declared at}} +     virtual void f() { }  +}; + +int main () { +      (void)A();	// expected-error {{cannot define the implicit default constructor for 'struct A', because const member 'i' cannot be default-initialized}} +} diff --git a/test/SemaObjC/conditional-expr-6.m b/test/SemaObjC/conditional-expr-6.m new file mode 100644 index 000000000000..bba51bb8178f --- /dev/null +++ b/test/SemaObjC/conditional-expr-6.m @@ -0,0 +1,51 @@ +// RUN: clang-cc -fsyntax-only -verify %s + +@protocol MyProtocol @end + +@interface NSObject @end + +@interface NSInterm : NSObject <MyProtocol> +@end + +@interface NSArray : NSInterm  +@end + +@interface NSSet : NSObject <MyProtocol> +@end + + +@interface N1 : NSObject +@end + +@interface N1() <MyProtocol> +@end + +NSObject* test (int argc) { +    NSArray *array = ((void*)0); +    NSSet *set = ((void*)0); +    return (argc) ? set : array ; +} + + +NSObject* test1 (int argc) { +    NSArray *array = ((void*)0); +    NSSet *set = ((void*)0); +    id <MyProtocol> instance = (argc) ? array : set; +    id <MyProtocol> instance1 = (argc) ? set : array; + +    N1 *n1 = ((void*)0); +    id <MyProtocol> instance2 = (argc) ? set : n1; +    id <MyProtocol> instance3 = (argc) ? n1 : array; + +    NSArray<MyProtocol> *qual_array = ((void*)0); +    id <MyProtocol> instance4 = (argc) ? array : qual_array; +    id <MyProtocol> instance5 = (argc) ? qual_array : array; +    NSSet<MyProtocol> *qual_set = ((void*)0); +    id <MyProtocol> instance6 = (argc) ? qual_set : qual_array; +    id <MyProtocol> instance7 = (argc) ? qual_set : array; +    id <MyProtocol> instance8 = (argc) ? qual_array : set; +    id <MyProtocol> instance9 = (argc) ? qual_array : qual_set; + + +    return (argc) ? array : set; +} diff --git a/test/SemaObjC/continuation-class-err.m b/test/SemaObjC/continuation-class-err.m index f516a9326a95..262b786b5408 100644 --- a/test/SemaObjC/continuation-class-err.m +++ b/test/SemaObjC/continuation-class-err.m @@ -5,11 +5,36 @@    id _object;    id _object1;  } -@property(readonly) id object; -@property(readwrite, assign) id object1; +@property(readonly) id object;	// expected-note {{property declared here}} +@property(readwrite, assign) id object1; // expected-note {{property declared here}}  @end  @interface ReadOnly () -@property(readwrite, copy) id object;	 -@property(readonly) id object1; // expected-error {{attribute of property in continuation class of 'ReadOnly' can only  be 'readwrite'}} +@property(readwrite, copy) id object;	// expected-warning {{property attribute in continuation class does not match the primary class}} +@property(readonly) id object1; // expected-error {{property declaration in continuation class of 'ReadOnly' is to change a 'readonly' property to 'readwrite'}}  @end + +@protocol Proto +  @property (copy) id fee; // expected-note {{property declared here}} +@end + +@protocol Foo<Proto> +  @property (copy) id foo; // expected-note {{property declared here}} +@end + +@interface Bar  <Foo> { +        id _foo; +        id _fee; +} +@end + +@interface Bar () +@property (copy) id foo;	// expected-error {{property declaration in continuation class of 'Bar' is to change a 'readonly' property to 'readwrite'}} +@property (copy) id fee;	// expected-error {{property declaration in continuation class of 'Bar' is to change a 'readonly' property to 'readwrite'}} +@end + +@implementation Bar +@synthesize foo = _foo; +@synthesize fee = _fee; +@end + diff --git a/test/SemaObjC/id-isa-ref.m b/test/SemaObjC/id-isa-ref.m index dc42f9a53965..fa3293ce79b5 100644 --- a/test/SemaObjC/id-isa-ref.m +++ b/test/SemaObjC/id-isa-ref.m @@ -1,7 +1,7 @@  // RUN: clang-cc -fsyntax-only -verify %s  // Failing currently due to Obj-C type representation changes. 2009-09-17 -// XFAIL +// XFAIL: *  typedef struct objc_object {    struct objc_class *isa; diff --git a/test/SemaObjC/property-category-4.m b/test/SemaObjC/property-category-4.m new file mode 100644 index 000000000000..ee08b09c0137 --- /dev/null +++ b/test/SemaObjC/property-category-4.m @@ -0,0 +1,18 @@ +// RUN: clang-cc -fsyntax-only -verify %s + +@interface IDELogNavigator +{ +  id selectedObjects; +} +@end + +@interface IDELogNavigator (CAT) +  @property (readwrite, retain) id selectedObjects; // expected-note {{property declared here}} +  @property (readwrite, retain) id d_selectedObjects; // expected-note {{property declared here}} +@end + +@implementation IDELogNavigator  +@synthesize selectedObjects = _selectedObjects; // expected-error {{property declared in category 'CAT' cannot be implemented in class implementation}} +@dynamic d_selectedObjects; // expected-error {{property declared in category 'CAT' cannot be implemented in class implementation}} +@end + diff --git a/test/SemaObjC/return.m b/test/SemaObjC/return.m index 9acf47079958..ff6499479458 100644 --- a/test/SemaObjC/return.m +++ b/test/SemaObjC/return.m @@ -1,6 +1,22 @@ -// RUN: clang-cc %s -fsyntax-only -verify +// RUN: clang-cc %s -fsyntax-only -verify -Wmissing-noreturn  int test1() {    id a;    @throw a;  } + +// PR5286 +void test2(int a) { +  while (1) { +    if (a) +      return; +  } +} + +// PR5286 +void test3(int a) {  // expected-warning {{function could be attribute 'noreturn'}} +  while (1) { +    if (a) +      @throw (id)0; +  } +} diff --git a/test/SemaObjCXX/overload.mm b/test/SemaObjCXX/overload.mm index 47141002864c..56dc5108eb95 100644 --- a/test/SemaObjCXX/overload.mm +++ b/test/SemaObjCXX/overload.mm @@ -1,5 +1,5 @@  // RUN: clang-cc -fsyntax-only -verify %s -// XFAIL +// XFAIL: *  @interface Foo  @end diff --git a/test/SemaObjCXX/references.mm b/test/SemaObjCXX/references.mm index 82797cef77c7..e02f360f7876 100644 --- a/test/SemaObjCXX/references.mm +++ b/test/SemaObjCXX/references.mm @@ -1,7 +1,7 @@  // FIXME: This crashes, disable it until fixed.  // RN: clang-cc -verify -emit-llvm -o - %s  // RUN: false -// XFAIL +// XFAIL: *  // Test reference binding. diff --git a/test/SemaTemplate/class-template-spec.cpp b/test/SemaTemplate/class-template-spec.cpp index e44115c748c3..4cd43b469ae0 100644 --- a/test/SemaTemplate/class-template-spec.cpp +++ b/test/SemaTemplate/class-template-spec.cpp @@ -20,8 +20,7 @@ int test_incomplete_specs(A<double, double> *a1,                            A<double> *a2)  {    (void)a1->x; // expected-error{{incomplete definition of type 'A<double, double>'}} -  (void)a2->x; // expected-error{{implicit instantiation of undefined template 'struct A<double, int>'}} \ -               // expected-note{{first required here}} +  (void)a2->x; // expected-error{{implicit instantiation of undefined template 'struct A<double, int>'}}  }  typedef float FLOAT; @@ -71,8 +70,7 @@ namespace N {  }  // Diagnose specialization errors -struct A<double> { }; // expected-error{{template specialization requires 'template<>'}} \ -                      // expected-error{{after instantiation}} +struct A<double> { }; // expected-error{{template specialization requires 'template<>'}}  template<> struct ::A<double>; @@ -100,3 +98,9 @@ template<> struct N::B<char> {    int testf(int x) { return f(x); }  }; +// PR5264 +template <typename T> class Foo; +Foo<int>* v; +Foo<int>& F() { return *v; } +template <typename T> class Foo {}; +Foo<int> x; diff --git a/test/SemaTemplate/constructor-template.cpp b/test/SemaTemplate/constructor-template.cpp index acd845bc2fd5..79bf7c585e34 100644 --- a/test/SemaTemplate/constructor-template.cpp +++ b/test/SemaTemplate/constructor-template.cpp @@ -51,3 +51,4 @@ void test_X1(X1<int> xi) {  template<class C> struct A {};  template <> struct A<int>{A(const A<int>&);};  struct B { A<int> x; B(B& a) : x(a.x) {} }; + diff --git a/test/SemaTemplate/copy-ctor-assign.cpp b/test/SemaTemplate/copy-ctor-assign.cpp index 90fb0133a721..69481ea557f4 100644 --- a/test/SemaTemplate/copy-ctor-assign.cpp +++ b/test/SemaTemplate/copy-ctor-assign.cpp @@ -33,4 +33,20 @@ void test3(X<int> &x, X<int> xi, X<long> xl, X<int Y::*> xmptr) {    x = xi;    x = xl;    x = xmptr; // expected-note{{instantiation}} -}
\ No newline at end of file +} + +struct X1 { +  X1 &operator=(const X1&); +}; + +template<typename T> +struct X2 : X1 { +  template<typename U> X2 &operator=(const U&); +}; + +struct X3 : X2<int> { +}; + +void test_X2(X3 &to, X3 from) { +  to = from; +} diff --git a/test/SemaTemplate/default-expr-arguments.cpp b/test/SemaTemplate/default-expr-arguments.cpp index 575283ed8b51..9c0f1ecf0c3b 100644 --- a/test/SemaTemplate/default-expr-arguments.cpp +++ b/test/SemaTemplate/default-expr-arguments.cpp @@ -84,3 +84,27 @@ struct X1 {  void test_X1() {    X1<int> x1;  } + +// PR5283 +namespace PR5283 { +template<typename T> struct A { +  A(T = 1); // expected-error 3 {{incompatible type initializing 'int', expected 'int *'}} +}; + +struct B : A<int*> {  +  B(); +}; +B::B() { } // expected-note {{in instantiation of default function argument expression for 'A<int *>' required he}} + +struct C : virtual A<int*> { +  C(); +}; +C::C() { } // expected-note {{in instantiation of default function argument expression for 'A<int *>' required he}} + +struct D { +  D(); +   +  A<int*> a; +}; +D::D() { } // expected-note {{in instantiation of default function argument expression for 'A<int *>' required he}} +} diff --git a/test/SemaTemplate/ext-vector-type.cpp b/test/SemaTemplate/ext-vector-type.cpp index b6aebc102fb4..7cc4ae930ed2 100644 --- a/test/SemaTemplate/ext-vector-type.cpp +++ b/test/SemaTemplate/ext-vector-type.cpp @@ -45,3 +45,16 @@ struct make5 {    typedef int_ptr __attribute__((ext_vector_type(Length))) type; // expected-error{{invalid vector type}}               }; +template<int Length> +struct make6 { +  typedef int __attribute__((ext_vector_type(Length))) type; +}; + +int test_make6() { +  make6<4>::type x; +  x.w = 7; + +  make6<2>::type y; +  y.x = -1; +  y.w = -1; // expected-error{{vector component access exceeds type}} +} diff --git a/test/SemaTemplate/friend-template.cpp b/test/SemaTemplate/friend-template.cpp index 761c13076d2a..84a8e899dbea 100644 --- a/test/SemaTemplate/friend-template.cpp +++ b/test/SemaTemplate/friend-template.cpp @@ -54,6 +54,7 @@ struct X1 {  template<typename U> void f2(U);  X1<int> x1i; +X0<int*> x0ip;  template<> void f2(int); @@ -62,3 +63,31 @@ template<> void f2(int);  template<typename U> void f3(U);  template<> void f3(int); + +// PR5332 +template <typename T> +class Foo { +  template <typename U> +  friend class Foo; +}; + +Foo<int> foo; + +template<typename T, T Value> +struct X2a; + +template<typename T, int Size> +struct X2b; + +template<typename T> +class X3 { +  template<typename U, U Value> +  friend struct X2a; + +  template<typename U, T Value> +  friend struct X2b; +}; + +X3<int> x3i; // okay + +X3<long> x3l; // FIXME: should cause an instantiation-time failure diff --git a/test/SemaTemplate/instantiate-cast.cpp b/test/SemaTemplate/instantiate-cast.cpp index 6b3fc6e12534..c3c318f36d5d 100644 --- a/test/SemaTemplate/instantiate-cast.cpp +++ b/test/SemaTemplate/instantiate-cast.cpp @@ -96,7 +96,6 @@ struct FunctionalCast1 {  template struct FunctionalCast1<int, float>;  template struct FunctionalCast1<A, int>; // expected-note{{instantiation}} -#if 0  // Generates temporaries, which we cannot handle yet.  template<int N, long M>  struct FunctionalCast2 { @@ -106,4 +105,13 @@ struct FunctionalCast2 {  };  template struct FunctionalCast2<1, 3>; -#endif + +// --------------------------------------------------------------------- +// implicit casting +// --------------------------------------------------------------------- +template<typename T> +struct Derived2 : public Base { }; + +void test_derived_to_base(Base *&bp, Derived2<int> *dp) { +  bp = dp; +} diff --git a/test/SemaTemplate/instantiate-declref-ice.cpp b/test/SemaTemplate/instantiate-declref-ice.cpp index 21ee87202797..ab12b90f6c98 100644 --- a/test/SemaTemplate/instantiate-declref-ice.cpp +++ b/test/SemaTemplate/instantiate-declref-ice.cpp @@ -5,3 +5,33 @@ template<int i> struct x {    x<j>* y;  }; +template<int i> +const int x<i>::j; + +int array0[x<2>::j]; + + +template<typename T> +struct X0 { +  static const unsigned value = sizeof(T); +}; + +template<typename T> +const unsigned X0<T>::value; + +int array1[X0<int>::value == sizeof(int)? 1 : -1]; + +const unsigned& testX0() { return X0<int>::value; } + +int array2[X0<int>::value == sizeof(int)? 1 : -1]; + +template<typename T> +struct X1 { +  static const unsigned value; +}; + +template<typename T> +const unsigned X1<T>::value = sizeof(T); + +int array3[X1<int>::value == sizeof(int)? 1 : -1]; // expected-error{{variable length arrays are not permitted in C++}} \ +// expected-error{{variable length array declaration not allowed at file scope}} diff --git a/test/SemaTemplate/instantiate-declref.cpp b/test/SemaTemplate/instantiate-declref.cpp index 051c6050abea..359e2c7dfaa4 100644 --- a/test/SemaTemplate/instantiate-declref.cpp +++ b/test/SemaTemplate/instantiate-declref.cpp @@ -69,3 +69,21 @@ namespace N2 {  template struct N2::Outer2::Inner<float>;  template struct N2::Outer2::Inner<int*, float*>; // expected-note{{instantiation}} + +// Test dependent pointer-to-member expressions. +template<typename T> +struct smart_ptr { +  struct safe_bool { +    int member; +  }; +   +  operator int safe_bool::*() const {  +    return ptr? &safe_bool::member : 0; +  } +   +  T* ptr; +}; + +void test_smart_ptr(smart_ptr<int> p) { +  if (p) { } +} diff --git a/test/SemaTemplate/instantiate-function-1.mm b/test/SemaTemplate/instantiate-function-1.mm index be995e7ff615..c119ab5da8b9 100644 --- a/test/SemaTemplate/instantiate-function-1.mm +++ b/test/SemaTemplate/instantiate-function-1.mm @@ -1,5 +1,5 @@  // RUN: clang-cc -fsyntax-only -verify %s -// XFAIL +// XFAIL: *  template<typename T> struct Member0 {    void f(T t) { diff --git a/test/SemaTemplate/instantiate-method.cpp b/test/SemaTemplate/instantiate-method.cpp index f7c09ef87900..df1e1d964eb6 100644 --- a/test/SemaTemplate/instantiate-method.cpp +++ b/test/SemaTemplate/instantiate-method.cpp @@ -81,3 +81,20 @@ int *a(A0<int> &x0, A1<int> &x1) {    int *y0 = x0;    int *y1 = x1; // expected-error{{initializing}}  } + +struct X0Base { +  int &f(); +}; + +template<typename T> +struct X0 : X0Base { +}; + +template<typename U> +struct X1 : X0<U> { +  int &f2() { return X0Base::f(); } +}; + +void test_X1(X1<int> x1i) { +  int &ir = x1i.f2(); +} diff --git a/test/SemaTemplate/instantiate-non-type-template-parameter.cpp b/test/SemaTemplate/instantiate-non-type-template-parameter.cpp new file mode 100644 index 000000000000..32acbd0d8bdc --- /dev/null +++ b/test/SemaTemplate/instantiate-non-type-template-parameter.cpp @@ -0,0 +1,14 @@ +// RUN: clang-cc -fsyntax-only -verify %s + +// PR5311 +template<typename T> +class StringSwitch { +public: +  template<unsigned N> +  void Case(const char (&S)[N], const int & Value) { +  } +}; + +int main(int argc, char *argv[]) { +  (void)StringSwitch<int>(); +} diff --git a/test/SemaTemplate/instantiate-subscript.cpp b/test/SemaTemplate/instantiate-subscript.cpp index 434d84e2b893..20e2c39d0cce 100644 --- a/test/SemaTemplate/instantiate-subscript.cpp +++ b/test/SemaTemplate/instantiate-subscript.cpp @@ -6,7 +6,7 @@ struct Sub0 {  };  struct Sub1 { -  long &operator[](long); +  long &operator[](long); // expected-note{{candidate function}}  };  struct ConvertibleToInt { @@ -24,3 +24,18 @@ template struct Subscript0<int*, int, int&>;  template struct Subscript0<Sub0, int, int&>;  template struct Subscript0<Sub1, ConvertibleToInt, long&>;  template struct Subscript0<Sub1, Sub0, long&>; // expected-note{{instantiation}} + +// PR5345 +template <typename T> +struct S { +  bool operator[](int n) const { return true; } +}; + +template <typename T> +void Foo(const S<int>& s, T x) { +  if (s[0]) {} +} + +void Bar() { +  Foo(S<int>(), 0); +} diff --git a/test/SemaTemplate/member-template-access-expr.cpp b/test/SemaTemplate/member-template-access-expr.cpp index 0f9f21f339d1..0238cd53c553 100644 --- a/test/SemaTemplate/member-template-access-expr.cpp +++ b/test/SemaTemplate/member-template-access-expr.cpp @@ -1,5 +1,4 @@  // RUN: clang-cc -fsyntax-only -verify %s -  template<typename U, typename T>  U f0(T t) {    return t.template get<U>(); @@ -50,3 +49,47 @@ B<T>::destroy()  void do_destroy_B(B<int> b) {    b.destroy();  } + +struct X1 { +  int* f1(int); +  template<typename T> float* f1(T); +   +  static int* f2(int); +  template<typename T> static float* f2(T); +}; + +void test_X1(X1 x1) { +  float *fp1 = x1.f1<>(17); +  float *fp2 = x1.f1<int>(3.14); +  int *ip1 = x1.f1(17); +  float *ip2 = x1.f1(3.14); +   +  float* (X1::*mf1)(int) = &X1::f1; +  float* (X1::*mf2)(int) = &X1::f1<>; +  float* (X1::*mf3)(float) = &X1::f1<float>; +   +  float* (*fp3)(int) = &X1::f2; +  float* (*fp4)(int) = &X1::f2<>; +  float* (*fp5)(float) = &X1::f2<float>;   +  float* (*fp6)(int) = X1::f2; +  float* (*fp7)(int) = X1::f2<>; +  float* (*fp8)(float) = X1::f2<float>;   +} + +template<int A> struct X2 {  +  int m; +}; + +template<typename T> +struct X3 : T { }; + +template<typename T> +struct X4 { +  template<typename U> +  void f(X2<sizeof(X3<U>().U::m)>); +}; + +void f(X4<X3<int> > x4i) { +  X2<sizeof(int)> x2; +  x4i.f<X2<sizeof(int)> >(x2); +} diff --git a/test/SemaTemplate/nested-name-spec-template.cpp b/test/SemaTemplate/nested-name-spec-template.cpp index a5aa2dcb527a..1bdc7a89d4e8 100644 --- a/test/SemaTemplate/nested-name-spec-template.cpp +++ b/test/SemaTemplate/nested-name-spec-template.cpp @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify %s +// RUN: clang-cc -fsyntax-only -verify -fms-extensions=0 %s  namespace N {     namespace M { diff --git a/test/SemaTemplate/nested-template.cpp b/test/SemaTemplate/nested-template.cpp index 5ee2c9954005..4d948184cee9 100644 --- a/test/SemaTemplate/nested-template.cpp +++ b/test/SemaTemplate/nested-template.cpp @@ -101,3 +101,10 @@ struct X0<T*> {    template<typename U>    void f(U u = T()) { }  }; + +// PR5103 +template<typename> +struct X1 { +  template<typename, bool = false> struct B { }; +}; +template struct X1<int>::B<bool>; diff --git a/test/SemaTemplate/operator-function-id-template.cpp b/test/SemaTemplate/operator-function-id-template.cpp new file mode 100644 index 000000000000..92a8c84e3be6 --- /dev/null +++ b/test/SemaTemplate/operator-function-id-template.cpp @@ -0,0 +1,28 @@ +// RUN: clang-cc -fsyntax-only -verify %s + +template<typename T> +struct A {  +  template<typename U> A<T> operator+(U); +}; + +template<int Value, typename T> bool operator==(A<T>, A<T>); + +template<> bool operator==<0>(A<int>, A<int>); + +bool test_qualified_id(A<int> ai) { +  return ::operator==<0, int>(ai, ai); +} + +void test_op(A<int> a, int i) { +  const A<int> &air = a.operator+<int>(i); +} + +template<typename T> +void test_op_template(A<T> at, T x) { +  const A<T> &atr = at.template operator+<T>(x); +  const A<T> &atr2 = at.A::template operator+<T>(x); +  // FIXME: unrelated template-name instantiation issue +  //  const A<T> &atr3 = at.template A<T>::template operator+<T>(x); +} + +template void test_op_template<float>(A<float>, float); diff --git a/test/SemaTemplate/template-id-expr.cpp b/test/SemaTemplate/template-id-expr.cpp new file mode 100644 index 000000000000..a0cbe4408494 --- /dev/null +++ b/test/SemaTemplate/template-id-expr.cpp @@ -0,0 +1,14 @@ +// RUN: clang-cc -fsyntax-only -verify %s + +// PR5336 +template<typename FromCl> +struct isa_impl_cl { + template<class ToCl> + static void isa(const FromCl &Val) { } +}; + +template<class X, class Y> +void isa(const Y &Val) {   return isa_impl_cl<Y>::template isa<X>(Val); } + +class Value; +void f0(const Value &Val) { isa<Value>(Val); } diff --git a/test/SemaTemplate/template-id-printing.cpp b/test/SemaTemplate/template-id-printing.cpp new file mode 100644 index 000000000000..13250943e92c --- /dev/null +++ b/test/SemaTemplate/template-id-printing.cpp @@ -0,0 +1,13 @@ +// RUN: clang-cc -fsyntax-only -ast-print %s | FileCheck %s +namespace N { +  template<typename T, typename U> void f(U); +  template<int> void f(); +} + +void g() { +  // CHECK: N::f<int>(3.14 +  N::f<int>(3.14); +   +  // CHECK: N::f<double> +  void (*fp)(int) = N::f<double>; +} diff --git a/test/lit.site.cfg.in b/test/lit.site.cfg.in index 9dabafcde1f4..c88c90b7c5df 100644 --- a/test/lit.site.cfg.in +++ b/test/lit.site.cfg.in @@ -5,6 +5,7 @@ config.llvm_obj_root = "@LLVM_BINARY_DIR@"  config.llvm_tools_dir = "@LLVM_TOOLS_DIR@"  config.llvm_libs_dir = "@LLVM_LIBS_DIR@"  config.clang_obj_root = "@CLANG_BINARY_DIR@" +config.target_triple = "@TARGET_TRIPLE@"  # Let the main config do the real work.  lit.load_config(config, "@CLANG_SOURCE_DIR@/test/lit.cfg") | 
