[cfe-commits] r126035 - in /cfe/trunk: lib/Sema/SemaDecl.cpp test/FixIt/fixit.cpp
Douglas Gregor
dgregor at apple.com
Sat Feb 19 11:04:23 PST 2011
Author: dgregor
Date: Sat Feb 19 13:04:23 2011
New Revision: 126035
URL: http://llvm.org/viewvc/llvm-project?rev=126035&view=rev
Log:
Remove the Fix-It for "main must return 'int'", which is not always
correct and is not worth fixing. Fixes PR8396.
Modified:
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/test/FixIt/fixit.cpp
Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=126035&r1=126034&r2=126035&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Sat Feb 19 13:04:23 2011
@@ -4377,14 +4377,7 @@
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);
}
Modified: cfe/trunk/test/FixIt/fixit.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/FixIt/fixit.cpp?rev=126035&r1=126034&r2=126035&view=diff
==============================================================================
--- cfe/trunk/test/FixIt/fixit.cpp (original)
+++ cfe/trunk/test/FixIt/fixit.cpp Sat Feb 19 13:04:23 2011
@@ -61,11 +61,6 @@
}
-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();
More information about the cfe-commits
mailing list