llvm-project
7de1a17c - [clang-tidy] Fix `modernize-use-scoped-lock` crash on malformed code (#165127)

Commit
84 days ago
[clang-tidy] Fix `modernize-use-scoped-lock` crash on malformed code (#165127) This code: ```cpp void f() { std::lock_guard<std::mutex> dont_crash {some_nonexistant_variable}; } ``` Generates an AST like this: ```txt TranslationUnitDecl `-FunctionDecl <line:3:1, line:5:1> line:3:6 f 'void ()' `-CompoundStmt <col:10, line:5:1> `-DeclStmt <line:4:3, col:69> `-VarDecl <col:3, col:31> col:31 dont_crash 'std::lock_guard<std::mutex>' destroyed ``` Where the `VarDecl` has no initializer. The check doesn't expect this and crashes.
Author
Parents
Loading