[llvm] [Instrumentor] Add spellcheck for instrumentor properties (PR #205416)

Johannes Doerfert via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 23 13:05:06 PDT 2026


================
@@ -202,16 +221,27 @@ bool readConfigFromJSON(InstrumentationConfig &IConf, StringRef InputFile,
       }
       auto *IO = IChoiceMap.lookup(ObjIt.first);
       if (!IO) {
-        Ctx.diagnose(DiagnosticInfoInstrumentation(
+        Twine NoMatchingMsg =
             Twine("malformed JSON configuration, expected an object matching "
-                  "an instrumentor choice, got ") +
-                StringRef(ObjIt.first),
-            DS_Warning));
+                  "an instrumentor choice, got '") +
+            StringRef(ObjIt.first) + Twine("'");
+        StringRef Closest = closestOption(IChoiceMap, ObjIt.first);
+        Twine Diag = NoMatchingMsg +
+                     (Closest.empty()
+                          ? Twine()
+                          : Twine("; did you mean '") + Closest + Twine("'?"));
+        Ctx.diagnose(DiagnosticInfoInstrumentation(Diag, DS_Warning));
         continue;
       }
       SeenIOs.insert(IO);
       StringMap<bool> ValueMap, ReplaceMap;
       StringRef FilterStr;
+      StringSet<> IOOpts;
+      IOOpts.insert("enabled");
+      IOOpts.insert("filter");
+      for (auto &IRArg : IO->IRTArgs) {
+        IOOpts.insert(IRArg.Name);
+      }
----------------
jdoerfert wrote:

style, no braces

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


More information about the llvm-commits mailing list