[cfe-commits] r65653 - /cfe/trunk/lib/Sema/SemaType.cpp

Chris Lattner sabre at nondot.org
Fri Feb 27 14:32:38 PST 2009


Author: lattner
Date: Fri Feb 27 16:31:56 2009
New Revision: 65653

URL: http://llvm.org/viewvc/llvm-project?rev=65653&view=rev
Log:
Give a code insertion hint for how to fix 'implicit int' warnings and errors.

Modified:
    cfe/trunk/lib/Sema/SemaType.cpp

Modified: cfe/trunk/lib/Sema/SemaType.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaType.cpp?rev=65653&r1=65652&r2=65653&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaType.cpp (original)
+++ cfe/trunk/lib/Sema/SemaType.cpp Fri Feb 27 16:31:56 2009
@@ -77,7 +77,9 @@
       // 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 @@
       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.  





More information about the cfe-commits mailing list