diff options
author | Ted Kremenek <kremenek@apple.com> | 2013-03-25 22:28:37 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2013-03-25 22:28:37 +0000 |
commit | cd3d440b827cb47e16e9ada47cf58948d8a1df34 (patch) | |
tree | afe777dea700a1be5f17c328b6af8eaf42191c6d /clang/lib/Sema/SemaChecking.cpp | |
parent | 780420ea4ec6a587969d48747f2b4c018cd03ae9 (diff) | |
download | bcm5719-llvm-cd3d440b827cb47e16e9ada47cf58948d8a1df34.tar.gz bcm5719-llvm-cd3d440b827cb47e16e9ada47cf58948d8a1df34.zip |
For printf checking, handle nested typedefs for darwin-specific checking.
Fixes <rdar://problem/13491605>.
llvm-svn: 177931
Diffstat (limited to 'clang/lib/Sema/SemaChecking.cpp')
-rw-r--r-- | clang/lib/Sema/SemaChecking.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp index cfce85eef01..4e11b3aa792 100644 --- a/clang/lib/Sema/SemaChecking.cpp +++ b/clang/lib/Sema/SemaChecking.cpp @@ -2803,7 +2803,9 @@ CheckPrintfHandler::checkFormatExpr(const analyze_printf::PrintfSpecifier &FS, // casts to primitive types that are known to be large enough. bool ShouldNotPrintDirectly = false; if (S.Context.getTargetInfo().getTriple().isOSDarwin()) { - if (const TypedefType *UserTy = IntendedTy->getAs<TypedefType>()) { + // Use a 'while' to peel off layers of typedefs. + QualType TyTy = IntendedTy; + while (const TypedefType *UserTy = TyTy->getAs<TypedefType>()) { StringRef Name = UserTy->getDecl()->getName(); QualType CastTy = llvm::StringSwitch<QualType>(Name) .Case("NSInteger", S.Context.LongTy) @@ -2815,7 +2817,9 @@ CheckPrintfHandler::checkFormatExpr(const analyze_printf::PrintfSpecifier &FS, if (!CastTy.isNull()) { ShouldNotPrintDirectly = true; IntendedTy = CastTy; + break; } + TyTy = UserTy->desugar(); } } |