[clang-tools-extra] 155b9b3 - [clang-doc][nfc] Default initialize all StringRef members (#191641)

via cfe-commits cfe-commits at lists.llvm.org
Sat Apr 11 09:52:20 PDT 2026


Author: Paul Kirth
Date: 2026-04-11T09:52:16-07:00
New Revision: 155b9b354c1d91661be9f6d0432a96e47cfc2700

URL: https://github.com/llvm/llvm-project/commit/155b9b354c1d91661be9f6d0432a96e47cfc2700
DIFF: https://github.com/llvm/llvm-project/commit/155b9b354c1d91661be9f6d0432a96e47cfc2700.diff

LOG: [clang-doc][nfc] Default initialize all StringRef members (#191641)

Ensure all StringRef members are default initialized to avoid potential
bugs.

Added: 
    

Modified: 
    clang-tools-extra/clang-doc/Representation.h

Removed: 
    


################################################################################
diff  --git a/clang-tools-extra/clang-doc/Representation.h b/clang-tools-extra/clang-doc/Representation.h
index b88c707214f7f..5f404463b012e 100644
--- a/clang-tools-extra/clang-doc/Representation.h
+++ b/clang-tools-extra/clang-doc/Representation.h
@@ -305,7 +305,7 @@ struct Context : public Reference {
           StringRef Path, StringRef DocumentationFileName)
       : Reference(USR, Name, IT, QualName, Path, DocumentationFileName) {}
   explicit Context(const Info &I);
-  StringRef RelativePath;
+  StringRef RelativePath = {};
 };
 
 // Holds the children of a record or namespace.
@@ -465,7 +465,7 @@ struct Location : public llvm::ilist_node<Location> {
            std::tie(Other.StartLineNumber, Other.EndLineNumber, Other.Filename);
   }
 
-  StringRef Filename;
+  StringRef Filename = {};
   int StartLineNumber = 0;
   int EndLineNumber = 0;
   bool IsFileInRootDir = false;
@@ -495,10 +495,10 @@ struct Info {
   StringRef getFileBaseName() const;
 
   // Path of directory where the clang-doc generated file will be saved.
-  StringRef Path;
+  StringRef Path = {};
 
   // Unqualified name of the decl.
-  StringRef Name;
+  StringRef Name = {};
 
   // The name used for the file that this info is documented in.
   // In the JSON generator, infos are documented in files with mangled names.
@@ -668,7 +668,7 @@ struct TypedefInfo : public SymbolInfo, public llvm::ilist_node<TypedefInfo> {
   std::optional<TemplateInfo> Template;
 
   // Underlying type declaration
-  StringRef TypeDeclaration;
+  StringRef TypeDeclaration = {};
 
   // Indicates if this is a new C++ "using"-style typedef:
   //   using MyVector = std::vector<int>


        


More information about the cfe-commits mailing list