From 033a9c0804f48119a03b73a2af42a04d4d0294ce Mon Sep 17 00:00:00 2001 From: Jordan Rose Date: Mon, 4 Jun 2012 22:49:02 +0000 Subject: 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 --- lib/Analysis/ScanfFormatString.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'lib/Analysis/ScanfFormatString.cpp') diff --git a/lib/Analysis/ScanfFormatString.cpp b/lib/Analysis/ScanfFormatString.cpp index 6bc4adb4f3..066d5d6fa1 100644 --- a/lib/Analysis/ScanfFormatString.cpp +++ b/lib/Analysis/ScanfFormatString.cpp @@ -316,6 +316,11 @@ bool ScanfSpecifier::fixType(QualType QT, const LangOptions &LangOpt, return false; QualType PT = QT->getPointeeType(); + + // If it's an enum, get its underlying type. + if (const EnumType *ETy = QT->getAs()) + QT = ETy->getDecl()->getIntegerType(); + const BuiltinType *BT = PT->getAs(); if (!BT) return false; -- cgit v1.2.3