pch-with-errors.c 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #ifndef HEADER
  2. #define HEADER
  3. #include "blahblah.h"
  4. void erroneous(int);
  5. void erroneous(float);
  6. struct bar;
  7. struct zed {
  8. bar g;
  9. };
  10. struct baz {
  11. zed h;
  12. };
  13. void errparm(zed e);
  14. struct S {
  15. {
  16. ;
  17. #else
  18. void foo(void) {
  19. erroneous(0);
  20. }
  21. #endif
  22. // RUN: c-index-test -write-pch %t.h.pch %s -Xclang -detailed-preprocessing-record
  23. // RUN: c-index-test -test-load-source local %s -include %t.h -Xclang -detailed-preprocessing-record | FileCheck -check-prefix=CHECK-PARSE %s
  24. // RUN: c-index-test -index-file %s -include %t.h -Xclang -detailed-preprocessing-record | FileCheck -check-prefix=CHECK-INDEX %s
  25. // CHECK-PARSE: pch-with-errors.c:{{.*}}:6: FunctionDecl=foo
  26. // CHECK-PARSE: pch-with-errors.c:{{.*}}:3: CallExpr=erroneous
  27. // CHECK-INDEX: [indexDeclaration]: kind: function | name: foo
  28. // CHECK-INDEX: [indexEntityReference]: kind: function | name: erroneous
  29. // RUN: not %clang -fsyntax-only %s -include %t.h 2>&1 | FileCheck -check-prefix=PCH-ERR %s
  30. // PCH-ERR: error: PCH file contains compiler errors
  31. // RUN: not c-index-test -write-pch %t.pch foobar.c 2>&1 | FileCheck -check-prefix=NONEXISTENT %s
  32. // NONEXISTENT: Unable to load translation unit