[clang-tools-extra] [clang-doc] Add Start and End Line Numbers (PR #135081)

Daniel Thornburgh via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 10 15:24:38 PDT 2025


================
@@ -28,6 +28,18 @@ template <typename T> bool isTypedefAnonRecord(const T *D) {
   return false;
 }
 
+Location MapASTVisitor::getDeclLocation(const NamedDecl *D) const {
+  bool IsFileInRootDir;
+  llvm::SmallString<128> File =
+      getFile(D, D->getASTContext(), CDCtx.SourceRoot, IsFileInRootDir);
+  ASTContext &Context = D->getASTContext();
+  int Start =
+      Context.getSourceManager().getPresumedLoc(D->getBeginLoc()).getLine();
----------------
mysterymath wrote:

nit: Extracting out a source manager reference would make the difference between these two lines clearer.

https://github.com/llvm/llvm-project/pull/135081


More information about the cfe-commits mailing list