// RUN: %clang_cc1 -DSETNODEBUG=0 -emit-llvm -std=c++14 -debug-info-kind=limited %s -o - | FileCheck %s --check-prefix=YESINFO
// RUN: %clang_cc1 -DSETNODEBUG=1 -emit-llvm -std=c++14 -debug-info-kind=limited %s -o - | FileCheck %s --check-prefix=NOINFO
// Const global variable. Use it so it gets emitted.
NODEBUG static const int const_global_int_def = 1;
void ;
void
// YESINFO-DAG: !DIGlobalVariable(name: "const_global_int_def"
// NOINFO-NOT: !DIGlobalVariable(name: "const_global_int_def"
// Global variable with a more involved type.
// If the variable has no debug info, the type should not appear either.
;
NODEBUG S1 global_struct = ;
// YESINFO-DAG: !DICompositeType({{.*}} name: "S1"
// NOINFO-NOT: !DICompositeType({{.*}} name: "S1"
// YESINFO-DAG: !DIGlobalVariable(name: "global_struct"
// NOINFO-NOT: !DIGlobalVariable(name: "global_struct"
// Static data members. Const member needs a use.
// Also the class as a whole needs a use, so that we produce debug info for
// the entire class (iterating over the members, demonstrably skipping those
// with 'nodebug').
;
int S2::static_member = 5;
void
// YESINFO-DAG: !DIGlobalVariable(name: "static_member"
// NOINFO-NOT: !DIGlobalVariable(name: "static_member"
// YESINFO-DAG: !DIDerivedType({{.*}} name: "static_const_member"
// NOINFO-NOT: !DIDerivedType({{.*}} name: "static_const_member"
// Function-local static and auto variables.
void
// YESINFO-DAG: !DIGlobalVariable(name: "static_local"
// NOINFO-NOT: !DIGlobalVariable(name: "static_local"
// YESINFO-DAG: !DILocalVariable(name: "normal_local"
// NOINFO-NOT: !DILocalVariable(name: "normal_local"
using y NODEBUG = int;
void
// YESINFO-DAG: !DIDerivedType(tag: DW_TAG_typedef, name: "x"
// NOINFO-NOT: !DIDerivedType(tag: DW_TAG_typedef, name: "x"
// YESINFO-DAG: !DIDerivedType(tag: DW_TAG_typedef, name: "y<int>"
// NOINFO-NOT: !DIDerivedType(tag: DW_TAG_typedef, name: "y<int>"