From: Douglas Gregor Date: Sat, 19 Feb 2011 19:04:23 +0000 (+0000) Subject: Remove the Fix-It for "main must return 'int'", which is not always X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5f39f706afeb4d4a6f246db1e8cd2da0fb5b7f37;p=clang Remove the Fix-It for "main must return 'int'", which is not always 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 --- diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index 95ab5fadd5..679b430a3c 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -4377,14 +4377,7 @@ void Sema::CheckMain(FunctionDecl* FD) { const FunctionType* FT = T->getAs(); 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(&TL)) { - D << FixItHint::CreateReplacement(PTL->getResultLoc().getSourceRange(), - "int"); - } + Diag(FD->getTypeSpecStartLoc(), diag::err_main_returns_nonint); FD->setInvalidDecl(true); } diff --git a/test/FixIt/fixit.cpp b/test/FixIt/fixit.cpp index 1993425c95..41b187b071 100644 --- a/test/FixIt/fixit.cpp +++ b/test/FixIt/fixit.cpp @@ -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();