head	1.1;
branch	1.1.1;
access;
symbols
	netbsd-11-0-RC4:1.1.1.2
	netbsd-11-0-RC3:1.1.1.2
	netbsd-11-0-RC2:1.1.1.2
	netbsd-11-0-RC1:1.1.1.2
	perseant-exfatfs-base-20250801:1.1.1.2
	netbsd-11:1.1.1.2.0.10
	netbsd-11-base:1.1.1.2
	netbsd-10-1-RELEASE:1.1.1.2
	perseant-exfatfs-base-20240630:1.1.1.2
	perseant-exfatfs:1.1.1.2.0.8
	perseant-exfatfs-base:1.1.1.2
	netbsd-9-4-RELEASE:1.1.1.1
	netbsd-10-0-RELEASE:1.1.1.2
	netbsd-10-0-RC6:1.1.1.2
	netbsd-10-0-RC5:1.1.1.2
	netbsd-10-0-RC4:1.1.1.2
	netbsd-10-0-RC3:1.1.1.2
	netbsd-10-0-RC2:1.1.1.2
	netbsd-10-0-RC1:1.1.1.2
	netbsd-10:1.1.1.2.0.6
	netbsd-10-base:1.1.1.2
	netbsd-9-3-RELEASE:1.1.1.1
	cjep_sun2x:1.1.1.2.0.4
	cjep_sun2x-base:1.1.1.2
	cjep_staticlib_x-base1:1.1.1.2
	netbsd-9-2-RELEASE:1.1.1.1
	cjep_staticlib_x:1.1.1.2.0.2
	cjep_staticlib_x-base:1.1.1.2
	netbsd-9-1-RELEASE:1.1.1.1
	phil-wifi-20200421:1.1.1.2
	phil-wifi-20200411:1.1.1.2
	phil-wifi-20200406:1.1.1.2
	netbsd-9-0-RELEASE:1.1.1.1
	netbsd-9-0-RC2:1.1.1.1
	netbsd-9-0-RC1:1.1.1.1
	netbsd-9:1.1.1.1.0.6
	netbsd-9-base:1.1.1.1
	phil-wifi-20190609:1.1.1.1
	pgoyette-compat-merge-20190127:1.1.1.1
	pgoyette-compat-20190127:1.1.1.1
	pgoyette-compat-20190118:1.1.1.1
	pgoyette-compat-1226:1.1.1.1
	pgoyette-compat-1126:1.1.1.1
	pgoyette-compat-1020:1.1.1.1
	pgoyette-compat-0930:1.1.1.1
	pgoyette-compat-0906:1.1.1.1
	pgoyette-compat-0728:1.1.1.1
	clang-337282:1.1.1.1
	phil-wifi:1.1.1.1.0.4
	phil-wifi-base:1.1.1.1
	pgoyette-compat-0625:1.1.1.1
	pgoyette-compat-0521:1.1.1.1
	pgoyette-compat-0502:1.1.1.1
	pgoyette-compat-0422:1.1.1.1
	pgoyette-compat-0415:1.1.1.1
	pgoyette-compat-0407:1.1.1.1
	pgoyette-compat-0330:1.1.1.1
	pgoyette-compat-0322:1.1.1.1
	pgoyette-compat-0315:1.1.1.1
	pgoyette-compat:1.1.1.1.0.2
	pgoyette-compat-base:1.1.1.1
	clang-319952:1.1.1.1
	clang-309604:1.1.1.1
	LLVM:1.1.1;
locks; strict;
comment	@// @;


1.1
date	2017.08.01.19.34.35;	author joerg;	state Exp;
branches
	1.1.1.1;
next	;
commitid	pMuDy65V0VicSx1A;

1.1.1.1
date	2017.08.01.19.34.35;	author joerg;	state Exp;
branches
	1.1.1.1.4.1;
next	1.1.1.2;
commitid	pMuDy65V0VicSx1A;

1.1.1.2
date	2019.11.13.22.20.11;	author joerg;	state dead;
branches;
next	;
commitid	QD8YATxuNG34YJKB;

1.1.1.1.4.1
date	2020.04.13.07.47.26;	author martin;	state dead;
branches;
next	;
commitid	X01YhRUPVUDaec4C;


desc
@@


1.1
log
@Initial revision
@
text
@// RUN: %clang_cc1 %s -DUSEIT -triple %itanium_abi_triple -emit-llvm -o - |  FileCheck %s

// Test with decls and template defs in pch, and just use in .cpp
// RUN:  %clang_cc1 %s -DTMPL_DEF_IN_HEADER -triple %itanium_abi_triple -emit-pch -o %t
// RUN:  %clang_cc1 %s -DTMPL_DEF_IN_HEADER -DUSEIT -triple %itanium_abi_triple -include-pch %t -emit-llvm -o - | FileCheck %s

// Test with A in pch, and B and C in main
// Test with just decls in pch, and template defs and use in .cpp
// RUN:  %clang_cc1 %s -triple %itanium_abi_triple -emit-pch -o %t
// RUN:  %clang_cc1 %s -DUSEIT -triple %itanium_abi_triple -include-pch %t -emit-llvm -o - | FileCheck %s

#ifndef HEADER
#define HEADER
template < typename T, int N = 0 > class TmplWithArray {
public:
  virtual T& operator [] (int idx);
  virtual T& func1 (int idx);
  virtual T& func2 (int idx);
  T ar[N+1];
};
struct Wrapper {
  TmplWithArray<bool, 10> data;
  bool indexIt(int a) {
    if (a > 6) return data[a] ;      // Should devirtualize
    if (a > 4) return data.func1(a); // Should devirtualize
    return data.func2(a);            // Should devirtualize
  }
};

#ifdef TMPL_DEF_IN_HEADER
template <typename T, int N> T& TmplWithArray<T, N >::operator[](int idx) {
  return ar[idx];
}
template <typename T, int N> T& TmplWithArray<T, N >::func1(int idx) {
  return ar[idx];
}
#endif // TMPL_DEF_IN_HEADER
#endif // HEADER

#ifdef USEIT
#ifndef TMPL_DEF_IN_HEADER
template <typename T, int N> T& TmplWithArray<T, N >::operator[](int idx) {
  return ar[idx];
}
template <typename T, int N> T& TmplWithArray<T, N >::func1(int idx) {
  return ar[idx];
}
#endif // !TMPL_DEF_IN_HEADER
extern Wrapper ew;
bool stuff(int p)
{
  return ew.indexIt(p);
}
#endif

// CHECK-DAG: call {{.*}} @@_ZN13TmplWithArrayIbLi10EEixEi
// CHECK-DAG: call {{.*}} @@_ZN13TmplWithArrayIbLi10EE5func1Ei
// CHECK-DAG: call {{.*}} @@_ZN13TmplWithArrayIbLi10EE5func2Ei

@


1.1.1.1
log
@Import clang r309604 from branches/release_50
@
text
@@


1.1.1.1.4.1
log
@Mostly merge changes from HEAD upto 20200411
@
text
@@


1.1.1.2
log
@Mark old LLVM instance as dead.
@
text
@@

