@@ -112,7 +112,7 @@ class Function {
112
112
113
113
std::string getHeader (const clang::SourceManager &srcmgr) const {
114
114
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));
116
116
return declfile->getName ().str ();
117
117
}
118
118
@@ -254,7 +254,7 @@ class MyFrontendAction: public clang::ASTFrontendAction {
254
254
bool prefixable (clang::SourceLocation sloc) {
255
255
const clang::SourceManager &srcmgr = getCompilerInstance ().getSourceManager ();
256
256
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)) {
258
258
return prefixable (declfile->getName ().str ());
259
259
}
260
260
@@ -406,6 +406,8 @@ class CompilationDatabase : public clang::tooling::CompilationDatabase
406
406
// Some versions of clang ship with the full version string in the include path, others only with the major version number.
407
407
" -I" LLVM_LIBRARY_DIR " /clang/" LLVM_VERSION_STRING " /include/" ,
408
408
" -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" ,
409
411
file.str ()
410
412
};
411
413
return { clang::tooling::CompileCommand (" ." , file, cmdline, " " ) };
0 commit comments