aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2011-02-19 19:04:23 +0000
committerDouglas Gregor <dgregor@apple.com>2011-02-19 19:04:23 +0000
commit5f39f706afeb4d4a6f246db1e8cd2da0fb5b7f37 (patch)
treefde454c52076087981db6b0cf807013e73e70b3e
parent3263e09c8e0925edaa541d0d4bb995b4bfb454e7 (diff)
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
-rw-r--r--lib/Sema/SemaDecl.cpp9
-rw-r--r--test/FixIt/fixit.cpp5
2 files changed, 1 insertions, 13 deletions
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<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);
}
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();