Skip to content
Snippets Groups Projects
Commit a92935dc authored by Axel Naumann's avatar Axel Naumann
Browse files

[dictgen] Use header search if we cannot find a header to be inlined:

This can happen if the header is in an otehrwise excluded directory.
While we do not want to remember the -I in the PCH, we do want to
find the header to be injected into the dictionary!
parent 3ee805aa
Branches
Tags
No related merge requests found
...@@ -520,19 +520,29 @@ void TModuleGenerator::WriteContentHeader(std::ostream &out) const ...@@ -520,19 +520,29 @@ void TModuleGenerator::WriteContentHeader(std::ostream &out) const
bool TModuleGenerator::FindHeader(const std::string &hdrName, std::string &hdrFullPath) const bool TModuleGenerator::FindHeader(const std::string &hdrName, std::string &hdrFullPath) const
{ {
hdrFullPath = hdrName; hdrFullPath = hdrName;
bool headerFound = false; if (llvm::sys::fs::exists(hdrFullPath))
if (llvm::sys::fs::exists(hdrFullPath)) {
return true; return true;
} else { for (auto const &incDir : fCompI) {
for (auto const & incDir : fCompI) { hdrFullPath = incDir + ROOT::TMetaUtils::GetPathSeparator() + hdrName;
hdrFullPath = incDir + ROOT::TMetaUtils::GetPathSeparator() + hdrName; if (llvm::sys::fs::exists(hdrFullPath)) {
if (llvm::sys::fs::exists(hdrFullPath)) { return true;
headerFound = true;
break;
}
} }
} }
return headerFound; clang::Preprocessor &PP = fCI->getPreprocessor();
clang::HeaderSearch &HdrSearch = PP.getHeaderSearchInfo();
const clang::DirectoryLookup *CurDir = 0;
if (const clang::FileEntry *hdrFileEntry
= HdrSearch.LookupFile(hdrName, clang::SourceLocation(),
true /*isAngled*/, 0 /*FromDir*/, CurDir,
clang::ArrayRef<std::pair<const clang::FileEntry*,
const clang::DirectoryEntry*>>(),
0 /*IsMapped*/, 0 /*SearchPath*/, 0 /*RelativePath*/,
0 /*RequestingModule*/, 0/*SuggestedModule*/)) {
hdrFullPath = hdrFileEntry->getName();
return true;
}
return false;
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment