11cb0e01eSAwanish Pandey // Test for DebugInfo for Defaulted parameters for C++ templates
21cb0e01eSAwanish Pandey // Supported: -O0, standalone DI
31cb0e01eSAwanish Pandey 
41cb0e01eSAwanish Pandey // RUN: %clang_cc1 -dwarf-version=5  -emit-llvm -triple x86_64-linux-gnu %s -o - \
51cb0e01eSAwanish Pandey // RUN:   -O0 -disable-llvm-passes \
61cb0e01eSAwanish Pandey // RUN:   -debug-info-kind=standalone \
71cb0e01eSAwanish Pandey // RUN: | FileCheck %s
81cb0e01eSAwanish Pandey 
91cb0e01eSAwanish Pandey // CHECK: DILocalVariable(name: "f1", {{.*}}, type: ![[TEMPLATE_TYPE:[0-9]+]]
101cb0e01eSAwanish Pandey // CHECK: [[TEMPLATE_TYPE]] = {{.*}}!DICompositeType({{.*}}, templateParams: ![[F1_TYPE:[0-9]+]]
11*e9644e6fSDavid Blaikie // CHECK: [[F1_TYPE]] = !{![[FIRST:[0-9]+]], ![[SECOND:[0-9]+]], ![[THIRD:[0-9]+]], ![[FORTH:[0-9]+]]}
121cb0e01eSAwanish Pandey // CHECK: [[FIRST]] = !DITemplateTypeParameter(name: "T", type: !{{[0-9]*}})
131cb0e01eSAwanish Pandey // CHECK: [[SECOND]] = !DITemplateValueParameter(name: "i", type: !{{[0-9]*}}, value: i32 6)
14db92719cSDavid Blaikie // CHECK: [[THIRD]] = !DITemplateValueParameter(name: "b", type: !{{[0-9]*}}, value: i8 0)
151cb0e01eSAwanish Pandey 
161cb0e01eSAwanish Pandey // CHECK: DILocalVariable(name: "f2", {{.*}}, type: ![[TEMPLATE_TYPE:[0-9]+]]
171cb0e01eSAwanish Pandey // CHECK: [[TEMPLATE_TYPE]] = {{.*}}!DICompositeType({{.*}}, templateParams: ![[F2_TYPE:[0-9]+]]
18*e9644e6fSDavid Blaikie // CHECK: [[F2_TYPE]] = !{![[FIRST:[0-9]+]], ![[SECOND:[0-9]+]], ![[THIRD:[0-9]+]], ![[FORTH:[0-9]+]]}
191cb0e01eSAwanish Pandey // CHECK: [[FIRST]] = !DITemplateTypeParameter(name: "T", type: !{{[0-9]*}}, defaulted: true)
201cb0e01eSAwanish Pandey // CHECK: [[SECOND]] = !DITemplateValueParameter(name: "i", type: !{{[0-9]*}}, defaulted: true, value: i32 3)
21db92719cSDavid Blaikie // CHECK: [[THIRD]] = !DITemplateValueParameter(name: "b", type: !{{[0-9]*}}, defaulted: true, value: i8 1)
221cb0e01eSAwanish Pandey 
23*e9644e6fSDavid Blaikie template <typename T = char, int i = 3, bool b = true, int x = sizeof(T)>
241cb0e01eSAwanish Pandey class foo {
251cb0e01eSAwanish Pandey };
261cb0e01eSAwanish Pandey 
main()271cb0e01eSAwanish Pandey int main() {
28*e9644e6fSDavid Blaikie   foo<int, 6, false, 3> f1;
291cb0e01eSAwanish Pandey   foo<> f2;
301cb0e01eSAwanish Pandey   return 0;
311cb0e01eSAwanish Pandey }
32