зеркало из https://github.com/microsoft/clang-1.git
Don't suggest -Wuninitialized fixits for uninitialized enum types.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124924 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
52d6bbe3aa
Коммит
09f57b966c
|
@ -430,7 +430,7 @@ public:
|
|||
// Suggest possible initialization (if any).
|
||||
const char *initialization = 0;
|
||||
QualType vdTy = vd->getType().getCanonicalType();
|
||||
|
||||
|
||||
if (vdTy->getAs<ObjCObjectPointerType>()) {
|
||||
// Check if 'nil' is defined.
|
||||
if (S.PP.getMacroInfo(&S.getASTContext().Idents.get("nil")))
|
||||
|
@ -442,6 +442,8 @@ public:
|
|||
initialization = " = 0.0";
|
||||
else if (vdTy->isBooleanType() && S.Context.getLangOptions().CPlusPlus)
|
||||
initialization = " = false";
|
||||
else if (vdTy->isEnumeralType())
|
||||
continue;
|
||||
else if (vdTy->isScalarType())
|
||||
initialization = " = 0";
|
||||
|
||||
|
|
|
@ -41,3 +41,11 @@ unsigned test3_c() {
|
|||
return x; // expected-warning{{variable 'x' is possibly uninitialized when used here}}
|
||||
}
|
||||
|
||||
enum test4_A {
|
||||
test4_A_a, test_4_A_b
|
||||
};
|
||||
test4_A test4() {
|
||||
test4_A a; // expected-note{{variable 'a' is declared here}}
|
||||
return a; // expected-warning{{variable 'a' is possibly uninitialized when used here}}
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче