diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2012-12-06 18:59:10 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2012-12-06 18:59:10 +0000 |
commit | 35f3f36cb9451f347b83a6e7f01e3c702df4732d (patch) | |
tree | d71220afa445888c85ee7862f0117404a0acc6b8 /lib | |
parent | c39f9fa39c472a6663111788b89c67fd365271d8 (diff) |
Add a bit on FunctionDecl/ObjCMethodDecl to indicate if there was a body
that was skipped by the parser.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169531 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Parse/ParseStmt.cpp | 4 | ||||
-rw-r--r-- | lib/Sema/SemaDecl.cpp | 8 | ||||
-rw-r--r-- | lib/Serialization/ASTReaderDecl.cpp | 2 | ||||
-rw-r--r-- | lib/Serialization/ASTWriterDecl.cpp | 2 |
4 files changed, 14 insertions, 2 deletions
diff --git a/lib/Parse/ParseStmt.cpp b/lib/Parse/ParseStmt.cpp index f6f5afe467..8c33bd6de8 100644 --- a/lib/Parse/ParseStmt.cpp +++ b/lib/Parse/ParseStmt.cpp @@ -2006,7 +2006,7 @@ Decl *Parser::ParseFunctionStatementBody(Decl *Decl, ParseScope &BodyScope) { if (SkipFunctionBodies && Actions.canSkipFunctionBody(Decl) && trySkippingFunctionBody()) { BodyScope.Exit(); - return Actions.ActOnFinishFunctionBody(Decl, 0); + return Actions.ActOnSkippedFunctionBody(Decl); } PrettyDeclStackTraceEntry CrashInfo(Actions, Decl, LBraceLoc, @@ -2049,7 +2049,7 @@ Decl *Parser::ParseFunctionTryBlock(Decl *Decl, ParseScope &BodyScope) { if (SkipFunctionBodies && Actions.canSkipFunctionBody(Decl) && trySkippingFunctionBody()) { BodyScope.Exit(); - return Actions.ActOnFinishFunctionBody(Decl, 0); + return Actions.ActOnSkippedFunctionBody(Decl); } SourceLocation LBraceLoc = Tok.getLocation(); diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index 102a6ae9a2..9dd7779537 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -8016,6 +8016,14 @@ bool Sema::canSkipFunctionBody(Decl *D) { return !FD->isConstexpr(); } +Decl *Sema::ActOnSkippedFunctionBody(Decl *Decl) { + if (FunctionDecl *FD = dyn_cast<FunctionDecl>(Decl)) + FD->setHasSkippedBody(); + else if (ObjCMethodDecl *MD = dyn_cast<ObjCMethodDecl>(Decl)) + MD->setHasSkippedBody(); + return ActOnFinishFunctionBody(Decl, 0); +} + Decl *Sema::ActOnFinishFunctionBody(Decl *D, Stmt *BodyArg) { return ActOnFinishFunctionBody(D, BodyArg, false); } diff --git a/lib/Serialization/ASTReaderDecl.cpp b/lib/Serialization/ASTReaderDecl.cpp index 6693416b4a..d201f539fa 100644 --- a/lib/Serialization/ASTReaderDecl.cpp +++ b/lib/Serialization/ASTReaderDecl.cpp @@ -528,6 +528,7 @@ void ASTDeclReader::VisitFunctionDecl(FunctionDecl *FD) { FD->IsExplicitlyDefaulted = Record[Idx++]; FD->HasImplicitReturnZero = Record[Idx++]; FD->IsConstexpr = Record[Idx++]; + FD->HasSkippedBody = Record[Idx++]; FD->EndRangeLoc = ReadSourceLocation(Record, Idx); switch ((FunctionDecl::TemplatedKind)Record[Idx++]) { @@ -652,6 +653,7 @@ void ASTDeclReader::VisitObjCMethodDecl(ObjCMethodDecl *MD) { MD->setPropertyAccessor(Record[Idx++]); MD->setDefined(Record[Idx++]); MD->IsOverriding = Record[Idx++]; + MD->HasSkippedBody = Record[Idx++]; MD->IsRedeclaration = Record[Idx++]; MD->HasRedeclaration = Record[Idx++]; diff --git a/lib/Serialization/ASTWriterDecl.cpp b/lib/Serialization/ASTWriterDecl.cpp index 777b1eab28..dfafc16511 100644 --- a/lib/Serialization/ASTWriterDecl.cpp +++ b/lib/Serialization/ASTWriterDecl.cpp @@ -328,6 +328,7 @@ void ASTDeclWriter::VisitFunctionDecl(FunctionDecl *D) { Record.push_back(D->isExplicitlyDefaulted()); Record.push_back(D->hasImplicitReturnZero()); Record.push_back(D->isConstexpr()); + Record.push_back(D->HasSkippedBody); Writer.AddSourceLocation(D->getLocEnd(), Record); Record.push_back(D->getTemplatedKind()); @@ -419,6 +420,7 @@ void ASTDeclWriter::VisitObjCMethodDecl(ObjCMethodDecl *D) { Record.push_back(D->isPropertyAccessor()); Record.push_back(D->isDefined()); Record.push_back(D->IsOverriding); + Record.push_back(D->HasSkippedBody); Record.push_back(D->IsRedeclaration); Record.push_back(D->HasRedeclaration); |