]> granicus.if.org Git - clang/commitdiff
Remove the Fix-It for "main must return 'int'", which is not always
authorDouglas Gregor <dgregor@apple.com>
Sat, 19 Feb 2011 19:04:23 +0000 (19:04 +0000)
committerDouglas Gregor <dgregor@apple.com>
Sat, 19 Feb 2011 19:04:23 +0000 (19:04 +0000)
correct and is not worth fixing. Fixes PR8396.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126035 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaDecl.cpp
test/FixIt/fixit.cpp

index 95ab5fadd5a386726002e536d207e3ee58d173f8..679b430a3cfc9e84881ca9fd25878e9bfbf9f1ad 100644 (file)
@@ -4377,14 +4377,7 @@ void Sema::CheckMain(FunctionDecl* FD) {
   const FunctionType* FT = T->getAs<FunctionType>();
 
   if (!Context.hasSameUnqualifiedType(FT->getResultType(), Context.IntTy)) {
-    TypeSourceInfo *TSI = FD->getTypeSourceInfo();
-    TypeLoc TL = TSI->getTypeLoc().IgnoreParens();
-    const SemaDiagnosticBuilder& D = Diag(FD->getTypeSpecStartLoc(),
-                                          diag::err_main_returns_nonint);
-    if (FunctionTypeLoc* PTL = dyn_cast<FunctionTypeLoc>(&TL)) {
-      D << FixItHint::CreateReplacement(PTL->getResultLoc().getSourceRange(),
-                                        "int");
-    }
+    Diag(FD->getTypeSpecStartLoc(), diag::err_main_returns_nonint);
     FD->setInvalidDecl(true);
   }
 
index 1993425c955d147203eb6f0a3ed7983a8b15537b..41b187b0718ce263369195ed33789330d06d6a8a 100644 (file)
@@ -61,11 +61,6 @@ namespace rdar7796492 {
 
 }
 
-CT<1> main(void); // expected-error{{'main' must return 'int'}}
-
-// typedef CT<1> mainT(void);
-// mainT main; // TODO
-
 // extra qualification on member
 class C {
   int C::foo();