aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaType.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-02-27 22:31:56 +0000
committerChris Lattner <sabre@nondot.org>2009-02-27 22:31:56 +0000
commit173144affecc3f97b73b075c44752aff8cfcfc3a (patch)
tree050bc97f48656f6ce2c05d77b29ca055333991b0 /lib/Sema/SemaType.cpp
parent8c633a09ec67a9bef4bebb7dcb254b2b89e680fe (diff)
Give a code insertion hint for how to fix 'implicit int' warnings and errors.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65653 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaType.cpp')
-rw-r--r--lib/Sema/SemaType.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/Sema/SemaType.cpp b/lib/Sema/SemaType.cpp
index bfbf8ab952..a1c5dbc4d1 100644
--- a/lib/Sema/SemaType.cpp
+++ b/lib/Sema/SemaType.cpp
@@ -77,7 +77,9 @@ QualType Sema::ConvertDeclSpecToType(const DeclSpec &DS) {
// In C89 mode, we only warn if there is a completely missing declspec
// when one is not allowed.
if (DS.isEmpty())
- Diag(DS.getSourceRange().getBegin(), diag::warn_missing_declspec);
+ Diag(DS.getSourceRange().getBegin(), diag::warn_missing_declspec)
+ << CodeModificationHint::CreateInsertion(DS.getSourceRange().getBegin(),
+ "int");
} else if (!DS.hasTypeSpecifier()) {
// C99 and C++ require a type specifier. For example, C99 6.7.2p2 says:
// "At least one type specifier shall be given in the declaration
@@ -87,7 +89,9 @@ QualType Sema::ConvertDeclSpecToType(const DeclSpec &DS) {
unsigned DK = getLangOptions().CPlusPlus && !getLangOptions().Microsoft?
diag::err_missing_type_specifier
: diag::warn_missing_type_specifier;
- Diag(DS.getSourceRange().getBegin(), DK);
+ Diag(DS.getSourceRange().getBegin(), DK)
+ << CodeModificationHint::CreateInsertion(DS.getSourceRange().getBegin(),
+ "int");
}
// FALL THROUGH.