[PATCH] D30881: Track skipped files in dependency scanning

Volodymyr Sapsai via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 1 17:03:03 PDT 2018


This revision was automatically updated to reflect the committed changes.
vsapsai marked an inline comment as done.
Closed by commit rL331319: Track skipped files in dependency scanning. (authored by vsapsai, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D30881?vs=144802&id=144813#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D30881

Files:
  cfe/trunk/lib/Frontend/DependencyFile.cpp
  cfe/trunk/test/Frontend/Inputs/SystemHeaderPrefix/with-header-guard.h
  cfe/trunk/test/Frontend/dependency-gen-symlink.c


Index: cfe/trunk/test/Frontend/Inputs/SystemHeaderPrefix/with-header-guard.h
===================================================================
--- cfe/trunk/test/Frontend/Inputs/SystemHeaderPrefix/with-header-guard.h
+++ cfe/trunk/test/Frontend/Inputs/SystemHeaderPrefix/with-header-guard.h
@@ -0,0 +1,3 @@
+#ifndef HEADER_GUARD
+#define HEADER_GUARD
+#endif
Index: cfe/trunk/test/Frontend/dependency-gen-symlink.c
===================================================================
--- cfe/trunk/test/Frontend/dependency-gen-symlink.c
+++ cfe/trunk/test/Frontend/dependency-gen-symlink.c
@@ -0,0 +1,24 @@
+// REQUIRES: shell
+
+// Basic test
+// RUN: rm -rf %t.dir
+// RUN: mkdir %t.dir
+// RUN: mkdir %t.dir/a
+// RUN: mkdir %t.dir/b
+// RUN: echo "#ifndef HEADER_A" > %t.dir/a/header.h
+// RUN: echo "#define HEADER_A" >> %t.dir/a/header.h
+// RUN: echo "#endif" >> %t.dir/a/header.h
+// RUN: ln -s %t.dir/a/header.h %t.dir/b/header.h
+
+// RUN: %clang_cc1 -dependency-file %t.dir/file.deps -MT %s.o %s -fsyntax-only -I %t.dir -isystem %S/Inputs/SystemHeaderPrefix
+// RUN: FileCheck -input-file=%t.dir/file.deps %s
+// CHECK: dependency-gen-symlink.c.o
+// CHECK: dependency-gen-symlink.c
+// CHECK: a/header.h
+// CHECK: b/header.h
+// CHECK-NOT: with-header-guard.h
+#include "a/header.h"
+#include "b/header.h"
+// System header shouldn't be included in dependencies.
+#include <with-header-guard.h>
+#include <with-header-guard.h>
Index: cfe/trunk/lib/Frontend/DependencyFile.cpp
===================================================================
--- cfe/trunk/lib/Frontend/DependencyFile.cpp
+++ cfe/trunk/lib/Frontend/DependencyFile.cpp
@@ -185,6 +185,10 @@
   void FileChanged(SourceLocation Loc, FileChangeReason Reason,
                    SrcMgr::CharacteristicKind FileType,
                    FileID PrevFID) override;
+
+  void FileSkipped(const FileEntry &SkippedFile, const Token &FilenameTok,
+                   SrcMgr::CharacteristicKind FileType) override;
+
   void InclusionDirective(SourceLocation HashLoc, const Token &IncludeTok,
                           StringRef FileName, bool IsAngled,
                           CharSourceRange FilenameRange, const FileEntry *File,
@@ -291,6 +295,16 @@
   AddFilename(llvm::sys::path::remove_leading_dotslash(Filename));
 }
 
+void DFGImpl::FileSkipped(const FileEntry &SkippedFile,
+                          const Token &FilenameTok,
+                          SrcMgr::CharacteristicKind FileType) {
+  StringRef Filename = SkippedFile.getName();
+  if (!FileMatchesDepCriteria(Filename.data(), FileType))
+    return;
+
+  AddFilename(llvm::sys::path::remove_leading_dotslash(Filename));
+}
+
 void DFGImpl::InclusionDirective(SourceLocation HashLoc,
                                  const Token &IncludeTok,
                                  StringRef FileName,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D30881.144813.patch
Type: text/x-patch
Size: 2840 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180502/b7eb282c/attachment.bin>


More information about the llvm-commits mailing list