Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Just a few optional ideas, this is fine as-is
clang-tools-extra/clangd/InlayHints.cpp | ||
---|---|---|
113 | nit: one of these trim()s can be an rtrim | |
126 | In order to use sourcePrefix it we're doing the buffer lookup stuff for every param. Would be a little more direct to grab the mainfile buffer + fileid at the start, and then here just decompose the top macrocallerloc straight away. Seems a little simpler to reason about, no idea if the performance matters much, up to you. | |
135 | I think we should handle the case where we never find /*. *maybe* it can't happen, but I wouldn't want to bet too much on it. Alternatively, rewinding back to the start of the (possibly long) comment just to check if it matches a fixed string seems a little roundabout. Could be: if (!SourcePrefix.consume_back("*/")) return false; SourcePrefix = SourcePrefix.rtrim().rtrim('=').rtrim(); if (!SourcePrefix.consume_back(ParamName)) return false; return SourcePrefix.rtrim().endswith("/*"); |
nit: one of these trim()s can be an rtrim