tinycodinglm / lang /clang003.jsonl
winapiadmin's picture
Upload folder using huggingface_hub (part 15)
b27bfb3 verified
|
Raw History Blame Contribute Delete
1.13 kB
{"type": "session", "harness": "deepseek-harness", "id": "clang003", "name": "Clang-tidy custom checks"}
{"type": "message", "message": {"role": "system", "content": "You are an expert software engineer and technical assistant. You provide accurate, detailed, and practical answers. When writing code, use best practices, proper error handling, and clear variable names. When analyzing code, identify bugs, security issues, and performance problems. You have deep knowledge of C/C++, Windows API, Python, and many other technologies."}}
{"type": "message", "message": {"role": "user", "content": "How do I write custom clang-tidy checks?"}}
{"type": "message", "message": {"role": "assistant", "content": "```cpp\nvoid MyCheck::registerMatchers(MatchFinder *Finder) {\n Finder->addMatcher(\n callExpr(callee(functionDecl(hasName(\"gets\")))).bind(\"gets_call\"),\n this\n );\n}\nvoid MyCheck::check(const MatchFinder::MatchResult &Result) {\n if (auto *Call = Result.Nodes.getNodeAs<CallExpr>(\"gets_call\"))\n diag(Call->getBeginLoc(), \"gets() is dangerous, use fgets() instead\");\n}\n```"}}