summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend/DependencyFile.cpp
diff options
context:
space:
mode:
authorDavid Majnemer <david.majnemer@gmail.com>2014-10-27 22:31:50 +0000
committerDavid Majnemer <david.majnemer@gmail.com>2014-10-27 22:31:50 +0000
commitf0822fb00a10911a762d271008e41b47b3e0e2b9 (patch)
treefa598c359269518bb85203c477d102d74214ff2e /clang/lib/Frontend/DependencyFile.cpp
parenta41521a8bd00298e72ed7a2469385c9432daca0f (diff)
downloadbcm5719-llvm-f0822fb00a10911a762d271008e41b47b3e0e2b9.tar.gz
bcm5719-llvm-f0822fb00a10911a762d271008e41b47b3e0e2b9.zip
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. llvm-svn: 220726
Diffstat (limited to 'clang/lib/Frontend/DependencyFile.cpp')
-rw-r--r--clang/lib/Frontend/DependencyFile.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/clang/lib/Frontend/DependencyFile.cpp b/clang/lib/Frontend/DependencyFile.cpp
index 22ed38fc129..08d66c70943 100644
--- a/clang/lib/Frontend/DependencyFile.cpp
+++ b/clang/lib/Frontend/DependencyFile.cpp
@@ -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::maybeAddDependency(StringRef Filename, bool FromModule
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::AttachToASTReader(ASTReader &R) {
/// 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)
OpenPOWER on IntegriCloud