[PATCH] D30882: Add a callback for __has_include and use it for dependency scanning

Volodymyr Sapsai via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 14 17:15:28 PDT 2018


vsapsai added inline comments.


================
Comment at: clang/lib/Frontend/DependencyFile.cpp:300-304
   StringRef Filename = FE->getName();
   if (!FileMatchesDepCriteria(Filename.data(), FileType))
     return;
 
   AddFilename(llvm::sys::path::remove_leading_dotslash(Filename));
----------------
This was the role model.


================
Comment at: clang/lib/Frontend/DependencyFile.cpp:340
+    return;
+  StringRef Filename = File->getName();
+  if (!FileMatchesDepCriteria(Filename.data(), FileType))
----------------
rsmith wrote:
> Should we really be using the (arbitrary) name of the file from the `FileEntry` rather than the name as written? It looks like the corresponding code for `InclusionDirective` uses the name as written instead.
`InclusionDirective` covers only cases when file is not found. Existing files are handled in `FileChanged`. Advantage of using `File->getName()` is that for input with absolute paths file name will be absolute too.


https://reviews.llvm.org/D30882





More information about the cfe-commits mailing list