https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/141490
I don't think this depends on #line directives, to it should be fine to use getBufferName. >From e8e0bddda7dcc5e64624912e68f5de8d7ff485eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= <tbae...@redhat.com> Date: Mon, 26 May 2025 13:59:52 +0200 Subject: [PATCH] [clang][Lex] Use getBufferName() in isInPredefinedFile() I don't think this depends on #line directives, to it should be fine to use getBufferName. --- clang/include/clang/Basic/SourceManager.h | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/clang/include/clang/Basic/SourceManager.h b/clang/include/clang/Basic/SourceManager.h index cd3dac9133223..cb5ed219bd000 100644 --- a/clang/include/clang/Basic/SourceManager.h +++ b/clang/include/clang/Basic/SourceManager.h @@ -1531,11 +1531,8 @@ class SourceManager : public RefCountedBase<SourceManager> { /// Returns whether \p Loc is located in a built-in or command line source. bool isInPredefinedFile(SourceLocation Loc) const { - PresumedLoc Presumed = getPresumedLoc(Loc); - if (Presumed.isInvalid()) - return false; - StringRef Filename(Presumed.getFilename()); - return Filename == "<built-in>" || Filename == "<command line>"; + StringRef BufferName = getBufferName(Loc); + return BufferName == "<built-in>" || BufferName == "<command line>"; } /// Returns if a SourceLocation is in a system header. _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits