targeted-cursor.c 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. #include "targeted-top.h"
  2. #include "targeted-preamble.h"
  3. int LocalVar1;
  4. int LocalVar2;
  5. // RUN: c-index-test -write-pch %t.h.pch %S/targeted-top.h
  6. // RUN: env CINDEXTEST_FAILONERROR=1 c-index-test -cursor-at=%s:5:10 %s -include %t.h \
  7. // RUN: -Xclang -error-on-deserialized-decl=NestedVar1 \
  8. // RUN: -Xclang -error-on-deserialized-decl=TopVar \
  9. // RUN: | FileCheck %s -check-prefix=LOCAL-CURSOR1
  10. // RUN: env CINDEXTEST_FAILONERROR=1 c-index-test -cursor-at=%S/targeted-top.h:11:15 %s -include %t.h \
  11. // RUN: -Xclang -error-on-deserialized-decl=NestedVar1 \
  12. // RUN: -Xclang -error-on-deserialized-decl=vector_get_x \
  13. // RUN: | FileCheck %s -check-prefix=TOP-CURSOR1
  14. // RUN: env CINDEXTEST_FAILONERROR=1 c-index-test -cursor-at=%S/targeted-nested1.h:2:16 %s -include %t.h \
  15. // RUN: -Xclang -error-on-deserialized-decl=TopVar \
  16. // RUN: | FileCheck %s -check-prefix=NESTED-CURSOR1
  17. // RUN: env CINDEXTEST_FAILONERROR=1 c-index-test -cursor-at=%S/targeted-fields.h:2:7 %s -include %t.h \
  18. // RUN: -Xclang -error-on-deserialized-decl=NestedVar1 \
  19. // RUN: -Xclang -error-on-deserialized-decl=TopVar \
  20. // RUN: | FileCheck %s -check-prefix=FIELD-CURSOR1
  21. // RUN: env CINDEXTEST_FAILONERROR=1 c-index-test -cursor-at=%S/targeted-fields.h:1:1 %s -include %t.h \
  22. // RUN: -Xclang -error-on-deserialized-decl=NestedVar1 \
  23. // RUN: -Xclang -error-on-deserialized-decl=TopVar \
  24. // RUN: | FileCheck %s -check-prefix=FIELD-CURSOR2
  25. // RUN: env CINDEXTEST_FAILONERROR=1 CINDEXTEST_EDITING=1 CINDEXTEST_COMPLETION_NO_CACHING=1 \
  26. // RUN: c-index-test -cursor-at=%s:5:10 %s -include %t.h \
  27. // RUN: -Xclang -error-on-deserialized-decl=PreambleVar \
  28. // RUN: -Xclang -error-on-deserialized-decl=NestedVar1 \
  29. // RUN: -Xclang -error-on-deserialized-decl=TopVar \
  30. // RUN: | FileCheck %s -check-prefix=LOCAL-CURSOR1
  31. // RUN: env CINDEXTEST_FAILONERROR=1 CINDEXTEST_EDITING=1 CINDEXTEST_COMPLETION_NO_CACHING=1 \
  32. // RUN: c-index-test -cursor-at=%S/targeted-top.h:11:15 %s -include %t.h \
  33. // RUN: -Xclang -error-on-deserialized-decl=PreambleVar \
  34. // RUN: -Xclang -error-on-deserialized-decl=NestedVar1 \
  35. // RUN: -Xclang -error-on-deserialized-decl=vector_get_x \
  36. // RUN: | FileCheck %s -check-prefix=TOP-CURSOR1
  37. // RUN: env CINDEXTEST_FAILONERROR=1 CINDEXTEST_EDITING=1 CINDEXTEST_COMPLETION_NO_CACHING=1 \
  38. // RUN: c-index-test -cursor-at=%S/targeted-nested1.h:2:16 %s -include %t.h \
  39. // RUN: -Xclang -error-on-deserialized-decl=PreambleVar \
  40. // RUN: -Xclang -error-on-deserialized-decl=TopVar \
  41. // RUN: | FileCheck %s -check-prefix=NESTED-CURSOR1
  42. // RUN: env CINDEXTEST_FAILONERROR=1 CINDEXTEST_EDITING=1 CINDEXTEST_COMPLETION_NO_CACHING=1 \
  43. // RUN: c-index-test -cursor-at=%S/targeted-preamble.h:2:15 %s -include %t.h \
  44. // RUN: -Xclang -error-on-deserialized-decl=NestedVar1 \
  45. // RUN: -Xclang -error-on-deserialized-decl=TopVar \
  46. // RUN: | FileCheck %s -check-prefix=PREAMBLE-CURSOR1
  47. // LOCAL-CURSOR1: VarDecl=LocalVar1:5:5
  48. // TOP-CURSOR1: VarDecl=TopVar:11:12
  49. // NESTED-CURSOR1: VarDecl=NestedVar1:2:12
  50. // PREAMBLE-CURSOR1: VarDecl=PreambleVar:2:12
  51. // FIELD-CURSOR1: FieldDecl=z:2:7 (Definition)
  52. // FIELD-CURSOR2: StructDecl=:13:9 (Definition)