Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[clang-doc] fix ASan complaints from passing RepositoryURL as reference#148923

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
evelez7 merged 1 commit intomainfromusers/evelez7/clang-doc-repositoryurl-asan
Jul 16, 2025

Conversation

evelez7
Copy link
Member

Passing RepositoryURL around as an optional reference triggered
stack-use-after-return complaints.

Passing RepositoryURL around as an optional reference triggeredstack-use-after-return complaints.
@evelez7evelez7 marked this pull request as ready for reviewJuly 15, 2025 18:45
@evelez7Graphite App
Copy link
MemberAuthor

evelez7 commentedJul 15, 2025
edited
Loading

@llvmbot
Copy link
Member

@llvm/pr-subscribers-clang-tools-extra

Author: Erick Velez (evelez7)

Changes

Passing RepositoryURL around as an optional reference triggered
stack-use-after-return complaints.


Full diff:https://github.com/llvm/llvm-project/pull/148923.diff

1 Files Affected:

  • (modified) clang-tools-extra/clang-doc/JSONGenerator.cpp (+10-10)
diff --git a/clang-tools-extra/clang-doc/JSONGenerator.cpp b/clang-tools-extra/clang-doc/JSONGenerator.cppindex 6fdc7196e9095..cc4c68346ec53 100644--- a/clang-tools-extra/clang-doc/JSONGenerator.cpp+++ b/clang-tools-extra/clang-doc/JSONGenerator.cpp@@ -45,7 +45,7 @@ static auto SerializeReferenceLambda = [](const auto &Ref, Object &Object) {  static json::Object serializeLocation(const Location &Loc,-                  const std::optional<StringRef> &RepositoryUrl) {+                  const std::optional<StringRef> RepositoryUrl) {   Object LocationObj = Object();   LocationObj["LineNumber"] = Loc.StartLineNumber;   LocationObj["Filename"] = Loc.Filename;@@ -169,7 +169,7 @@ static json::Value serializeComment(const CommentInfo &I) {  static void serializeCommonAttributes(const Info &I, json::Object &Obj,-                          const std::optional<StringRef> &RepositoryUrl) {+                          const std::optional<StringRef> RepositoryUrl) {   Obj["Name"] = I.Name;   Obj["USR"] = toHex(toStringRef(I.USR));@@ -211,9 +211,9 @@ static void serializeReference(const Reference &Ref, Object &ReferenceObj) { // differently. Only enums, records, and typedefs are handled here. static void serializeCommonChildren(const ScopeChildren &Children, json::Object &Obj,-                        const std::optional<StringRef> &RepositoryUrl) {-  static auto SerializeInfo = [&RepositoryUrl](const auto &Info,-                                               Object &Object) {+                        const std::optional<StringRef> RepositoryUrl) {+  static auto SerializeInfo = [RepositoryUrl](const auto &Info,+                                              Object &Object) {     serializeInfo(Info, Object, RepositoryUrl);   };@@ -304,7 +304,7 @@ static void serializeInfo(const FieldTypeInfo &I, Object &Obj) { }  static void serializeInfo(const FunctionInfo &F, json::Object &Obj,-                          const std::optional<StringRef> &RepositoryURL) {+                          const std::optional<StringRef> RepositoryURL) {   serializeCommonAttributes(F, Obj, RepositoryURL);   Obj["IsStatic"] = F.IsStatic;@@ -459,7 +459,7 @@ static void serializeInfo(const RecordInfo &I, json::Object &Obj, }  static void serializeInfo(const VarInfo &I, json::Object &Obj,-                          const std::optional<StringRef> &RepositoryUrl) {+                          const std::optional<StringRef> RepositoryUrl) {   serializeCommonAttributes(I, Obj, RepositoryUrl);   Obj["IsStatic"] = I.IsStatic;   auto TypeObj = Object();@@ -468,15 +468,15 @@ static void serializeInfo(const VarInfo &I, json::Object &Obj, }  static void serializeInfo(const NamespaceInfo &I, json::Object &Obj,-                          const std::optional<StringRef> &RepositoryUrl) {+                          const std::optional<StringRef> RepositoryUrl) {   serializeCommonAttributes(I, Obj, RepositoryUrl);    if (!I.Children.Namespaces.empty())     serializeArray(I.Children.Namespaces, Obj, "Namespaces",                    SerializeReferenceLambda);-  static auto SerializeInfo = [&RepositoryUrl](const auto &Info,-                                               Object &Object) {+  static auto SerializeInfo = [RepositoryUrl](const auto &Info,+                                              Object &Object) {     serializeInfo(Info, Object, RepositoryUrl);   };

Copy link
Contributor

@ilovepiilovepi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

LGTM, assuming the complaint is from the optional and not the StringRef.

@evelez7Graphite App
Copy link
MemberAuthor

LGTM, assuming the complaint is from the optional and not the StringRef.

Yeah the complaint was from the optional's bool operator being checked.

ilovepi reacted with thumbs up emoji

@evelez7Graphite App
Copy link
MemberAuthor

evelez7 commentedJul 16, 2025
edited
Loading

Merge activity

  • Jul 16, 4:01 PM UTC: A user started a stack merge that includes this pull request viaGraphite.
  • Jul 16, 4:03 PM UTC:@evelez7 merged this pull request withGraphite.

@evelez7evelez7 merged commit64c273a intomainJul 16, 2025
13 checks passed
@evelez7evelez7 deleted the users/evelez7/clang-doc-repositoryurl-asan branchJuly 16, 2025 16:03
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@ilovepiilovepiilovepi approved these changes

@petrhosekpetrhosekAwaiting requested review from petrhosek

Assignees
No one assigned
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3 participants
@evelez7@llvmbot@ilovepi

[8]ページ先頭

©2009-2025 Movatter.jp