diff options
| author | Brooks Davis <brooks@FreeBSD.org> | 2010-05-06 15:35:00 +0000 |
|---|---|---|
| committer | Brooks Davis <brooks@FreeBSD.org> | 2010-05-06 15:35:00 +0000 |
| commit | 619336abdf11002aab0c85490943ce8d6e9df4c0 (patch) | |
| tree | ac01c9c5194b2cdf14fc468a96d6b53e7aef5cfe /devel/llvm-devel/files/patch-tools_clang_lib_Sema_SemaChecking.cpp | |
| parent | - Updated to 2.8.1 (diff) | |
Update to r103179.
Start calling this 2.8.r* since 2.7 has shipped.
Add support for FreeBSD printf format extensions.[0]
Submitted by: rdivacky [0]
Diffstat (limited to 'devel/llvm-devel/files/patch-tools_clang_lib_Sema_SemaChecking.cpp')
| -rw-r--r-- | devel/llvm-devel/files/patch-tools_clang_lib_Sema_SemaChecking.cpp | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/devel/llvm-devel/files/patch-tools_clang_lib_Sema_SemaChecking.cpp b/devel/llvm-devel/files/patch-tools_clang_lib_Sema_SemaChecking.cpp new file mode 100644 index 000000000000..32917b92b8d0 --- /dev/null +++ b/devel/llvm-devel/files/patch-tools_clang_lib_Sema_SemaChecking.cpp @@ -0,0 +1,45 @@ + +$FreeBSD$ + +--- tools/clang/lib/Sema/SemaChecking.cpp.orig ++++ tools/clang/lib/Sema/SemaChecking.cpp +@@ -1275,6 +1275,39 @@ + CoveredArgs.set(argIndex); + } + ++ // FreeBSD extensions ++ if (CS.getKind() == ConversionSpecifier::bArg || CS.getKind() == ConversionSpecifier::DArg) { ++ // claim the second argument ++ CoveredArgs.set(argIndex + 1); ++ ++ // Now type check the data expression that matches the ++ // format specifier. ++ const Expr *Ex = getDataArg(argIndex); ++ QualType type = (CS.getKind() == ConversionSpecifier::bArg) ? S.Context.IntTy : S.Context.getPointerType(S.Context.UnsignedCharTy); ++ //const analyze_printf::ArgTypeResult &ATR = S.Context.IntTy; ++ const analyze_printf::ArgTypeResult &ATR = type; ++ if (ATR.isValid() && !ATR.matchesType(S.Context, Ex->getType())) ++ S.Diag(getLocationOfByte(CS.getStart()), ++ diag::warn_printf_conversion_argument_type_mismatch) ++ << ATR.getRepresentativeType(S.Context) << Ex->getType() ++ << getFormatSpecifierRange(startSpecifier, specifierLen) ++ << Ex->getSourceRange(); ++ ++ // Now type check the data expression that matches the ++ // format specifier. ++ Ex = getDataArg(argIndex + 1); ++ const analyze_printf::ArgTypeResult &ATR2 = ArgTypeResult::CStrTy; ++ if (ATR2.isValid() && !ATR2.matchesType(S.Context, Ex->getType())) ++ S.Diag(getLocationOfByte(CS.getStart()), ++ diag::warn_printf_conversion_argument_type_mismatch) ++ << ATR2.getRepresentativeType(S.Context) << Ex->getType() ++ << getFormatSpecifierRange(startSpecifier, specifierLen) ++ << Ex->getSourceRange(); ++ ++ return true; ++ } ++ // END OF FREEBSD EXTENSIONS ++ + // Check for using an Objective-C specific conversion specifier + // in a non-ObjC literal. + if (!IsObjCLiteral && CS.isObjCArg()) { |
