brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.8 KiB · e8d2415 Raw
51 lines · c
1// This test checks that reusing FileManager produces deterministic results on case-insensitive filesystems.2 3// RUN: rm -rf %t4// RUN: split-file %s %t5 6//--- dir1/arm/lower.h7//--- dir2/ARM/upper.h8//--- t1.c9#include "upper.h"10//--- t2.c11#include "arm/lower.h"12 13//--- cdb.json.template14[{15  "directory": "DIR",16  "command": "clang -fsyntax-only DIR/t1.c -I DIR/dir2/ARM -I DIR/dir1",17  "file": "DIR/t1.c"18},{19  "directory": "DIR",20  "command": "clang -fsyntax-only DIR/t2.c -I DIR/dir2     -I DIR/dir1",21  "file": "DIR/t2.c"22}]23 24//--- cdb-rev.json.template25[{26  "directory": "DIR",27  "command": "clang -fsyntax-only DIR/t2.c -I DIR/dir2     -I DIR/dir1",28  "file": "DIR/t2.c"29},{30  "directory": "DIR",31  "command": "clang -fsyntax-only DIR/t1.c -I DIR/dir2/ARM -I DIR/dir1",32  "file": "DIR/t1.c"33}]34 35// RUN: sed -e "s|DIR|%/t|g" %t/cdb.json.template     > %t/cdb.json36// RUN: sed -e "s|DIR|%/t|g" %t/cdb-rev.json.template > %t/cdb-rev.json37 38// RUN: clang-scan-deps -compilation-database=%t/cdb.json     -format make -j 1 | sed 's:\\\\\?:/:g' | FileCheck %s39 40// In the reversed case, Clang starts by scanning "t2.c". When looking up the "arm/lower.h" header,41// the string is appended to "DIR/dir2". That file ("DIR/dir2/arm/lower.h") doesn't exist, but when42// learning so, the FileManager stats and caches the parent directory ("DIR/dir2/arm"), using the43// UID as the key.44// When scanning "t1.c" later on, the "DIR/dir2/ARM" search directory is assigned the **same**45// directory entry (with lowercase "arm"), since they share the UID on case-insensitive filesystems.46// To preserve the correct case throughout the compiler for any file within that directory, it's47// important to use the spelling actually used, not just the cached one.48// RUN: clang-scan-deps -compilation-database=%t/cdb-rev.json -format make -j 1 | sed 's:\\\\\?:/:g' | FileCheck %s49 50// CHECK: ARM/upper.h51