Skip to content

Commit 7d2cf87

Browse files
authored
Merge pull request #334 from jwendell/fix-clang-19-rhel
Fix to build with newer Clang versions and RHEL
2 parents 3396212 + abe42e3 commit 7d2cf87

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

bssl-compat/prefixer/prefixer.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ class Function {
112112

113113
std::string getHeader(const clang::SourceManager &srcmgr) const {
114114
clang::SourceLocation sloc = getFileLoc(srcmgr, m_node->getLocation());
115-
const clang::FileEntry *declfile = srcmgr.getFileEntryForID(srcmgr.getFileID(sloc));
115+
const clang::OptionalFileEntryRef declfile = srcmgr.getFileEntryRefForID(srcmgr.getFileID(sloc));
116116
return declfile->getName().str();
117117
}
118118

@@ -254,7 +254,7 @@ class MyFrontendAction: public clang::ASTFrontendAction {
254254
bool prefixable(clang::SourceLocation sloc) {
255255
const clang::SourceManager &srcmgr = getCompilerInstance().getSourceManager();
256256
clang::FileID fileid = srcmgr.getFileID(getFileLoc(srcmgr, sloc));
257-
if(const clang::FileEntry *declfile = srcmgr.getFileEntryForID(fileid)) {
257+
if(const clang::OptionalFileEntryRef declfile = srcmgr.getFileEntryRefForID(fileid)) {
258258
return prefixable (declfile->getName().str());
259259
}
260260

@@ -406,6 +406,8 @@ class CompilationDatabase : public clang::tooling::CompilationDatabase
406406
// Some versions of clang ship with the full version string in the include path, others only with the major version number.
407407
"-I" LLVM_LIBRARY_DIR "/clang/" LLVM_VERSION_STRING "/include/",
408408
"-I" LLVM_LIBRARY_DIR "/clang/" + std::to_string(LLVM_VERSION_MAJOR) + "/include/",
409+
// RHEL ships with a different path for the Clang headers
410+
"-I/usr/lib/clang/" + std::to_string(LLVM_VERSION_MAJOR) + "/include",
409411
file.str()
410412
};
411413
return { clang::tooling::CompileCommand(".", file, cmdline, "") };

0 commit comments

Comments
 (0)