[clang-tools-extra] [clangd][refactor] Improve function source code qualification logic in DefineOutline (PR #173606)
Baranov Victor via cfe-commits
cfe-commits at lists.llvm.org
Fri Jan 2 15:04:31 PST 2026
================
@@ -236,8 +236,13 @@ getFunctionSourceCode(const FunctionDecl *FD, const DeclContext *TargetContext,
if (Ref.Qualifier || Ref.Targets.empty() || Ref.NameLoc.isMacroID())
return;
// Only qualify return type and function name.
- if (Ref.NameLoc != FD->getReturnTypeSourceRange().getBegin() &&
- Ref.NameLoc != FD->getLocation())
+ auto ReturnTypeRange = FD->getReturnTypeSourceRange();
----------------
vbvictor wrote:
this could be made inside `if` to reduce scope.
```cpp
if (auto ReturnTypeRange = FD->getReturnTypeSourceRange(); Ref.NameLoc != FD->getLocation() ...)
```
https://github.com/llvm/llvm-project/pull/173606
More information about the cfe-commits
mailing list