1 // Check to make sure clang is somewhat picky about -g options. 2 3 // Linux. 4 // RUN: %clang -### -c -g %s -target x86_64-linux-gnu 2>&1 \ 5 // RUN: | FileCheck -check-prefix=G_LIMITED -check-prefix=G_GDB %s 6 // RUN: %clang -### -c -g2 %s -target x86_64-linux-gnu 2>&1 \ 7 // RUN: | FileCheck -check-prefix=G_LIMITED -check-prefix=G_GDB %s 8 // RUN: %clang -### -c -g3 %s -target x86_64-linux-gnu 2>&1 \ 9 // RUN: | FileCheck -check-prefix=G_LIMITED -check-prefix=G_GDB %s 10 // RUN: %clang -### -c -ggdb %s -target x86_64-linux-gnu 2>&1 \ 11 // RUN: | FileCheck -check-prefix=G_LIMITED -check-prefix=G_GDB %s 12 // RUN: %clang -### -c -ggdb1 %s -target x86_64-linux-gnu 2>&1 \ 13 // RUN: | FileCheck -check-prefix=GLTO_ONLY -check-prefix=G_GDB %s 14 // RUN: %clang -### -c -ggdb3 %s -target x86_64-linux-gnu 2>&1 \ 15 // RUN: | FileCheck -check-prefix=G_LIMITED -check-prefix=G_GDB %s 16 // RUN: %clang -### -c -glldb %s -target x86_64-linux-gnu 2>&1 \ 17 // RUN: | FileCheck -check-prefix=G_STANDALONE -check-prefix=G_LLDB %s 18 // RUN: %clang -### -c -gsce %s -target x86_64-linux-gnu 2>&1 \ 19 // RUN: | FileCheck -check-prefix=G_LIMITED -check-prefix=G_SCE %s 20 // RUN: %clang -### -c -gdbx %s -target x86_64-linux-gnu 2>&1 \ 21 // RUN: | FileCheck -check-prefix=G_LIMITED -check-prefix=G_DBX %s 22 23 // Android. 24 // Android should always generate DWARF4. 25 // RUN: %clang -### -c -g %s -target arm-linux-androideabi 2>&1 \ 26 // RUN: | FileCheck -check-prefix=G_LIMITED -check-prefix=G_DWARF4 %s 27 28 // Darwin. 29 // RUN: %clang -### -c -g %s -target x86_64-apple-darwin14 2>&1 \ 30 // RUN: | FileCheck -check-prefix=G_STANDALONE \ 31 // RUN: -check-prefix=G_DWARF2 \ 32 // RUN: -check-prefix=G_LLDB %s 33 // RUN: %clang -### -c -g %s -target x86_64-apple-darwin16 2>&1 \ 34 // RUN: | FileCheck -check-prefix=G_STANDALONE \ 35 // RUN: -check-prefix=G_DWARF4 \ 36 // RUN: -check-prefix=G_LLDB %s 37 // RUN: %clang -### -c -g2 %s -target x86_64-apple-darwin16 2>&1 \ 38 // RUN: | FileCheck -check-prefix=G_STANDALONE \ 39 // RUN: -check-prefix=G_DWARF4 %s 40 // RUN: %clang -### -c -g3 %s -target x86_64-apple-darwin16 2>&1 \ 41 // RUN: | FileCheck -check-prefix=G_STANDALONE \ 42 // RUN: -check-prefix=G_DWARF4 %s 43 // RUN: %clang -### -c -ggdb %s -target x86_64-apple-darwin16 2>&1 \ 44 // RUN: | FileCheck -check-prefix=G_STANDALONE \ 45 // RUN: -check-prefix=G_DWARF4 \ 46 // RUN: -check-prefix=G_GDB %s 47 // RUN: %clang -### -c -ggdb1 %s -target x86_64-apple-darwin16 2>&1 \ 48 // RUN: | FileCheck -check-prefix=GLTO_ONLY %s 49 // RUN: %clang -### -c -ggdb3 %s -target x86_64-apple-darwin16 2>&1 \ 50 // RUN: | FileCheck -check-prefix=G_STANDALONE \ 51 // RUN: -check-prefix=G_DWARF4 %s 52 // RUN: %clang -### -c -g %s -target x86_64-apple-macosx10.11 2>&1 \ 53 // RUN: | FileCheck -check-prefix=G_STANDALONE \ 54 // RUN: -check-prefix=G_DWARF4 %s 55 // RUN: %clang -### -c -g %s -target x86_64-apple-macosx10.10 2>&1 \ 56 // RUN: | FileCheck -check-prefix=G_ONLY_DWARF2 %s 57 // RUN: %clang -### -c -g %s -target armv7-apple-ios9.0 2>&1 \ 58 // RUN: | FileCheck -check-prefix=G_STANDALONE \ 59 // RUN: -check-prefix=G_DWARF4 %s 60 // RUN: %clang -### -c -g %s -target armv7-apple-ios8.0 2>&1 \ 61 // RUN: | FileCheck -check-prefix=G_ONLY_DWARF2 %s 62 // RUN: %clang -### -c -g %s -target armv7k-apple-watchos 2>&1 \ 63 // RUN: | FileCheck -check-prefix=G_STANDALONE \ 64 // RUN: -check-prefix=G_DWARF4 %s 65 // RUN: %clang -### -c -g %s -target arm64-apple-tvos9.0 2>&1 \ 66 // RUN: | FileCheck -check-prefix=G_STANDALONE \ 67 // RUN: -check-prefix=G_DWARF4 %s 68 // RUN: %clang -### -c -g %s -target x86_64-apple-driverkit19.0 2>&1 \ 69 // RUN: | FileCheck -check-prefix=G_STANDALONE \ 70 // RUN: -check-prefix=G_DWARF4 %s 71 // RUN: %clang -### -c -g %s -target x86_64-apple-macosx15 2>&1 \ 72 // RUN: | FileCheck -check-prefix=G_STANDALONE \ 73 // RUN: -check-prefix=G_DWARF5 %s 74 // RUN: %clang -### -c -g %s -target arm64-apple-ios17.0 2>&1 \ 75 // RUN: | FileCheck -check-prefix=G_STANDALONE \ 76 // RUN: -check-prefix=G_DWARF4 %s 77 // RUN: %clang -### -c -g %s -target arm64-apple-ios18.0 2>&1 \ 78 // RUN: | FileCheck -check-prefix=G_STANDALONE \ 79 // RUN: -check-prefix=G_DWARF5 %s 80 // RUN: %clang -### -c -g %s -target arm64_32-apple-watchos11 2>&1 \ 81 // RUN: | FileCheck -check-prefix=G_STANDALONE \ 82 // RUN: -check-prefix=G_DWARF5 %s 83 // RUN: %clang -### -c -g %s -target arm64-apple-tvos18.0 2>&1 \ 84 // RUN: | FileCheck -check-prefix=G_STANDALONE \ 85 // RUN: -check-prefix=G_DWARF5 %s 86 // RUN: %clang -### -c -g %s -target x86_64-apple-driverkit24.0 2>&1 \ 87 // RUN: | FileCheck -check-prefix=G_STANDALONE \ 88 // RUN: -check-prefix=G_DWARF5 %s 89 // RUN: %clang -### -c -g %s -target arm64-apple-xros1 2>&1 \ 90 // RUN: | FileCheck -check-prefix=G_STANDALONE \ 91 // RUN: -check-prefix=G_DWARF4 %s 92 // RUN: %clang -### -c -g %s -target arm64-apple-xros2 2>&1 \ 93 // RUN: | FileCheck -check-prefix=G_STANDALONE \ 94 // RUN: -check-prefix=G_DWARF5 %s 95 // 96 // RUN: %clang -### -c -fsave-optimization-record %s \ 97 // RUN: -target x86_64-apple-darwin 2>&1 \ 98 // RUN: | FileCheck -check-prefix=GLTO_ONLY %s 99 // RUN: %clang -### -c -g -fsave-optimization-record %s \ 100 // RUN: -target x86_64-apple-darwin 2>&1 \ 101 // RUN: | FileCheck -check-prefix=G_STANDALONE %s 102 103 // FreeBSD. 104 // RUN: %clang -### -c -g %s -target x86_64-pc-freebsd 2>&1 \ 105 // RUN: | FileCheck -check-prefix=G_GDB \ 106 // RUN: -check-prefix=G_DWARF4 %s 107 108 // Haiku. 109 // RUN: %clang -### -c -g %s --target=x86_64-unknown-haiku 2>&1 \ 110 // RUN: | FileCheck -check-prefix=G_STANDALONE \ 111 // RUN: -check-prefix=G_DWARF4 %s 112 113 // Windows. 114 // RUN: %clang -### -c -g %s -target x86_64-w64-windows-gnu 2>&1 \ 115 // RUN: | FileCheck -check-prefix=G_GDB %s 116 // RUN: %clang -### -c -g %s -target x86_64-windows-msvc 2>&1 \ 117 // RUN: | FileCheck -check-prefix=G_NOTUNING %s 118 // RUN: %clang_cl -### -c -Z7 -target x86_64-windows-msvc -- %s 2>&1 \ 119 // RUN: | FileCheck -check-prefix=G_NOTUNING %s 120 121 // On the PS4/PS5, -g defaults to -gno-column-info. We default to always 122 // generating the arange section, but keyed off SCE DebuggerTuning being in 123 // play during codegen, instead of -generate-arange-section. 124 // RUN: %clang -### -c %s -target x86_64-scei-ps4 2>&1 \ 125 // RUN: | FileCheck -check-prefix=NOG_PS %s 126 // RUN: %clang -### -c %s -target x86_64-sie-ps5 2>&1 \ 127 // RUN: | FileCheck -check-prefix=NOG_PS %s 128 /// PS4 will stay on v4 even if the generic default version changes. 129 // RUN: %clang -### -c %s -g -target x86_64-scei-ps4 2>&1 \ 130 // RUN: | FileCheck -check-prefixes=G_DWARF4,G_SCE,NOCI,FWD_TMPL_PARAMS %s 131 // RUN: %clang -### -c %s -g -target x86_64-sie-ps5 2>&1 \ 132 // RUN: | FileCheck -check-prefixes=G_DWARF5,G_SCE,NOCI,FWD_TMPL_PARAMS %s 133 // RUN: %clang -### -c %s -g -gcolumn-info -target x86_64-scei-ps4 2>&1 \ 134 // RUN: | FileCheck -check-prefix=CI %s 135 // RUN: %clang -### -c %s -gsce -target x86_64-unknown-linux 2>&1 \ 136 // RUN: | FileCheck -check-prefix=NOCI %s 137 // RUN: %clang -### %s -g -flto=thin -target x86_64-scei-ps4 2>&1 \ 138 // RUN: | FileCheck -check-prefix=LDGARANGE %s 139 // RUN: %clang -### %s -g -flto=full -target x86_64-scei-ps4 2>&1 \ 140 // RUN: | FileCheck -check-prefix=LDGARANGE %s 141 // RUN: %clang -### %s -g -flto -target x86_64-sie-ps5 2>&1 \ 142 // RUN: | FileCheck -check-prefix=LDGARANGE %s 143 // RUN: %clang -### %s -g -target x86_64-sie-ps5 2>&1 \ 144 // RUN: | FileCheck -check-prefix=LDGARANGE %s 145 146 // On the AIX, -g defaults to limited debug info. 147 // RUN: %clang -### -c -g %s -target powerpc-ibm-aix-xcoff 2>&1 \ 148 // RUN: | FileCheck -check-prefix=G_LIMITED %s 149 // RUN: %clang -### -c -g %s -target powerpc64-ibm-aix-xcoff 2>&1 \ 150 // RUN: | FileCheck -check-prefix=G_LIMITED %s 151 // RUN: %clang -### -c -g %s -target powerpc-ibm-aix-xcoff 2>&1 \ 152 // RUN: | FileCheck -check-prefix=G_NOTUNING %s 153 // RUN: %clang -### -c -g %s -target powerpc64-ibm-aix-xcoff 2>&1 \ 154 // RUN: | FileCheck -check-prefix=G_NOTUNING %s 155 // RUN: %clang -### -c -g -gdbx %s -target powerpc-ibm-aix-xcoff 2>&1 \ 156 // RUN: | FileCheck -check-prefixes=G_LIMITED,G_DBX %s 157 // RUN: %clang -### -c -g -gdbx %s -target powerpc64-ibm-aix-xcoff 2>&1 \ 158 // RUN: | FileCheck -check-prefixes=G_LIMITED,G_DBX %s 159 160 // For DBX, -g defaults to -gstrict-dwarf. 161 // RUN: %clang -### -c -g %s -target powerpc-ibm-aix-xcoff 2>&1 \ 162 // RUN: | FileCheck -check-prefix=STRICT %s 163 // RUN: %clang -### -c -g %s -target powerpc64-ibm-aix-xcoff 2>&1 \ 164 // RUN: | FileCheck -check-prefix=STRICT %s 165 // RUN: %clang -### -c -g -gno-strict-dwarf %s -target powerpc-ibm-aix-xcoff \ 166 // RUN: 2>&1 | FileCheck -check-prefix=NOSTRICT %s 167 // RUN: %clang -### -c -g %s -target x86_64-linux-gnu 2>&1 \ 168 // RUN: | FileCheck -check-prefix=NOSTRICT %s 169 // RUN: %clang -### -c -g -ggdb %s -target powerpc-ibm-aix-xcoff 2>&1 \ 170 // RUN: | FileCheck -check-prefix=NOSTRICT %s 171 172 // On the AIX, -g defaults to -gno-column-info. 173 // RUN: %clang -### -c -g %s -target powerpc-ibm-aix-xcoff 2>&1 \ 174 // RUN: | FileCheck -check-prefix=NOCI %s 175 // RUN: %clang -### -c -g %s -target powerpc64-ibm-aix-xcoff 2>&1 \ 176 // RUN: | FileCheck -check-prefix=NOCI %s 177 // RUN: %clang -### -c -g %s -target powerpc-ibm-aix-xcoff -gcolumn-info 2>&1 \ 178 // RUN: | FileCheck -check-prefix=CI %s 179 // RUN: %clang -### -c -g %s -target powerpc64-ibm-aix-xcoff -gcolumn-info \ 180 // RUN: 2>&1 | FileCheck -check-prefix=CI %s 181 182 // WebAssembly. 183 // WebAssembly should default to DWARF4. 184 // RUN: %clang -### -c -g %s -target wasm32 2>&1 \ 185 // RUN: | FileCheck -check-prefix=G_DWARF4 %s 186 // RUN: %clang -### -c -g %s -target wasm64 2>&1 \ 187 // RUN: | FileCheck -check-prefix=G_DWARF4 %s 188 189 // RUN: %clang -### -c -gdwarf-2 %s 2>&1 \ 190 // RUN: | FileCheck -check-prefix=G_ONLY_DWARF2 %s 191 // 192 // RUN: not %clang -### -c -gfoo %s 2>&1 | FileCheck -check-prefix=G_ERR %s 193 // RUN: %clang -### -c -g -g0 %s 2>&1 | FileCheck -check-prefix=G_NO %s 194 // RUN: %clang -### -c -ggdb0 %s 2>&1 | FileCheck -check-prefix=G_NO %s 195 // RUN: %clang -### -c -glldb -g0 %s 2>&1 | FileCheck -check-prefix=G_NO %s 196 // RUN: %clang -### -c -glldb -g1 %s 2>&1 \ 197 // RUN: | FileCheck -check-prefix=GLTO_ONLY -check-prefix=G_LLDB %s 198 // 199 // PS4 defaults to sce; -ggdb0 changes tuning but turns off debug info, 200 // then -g turns it back on without affecting tuning. 201 // RUN: %clang -### -c -ggdb0 -g -target x86_64-scei-ps4 %s 2>&1 \ 202 // RUN: | FileCheck -check-prefix=G_GDB %s 203 // 204 // RUN: %clang -### -c -g1 %s 2>&1 \ 205 // RUN: | FileCheck -check-prefix=GLTO_ONLY %s 206 // RUN: %clang -### -c -gmlt %s 2>&1 \ 207 // RUN: | FileCheck -check-prefix=GLTO_ONLY %s 208 // RUN: %clang -### -c -gline-tables-only %s 2>&1 \ 209 // RUN: | FileCheck -check-prefix=GLTO_ONLY %s 210 // RUN: %clang -### -c -gline-tables-only %s -target x86_64-apple-darwin 2>&1 \ 211 // RUN: | FileCheck -check-prefix=GLTO_ONLY %s 212 // RUN: %clang -### -c -gline-tables-only %s -target i686-pc-openbsd 2>&1 \ 213 // RUN: | FileCheck -check-prefix=GLTO_ONLY_DWARF2 %s 214 // RUN: %clang -### -c -gline-tables-only -g %s -target x86_64-linux-gnu 2>&1 \ 215 // RUN: | FileCheck -check-prefix=G_ONLY %s 216 // RUN: %clang -### -c -gline-tables-only -g %s -target x86_64-apple-darwin16 2>&1 \ 217 // RUN: | FileCheck -check-prefix=G_STANDALONE -check-prefix=G_DWARF4 %s 218 // RUN: %clang -### -c -gline-tables-only -g %s -target i686-pc-openbsd 2>&1 \ 219 // RUN: | FileCheck -check-prefix=G_ONLY_DWARF2 %s 220 // RUN: %clang -### -c -gline-tables-only -g %s --target=i386-pc-solaris 2>&1 \ 221 // RUN: | FileCheck -check-prefix=G_ONLY %s 222 // RUN: %clang -### -c -gline-tables-only -g0 %s 2>&1 \ 223 // RUN: | FileCheck -check-prefix=GLTO_NO %s 224 // 225 // RUN: %clang -### -c -gline-directives-only %s -target x86_64-apple-darwin 2>&1 \ 226 // RUN: | FileCheck -check-prefix=GLIO_ONLY %s 227 // RUN: %clang -### -c -gline-directives-only %s -target i686-pc-openbsd 2>&1 \ 228 // RUN: | FileCheck -check-prefix=GLIO_ONLY_DWARF2 %s 229 // RUN: %clang -### -c -gline-directives-only -g %s -target x86_64-linux-gnu 2>&1 \ 230 // RUN: | FileCheck -check-prefix=G_ONLY %s 231 // RUN: %clang -### -c -gline-directives-only -g %s -target x86_64-apple-darwin16 2>&1 \ 232 // RUN: | FileCheck -check-prefix=G_STANDALONE -check-prefix=G_DWARF4 %s 233 // RUN: %clang -### -c -gline-directives-only -g %s -target i686-pc-openbsd 2>&1 \ 234 // RUN: | FileCheck -check-prefix=G_ONLY_DWARF2 %s 235 // RUN: %clang -### -c -gline-directives-only -g %s --target=i386-pc-solaris 2>&1 \ 236 // RUN: | FileCheck -check-prefix=G_ONLY %s 237 // RUN: %clang -### -c -gline-directives-only -g0 %s 2>&1 \ 238 // RUN: | FileCheck -check-prefix=GLIO_NO %s 239 240 // RUN: %clang -### -c -grecord-gcc-switches %s 2>&1 | FileCheck -check-prefix=GRECORD %s 241 // RUN: %clang -### -c -gno-record-gcc-switches %s 2>&1 | FileCheck -check-prefix=GNO_RECORD %s 242 // RUN: %clang -### -c -grecord-gcc-switches -gno-record-gcc-switches %s 2>&1 | FileCheck -check-prefix=GNO_RECORD %s 243 // RUN: %clang -### -c -grecord-gcc-switches -o - %s 2>&1 | FileCheck -check-prefix=GRECORD_O %s 244 // RUN: %clang -### -c -O3 -ffunction-sections -grecord-gcc-switches %s 2>&1 | FileCheck -check-prefix=GRECORD_OPT %s 245 246 // RUN: %clang -### -c -grecord-command-line %s 2>&1 | FileCheck -check-prefix=GRECORD %s 247 // RUN: %clang -### -c -gno-record-command-line %s 2>&1 | FileCheck -check-prefix=GNO_RECORD %s 248 // RUN: %clang -### -c -grecord-command-line -gno-record-command-line %s 2>&1 | FileCheck -check-prefix=GNO_RECORD %s 249 // RUN: %clang -### -c -grecord-command-line -o - %s 2>&1 | FileCheck -check-prefix=GRECORD_O %s 250 // RUN: %clang -### -c -O3 -ffunction-sections -grecord-command-line %s 2>&1 | FileCheck -check-prefix=GRECORD_OPT %s 251 252 // RUN: %clang -### -c -gstrict-dwarf -gno-strict-dwarf %s 2>&1 | FileCheck -check-prefix=GIGNORE %s 253 254 // RUN: %clang -### -c -ggnu-pubnames %s 2>&1 | FileCheck -check-prefix=GPUB %s 255 // RUN: %clang -### -c -ggdb %s 2>&1 | FileCheck -check-prefix=NOPUB %s 256 // RUN: %clang -### -c -ggnu-pubnames -gno-gnu-pubnames %s 2>&1 | FileCheck -check-prefix=NOPUB %s 257 // RUN: %clang -### -c -ggnu-pubnames -gno-pubnames %s 2>&1 | FileCheck -check-prefix=NOPUB %s 258 // 259 // RUN: %clang -### -c -gpubnames %s 2>&1 | FileCheck -check-prefix=PUB %s 260 // RUN: %clang -### -c -ggdb %s 2>&1 | FileCheck -check-prefix=NOPUB %s 261 // RUN: %clang -### -c -gpubnames -gno-gnu-pubnames %s 2>&1 | FileCheck -check-prefix=NOPUB %s 262 // RUN: %clang -### -c -gpubnames -gno-pubnames %s 2>&1 | FileCheck -check-prefix=NOPUB %s 263 264 /// Specify --target= so that %clang doesn't exit with code 1 even if LLVM_DEFAULT_TARGET_TRIPLE specifies a RISC-V target triple. 265 // RUN: %clang -### --target=x86_64 -c -gsplit-dwarf -g -gno-pubnames %s 2>&1 | FileCheck -check-prefix=NOPUB %s 266 // 267 // RUN: %clang -### -c -fdebug-ranges-base-address %s 2>&1 | FileCheck -check-prefix=RNGBSE %s 268 // RUN: %clang -### -c %s 2>&1 | FileCheck -check-prefix=NORNGBSE %s 269 // RUN: %clang -### -c -fdebug-ranges-base-address -fno-debug-ranges-base-address %s 2>&1 | FileCheck -check-prefix=NORNGBSE %s 270 // 271 // RUN: %clang -### -c -gomit-unreferenced-methods -fno-standalone-debug %s 2>&1 | FileCheck -check-prefix=INCTYPES %s 272 // RUN: %clang -### -c %s 2>&1 | FileCheck -check-prefix=NOINCTYPES %s 273 // RUN: %clang -### -c -gomit-unreferenced-methods -fdebug-types-section -target x86_64-unknown-linux %s 2>&1 \ 274 // RUN: | FileCheck -check-prefix=NOINCTYPES %s 275 // RUN: %clang -### -c -gomit-unreferenced-methods -fstandalone-debug %s 2>&1 | FileCheck -check-prefix=NOINCTYPES %s 276 // 277 // RUN: %clang -### -c -glldb %s 2>&1 | FileCheck -check-prefix=NOPUB %s 278 // RUN: %clang -### -c -glldb -gno-pubnames %s 2>&1 | FileCheck -check-prefix=NOPUB %s 279 // 280 // RUN: %clang -### -c -gdwarf-aranges %s 2>&1 | FileCheck -check-prefix=GARANGE %s 281 // 282 // RUN: %clang -### -fdebug-types-section -target x86_64-unknown-linux %s 2>&1 \ 283 // RUN: | FileCheck -check-prefix=FDTS %s 284 // 285 // RUN: %clang -### -fdebug-types-section -fno-debug-types-section -target x86_64-unknown-linux %s 2>&1 \ 286 // RUN: | FileCheck -check-prefix=NOFDTS %s 287 // 288 // RUN: %clang -### -fdebug-types-section -target wasm32-unknown-unknown %s 2>&1 \ 289 // RUN: | FileCheck -check-prefix=FDTS %s 290 // 291 // RUN: not %clang -### -fdebug-types-section -target x86_64-apple-darwin %s 2>&1 \ 292 // RUN: | FileCheck -check-prefix=FDTSE %s 293 // 294 // RUN: %clang -### -fdebug-types-section -fno-debug-types-section -target x86_64-apple-darwin %s 2>&1 \ 295 // RUN: | FileCheck -check-prefix=NOFDTSE %s 296 // 297 // RUN: %clang -### -g -gno-column-info %s 2>&1 \ 298 // RUN: | FileCheck -check-prefix=NOCI %s 299 // 300 // RUN: %clang -### -g -target x86_64-unknown-unknown %s 2>&1 \ 301 // | FileCheck -check-prefix=CI %s 302 // 303 // RUN: %clang -### -gmodules %s 2>&1 \ 304 // RUN: | FileCheck -check-prefix=GEXTREFS %s 305 // 306 // RUN: %clang -### -gmodules -g %s 2>&1 \ 307 // RUN: | FileCheck -check-prefix=GEXTREFS %s 308 // 309 // RUN: %clang -### -gline-tables-only -gmodules %s 2>&1 \ 310 // RUN: | FileCheck -check-prefix=GEXTREFS %s 311 // 312 // RUN: %clang -### -gmodules -gline-tables-only %s 2>&1 \ 313 // RUN: | FileCheck -check-prefix=GLTO_ONLY %s 314 // 315 // RUN: %clang -### -target %itanium_abi_triple -gmodules -gline-directives-only %s 2>&1 \ 316 // RUN: | FileCheck -check-prefix=GLIO_ONLY %s 317 // 318 // RUN: %clang -### -gmodules -gno-modules %s 2>&1 \ 319 // RUN: | FileCheck -check-prefix=NOGEXTREFS %s 320 // 321 // RUN: %clang -### -gno-modules %s 2>&1 | FileCheck -check-prefix=GNOMOD %s 322 // 323 // NOG_PS: "-cc1" 324 // NOG_PS-NOT: "-dwarf-version= 325 // NOG_PS-NOT: "-generate-arange-section" 326 // 327 // G_ERR: error: unknown argument: 328 // 329 // G_NO: "-cc1" 330 // G_NO-NOT: -debug-info-kind= 331 // 332 // GLTO_ONLY: "-cc1" 333 // GLTO_ONLY-NOT: "-dwarf-ext-refs" 334 // GLTO_ONLY: "-debug-info-kind=line-tables-only" 335 // GLTO_ONLY-NOT: "-dwarf-ext-refs" 336 // 337 // GLTO_ONLY_DWARF2: "-cc1" 338 // GLTO_ONLY_DWARF2: "-debug-info-kind=line-tables-only" 339 // GLTO_ONLY_DWARF2: "-dwarf-version=2" 340 // 341 // GLIO_ONLY: "-cc1" 342 // GLIO_ONLY-NOT: "-dwarf-ext-refs" 343 // GLIO_ONLY: "-debug-info-kind=line-directives-only" 344 // GLIO_ONLY-NOT: "-dwarf-ext-refs" 345 // 346 // GLIO_ONLY_DWARF2: "-cc1" 347 // GLIO_ONLY_DWARF2: "-debug-info-kind=line-directives-only" 348 // GLIO_ONLY_DWARF2: "-dwarf-version=2" 349 // 350 // G_ONLY: "-cc1" 351 // G_ONLY: "-debug-info-kind=constructor" 352 // 353 // These tests assert that "-gline-tables-only" "-g" uses the latter, 354 // but otherwise not caring about the DebugInfoKind. 355 // G_ONLY_DWARF2: "-cc1" 356 // G_ONLY_DWARF2: "-debug-info-kind={{standalone|constructor}}" 357 // G_ONLY_DWARF2: "-dwarf-version=2" 358 // 359 // G_STANDALONE: "-cc1" 360 // G_STANDALONE: "-debug-info-kind=standalone" 361 // G_LIMITED: "-cc1" 362 // G_LIMITED: "-debug-info-kind=constructor" 363 // G_DWARF2: "-dwarf-version=2" 364 // G_DWARF4-DAG: "-dwarf-version=4" 365 // G_DWARF5-DAG: "-dwarf-version=5" 366 // 367 // G_GDB: "-debugger-tuning=gdb" 368 // G_LLDB: "-debugger-tuning=lldb" 369 // G_SCE-DAG: "-debugger-tuning=sce" 370 // G_DBX: "-debugger-tuning=dbx" 371 // 372 // STRICT: "-gstrict-dwarf" 373 // NOSTRICT-NOT: "-gstrict-dwarf" 374 // 375 // G_NOTUNING: "-cc1" 376 // G_NOTUNING-NOT: "-debugger-tuning=" 377 // 378 // This tests asserts that "-gline-tables-only" "-g0" disables debug info. 379 // GLTO_NO: "-cc1" 380 // GLTO_NO-NOT: -debug-info-kind= 381 // 382 // This tests asserts that "-gline-directives-only" "-g0" disables debug info. 383 // GLIO_NO: "-cc1" 384 // GLIO_NO-NOT: -debug-info-kind= 385 // 386 // GRECORD: "-dwarf-debug-flags" 387 // GRECORD: -### -c -grecord-command-line 388 // 389 // GNO_RECORD-NOT: "-dwarf-debug-flags" 390 // GNO_RECORD-NOT: -### -c -grecord-command-line 391 // 392 // GRECORD_O: "-dwarf-debug-flags" 393 // GRECORD_O: -### -c -grecord-command-line -o - 394 // 395 // GRECORD_OPT: -### -c -O3 -ffunction-sections -grecord-command-line 396 // 397 // GIGNORE-NOT: "argument unused during compilation" 398 // 399 // GPUB: -ggnu-pubnames 400 // NOPUB-NOT: -ggnu-pubnames 401 // NOPUB-NOT: -gpubnames 402 // 403 404 // LDGARANGE: {{".*ld.*"}} {{.*}} 405 // LDGARANGE-NOT: -generate-arange-section" 406 // SNLDTLTOGARANGE: {{".*orbis-ld.*"}} {{.*}} "-lto-thin-debug-options= -generate-arange-section" 407 // SNLDFLTOGARANGE: {{".*orbis-ld.*"}} {{.*}} "-lto-debug-options= -generate-arange-section" 408 409 // PUB: -gpubnames 410 // 411 // RNGBSE: -fdebug-ranges-base-address 412 // NORNGBSE-NOT: -fdebug-ranges-base-address 413 // 414 // INCTYPES: -gomit-unreferenced-methods 415 // NOINCTYPES-NOT: -gomit-unreferenced-methods 416 // 417 // GARANGE-DAG: -generate-arange-section 418 // 419 // FDTS: "-mllvm" "-generate-type-units" 420 // FDTSE: error: unsupported option '-fdebug-types-section' for target 'x86_64-apple-darwin' 421 // 422 // NOFDTS-NOT: "-mllvm" "-generate-type-units" 423 // NOFDTSE-NOT: error: unsupported option '-fdebug-types-section' for target 'x86_64-apple-darwin' 424 // 425 // CI-NOT: "-gno-column-info" 426 // 427 // NOCI-DAG: "-gno-column-info" 428 // 429 // GEXTREFS: "-dwarf-ext-refs" "-fmodule-format=obj" 430 // GEXTREFS: "-debug-info-kind={{standalone|constructor}}" 431 // NOGEXTREFS-NOT: -dwarf-ext-refs 432 // 433 // GNOMOD-NOT: -debug-info-kind= 434 435 // RUN: not %clang -cc1 -debug-info-kind=watkind 2>&1 | FileCheck -check-prefix=BADSTRING1 %s 436 // BADSTRING1: error: invalid value 'watkind' in '-debug-info-kind=watkind' 437 // RUN: not %clang -cc1 -debugger-tuning=gmodal 2>&1 | FileCheck -check-prefix=BADSTRING2 %s 438 // BADSTRING2: error: invalid value 'gmodal' in '-debugger-tuning=gmodal' 439 440 // RUN: %clang -### -fdebug-macro %s 2>&1 | FileCheck -check-prefix=MACRO %s 441 // RUN: %clang -### -fno-debug-macro %s 2>&1 | FileCheck -check-prefix=NOMACRO %s 442 // RUN: %clang -### %s 2>&1 | FileCheck -check-prefix=NOMACRO %s 443 // MACRO: "-debug-info-macro" 444 // NOMACRO-NOT: "-debug-info-macro" 445 // 446 // RUN: %clang -### -g -fno-eliminate-unused-debug-types -c %s 2>&1 \ 447 // RUN: | FileCheck -check-prefix=DEBUG_UNUSED_TYPES %s 448 // DEBUG_UNUSED_TYPES: "-debug-info-kind=unused-types" 449 // DEBUG_UNUSED_TYPES-NOT: "-debug-info-kind=limited" 450 // RUN: %clang -### -g -feliminate-unused-debug-types -c %s 2>&1 \ 451 // RUN: | FileCheck -check-prefix=NO_DEBUG_UNUSED_TYPES %s 452 // RUN: %clang -### -fno-eliminate-unused-debug-types -g1 -c %s 2>&1 \ 453 // RUN: | FileCheck -check-prefix=NO_DEBUG_UNUSED_TYPES %s 454 // NO_DEBUG_UNUSED_TYPES: "-debug-info-kind={{constructor|line-tables-only|standalone}}" 455 // NO_DEBUG_UNUSED_TYPES-NOT: "-debug-info-kind=unused-types" 456 // 457 // RUN: %clang -### -c -gdwarf-5 -gdwarf64 -target x86_64 %s 2>&1 | FileCheck -check-prefix=GDWARF64_ON %s 458 // RUN: %clang -### -c -gdwarf-4 -gdwarf64 -target x86_64 %s 2>&1 | FileCheck -check-prefix=GDWARF64_ON %s 459 // RUN: %clang -### -c -gdwarf-3 -gdwarf64 -target x86_64 %s 2>&1 | FileCheck -check-prefix=GDWARF64_ON %s 460 // RUN: not %clang -### -c -gdwarf-2 -gdwarf64 --target=x86_64 %s 2>&1 | FileCheck -check-prefix=GDWARF64_VER %s 461 // RUN: %clang -### -c -gdwarf-4 -gdwarf64 -target x86_64 -target x86_64 %s 2>&1 \ 462 // RUN: | FileCheck -check-prefix=GDWARF64_ON %s 463 // RUN: not %clang -### -c -gdwarf-4 -gdwarf64 --target=i386-linux-gnu %s 2>&1 \ 464 // RUN: | FileCheck -check-prefix=GDWARF64_32ARCH %s 465 // RUN: not %clang -### -c -gdwarf-4 -gdwarf64 -target x86_64-apple-darwin %s 2>&1 \ 466 // RUN: | FileCheck -check-prefix=GDWARF64_ELF %s 467 // 468 // GDWARF64_ON: "-gdwarf64" 469 // GDWARF64_VER: error: invalid argument '-gdwarf64' only allowed with 'DWARFv3 or greater' 470 // GDWARF64_32ARCH: error: invalid argument '-gdwarf64' only allowed with '64 bit architecture' 471 // GDWARF64_ELF: error: invalid argument '-gdwarf64' only allowed with 'ELF platforms' 472 473 /// Default to -fno-dwarf-directory-asm for -fno-integrated-as before DWARF v5. 474 // RUN: %clang -### -target x86_64 -c -gdwarf-2 %s 2>&1 | FileCheck --check-prefix=DIRECTORY %s 475 // RUN: %clang -### -target x86_64 -c -gdwarf-5 %s 2>&1 | FileCheck --check-prefix=DIRECTORY %s 476 // RUN: %clang -### -target x86_64 -c -gdwarf-4 -fno-integrated-as %s 2>&1 | FileCheck --check-prefix=NODIRECTORY %s 477 // RUN: %clang -### -target x86_64 -c -gdwarf-5 -fno-integrated-as %s 2>&1 | FileCheck --check-prefix=DIRECTORY %s 478 479 // RUN: %clang -### -target x86_64 -c -gdwarf-4 -fno-dwarf-directory-asm %s 2>&1 | FileCheck --check-prefix=NODIRECTORY %s 480 481 // DIRECTORY-NOT: "-fno-dwarf-directory-asm" 482 // NODIRECTORY: "-fno-dwarf-directory-asm" 483 484 // RUN: %clang -### -target x86_64 -c -g -gsimple-template-names %s 2>&1 | FileCheck --check-prefixes=SIMPLE_TMPL_NAMES,FWD_TMPL_PARAMS %s 485 // SIMPLE_TMPL_NAMES: -gsimple-template-names=simple 486 // FWD_TMPL_PARAMS-DAG: -debug-forward-template-params 487 // RUN: not %clang -### -target x86_64 -c -g -gsimple-template-names=mangled %s 2>&1 | FileCheck --check-prefix=MANGLED_TEMP_NAMES %s 488 // MANGLED_TEMP_NAMES: error: unknown argument '-gsimple-template-names=mangled'; did you mean '-Xclang -gsimple-template-names=mangled' 489 // RUN: %clang -### -target x86_64 -c -g %s 2>&1 | FileCheck --check-prefix=FULL_TEMP_NAMES --implicit-check-not=debug-forward-template-params %s 490 // FULL_TEMP_NAMES-NOT: -gsimple-template-names 491 492 //// Test -g[no-]template-alias (enabled by default with SCE debugger tuning and DWARF version >= 4). 493 // RUN: %clang -### -target x86_64 -c -gdwarf-5 -gsce %s 2>&1 | FileCheck %s --check-prefixes=TEMPLATE-ALIAS 494 // RUN: %clang -### -target x86_64 -c -gdwarf-3 -gsce %s 2>&1 | FileCheck %s --check-prefixes=NO-TEMPLATE-ALIAS 495 // RUN: %clang -### -target x86_64 -c -gdwarf-5 -gsce -gtemplate-alias %s 2>&1 | FileCheck %s --check-prefixes=TEMPLATE-ALIAS 496 // RUN: %clang -### -target x86_64 -c -gdwarf-5 -gsce -gno-template-alias %s 2>&1 | FileCheck %s --check-prefixes=NO-TEMPLATE-ALIAS 497 // RUN: %clang -### -target x86_64 -c -gdwarf-5 -gtemplate-alias %s 2>&1 | FileCheck %s --check-prefixes=TEMPLATE-ALIAS 498 // RUN: %clang -### -target x86_64 -c -gdwarf-5 -gtemplate-alias -gno-template-alias %s 2>&1 | FileCheck %s --check-prefixes=NO-TEMPLATE-ALIAS 499 // TEMPLATE-ALIAS: "-gtemplate-alias" 500 // NO-TEMPLATE-ALIAS-NOT: "-gtemplate-alias" 501