Remember the compilation options used

and reuse them when the file is not found in the compilation database. This is a very common case : it happens for all headers. In practice, this heuristics gives good results.