[clang] [clang] Limit file location search for macro argument locations (PR #232469)
Raphael Isemann via cfe-commits
cfe-commits at lists.llvm.org
Fri Oct 16 01:44:30 PDT 2026
================
@@ -1211,9 +1212,14 @@ class SourceManager : public RefCountedBase<SourceManager> {
/// Given \p Loc, if it is a macro location return the expansion
/// location or the spelling location, depending on if it comes from a
/// macro argument or not.
- SourceLocation getFileLoc(SourceLocation Loc) const {
+ ///
+ /// If resolving \p Loc requires walking through more than \p MaxDepth
+ /// macro expansions, an invalid location is returned instead.
----------------
Teemperor wrote:
note: an optional<SourceLocation> feels nicer to me, but the rest of the file already uses the invalid SourcdLocation as a magic return value.
https://github.com/llvm/llvm-project/pull/232469
More information about the cfe-commits
mailing list