[PATCH] D102923: [clang][lex] Remark on search path usage

Jan Svoboda via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 8 08:39:06 PDT 2021


jansvoboda11 added inline comments.


================
Comment at: clang/test/Preprocessor/header-search-user-entries.c:9-11
+// CHECK: remark: user-provided search path used: '{{.*}}/header-search-user-entries/a'
+// CHECK: remark: user-provided search path used: '{{.*}}/header-search-user-entries/a_next'
+// CHECK: remark: user-provided search path used: '{{.*}}/header-search-user-entries/d'
----------------
jansvoboda11 wrote:
> jansvoboda11 wrote:
> > dexonsmith wrote:
> > > If `-verify` doesn't work (hopefully it does), I think you'll need to add some `CHECK-NOT` / `CHECK-NEXT` / etc. or else you're not testing for the absence of other diagnostics.
> > > 
> > > Please also test:
> > > - Framework search path (used vs. not used)
> > > - System search path (used vs. not used)
> > > - One search path described relative to `-isysroot` (used vs. not used)
> > > - Header map (matched and used vs. matched but not used vs. not matched -- for the middle case, I'm not sure what result we actually want)
> > > - A path only used via `#if __has_include()` (when it's not followed by an `#include` or `#import`)
> > > - A path only used via ObjC's `#import`
> > > 
> > > If one of them doesn't work and it's complex enough to separate into a follow up, I think that'd be fine, but please find somewhere to leave a FIXME.
> > Good point, I'll work on improving the coverage.
> I tried using `-verify` together with `expected-remark-re` (to match **relative** paths) and `@*` (to match any/no line number), but those don't seem to work together.
> 
> This expectation:
> ```
> // expected-remark-re @* {{search path used: '{{.*}}/search-path-usage/FwA'}}
> ```
> produces:
> ```
> error: 'error' diagnostics seen but not expected: 
>   File /Users/Jan/Code/upstream-llvm/clang/test/Preprocessor/search-path-usage-headers.m Line 30: cannot find start ('{{') of expected regex
> error: 'remark' diagnostics seen but not expected: 
>   (frontend): search path used: '/Users/Jan/Code/upstream-llvm/clang/test/Preprocessor/Inputs/search-path-usage/FwA'
> 2 errors generated.
> ```
> 
> If I drop `@*`, stuff doesn't work (presumably because of line numbers):
> ```
> error: 'remark' diagnostics expected but not seen: 
>   File /Users/Jan/Code/upstream-llvm/clang/test/Preprocessor/search-path-usage-headers.m Line 30: search path used: '{{.*}}/search-path-usage/FwA'
> error: 'remark' diagnostics seen but not expected: 
>   (frontend): search path used: '/Users/Jan/Code/upstream-llvm/clang/test/Preprocessor/Inputs/search-path-usage/FwA'
> 2 errors generated.
> ```
> 
> Let me know if I'm doing something wrong. In the meantime, I made the FileCheck checks more thorough as you suggested.
> - Header map (matched and used vs. matched but not used vs. not matched -- for the middle case, I'm not sure what result we actually want)

Can you clarify what you mean by "matched" and "used" exactly?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D102923/new/

https://reviews.llvm.org/D102923



More information about the cfe-commits mailing list