brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.1 KiB · afc371d Raw
51 lines · cpp
1// RUN: rm -rf %t2// RUN: mkdir -p %t3// RUN: split-file %s %t4 5// DEFINE: %{emit-pch-action} = \6// DEFINE:   %clang_cc1 -x c++ -emit-pch -o %t/header.pch %t/header.h7 8// DEFINE: %{analyze-action} = \9// DEFINE:   %clang_analyze_cc1 -include-pch %t/header.pch \10// DEFINE:   -analyzer-checker=core,apiModeling,unix.StdCLibraryFunctions \11// DEFINE:   -verify %t/main.cpp12 13// RUN: %{emit-pch-action} -triple x86_64-apple-macosx10.15.014// RUN: %{analyze-action}  -triple x86_64-apple-macosx10.15.015// RUN: %{emit-pch-action}16// RUN: %{analyze-action}17 18 19//--- header.h20 21 22// Pre-compiled header23 24int foo();25 26// Literal data for macro values will be null as they are defined in a PCH27#define EOF -128#define AT_FDCWD -229 30 31//--- main.cpp32 33 34// Source file35// expected-no-diagnostics36int test() {37  // we need a function call here to initiate erroneous routine38  return foo(); // no-crash39}40 41// Test that StdLibraryFunctionsChecker can obtain the definition of42// AT_FDCWD even if it is from a PCH:43int faccessat(int, const char *, int, int);44 45void test_faccessat() {46  char fileSystemPath[10] = { 0 };47 48  if (0 != faccessat(AT_FDCWD, fileSystemPath, 2, 0x0030)) {}49}50 51