Skip to content

Conversation

@kazutakahirata
Copy link
Contributor

No description provided.

@kazutakahirata kazutakahirata requested a review from nikic February 8, 2025 17:21
@llvmbot llvmbot added the clang Clang issues not falling into any other category label Feb 8, 2025
@llvmbot
Copy link
Member

llvmbot commented Feb 8, 2025

@llvm/pr-subscribers-clang

Author: Kazu Hirata (kazutakahirata)

Changes

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

1 Files Affected:

  • (modified) clang/utils/TableGen/ClangOptionDocEmitter.cpp (+10-6)
diff --git a/clang/utils/TableGen/ClangOptionDocEmitter.cpp b/clang/utils/TableGen/ClangOptionDocEmitter.cpp
index e08fb11df31002..b6c1aad90b5cb9 100644
--- a/clang/utils/TableGen/ClangOptionDocEmitter.cpp
+++ b/clang/utils/TableGen/ClangOptionDocEmitter.cpp
@@ -109,13 +109,17 @@ Documentation extractDocumentation(const RecordKeeper &Records,
     // Pretend no-X and Xno-Y options are aliases of X and XY.
     std::string Name = std::string(R->getValueAsString("Name"));
     if (Name.size() >= 4) {
-      if (Name.substr(0, 3) == "no-" && OptionsByName[Name.substr(3)]) {
-        Aliases[OptionsByName[Name.substr(3)]].push_back(R);
-        continue;
+      if (Name.substr(0, 3) == "no-") {
+        if (const Record *Opt = OptionsByName[Name.substr(3)]) {
+          Aliases[Opt].push_back(R);
+          continue;
+        }
       }
-      if (Name.substr(1, 3) == "no-" && OptionsByName[Name[0] + Name.substr(4)]) {
-        Aliases[OptionsByName[Name[0] + Name.substr(4)]].push_back(R);
-        continue;
+      if (Name.substr(1, 3) == "no-") {
+        if (const Record *Opt = OptionsByName[Name[0] + Name.substr(4)]) {
+          Aliases[Opt].push_back(R);
+          continue;
+        }
       }
     }
 

@kazutakahirata kazutakahirata merged commit cf5947b into llvm:main Feb 8, 2025
10 checks passed
@kazutakahirata kazutakahirata deleted the cleanup_001_repeated_hash_lookups_clang_TableGen branch February 8, 2025 19:36
Icohedron pushed a commit to Icohedron/llvm-project that referenced this pull request Feb 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clang Clang issues not falling into any other category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants