[clang-tools-extra] [clangd] Do not show `aParam` parameter hint for argument spelled `param` (PR #119162)

Nathan Ridge via cfe-commits cfe-commits at lists.llvm.org
Sun Dec 15 17:27:50 PST 2024


================
@@ -867,13 +867,28 @@ class InlayHintVisitor : public RecursiveASTVisitor<InlayHintVisitor> {
     }
   }
 
+  static bool argumentMatchesParamName(StringRef ArgName, StringRef ParamName) {
+    // Exact match.
+    if (ParamName == ArgName)
+      return true;
+
+    // Parameter name uses "a" prefix (e.g. "aParam").
+    if (ParamName.size() > 1 && ParamName[0] == 'a' &&
----------------
HighCommander4 wrote:

In the codebase where I encountered this convention, the `a` prefix did not refer to the _word_ "a" (indefinite article), but rather was an abbreviation for "argument" (used as an imprecise synonym for "parameter"). So, with this convention, the prefix would be `a` even in front of `Apple`.

But I suppose I can imagine a different convention where the prefix is an indefinite article and so you'd get `anApple`.

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


More information about the cfe-commits mailing list