Skip to content

Commit

Permalink
TClingUtils: Avoid growing paths in GetFileName
Browse files Browse the repository at this point in the history
Strip of ../ so that the search finds a valid longest match. With the
upcoming upgrade of LLVM 13, this would otherwise lead to an error
"File name too long" but it's already wrong now.
  • Loading branch information
hahnjo committed Apr 12, 2022
1 parent cdcf037 commit 6bce8a8
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion core/clingutils/src/TClingUtils.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -3376,7 +3376,11 @@ llvm::StringRef ROOT::TMetaUtils::GetFileName(const clang::Decl& decl,
}

if (!headerFE) return invalidFilename;
llvm::StringRef headerFileName = headerFE->getName();

llvm::SmallString<256> headerFileName(headerFE->getName());
// Remove double ../ from the path so that the search below finds a valid
// longest match and does not result in growing paths.
llvm::sys::path::remove_dots(headerFileName, /*remove_dot_dot=*/true);

// Now headerFID references the last valid system header or the original
// user file.
Expand Down

0 comments on commit 6bce8a8

Please sign in to comment.