diff options
author | Jordan Rose <jordan_rose@apple.com> | 2012-06-04 22:49:02 +0000 |
---|---|---|
committer | Jordan Rose <jordan_rose@apple.com> | 2012-06-04 22:49:02 +0000 |
commit | 033a9c0804f48119a03b73a2af42a04d4d0294ce (patch) | |
tree | de9b92a1fecd17bdf4a6875c6b354389832fe0fc /lib/Analysis/PrintfFormatString.cpp | |
parent | ee0259d308e72141982a85b40863e760a8447edf (diff) |
Make suggestions for mismatched enum arguments to printf/scanf.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@157962 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/PrintfFormatString.cpp')
-rw-r--r-- | lib/Analysis/PrintfFormatString.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/Analysis/PrintfFormatString.cpp b/lib/Analysis/PrintfFormatString.cpp index 3b3a0b176e..aa6d7424c0 100644 --- a/lib/Analysis/PrintfFormatString.cpp +++ b/lib/Analysis/PrintfFormatString.cpp @@ -381,6 +381,10 @@ bool PrintfSpecifier::fixType(QualType QT, const LangOptions &LangOpt, return true; } + // If it's an enum, get its underlying type. + if (const EnumType *ETy = QT->getAs<EnumType>()) + QT = ETy->getDecl()->getIntegerType(); + // We can only work with builtin types. const BuiltinType *BT = QT->getAs<BuiltinType>(); if (!BT) |