Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Sam, you're my go-to reviewer for "tricky macro stuff", but feel free to hand off if you prefer :)
Nice catch! As always, sorry about the delay.
clang-tools-extra/clangd/SourceCode.cpp | ||
---|---|---|
987 | nit: I guess these would be clearer with auto -> SourceLocation | |
988 | I'm a little confused about the condition here: Loc points at the macro name, which must be at least 1 character long, so we can't be at EOF, right? Unless i'm missing something, I think we can promote to an assert | |
993 | on the other hand, I suppose this case *is* possible with e.g. a builtin macro used at the start of the file. I think hoisting this into the condition might be clearer by avoiding the redundant case (the actual *performance* doesn't matter, just for readability) // If this is foo in `#undef foo`, use the old definition. if (!MI && SM.getLocForStartOfFile(FID) != Loc) MI = PP.getMacroDefinitionAtLoc(II, Loc.getLocWithOffset(-1)).getMacroInfo(); |
nit: I guess these would be clearer with auto -> SourceLocation