Skip to content

Commit 18a2c05

Browse files
committed
Fix compile with clang trunk
clang::FileEntry::getName now returns a llvm::StringRef instead of a char*
1 parent 38edfdf commit 18a2c05

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

generator/annotator.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -194,8 +194,7 @@ std::string Annotator::htmlNameForFile(clang::FileID id)
194194
}
195195

196196
const clang::FileEntry* entry = getSourceMgr().getFileEntryForID(id);
197-
if (!entry || !entry->getName())
198-
{
197+
if (!entry || llvm::StringRef(entry->getName()).empty()) {
199198
cache[id] = {false, {} };
200199
return {};
201200
}
@@ -520,7 +519,7 @@ std::string Annotator::pathTo(clang::FileID From, const clang::FileEntry *To)
520519
{
521520
//this is a bit duplicated with the other pathTo and htmlNameForFile
522521

523-
if (!To || !To->getName())
522+
if (!To || llvm::StringRef(To->getName()).empty())
524523
return {};
525524

526525
std::string fromFN = htmlNameForFile(From);

generator/preprocessorcallback.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ bool PreprocessorCallback::FileNotFound(llvm::StringRef FileName, llvm::SmallVec
248248
clang::SourceLocation currentLoc = static_cast<clang::Lexer *>(PP.getCurrentLexer())->getSourceLocation();
249249
auto &SM = annotator.getSourceMgr();
250250
const clang::FileEntry* entry = SM.getFileEntryForID(SM.getFileID(currentLoc));
251-
if (!entry || !entry->getName())
251+
if (!entry || llvm::StringRef(entry->getName()).empty())
252252
return false;
253253
std::string recovery = annotator.projectManager.includeRecovery(FileName, entry->getName());
254254
if (recovery.empty() || !llvm::StringRef(recovery).endswith(FileName))

0 commit comments

Comments
 (0)