tigerleapgorge created this revision.
tigerleapgorge added a reviewer: rsmith.
tigerleapgorge added a subscriber: cfe-commits.
Herald added a subscriber: aemerson.

Hi Everyone,


Here is the 11th Lit C++11 compatibility patch.
This will most likely be my final Lit patch.
I have updated 16 tests this time.
Here are the explanations for each test.


CodeGenCXX/exceptions.cpp
  Implicit destructors are noexcept (nothrow) in C++11.
  The LLVM IR invocation for these destructors changed from “invoke” to “call”.

  This is related to C++11’s standard 15.4\14 and 15.4\15 in [except.spec] 
  In C++11, Clang marks implicit destructors as “nothrow” in the AST and 
“nounwind” in the LLVM IR.

    [except.spec] 15.4\14 
      An implicitly declared special member function shall have an 
exception-specification. 
      If f is an implicitly declared default constructor, copy constructor, 
move constructor, 
      destructor, copy assignment operator, or move assignment operator, 
      its implicit exception-specification specifies the type-id T if and only 
if T is allowed 
      by the exception-specification of a function directly invoked by f’s 
implicit definition; 
      f shall allow all exceptions if any function it directly invokes allows 
all exceptions,
      and f shall allow no exceptions if every function it directly invokes 
allows no exceptions.

    [except.spec] 15.4\15
      A deallocation function (3.7.4.2) with no explicit exception-specification
      is treated as if it were specified with noexcept(true).


  IR changes are as follows:

    test1::B::~B() is nothrow in C++11. IR for its invocation changed from 
invoke to call.
      C++98:  invoke void @_ZN5test11BD1Ev(%"struct.test1::B"* %temp.lvalue)
      C++98:          to label %invoke.cont4 unwind label %terminate.lpad

      C++11:  call void @_ZN5test11BD1Ev(%"struct.test1::B"* %temp.lvalue) #8

    The landing pad and its associated attribute no longer exists in C++11.

      C++98:  ; Function Attrs: noinline noreturn nounwind
      C++98:  define linkonce_odr hidden void @__clang_call_terminate(i8*) #4 
comdat {
      C++98:    %2 = call i8* @__cxa_begin_catch(i8* %0) #8
      C++98:    call void @_ZSt9terminatev() #12
      C++98:    unreachable
      C++98:  }

      C++98:  attributes #4 = { noinline noreturn nounwind }

      C++11: <does not exist>

  test2::A::operator delete(void*, unsigned long) is nothrow in C++11.
  test3::A::operator delete(void*, void*, double) is nothrow in C++11.
  test5::T::~T()  is nothrow in C++11.
  test7::A::~A()  is nothrow in C++11.
  test10::C::~C() is nothrow in C++11.
  test11::A::~A() is nothrow in C++11


CodeGenCXX/lpad-linetable.cpp
  The purpose of this test is to verify landingpad line numbers when catching
  any exceptions thrown by the destructors for “longs” and “shorts” as they go 
out of scope.
  However, in C++11, “longs” and “short”’s destructors are noexcept (nothrow).
   ~std::_Vector_base<long, std::allocator<long> >() noexcept
   ~std::_Vector_base<short, std::allocator<short> >() noexcept 

  Because these destructors no longer throw any exceptions in C++11, there is 
no need to generate the landingpads.
  And since the purpose of this test is to verify for landingpad line table, I 
have restricted this test to C++98.


CodeGenCXX/mangle-unnamed.cpp
  Test section f6() verifies the mangled name of the variable b that is inside 
  the static anonymous union along with an anonymous union of a unnamed bit 
field.

  Running this test in C++11 results in the following error.
    error: call to implicitly-deleted default constructor of '(anonymous union 
at t.cpp:2:10)'
    note: default constructor of '' is implicitly deleted because field '' has 
a deleted default constructor
    note: default constructor of '' is implicitly deleted because all data 
members are const-qualified

  This is most likely due to interaction between three parts of the C++11 
standard:
    1. Unnamed bit-field cannot be initialized.
         C++ Standard section 9.6.2 [class.bit]
            A declaration for a bit-field that omits the identifier declares an 
unnamed bit-field.
            Unnamed bit-fields are not members and cannot be initialized.
    2. Introduction of keyword “delete”. 
    3. Change in rules regarding Unions.
         http://www.stroustrup.com/C++11FAQ.html#unions
           If a union has a member with a user-defined constructor, copy, or 
destructor
           then that special function is deleted;
           that is, it cannot be used for an object of the union type. This is 
new.

  For f6(), Since the unnamed bitfield “int : 1;” can not be initialized, 
  its constructor is considered “deleted”, therefore it cannot be used inside a 
union.
  Hence f6() would be an invalid test for C++11.

  Since this test verifies for name managling, I have restricted f6() to C++98.


CodeGenCXX/arm.cpp
  test3::A::~A() is noexcept (nothrow) in C++11.
  LLVM IR invocation for this destructor has changed from “invoke” to “call”.


CodeGenCXX/eh-aggregate-copy-destroy.cpp
  ImplicitCopy::~ImplicitCopy()is noexcept (nothrow) in C++11.
  LLVM IR invocation for this destructor has changed from “invoke” to “call”.


CodeGenCXX/debug-info-class.cpp
  B::~B()is noexcept (nothrow) in C++11.
  LLVM IR invocation for this destructor has changed from “invoke” to “call”.


CodeGenCXX/goto.cpp
  test0::A::~A() is noexcept (nothrow) in C++11.
  IR invocation for this destructor changed from invoke to call.


CodeGenCXX/linetable-cleanup.cpp
  C::~C() has a nounwind attribute in C++11.
  Interestingly enough, IR invocation is "call" in both C++98 and C++11,
  The only difference is the extra attribute “#2”.

  IR changes are as follows:
    C++98: call void @_ZN1CD1Ev(%class.C* %c), !dbg !21
    C++11: call void @_ZN1CD1Ev(%class.C* %c) #2, !dbg !21
           attributes #2 = { nounwind }

  Relaxed the CHECK pattern matching to accommodate for possible existence of “ 
#[0-9]”.


CodeGenCXX/static-init.cpp
  Inside test4,
  The LLVM IR for useStaticLocal() has been greatly simplified in C++11.
  This is likely due to C++11 Standard section 6.7.4 [stmt.dcl]

    The zero-initialization (8.5) of all block-scope variables with static 
storage duration (3.7.1)
    or thread storage duration (3.7.2) is performed before any other 
initialization takes place.

  Since Struct HasVTable only has a virtual method f that is declared but not 
defined,
  Clang likely assumed that no initialization is needed inside routine 
useStaticLocal().
  Therefore Clang in C++11 no longer generates the default contructors for 
HasVTable nor 
  the singleton pattern to guard against reinitialization of HasVTable.

  Relevant IR changes are shown below.

  C++98 IR:
    @_ZZN5test414useStaticLocalEvE3obj = linkonce_odr global 
%"struct.test4::HasVTable" zeroinitializer, comdat, align 8
    @_ZGVZN5test414useStaticLocalEvE3obj = linkonce_odr global i64 0, comdat, 
align 8

    ; Function Attrs: inlinehint nounwind
    define linkonce_odr dereferenceable(8) %"struct.test4::HasVTable"* 
@_ZN5test414useStaticLocalEv() #4 comdat {
    entry:
      %0 = load atomic i8, i8* bitcast (i64* 
@_ZGVZN5test414useStaticLocalEvE3obj to i8*) acquire, align 8
      %guard.uninitialized = icmp eq i8 %0, 0
      br i1 %guard.uninitialized, label %init.check, label %init.end

    init.check:                                       ; preds = %entry
      %1 = call i32 @__cxa_guard_acquire(i64* 
@_ZGVZN5test414useStaticLocalEvE3obj) #1
      %tobool = icmp ne i32 %1, 0
      br i1 %tobool, label %init, label %init.end

    init:                                             ; preds = %init.check
      call void @_ZN5test49HasVTableC1Ev(%"struct.test4::HasVTable"* 
@_ZZN5test414useStaticLocalEvE3obj) #1
      call void @__cxa_guard_release(i64* @_ZGVZN5test414useStaticLocalEvE3obj) 
