r220726 - Frontend: Don't include stdin in the dependency list for an object file
David Majnemer
david.majnemer at gmail.com
Mon Oct 27 15:31:50 PDT 2014
Author: majnemer
Date: Mon Oct 27 17:31:50 2014
New Revision: 220726
URL: http://llvm.org/viewvc/llvm-project?rev=220726&view=rev
Log:
Frontend: Don't include stdin in the dependency list for an object file
GCC doesn't do this and it semes weird to include a file that we can't
open.
This fixes PR21362.
Modified:
cfe/trunk/lib/Frontend/DependencyFile.cpp
Modified: cfe/trunk/lib/Frontend/DependencyFile.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/DependencyFile.cpp?rev=220726&r1=220725&r2=220726&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/DependencyFile.cpp (original)
+++ cfe/trunk/lib/Frontend/DependencyFile.cpp Mon Oct 27 17:31:50 2014
@@ -22,6 +22,7 @@
#include "clang/Lex/Preprocessor.h"
#include "clang/Serialization/ASTReader.h"
#include "llvm/ADT/StringSet.h"
+#include "llvm/ADT/StringSwitch.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/Path.h"
#include "llvm/Support/raw_ostream.h"
@@ -113,10 +114,18 @@ void DependencyCollector::maybeAddDepend
Dependencies.push_back(Filename);
}
+static bool isSpecialFilename(StringRef Filename) {
+ return llvm::StringSwitch<bool>(Filename)
+ .Case("<built-in>", true)
+ .Case("<stdin>", true)
+ .Default(false);
+}
+
bool DependencyCollector::sawDependency(StringRef Filename, bool FromModule,
bool IsSystem, bool IsModuleFile,
bool IsMissing) {
- return Filename != "<built-in>" && (needSystemDependencies() || !IsSystem);
+ return !isSpecialFilename(Filename) &&
+ (needSystemDependencies() || !IsSystem);
}
DependencyCollector::~DependencyCollector() { }
@@ -218,7 +227,7 @@ void DependencyFileGenerator::AttachToAS
/// considered as a dependency.
bool DFGImpl::FileMatchesDepCriteria(const char *Filename,
SrcMgr::CharacteristicKind FileType) {
- if (strcmp("<built-in>", Filename) == 0)
+ if (isSpecialFilename(Filename))
return false;
if (IncludeSystemHeaders)
More information about the cfe-commits
mailing list