diff options
author | Jordan Rose <jordan_rose@apple.com> | 2012-06-04 22:48:57 +0000 |
---|---|---|
committer | Jordan Rose <jordan_rose@apple.com> | 2012-06-04 22:48:57 +0000 |
commit | 98709985a6e58f42291e533f0f12563bfd7bbce3 (patch) | |
tree | 10e4e7b797f1d6f5b5e5062932301a810529aa88 /clang/lib/Analysis/FormatString.cpp | |
parent | a8f556657ff41fd7d1dc496214c6361d18824b0e (diff) | |
download | bcm5719-llvm-98709985a6e58f42291e533f0f12563bfd7bbce3.tar.gz bcm5719-llvm-98709985a6e58f42291e533f0f12563bfd7bbce3.zip |
Teach printf/scanf about enums with fixed underlying types.
llvm-svn: 157961
Diffstat (limited to 'clang/lib/Analysis/FormatString.cpp')
-rw-r--r-- | clang/lib/Analysis/FormatString.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/clang/lib/Analysis/FormatString.cpp b/clang/lib/Analysis/FormatString.cpp index f776c89cc56..caceeac113b 100644 --- a/clang/lib/Analysis/FormatString.cpp +++ b/clang/lib/Analysis/FormatString.cpp @@ -241,6 +241,9 @@ bool ArgTypeResult::matchesType(ASTContext &C, QualType argTy) const { return true; case AnyCharTy: { + if (const EnumType *ETy = argTy->getAs<EnumType>()) + argTy = ETy->getDecl()->getIntegerType(); + if (const BuiltinType *BT = argTy->getAs<BuiltinType>()) switch (BT->getKind()) { default: @@ -255,7 +258,10 @@ bool ArgTypeResult::matchesType(ASTContext &C, QualType argTy) const { } case SpecificTy: { + if (const EnumType *ETy = argTy->getAs<EnumType>()) + argTy = ETy->getDecl()->getIntegerType(); argTy = C.getCanonicalType(argTy).getUnqualifiedType(); + if (T == argTy) return true; // Check for "compatible types". |