#1
      br label %init.end

    init.end:                                         ; preds = %init, 
%init.check, %entry
      ret %"struct.test4::HasVTable"* @_ZZN5test414useStaticLocalEvE3obj
    }

    ; Function Attrs: inlinehint nounwind
    define linkonce_odr void 
@_ZN5test49HasVTableC1Ev(%"struct.test4::HasVTable"* %this) unnamed_addr #4 
comdat align 2 {
    entry:
      %this.addr = alloca %"struct.test4::HasVTable"*, align 8
      store %"struct.test4::HasVTable"* %this, %"struct.test4::HasVTable"** 
%this.addr, align 8
      %this1 = load %"struct.test4::HasVTable"*, %"struct.test4::HasVTable"** 
%this.addr, align 8
      call void @_ZN5test49HasVTableC2Ev(%"struct.test4::HasVTable"* %this1) #1
      ret void
    }

    ; Function Attrs: inlinehint nounwind
    define linkonce_odr void 
@_ZN5test49HasVTableC2Ev(%"struct.test4::HasVTable"* %this) unnamed_addr #4 
comdat align 2 {
    entry:
      %this.addr = alloca %"struct.test4::HasVTable"*, align 8
      store %"struct.test4::HasVTable"* %this, %"struct.test4::HasVTable"** 
%this.addr, align 8
      %this1 = load %"struct.test4::HasVTable"*, %"struct.test4::HasVTable"** 
%this.addr, align 8
      %0 = bitcast %"struct.test4::HasVTable"* %this1 to i32 (...)***
      store i32 (...)** bitcast (i8** getelementptr inbounds ([3 x i8*], [3 x 
i8*]* @_ZTVN5test49HasVTableE, i32 0, i32 2) 
                                to i32 (...)**), i32 (...)*** %0, align 8
      ret void
    }

  C++11 IR:
    @_ZZN5test414useStaticLocalEvE3obj = linkonce_odr global { i8** } { i8** 
getelementptr inbounds ([3 x i8*], 
                                         [3 x i8*]* @_ZTVN5test49HasVTableE, 
i32 0, i32 2) }, comdat, align 8

    ; Function Attrs: inlinehint nounwind
    define linkonce_odr dereferenceable(8) %"struct.test4::HasVTable"* 
@_ZN5test414useStaticLocalEv() #5 comdat {
    entry:
      ret %"struct.test4::HasVTable"* bitcast ({ i8** }* 
@_ZZN5test414useStaticLocalEvE3obj to %"struct.test4::HasVTable"*)
    }


CodeGenCXX/value-init.cpp

  Section Test2:
    For the empty list initialization of an array of struct Test2, Clang has 
inlined the constructor call for t().

      struct Test2 {
        Test t;
      }; 

      Test2 empty2[3] = {};

    In C++98, Clang will call Test2()
    In C++11, Clang will load the member t and call Test() on it.

    Here are the IR changes.
      C++98:  call void @_ZN6PR98015Test2C1Ev(%"struct.PR9801::Test2"* 
%arrayinit.cur12)

      C++11:  %t = getelementptr inbounds %"struct.PR9801::Test2", 
%"struct.PR9801::Test2"* %arrayinit.cur12, i32 0, i32 0
      C++11:  call void @_ZN6PR98014TestC1Ev(%"struct.PR9801::Test"* %t)

    For the sake of simplicity, I have restricted the 2 CHECK lines to C++98.

  Section test6:
    The index arguments type has changed from i32 to i64.

      C++98:      %array.begin = getelementptr inbounds [20 x %struct.A], [20 x 
%struct.A]* %arrayinit.cur6, i32 0, i32 0
      C++11: %arrayinit.begin7 = getelementptr inbounds [20 x %struct.A], [20 x 
%struct.A]* %arrayinit.cur6, i64 0, i64 0

    According to the LLVM Language Reference Manual, this is valid.
      http://llvm.org/docs/LangRef.html#id213
        When indexing into an array, pointer or vector, integers of any width 
are allowed, 
        and they are not required to be constant. These integers are treated as 
signed values where relevant.

    Relaxed pattern matching to accommodate allow for i[0-9]+

CodeGenCXX/volatile-1.cpp
  In C++11, volatile accesses in discarded-value expressions generate loads in 
the LLVM IR.
  Add the “load volatile” for the following cases.

    i;
    (void)ci;
    (void)i;
    (void)(i,(i=i));
    i=i,k;
    (i=j,k);
    (i,j);
    ci;
    (i,j)=k;


CodeGenCXX/volatile.cpp
  This test checks for the IR of volatile pointer dereferences.
  In C++11, *x; resulted in an additional “load volatile”.
  This is because *x; is an indirection of the volatile qualified x inside a 
discarded-value expression.
  http://open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#1054
  And according to the standard defect fix 1054, this is now an use of x.
  
http://stackoverflow.com/questions/20242868/correct-behaviour-of-trivial-statements-involving-expressions-with-volatile-vari

 Expect the following extra line of IR in C++11.
    Existing:  %0 = load i32*, i32** @_ZN5test11xE, align 8
    C++11:     %1 = load volatile i32, i32* %0, align 4
    Existing:  ret void


Index/comment-cplus-decls.cpp
  In C++11, Test’s destructor has a noexcept attribute.
    C++98: <Declaration>~Test()</Declaration>
    C++11: <Declaration>~Test() noexcept</Declaration>


OpenMP/atomic_codegen.cpp
  St::~St() is noexcept (nothrow) in C++11.
  IR for the invocation of this destructor has changed from “invoke” to “call”.


OpenMP/threadprivate_codegen.cpp
  S1::~S1() is noexcept (nothrow) in C++11.
  IR for the invocation of this destructor has changed from “invoke” to “call”.

  CHECK-DEBUG-DAG (line 147 - 166) verifies for source code position. No new 
run line is added to keep line numbers the same.


PCH/macro-undef.cpp
  This test uses uninitialized variable diagnostics to verify macro undef 
behavior across PCH export and import.

  This test is compiled 3 times.
  1st time, the function template definitions for f() and g() are exported to a 
PCH file.
  2nd time, the PCH is imported to compile the main() function. Inside main, 
f() and g() are instantiated. The diagnostics is checked.
  3nd time, the PCH is imported to compile the main() function. Inside main, 
f() and g() are instantiated. The fix-it line of the diagnostics is checked.
           The fix-it line differs depending on if the macro NULL is defined or 
undefined.
           However, because C++11 introduced ‘nullptr’, the fix-it message no 
longer differs.

  In C++98, when NULL is defined to 0, the fix it message will use NULL (at 
line 11) 
            When NULL is undefined, the fix it message will use 0 (at line 17).
  In C++11, the fix it message will use ‘nullptr’ whether or not NULL is 
defined or undefined.

  C++98: note: initialize the variable 'p' to silence this warning
           void *p;  // @11
                  ^
                   = NULL

         note: initialize the variable 'p' to silence this warning
           void *p;  // @17
                  ^
                   = 0

  C++11: note: initialize the variable 'p' to silence this warning
         void *p;  // @11
                ^
                 = nullptr

         note: initialize the variable 'p' to silence this warning
           void *p;  // @17
                  ^
                   = nullptr


  Since this test is meant to test macro undef behavior and that the C++11 
fix-it diagnostics can not distinguish between the macro being defined to 
“NULL” vs being undefined (nullptr in both cases), I have restricted this test 
to C++98.


Cheers,
Charles Li


https://reviews.llvm.org/D24812

Files:
  test/CodeGenCXX/arm.cpp
  test/CodeGenCXX/debug-info-class.cpp
  test/CodeGenCXX/eh-aggregate-copy-destroy.cpp
  test/CodeGenCXX/exceptions.cpp
  test/CodeGenCXX/goto.cpp
  test/CodeGenCXX/linetable-cleanup.cpp
  test/CodeGenCXX/lpad-linetable.cpp
  test/CodeGenCXX/mangle-unnamed.cpp
  test/CodeGenCXX/static-init.cpp
  test/CodeGenCXX/value-init.cpp
  test/CodeGenCXX/volatile-1.cpp
  test/CodeGenCXX/volatile.cpp
  test/Index/comment-cplus-decls.cpp
  test/OpenMP/atomic_codegen.cpp
  test/OpenMP/threadprivate_codegen.cpp
  test/PCH/macro-undef.cpp

Index: test/PCH/macro-undef.cpp
===================================================================
--- test/PCH/macro-undef.cpp
+++ test/PCH/macro-undef.cpp
@@ -1,6 +1,6 @@
-// RUN: %clang_cc1 -emit-pch -o %t %s
-// RUN: %clang_cc1 -fsyntax-only -include-pch %t %s -Wuninitialized -verify
-// RUN: %clang_cc1 -fsyntax-only -include-pch %t %s -Wuninitialized -fdiagnostics-parseable-fixits 2>&1 | FileCheck %s
+// RUN: %clang_cc1 -std=c++98 -emit-pch -o %t %s
+// RUN: %clang_cc1 -std=c++98 -fsyntax-only -include-pch %t %s -Wuninitialized -verify
+// RUN: %clang_cc1 -std=c++98 -fsyntax-only -include-pch %t %s -Wuninitialized -fdiagnostics-parseable-fixits 2>&1 | FileCheck %s
 
 #ifndef HEADER
 #define HEADER
Index: test/OpenMP/threadprivate_codegen.cpp
===================================================================
--- test/OpenMP/threadprivate_codegen.cpp
+++ test/OpenMP/threadprivate_codegen.cpp
@@ -275,7 +275,7 @@
 // CHECK:      {{.*}}[[ARR_LOOP]]{{.*}}
 // CHECK-NEXT: [[ARR_ELEMENTPAST:%.*]] = phi [[S1]]* [ [[ARR_CUR]], {{.*}} ], [ [[ARR_ELEMENT:%.*]], {{.*}} ]
 // CHECK-NEXT: [[ARR_ELEMENT:%.*]] = getelementptr inbounds [[S1]], [[S1]]* [[ARR_ELEMENTPAST]], i{{.*}} -1
-// CHECK-NEXT: invoke {{.*}} [[S1_DTOR]]([[S1]]* [[ARR_ELEMENT]])
+// CHECK-NEXT: {{call|invoke}} {{.*}} [[S1_DTOR]]([[S1]]* [[ARR_ELEMENT]])
 // CHECK:      [[ARR_DONE:%.*]] = icmp eq [[S1]]* [[ARR_ELEMENT]], [[ARR_BEGIN]]
 // CHECK-NEXT: br i1 [[ARR_DONE]], label %[[ARR_EXIT:.*]], label %[[ARR_LOOP]]
 // CHECK:      {{.*}}[[ARR_EXIT]]{{.*}}
Index: test/OpenMP/atomic_codegen.cpp
===================================================================
--- test/OpenMP/atomic_codegen.cpp
+++ test/OpenMP/atomic_codegen.cpp
@@ -1,4 +1,6 @@
 // RUN: %clang_cc1 -verify -triple x86_64-apple-darwin10 -fopenmp -fexceptions -fcxx-exceptions -x c++ -emit-llvm %s -o - | FileCheck %s
+// RUN: %clang_cc1 -verify -triple x86_64-apple-darwin10 -fopenmp -fexceptions -fcxx-exceptions -x c++ -emit-llvm -std=c++98 %s -o - | FileCheck %s
+// RUN: %clang_cc1 -verify -triple x86_64-apple-darwin10 -fopenmp -fexceptions -fcxx-exceptions -x c++ -emit-llvm -std=c++11 %s -o - | FileCheck %s
 // RUN: %clang_cc1 -verify -triple x86_64-apple-darwin10 -fopenmp -fexceptions -fcxx-exceptions -debug-info-kind=line-tables-only -x c++ -emit-llvm %s -o - | FileCheck %s --check-prefix=TERM_DEBUG
 // expected-no-diagnostics
 
@@ -21,14 +23,15 @@
       // CHECK: [[SCALAR_ADDR:%.+]] = invoke dereferenceable(4) i32* @_ZN2St3getEv(%struct.St* [[TEMP_ST_ADDR]])
       // CHECK: [[SCALAR_VAL:%.+]] = load atomic i32, i32* [[SCALAR_ADDR]] monotonic
       // CHECK: store i32 [[SCALAR_VAL]], i32* @b
-      // CHECK: invoke void @_ZN2StD1Ev(%struct.St* [[TEMP_ST_ADDR]])
+      // CHECK98: invoke void @_ZN2StD1Ev(%struct.St* [[TEMP_ST_ADDR]])
+      // CHECK11: call void @_ZN2StD1Ev(%struct.St* [[TEMP_ST_ADDR]])
 #pragma omp atomic read
       b = St().get();
       // CHECK-DAG: invoke void @_ZN2StC1Ev(%struct.St* [[TEMP_ST_ADDR:%.+]])
       // CHECK-DAG: [[SCALAR_ADDR:%.+]] = invoke dereferenceable(4) i32* @_ZN2St3getEv(%struct.St* [[TEMP_ST_ADDR]])
       // CHECK-DAG: [[B_VAL:%.+]] = load i32, i32* @b
       // CHECK: store atomic i32 [[B_VAL]], i32* [[SCALAR_ADDR]] monotonic
-      // CHECK: invoke void @_ZN2StD1Ev(%struct.St* [[TEMP_ST_ADDR]])
+      // CHECK: {{invoke|call}} void @_ZN2StD1Ev(%struct.St* [[TEMP_ST_ADDR]])
 #pragma omp atomic write
       St().get() = b;
       // CHECK: invoke void @_ZN2StC1Ev(%struct.St* [[TEMP_ST_ADDR:%.+]])
@@ -46,7 +49,7 @@
       // CHECK: [[COND:%.+]] = extractvalue { i32, i1 } [[RES]], 1
       // CHECK: br i1 [[COND]], label %[[OMP_DONE:.+]], label %[[OMP_UPDATE]]
       // CHECK: [[OMP_DONE]]
-      // CHECK: invoke void @_ZN2StD1Ev(%struct.St* [[TEMP_ST_ADDR]])
+      // CHECK: {{invoke|call}} void @_ZN2StD1Ev(%struct.St* [[TEMP_ST_ADDR]])
 #pragma omp atomic
       St().get() %= b;
 #pragma omp atomic
@@ -67,7 +70,7 @@
       // CHECK: br i1 [[COND]], label %[[OMP_DONE:.+]], label %[[OMP_UPDATE]]
       // CHECK: [[OMP_DONE]]
       // CHECK: store i32 [[NEW_CALC_VAL]], i32* @a,
-      // CHECK: invoke void @_ZN2StD1Ev(%struct.St* [[TEMP_ST_ADDR]])
+      // CHECK: {{invoke|call}} void @_ZN2StD1Ev(%struct.St* [[TEMP_ST_ADDR]])
 #pragma omp atomic capture
       a = St().get() %= b;
     }
Index: test/Index/comment-cplus-decls.cpp
===================================================================
--- test/Index/comment-cplus-decls.cpp
+++ test/Index/comment-cplus-decls.cpp
@@ -2,9 +2,15 @@
 // RUN: mkdir %t
 // RUN: c-index-test -test-load-source all -comments-xml-schema=%S/../../bindings/xml/comment-xml-schema.rng -target x86_64-apple-darwin10 %s > %t/out
 // RUN: FileCheck %s < %t/out
+// RUN: c-index-test -test-load-source all -comments-xml-schema=%S/../../bindings/xml/comment-xml-schema.rng -target x86_64-apple-darwin10 -std=c++98 %s > %t/98
+// RUN: FileCheck %s < %t/98
+// RUN: c-index-test -test-load-source all -comments-xml-schema=%S/../../bindings/xml/comment-xml-schema.rng -target x86_64-apple-darwin10 -std=c++11 %s > %t/11
+// RUN: FileCheck %s < %t/11
 
 // Ensure that XML we generate is not invalid.
 // RUN: FileCheck %s -check-prefix=WRONG < %t/out
+// RUN: FileCheck %s -check-prefix=WRONG < %t/98
+// RUN: FileCheck %s -check-prefix=WRONG < %t/11
 // WRONG-NOT: CommentXMLInvalid
 // rdar://12378714
 
@@ -42,7 +48,7 @@
 // CHECK: <Declaration>class Test {}</Declaration>
 // CHECK: <Declaration>Test() : reserved(new Test::data())</Declaration>
 // CHECK: <Declaration>unsigned int getID() const</Declaration>
-// CHECK: <Declaration>~Test()</Declaration>
+// CHECK: <Declaration>~Test(){{( noexcept)?}}</Declaration>
 // CHECK: <Declaration>Test::data *reserved</Declaration>
 
 
Index: test/CodeGenCXX/volatile.cpp
===================================================================
--- test/CodeGenCXX/volatile.cpp
+++ test/CodeGenCXX/volatile.cpp
@@ -1,4 +1,5 @@
-// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -std=c++98 -o - | FileCheck %s
+// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -std=c++11 -o - | FileCheck -check-prefix=CHECK -check-prefix=CHECK11 %s
 
 // Check that IR gen doesn't try to do an lvalue-to-rvalue conversion
 // on a volatile reference result.  rdar://problem/8338198
@@ -27,6 +28,7 @@
   // CHECK-LABEL: define void @_ZN5test14testEv()
   void test() {
     // CHECK:      [[TMP:%.*]] = load i32*, i32** @_ZN5test11xE, align 8
+    // CHECK11:    {{%.*}} = load volatile i32, i32* [[TMP]], align 4
     // CHECK-NEXT: ret void
     *x;
   }
Index: test/CodeGenCXX/volatile-1.cpp
===================================================================
--- test/CodeGenCXX/volatile-1.cpp
+++ test/CodeGenCXX/volatile-1.cpp
@@ -1,4 +1,5 @@
-// RUN: %clang_cc1 -Wno-unused-value -triple %itanium_abi_triple -emit-llvm %s -o - | FileCheck %s
+// RUN: %clang_cc1 -Wno-unused-value -triple %itanium_abi_triple -emit-llvm %s -std=c++98 -o - | FileCheck %s
+// RUN: %clang_cc1 -Wno-unused-value -triple %itanium_abi_triple -emit-llvm %s -std=c++11 -o - | FileCheck -check-prefix=CHECK -check-prefix=CHECK11 %s
 
 // CHECK: @i = global [[INT:i[0-9]+]] 0
 volatile int i, j, k;
@@ -22,18 +23,22 @@
 
   asm("nop"); // CHECK: call void asm
 
-  // should not load
+  // should not load in C++98
   i;
+  // CHECK11-NEXT: load volatile [[INT]], [[INT]]* @i
 
   (float)(ci);
   // CHECK-NEXT: load volatile [[INT]], [[INT]]* getelementptr inbounds ([[CINT]], [[CINT]]* @ci, i32 0, i32 0)
   // CHECK-NEXT: load volatile [[INT]], [[INT]]* getelementptr inbounds ([[CINT]], [[CINT]]* @ci, i32 0, i32 1)
   // CHECK-NEXT: sitofp [[INT]]
 
-  // These are not uses in C++:
+  // These are not uses in C++98:
   //   [expr.static.cast]p6:
   //     The lvalue-to-rvalue . . . conversions are not applied to the expression.
   (void)ci;
+  // CHECK11-NEXT: load volatile [[INT]], [[INT]]* getelementptr inbounds ([[CINT]], [[CINT]]* @ci, i32 0, i32 0)
+  // CHECK11-NEXT: load volatile [[INT]], [[INT]]* getelementptr inbounds ([[CINT]], [[CINT]]* @ci, i32 0, i32 1)
+
   (void)a;
 
   (void)(ci=ci);
@@ -126,7 +131,8 @@
   // CHECK-NEXT: load volatile
   // CHECK-NEXT: sitofp
 
-  (void)i;
+  (void)i; // This is now a load in C++11
+  // CHECK11-NEXT: load volatile
 
   i=i;
   // CHECK-NEXT: load volatile
@@ -155,25 +161,30 @@
   // CHECK-NEXT: br label
   // CHECK:      phi
 
-  (void)(i,(i=i));
+  (void)(i,(i=i)); // first i is also a load in C++11
+  // CHECK11-NEXT: load volatile
   // CHECK-NEXT: load volatile
   // CHECK-NEXT: store volatile
 
-  i=i,k;
+  i=i,k; // k is also a load in C++11
   // CHECK-NEXT: load volatile [[INT]], [[INT]]* @i
   // CHECK-NEXT: store volatile {{.*}}, [[INT]]* @i
+  // CHECK11-NEXT: load volatile [[INT]], [[INT]]* @k
 
   (i=j,k=j);
   // CHECK-NEXT: load volatile [[INT]], [[INT]]* @j
   // CHECK-NEXT: store volatile {{.*}}, [[INT]]* @i
   // CHECK-NEXT: load volatile [[INT]], [[INT]]* @j
   // CHECK-NEXT: store volatile {{.*}}, [[INT]]* @k
 
-  (i=j,k);
+  (i=j,k); // k is also a load in C++11
   // CHECK-NEXT: load volatile [[INT]], [[INT]]* @j
   // CHECK-NEXT: store volatile {{.*}}, [[INT]]* @i
+  // CHECK11-NEXT: load volatile [[INT]], [[INT]]* @k
 
-  (i,j);
+  (i,j); // i and j both are loads in C++11
+  // CHECK11-NEXT: load volatile [[INT]], [[INT]]* @i
+  // CHECK11-NEXT: load volatile [[INT]], [[INT]]* @j
 
   // Extra load in C++.
   i=c=k;
@@ -190,7 +201,9 @@
   // CHECK-NEXT: add nsw [[INT]]
   // CHECK-NEXT: store volatile
 
-  ci;
+  ci; // ci is a load in C++11
+  // CHECK11-NEXT: load volatile {{.*}} @ci, i32 0, i32 0
+  // CHECK11-NEXT: load volatile {{.*}} @ci, i32 0, i32 1
 
   asm("nop"); // CHECK-NEXT: call void asm
 
@@ -338,8 +351,9 @@
   // CHECK-NEXT: load volatile
   // CHECK-NEXT: add
 
-  (i,j)=k;
+  (i,j)=k; // i is also a load in C++11
   // CHECK-NEXT: load volatile [[INT]], [[INT]]* @k
+  // CHECK11-NEXT: load volatile [[INT]], [[INT]]* @i
   // CHECK-NEXT: store volatile {{.*}}, [[INT]]* @j
 
   (j=k,i)=i;
Index: test/CodeGenCXX/value-init.cpp
===================================================================
--- test/CodeGenCXX/value-init.cpp
+++ test/CodeGenCXX/value-init.cpp
@@ -1,4 +1,5 @@
-// RUN: %clang_cc1 %s -triple x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 %s -triple x86_64-apple-darwin10 -emit-llvm -std=c++11 -o - | FileCheck %s
+// RUN: %clang_cc1 %s -triple x86_64-apple-darwin10 -emit-llvm -std=c++98 -o - | FileCheck -check-prefix=CHECK -check-prefix=CHECK98 %s
 
 struct A {
   virtual ~A();
@@ -114,8 +115,8 @@
 
   // CHECK: call void @llvm.memset.p0i8.i64
   // CHECK-NOT: call void @llvm.memset.p0i8.i64
-  // CHECK: call void @_ZN6PR98015Test2C1Ev
-  // CHECK-NOT: call void @_ZN6PR98015Test2C1Ev
+  // CHECK98: call void @_ZN6PR98015Test2C1Ev
+  // CHECK98-NOT: call void @_ZN6PR98015Test2C1Ev
   Test2 empty2[3] = {};
 
   // CHECK: call void @llvm.memset.p0i8.i64
@@ -222,7 +223,7 @@
   // CHECK:      [[CUR:%.*]] = phi [20 x [[A]]]* [ [[BEGIN]], {{%.*}} ], [ [[NEXT:%.*]], {{%.*}} ]
 
   // Inner loop.
-  // CHECK-NEXT: [[IBEGIN:%.*]] = getelementptr inbounds [20 x [[A]]], [20 x [[A]]]* [[CUR]], i32 0, i32 0
+  // CHECK-NEXT: [[IBEGIN:%.*]] = getelementptr inbounds [20 x [[A]]], [20 x [[A]]]* [[CUR]], i{{[0-9]+}} 0, i{{[0-9]+}} 0
   // CHECK-NEXT: [[IEND:%.*]] = getelementptr inbounds [[A]], [[A]]* [[IBEGIN]], i64 20
   // CHECK-NEXT: br label
   // CHECK:      [[ICUR:%.*]] = phi [[A]]* [ [[IBEGIN]], {{%.*}} ], [ [[INEXT:%.*]], {{%.*}} ]
Index: test/CodeGenCXX/static-init.cpp
===================================================================
--- test/CodeGenCXX/static-init.cpp
+++ test/CodeGenCXX/static-init.cpp
@@ -1,4 +1,5 @@
-// RUN: %clang_cc1 %s -triple=x86_64-pc-linuxs -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 %s -triple=x86_64-pc-linuxs -emit-llvm -std=c++98 -o - | FileCheck -check-prefix=CHECK -check-prefix=CHECK98 %s
+// RUN: %clang_cc1 %s -triple=x86_64-pc-linuxs -emit-llvm -std=c++11 -o - | FileCheck -check-prefix=CHECK -check-prefix=CHECK11 %s
 
 // CHECK: @_ZZ1hvE1i = internal global i32 0, align 4
 // CHECK: @base_req = global [4 x i8] c"foo\00", align 1
@@ -9,7 +10,8 @@
 // CHECK: @_ZZ2h2vE1i = linkonce_odr global i32 0, comdat, align 4
 // CHECK: @_ZGVZ2h2vE1i = linkonce_odr global i64 0, comdat, align 8{{$}}
 // CHECK: @_ZZN5test1L6getvarEiE3var = internal constant [4 x i32] [i32 1, i32 0, i32 2, i32 4], align 16
-// CHECK: @_ZZN5test414useStaticLocalEvE3obj = linkonce_odr global %"struct.test4::HasVTable" zeroinitializer, comdat, align 8
+// CHECK98: @_ZZN5test414useStaticLocalEvE3obj = linkonce_odr global %"struct.test4::HasVTable" zeroinitializer, comdat, align 8
+// CHECK11: @_ZZN5test414useStaticLocalEvE3obj = linkonce_odr global { i8** } { i8** getelementptr inbounds ([3 x i8*], [3 x i8*]* @_ZTVN5test49HasVTableE, i32 0, i32 2) }, comdat, align 8
 
 struct A {
   A();
@@ -169,5 +171,5 @@
   useStaticLocal();
 }
 // CHECK: define linkonce_odr dereferenceable(8) %"struct.test4::HasVTable"* @_ZN5test414useStaticLocalEv()
-// CHECK: ret %"struct.test4::HasVTable"* @_ZZN5test414useStaticLocalEvE3obj
+// CHECK: ret %"struct.test4::HasVTable"*{{.*}} @_ZZN5test414useStaticLocalEvE3obj
 }
Index: test/CodeGenCXX/linetable-cleanup.cpp
===================================================================
--- test/CodeGenCXX/linetable-cleanup.cpp
+++ test/CodeGenCXX/linetable-cleanup.cpp
@@ -1,10 +1,12 @@
 // RUN: %clang_cc1 -emit-llvm -debug-info-kind=limited -triple x86_64-apple-darwin10 %s -o - | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm -debug-info-kind=limited -triple x86_64-apple-darwin10 -std=c++98 %s -o - | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm -debug-info-kind=limited -triple x86_64-apple-darwin10 -std=c++11 %s -o - | FileCheck %s
 
 // Check the line numbers for cleanup code with EH in combination with
 // simple return expressions.
 
 // CHECK: define {{.*}}foo
-// CHECK: call void @_ZN1CD1Ev(%class.C* {{.*}}), !dbg ![[RET:[0-9]+]]
+// CHECK: call void @_ZN1CD1Ev(%class.C* {{.*}}){{( #[0-9])?}}, !dbg ![[RET:[0-9]+]]
 // CHECK: ret i32 0, !dbg ![[RET]]
 
 // CHECK: define {{.*}}bar
