Commit 8dcdfc0d authored by Liuke Gehry's avatar Liuke Gehry Committed by Tom Stellard
Browse files

Fix cppcoreguidelines-init-variables by removing the enum FixIt, and add...

Fix cppcoreguidelines-init-variables by removing the enum FixIt, and add support for initialization check of scoped enum

In C++, the enumeration is never Integer, and the enumeration condition judgment is added to avoid compiling errors when it is initialized to an integer.
Add support for initialization check of scope enum.

As the following case show, clang-tidy will give a wrong automatic fix:

    enum Color {Red, Green, Blue};
    enum class Gender {Male, Female};
    void func() {
      Color color; // Color color = 0; <--- fix bug
      Gender gender; // <--- no warning
    }

Reviewd By: aaron.ballman, whisperity

Differential Revision: http://reviews.llvm.org/D106431

(cherry picked from commit 4a097efe)
parent 20eced2c
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment