Use new utility function to clean leading junk from pathnames. NFC
llvm-svn: 246714
This commit is contained in:
@@ -51,15 +51,8 @@ struct DepCollectorPPCallbacks : public PPCallbacks {
|
||||
if (!FE)
|
||||
return;
|
||||
|
||||
StringRef Filename = FE->getName();
|
||||
|
||||
// Remove leading "./" (or ".//" or "././" etc.)
|
||||
while (Filename.size() > 2 && Filename[0] == '.' &&
|
||||
llvm::sys::path::is_separator(Filename[1])) {
|
||||
Filename = Filename.substr(1);
|
||||
while (llvm::sys::path::is_separator(Filename[0]))
|
||||
Filename = Filename.substr(1);
|
||||
}
|
||||
StringRef Filename =
|
||||
llvm::sys::path::remove_leading_dotslash(FE->getName());
|
||||
|
||||
DepCollector.maybeAddDependency(Filename, /*FromModule*/false,
|
||||
FileType != SrcMgr::C_User,
|
||||
@@ -295,15 +288,7 @@ void DFGImpl::FileChanged(SourceLocation Loc,
|
||||
if (!FileMatchesDepCriteria(Filename.data(), FileType))
|
||||
return;
|
||||
|
||||
// Remove leading "./" (or ".//" or "././" etc.)
|
||||
while (Filename.size() > 2 && Filename[0] == '.' &&
|
||||
llvm::sys::path::is_separator(Filename[1])) {
|
||||
Filename = Filename.substr(1);
|
||||
while (llvm::sys::path::is_separator(Filename[0]))
|
||||
Filename = Filename.substr(1);
|
||||
}
|
||||
|
||||
AddFilename(Filename);
|
||||
AddFilename(llvm::sys::path::remove_leading_dotslash(Filename));
|
||||
}
|
||||
|
||||
void DFGImpl::InclusionDirective(SourceLocation HashLoc,
|
||||
|
||||
Reference in New Issue
Block a user