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, 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 +#include