Index: test/CodeGenCXX/goto.cpp
===================================================================
--- test/CodeGenCXX/goto.cpp
+++ test/CodeGenCXX/goto.cpp
@@ -1,4 +1,5 @@
-// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -fcxx-exceptions -fexceptions -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -fcxx-exceptions -fexceptions -emit-llvm -std=c++98 -o - | FileCheck -check-prefix=CHECK -check-prefix=CHECK98 %s
+// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -fcxx-exceptions -fexceptions -emit-llvm -std=c++11 -o - | FileCheck -check-prefix=CHECK -check-prefix=CHECK11 %s
 
 // Reduced from a crash on boost::interprocess's node_allocator_test.cpp.
 namespace test0 {
@@ -24,7 +25,9 @@
     // CHECK-NEXT: invoke void @_ZN5test01AC1Ev([[A]]* [[TMP]])
     // CHECK:      invoke void @_ZN5test01VC1ERKNS_1AE([[V]]* [[NEWCAST]], [[A]]* dereferenceable({{[0-9]+}}) [[TMP]])
     // CHECK:      store i1 false, i1* [[CLEANUPACTIVE]]
-    // CHECK-NEXT: invoke void @_ZN5test01AD1Ev([[A]]* [[TMP]])
+
+    // CHECK98-NEXT: invoke void @_ZN5test01AD1Ev([[A]]* [[TMP]])
+    // CHECK11-NEXT: call void @_ZN5test01AD1Ev([[A]]* [[TMP]])
     A y;
     try {
       A z;
Index: test/CodeGenCXX/debug-info-class.cpp
===================================================================
--- test/CodeGenCXX/debug-info-class.cpp
+++ test/CodeGenCXX/debug-info-class.cpp
@@ -83,12 +83,17 @@
   return 0;
 }
 
-// RUN: %clang_cc1 -triple x86_64-unknown_unknown -emit-llvm -debug-info-kind=limited -fexceptions %s -o - | FileCheck %s
-// RUN: %clang_cc1 -triple i686-cygwin -emit-llvm -debug-info-kind=limited -fexceptions %s -o - | FileCheck %s
-// RUN: %clang_cc1 -triple armv7l-unknown-linux-gnueabihf -emit-llvm -debug-info-kind=limited -fexceptions %s -o - | FileCheck %s
+// RUN: %clang_cc1 -triple x86_64-unknown_unknown -emit-llvm -debug-info-kind=limited -fexceptions -std=c++98 %s -o - | FileCheck -check-prefix=CHECK98 %s
+// RUN: %clang_cc1 -triple i686-cygwin -emit-llvm -debug-info-kind=limited -fexceptions -std=c++98 %s -o - | FileCheck -check-prefix=CHECK98 %s
+// RUN: %clang_cc1 -triple armv7l-unknown-linux-gnueabihf -emit-llvm -debug-info-kind=limited -fexceptions -std=c++98 %s -o - | FileCheck -check-prefix=CHECK98 %s
+// RUN: %clang_cc1 -triple x86_64-unknown_unknown -emit-llvm -debug-info-kind=limited -fexceptions -std=c++11 %s -o - | FileCheck -check-prefix=CHECK11 %s
+// RUN: %clang_cc1 -triple i686-cygwin -emit-llvm -debug-info-kind=limited -fexceptions -std=c++11 %s -o - | FileCheck -check-prefix=CHECK11 %s
+// RUN: %clang_cc1 -triple armv7l-unknown-linux-gnueabihf -emit-llvm -debug-info-kind=limited -fexceptions -std=c++11 %s -o - | FileCheck -check-prefix=CHECK11 %s
+
+// CHECK98: invoke {{.+}} @_ZN1BD1Ev(%class.B* %b)
+// CHECK98-NEXT: unwind label %{{.+}}, !dbg ![[EXCEPTLOC:.*]]
+// CHECK11: call {{.+}} @_ZN1BD1Ev(%class.B* %b){{.*}}, !dbg ![[EXCEPTLOC:.*]]
 
-// CHECK: invoke {{.+}} @_ZN1BD1Ev(%class.B* %b)
-// CHECK-NEXT: unwind label %{{.+}}, !dbg ![[EXCEPTLOC:.*]]
 // CHECK: store i32 0, i32* %{{.+}}, !dbg ![[RETLOC:.*]]
 
 // CHECK: [[F:![0-9]*]] = !DICompositeType(tag: DW_TAG_structure_type, name: "F"
Index: test/CodeGenCXX/eh-aggregate-copy-destroy.cpp
===================================================================
--- test/CodeGenCXX/eh-aggregate-copy-destroy.cpp
+++ test/CodeGenCXX/eh-aggregate-copy-destroy.cpp
@@ -1,7 +1,8 @@
 // Check that in case of copying an array of memcpy-able objects, their
 // destructors will be called if an exception is thrown.
 //
-// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fexceptions -fcxx-exceptions -O0 -fno-elide-constructors -emit-llvm %s -o - | FileCheck %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fexceptions -fcxx-exceptions -O0 -fno-elide-constructors -std=c++98 -emit-llvm %s -o - | FileCheck -check-prefix=CHECK -check-prefix=CHECK98 %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fexceptions -fcxx-exceptions -O0 -fno-elide-constructors -std=c++11 -emit-llvm %s -o - | FileCheck -check-prefix=CHECK -check-prefix=CHECK11 %s
 
 struct ImplicitCopy {
   int x;
@@ -25,7 +26,8 @@
     // CHECK_LABEL: main
     // CHECK-NOT: call void @_ZN9ThrowCopyC1ERKS_
     // CHECK: invoke void @_ZN9ThrowCopyC1ERKS_
-    // CHECK: invoke void @_ZN12ImplicitCopyD1Ev
+    // CHECK98: invoke void @_ZN12ImplicitCopyD1Ev
+    // CHECK11: call void @_ZN12ImplicitCopyD1Ev
     Container c2(c1);
   }
   catch (...) {
Index: test/CodeGenCXX/arm.cpp
===================================================================
--- test/CodeGenCXX/arm.cpp
+++ test/CodeGenCXX/arm.cpp
@@ -1,4 +1,5 @@
-// RUN: %clang_cc1 %s -triple=thumbv7-apple-ios6.0 -fno-use-cxa-atexit -target-abi apcs-gnu -emit-llvm -o - -fexceptions | FileCheck %s
+// RUN: %clang_cc1 %s -triple=thumbv7-apple-ios6.0 -fno-use-cxa-atexit -target-abi apcs-gnu -emit-llvm -std=gnu++98 -o - -fexceptions | FileCheck -check-prefix=CHECK -check-prefix=CHECK98 %s
+// RUN: %clang_cc1 %s -triple=thumbv7-apple-ios6.0 -fno-use-cxa-atexit -target-abi apcs-gnu -emit-llvm -std=gnu++11 -o - -fexceptions | FileCheck -check-prefix=CHECK -check-prefix=CHECK11 %s
 
 // CHECK: @_ZZN5test74testEvE1x = internal global i32 0, align 4
 // CHECK: @_ZGVZN5test74testEvE1x = internal global i32 0
@@ -156,7 +157,8 @@
     // CHECK: getelementptr {{.*}}, i32 4
     // CHECK: bitcast {{.*}} to i32*
     // CHECK: load
-    // CHECK: invoke {{.*}} @_ZN5test31AD1Ev
+    // CHECK98: invoke {{.*}} @_ZN5test31AD1Ev
+    // CHECK11: call {{.*}} @_ZN5test31AD1Ev
     // CHECK: call void @_ZdaPv
     delete [] x;
   }
@@ -168,7 +170,8 @@
     // CHECK: getelementptr {{.*}}, i32 4
     // CHECK: bitcast {{.*}} to i32*
     // CHECK: load
-    // CHECK: invoke {{.*}} @_ZN5test31AD1Ev
+    // CHECK98: invoke {{.*}} @_ZN5test31AD1Ev
+    // CHECK11: call {{.*}} @_ZN5test31AD1Ev
     // CHECK: call void @_ZdaPv
     delete [] x;
   }
Index: test/CodeGenCXX/mangle-unnamed.cpp
===================================================================
--- test/CodeGenCXX/mangle-unnamed.cpp
+++ test/CodeGenCXX/mangle-unnamed.cpp
@@ -1,4 +1,5 @@
-// RUN: %clang_cc1 -emit-llvm %s -o - -triple=x86_64-apple-darwin10 | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm %s -o - -triple=x86_64-apple-darwin10 -std=c++11 | FileCheck -check-prefix=CHECK %s
+// RUN: %clang_cc1 -emit-llvm %s -o - -triple=x86_64-apple-darwin10 -std=c++98 | FileCheck -check-prefix=CHECK -check-prefix=CXX98 %s
 
 struct S {
   virtual ~S() { }
@@ -47,17 +48,19 @@
   return a;
 }
 
+#if __cplusplus <= 199711L
 int f6() {
   static union {
     union {
       int : 1;
     };
     int b;
   };
   
-  // CHECK: _ZZ2f6vE1b
+  // CXX98: _ZZ2f6vE1b
   return b;
 }
