149 lines · cpp
1// RUN: rm -rf %t2// RUN: split-file %s %t3// RUN: sed -e "s|DIR|%/t|g" %t/cdb.json.in > %t/cdb.json4 5//--- cdb.json.in6[{7 "directory": "DIR",8 "command": "clang -c DIR/tu.c -o DIR/tu.o -IDIR/include",9 "file": "DIR/tu.c"10}]11//--- include/header.h12//--- include/header2.h13//--- include/header3.h14//--- include/header4.h15//--- include/header5.h16//--- include/header6.h17//--- include/header7.h18//--- include/header8.h19//--- include/header9.h20//--- include/header10.h21//--- include/header11.h22//--- include/header12.h23//--- include/header13.h24//--- include/header14.h25//--- tu.c26#if 027R"x()x"28#endif29 30#include "header.h"31 32#if 033R"y(";34#endif35#include "header2.h"36 37#if 038//")y"39#endif40 41#if 042R"y(";43R"z()y";44#endif45#include "header3.h"46#if 047//")z"48#endif49 50#if 051R\52"y(";53R"z()y";54#endif55#include "header4.h"56#if 057//")z"58#endif59 60// Test u8 prefix with escaped newline61#if 062u8R\63"prefix(test)prefix"64#endif65#include "header5.h"66 67// Test u prefix with multiple escaped newlines68#if 069uR\70\71"multi(test)multi"72#endif73#include "header6.h"74 75// Test U prefix with escaped newline76#if 077UR\78"upper(test)upper"79#endif80#include "header7.h"81 82// Test L prefix with escaped newline83#if 084LR\85"wide(test)wide"86#endif87#include "header8.h"88 89// Test escaped newline with \r\n style90#if 091R\92"crlf(test)crlf"93#endif94#include "header9.h"95 96// Test multiple escaped newlines in different positions97#if 098u\998\100R\101"complex(test)complex"102#endif103#include "header10.h"104 105// Test raw string that should NOT be treated as raw (no R prefix due to identifier continuation)106#if 0107identifierR"notraw(test)notraw"108#endif109#include "header11.h"110 111// Test raw string with whitespace before escaped newline112#if 0113R \114"whitespace(test)whitespace"115#endif116#include "header12.h"117 118// Test nested raw strings in disabled code119#if 0120R"outer(121 R"inner(content)inner"122)outer"123#endif124#include "header13.h"125 126// Test raw string with empty delimiter127#if 0128R\129"(empty delimiter)";130#endif131#include "header14.h"132 133// RUN: clang-scan-deps -compilation-database %t/cdb.json -mode preprocess | FileCheck %s134// RUN: clang-scan-deps -compilation-database %t/cdb.json -mode preprocess-dependency-directives | FileCheck %s135// CHECK: tu.c136// CHECK-NEXT: header.h137// CHECK-NEXT: header3.h138// CHECK-NEXT: header4.h139// CHECK-NEXT: header5.h140// CHECK-NEXT: header6.h141// CHECK-NEXT: header7.h142// CHECK-NEXT: header8.h143// CHECK-NEXT: header9.h144// CHECK-NEXT: header10.h145// CHECK-NEXT: header11.h146// CHECK-NEXT: header12.h147// CHECK-NEXT: header13.h148// CHECK-NEXT: header14.h149