+#endif
 
 int f7() {
   static union {
Index: test/CodeGenCXX/lpad-linetable.cpp
===================================================================
--- test/CodeGenCXX/lpad-linetable.cpp
+++ test/CodeGenCXX/lpad-linetable.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1  -fcxx-exceptions -fexceptions -emit-llvm -debug-info-kind=limited -triple x86_64-apple-darwin10 %s -o - | FileCheck %s
+// RUN: %clang_cc1  -fcxx-exceptions -fexceptions -emit-llvm -debug-info-kind=limited -triple x86_64-apple-darwin10 -std=c++98 %s -o - | FileCheck %s
 // The landing pad should have the line number of the closing brace of the function.
 // rdar://problem/13888152
 // CHECK: ret i32
Index: test/CodeGenCXX/exceptions.cpp
===================================================================
--- test/CodeGenCXX/exceptions.cpp
+++ test/CodeGenCXX/exceptions.cpp
@@ -1,4 +1,5 @@
-// RUN: %clang_cc1 %s -triple=x86_64-linux-gnu -emit-llvm -o - -fcxx-exceptions -fexceptions | FileCheck %s
+// RUN: %clang_cc1 %s -triple=x86_64-linux-gnu -emit-llvm -std=c++98 -o - -fcxx-exceptions -fexceptions | FileCheck -check-prefix=CHECK -check-prefix=CHECK98 %s
+// RUN: %clang_cc1 %s -triple=x86_64-linux-gnu -emit-llvm -std=c++11 -o - -fcxx-exceptions -fexceptions | FileCheck -check-prefix=CHECK -check-prefix=CHECK11 %s
 
 typedef __typeof(sizeof(0)) size_t;
 
@@ -64,7 +65,10 @@
     // CHECK-NEXT: [[T2:%.*]] = load i32, i32* [[T1]], align 4
     // CHECK-NEXT: invoke void @_ZN5test11AC1Ei([[A]]* [[CAST]], i32 [[T2]])
     // CHECK:      store i1 false, i1* [[ACTIVE]]
-    // CHECK-NEXT: invoke void @_ZN5test11BD1Ev([[B]]* [[T0]])
+
+    // CHECK98-NEXT: invoke void @_ZN5test11BD1Ev([[B]]* [[T0]])
+    // CHECK11-NEXT: call void @_ZN5test11BD1Ev([[B]]* [[T0]])
+
     // CHECK:      ret [[A]]* [[CAST]]
     // CHECK:      [[ISACTIVE:%.*]] = load i1, i1* [[ACTIVE]]
     // CHECK-NEXT: br i1 [[ISACTIVE]]
@@ -74,10 +78,10 @@
 
   //   rdar://11904428
   //   Terminate landing pads should call __cxa_begin_catch first.
-  // CHECK:      define linkonce_odr hidden void @__clang_call_terminate(i8*) [[NI_NR_NUW:#[0-9]+]] comdat
-  // CHECK-NEXT:   [[T0:%.*]] = call i8* @__cxa_begin_catch(i8* %0) [[NUW:#[0-9]+]]
-  // CHECK-NEXT:   call void @_ZSt9terminatev() [[NR_NUW:#[0-9]+]]
-  // CHECK-NEXT:   unreachable
+  // CHECK98:      define linkonce_odr hidden void @__clang_call_terminate(i8*) [[NI_NR_NUW:#[0-9]+]] comdat
+  // CHECK98-NEXT:   [[T0:%.*]] = call i8* @__cxa_begin_catch(i8* %0) [[NUW:#[0-9]+]]
+  // CHECK98-NEXT:   call void @_ZSt9terminatev() [[NR_NUW:#[0-9]+]]
+  // CHECK98-NEXT:   unreachable
 
   A *d() {
     // CHECK:    define [[A:%.*]]* @_ZN5test11dEv()
@@ -89,7 +93,10 @@
     // CHECK:      [[T1:%.*]] = invoke i32 @_ZN5test11BcviEv([[B]]* [[T0]])
     // CHECK:      invoke void @_ZN5test11AC1Ei([[A]]* [[CAST]], i32 [[T1]])
     // CHECK:      store i1 false, i1* [[ACTIVE]]
-    // CHECK-NEXT: invoke void @_ZN5test11BD1Ev([[B]]* [[T0]])
+
+    // CHECK98-NEXT: invoke void @_ZN5test11BD1Ev([[B]]* [[T0]])
+    // CHECK11-NEXT: call void @_ZN5test11BD1Ev([[B]]* [[T0]])
+
     // CHECK:      ret [[A]]* [[CAST]]
     // CHECK:      [[ISACTIVE:%.*]] = load i1, i1* [[ACTIVE]]
     // CHECK-NEXT: br i1 [[ISACTIVE]]
@@ -109,8 +116,13 @@
     // CHECK:      [[T3:%.*]] = invoke i32 @_ZN5test11BcviEv([[B]]* [[T2]])
     // CHECK:      invoke void @_ZN5test11AC1Eii([[A]]* [[CAST]], i32 [[T1]], i32 [[T3]])
     // CHECK:      store i1 false, i1* [[ACTIVE]]
-    // CHECK-NEXT: invoke void @_ZN5test11BD1Ev([[B]]* [[T2]])
-    // CHECK:      invoke void @_ZN5test11BD1Ev([[B]]* [[T0]])
+
+    // CHECK98-NEXT: invoke void @_ZN5test11BD1Ev([[B]]* [[T2]])
+    // CHECK11-NEXT: call void @_ZN5test11BD1Ev([[B]]* [[T2]])
+
+    // CHECK98:      invoke void @_ZN5test11BD1Ev([[B]]* [[T0]])
+    // CHECK11:      call void @_ZN5test11BD1Ev([[B]]* [[T0]])
+
     // CHECK:      ret [[A]]* [[CAST]]
     // CHECK:      [[ISACTIVE:%.*]] = load i1, i1* [[ACTIVE]]
     // CHECK-NEXT: br i1 [[ISACTIVE]]
@@ -141,8 +153,13 @@
     // CHECK-NEXT: store [[A]]* [[CAST]], [[A]]** [[X]], align 8
     // CHECK:      invoke void @_ZN5test15makeBEv([[B:%.*]]* sret [[T2:%.*]])
     // CHECK:      [[RET:%.*]] = load [[A]]*, [[A]]** [[X]], align 8
-    // CHECK:      invoke void @_ZN5test11BD1Ev([[B]]* [[T2]])
-    // CHECK:      invoke void @_ZN5test11BD1Ev([[B]]* [[T0]])
+
+    // CHECK98:      invoke void @_ZN5test11BD1Ev([[B]]* [[T2]])
+    // CHECK11:      call void @_ZN5test11BD1Ev([[B]]* [[T2]])
+
+    // CHECK98:      invoke void @_ZN5test11BD1Ev([[B]]* [[T0]])
+    // CHECK11:      call void @_ZN5test11BD1Ev([[B]]* [[T0]])
+
     // CHECK:      ret [[A]]* [[RET]]
     // CHECK:      [[ISACTIVE:%.*]] = load i1, i1* [[ACTIVE]]
     // CHECK-NEXT: br i1 [[ISACTIVE]]
@@ -166,8 +183,11 @@
     // CHECK-NEXT: [[CAST:%.*]] = bitcast i8* [[NEW]] to [[A]]*
     // CHECK-NEXT: invoke void @_ZN5test21AC1Ei([[A]]* [[CAST]], i32 5)
     // CHECK:      ret [[A]]* [[CAST]]
-    // CHECK:      invoke void @_ZN5test21AdlEPvm(i8* [[NEW]], i64 8)
-    // CHECK:      call void @__clang_call_terminate(i8* {{%.*}}) [[NR_NUW]]
+
+    // CHECK98:      invoke void @_ZN5test21AdlEPvm(i8* [[NEW]], i64 8)
+    // CHECK11:      call void @_ZN5test21AdlEPvm(i8* [[NEW]], i64 8)
+
+    // CHECK98:      call void @__clang_call_terminate(i8* {{%.*}}) [[NR_NUW]]
     return new A(5);
   }
 }
@@ -192,8 +212,11 @@
     // CHECK-NEXT: [[CAST:%.*]] = bitcast i8* [[NEW]] to [[A]]*
     // CHECK-NEXT: invoke void @_ZN5test31AC1Ei([[A]]* [[CAST]], i32 5)
     // CHECK:      ret [[A]]* [[CAST]]
-    // CHECK:      invoke void @_ZN5test31AdlEPvS1_d(i8* [[NEW]], i8* [[FOO]], double [[BAR]])
-    // CHECK:      call void @__clang_call_terminate(i8* {{%.*}}) [[NR_NUW]]
+
+    // CHECK98:      invoke void @_ZN5test31AdlEPvS1_d(i8* [[NEW]], i8* [[FOO]], double [[BAR]])
+    // CHECK11:      call void @_ZN5test31AdlEPvS1_d(i8* [[NEW]], i8* [[FOO]], double [[BAR]])
+
+    // CHECK98:      call void @__clang_call_terminate(i8* {{%.*}}) [[NR_NUW]]
     return new(foo(),bar()) A(5);
   }
 
@@ -235,7 +258,9 @@
     // CHECK-NEXT: br i1 [[ISACTIVE]]
     // CHECK:      [[V0:%.*]] = load i8*, i8** [[SAVED0]]
     // CHECK-NEXT: [[V1:%.*]] = load i8*, i8** [[SAVED1]]
-    // CHECK-NEXT: invoke void @_ZN5test31AdlEPvS1_d(i8* [[V0]], i8* [[V1]], double [[CONST]])
+
+    // CHECK98-NEXT: invoke void @_ZN5test31AdlEPvS1_d(i8* [[V0]], i8* [[V1]], double [[CONST]])
+    // CHECK11-NEXT: call void @_ZN5test31AdlEPvS1_d(i8* [[V0]], i8* [[V1]], double [[CONST]])
   }
 }
 
@@ -283,9 +308,13 @@
   // CHECK-NEXT: [[SRC:%.*]] = bitcast i8* [[ADJ]] to [[A_T]]*
   // CHECK-NEXT: invoke void @_ZN5test51TC1Ev([[T_T]]* [[T]])
   // CHECK:      invoke void @_ZN5test51AC1ERKS0_RKNS_1TE([[A_T]]* [[A]], [[A_T]]* dereferenceable({{[0-9]+}}) [[SRC]], [[T_T]]* dereferenceable({{[0-9]+}}) [[T]])
-  // CHECK:      invoke void @_ZN5test51TD1Ev([[T_T]]* [[T]])
-  // CHECK:      call i8* @__cxa_begin_catch(i8* [[EXN]]) [[NUW]]
-  // CHECK-NEXT: invoke void @_ZN5test51AD1Ev([[A_T]]* [[A]])
+
+  // CHECK98:      invoke void @_ZN5test51TD1Ev([[T_T]]* [[T]])
+  // CHECK11:      call void @_ZN5test51TD1Ev([[T_T]]* [[T]])
+
+  // CHECK98:      call i8* @__cxa_begin_catch(i8* [[EXN]]) [[NUW]]
+  // CHECK98-NEXT: invoke void @_ZN5test51AD1Ev([[A_T]]* [[A]])
+
   // CHECK:      call void @__cxa_end_catch()
   void test() {
     try {
@@ -380,12 +409,16 @@
     // Destroy the inner A object.
     // CHECK-NEXT: load i1, i1* [[INNER_A]]
     // CHECK-NEXT: br i1
-    // CHECK:      invoke void @_ZN5test71AD1Ev(
+
+    // CHECK98:    invoke void @_ZN5test71AD1Ev(
+    // CHECK11:    call void @_ZN5test71AD1Ev(
 
     // Destroy the outer A object.
     // CHECK:      load i1, i1* [[OUTER_A]]
     // CHECK-NEXT: br i1
-    // CHECK:      invoke void @_ZN5test71AD1Ev(
+
+    // CHECK98:    invoke void @_ZN5test71AD1Ev(
+    // CHECK11:    call void @_ZN5test71AD1Ev(
 
     return new B(A(), new B(A(), 0));
   }
@@ -456,8 +489,12 @@
   // CHECK-NEXT: load i8, i8* @_ZN6test108suppressE, align 1
   // CHECK-NEXT: trunc
   // CHECK-NEXT: br i1
-  // CHECK:      call void @__cxa_end_catch()
-  // CHECK-NEXT: br label
+
+  // CHECK98:      call void @__cxa_end_catch()
+  // CHECK98-NEXT: br label
+  // CHECK11:      invoke void @__cxa_end_catch()
+  // CHECK11-NEXT: to label
+
   // CHECK:      invoke void @__cxa_rethrow()
   // CHECK:      unreachable
 }
@@ -504,7 +541,10 @@
   // CHECK-NEXT: br i1 [[EMPTY]]
   // CHECK:      [[AFTER:%.*]] = phi [[A]]* [ [[CUR]], {{%.*}} ], [ [[ELT:%.*]], {{%.*}} ]
   // CHECK-NEXT: [[ELT]] = getelementptr inbounds [[A]], [[A]]* [[AFTER]], i64 -1
-  // CHECK-NEXT: invoke void @_ZN6test111AD1Ev([[A]]* [[ELT]])
+
+  // CHECK98-NEXT: invoke void @_ZN6test111AD1Ev([[A]]* [[ELT]])
+  // CHECK11-NEXT: call void @_ZN6test111AD1Ev([[A]]* [[ELT]])
+
   // CHECK:      [[DONE:%.*]] = icmp eq [[A]]* [[ELT]], [[ARRAYBEGIN]]
   // CHECK-NEXT: br i1 [[DONE]],
   //     - Next, chain to cleanup for single.
@@ -517,13 +557,19 @@
   // CHECK-NEXT: br label
   // CHECK:      [[AFTER:%.*]] = phi [[A]]* [ [[ARRAYEND]], {{%.*}} ], [ [[ELT:%.*]], {{%.*}} ]
   // CHECK-NEXT: [[ELT]] = getelementptr inbounds [[A]], [[A]]* [[AFTER]], i64 -1
-  // CHECK-NEXT: invoke void @_ZN6test111AD1Ev([[A]]* [[ELT]])
+
+  // CHECK98-NEXT: invoke void @_ZN6test111AD1Ev([[A]]* [[ELT]])
+  // CHECK11-NEXT: call void @_ZN6test111AD1Ev([[A]]* [[ELT]])
+
   // CHECK:      [[DONE:%.*]] = icmp eq [[A]]* [[ELT]], [[ARRAYBEGIN]]
   // CHECK-NEXT: br i1 [[DONE]],
   //     - Next, chain to cleanup for single.
   // CHECK:      br label
   //   Finally, the cleanup for single.
-  // CHECK:      invoke void @_ZN6test111AD1Ev([[A]]* [[SINGLE]])
+
+  // CHECK98:      invoke void @_ZN6test111AD1Ev([[A]]* [[SINGLE]])
+  // CHECK11:      call void @_ZN6test111AD1Ev([[A]]* [[SINGLE]])
+
   // CHECK:      br label
   // CHECK:      resume
   //   (After this is a terminate landingpad.)
@@ -543,7 +589,9 @@
   // CHECK-NEXT:  [[CAST:%.*]] = bitcast i8* [[PTR]] to [[A:%.*]]*
   // CHECK-NEXT:  invoke void @_ZN6test121AC1Ev([[A]]* [[CAST]])
   // CHECK:       ret [[A]]* [[CAST]]
-  // CHECK:       invoke void @_ZN6test121AdlEPvS1_(i8* [[PTR]], i8* [[PTR]])
+
+  // CHECK98:       invoke void @_ZN6test121AdlEPvS1_(i8* [[PTR]], i8* [[PTR]])
+  // CHECK11:       call void @_ZN6test121AdlEPvS1_(i8* [[PTR]], i8* [[PTR]])
 }
 
-// CHECK: attributes [[NI_NR_NUW]] = { noinline noreturn nounwind }
+// CHECK98: attributes [[NI_NR_NUW]] = { noinline noreturn nounwind }
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to