summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2012-11-19 21:13:18 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2012-11-19 21:13:18 +0000
commit1ab34b3ad579f43f915cc3ae5c5e2d80fdd7191b (patch)
treec1956d7988e019085776c1ab305e3ea9f8a17721 /clang/lib/Sema
parentf65a638d942b87413a7181acb965e4c2fc4c0c6f (diff)
downloadbcm5719-llvm-1ab34b3ad579f43f915cc3ae5c5e2d80fdd7191b.tar.gz
bcm5719-llvm-1ab34b3ad579f43f915cc3ae5c5e2d80fdd7191b.zip
PR14381: Never skip constexpr function bodies when code-completing. We may need
them in order to parse the rest of the file. llvm-svn: 168327
Diffstat (limited to 'clang/lib/Sema')
-rw-r--r--clang/lib/Sema/SemaDecl.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index cc19ce99596..629fccc3064 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -7984,6 +7984,22 @@ void Sema::computeNRVO(Stmt *Body, FunctionScopeInfo *Scope) {
const_cast<VarDecl*>(NRVOCandidate)->setNRVOVariable(true);
}
+bool Sema::canSkipFunctionBody(Decl *D) {
+ if (isa<ObjCMethodDecl>(D))
+ return true;
+
+ FunctionDecl *FD = 0;
+ if (FunctionTemplateDecl *FTD = dyn_cast<FunctionTemplateDecl>(D))
+ FD = FTD->getTemplatedDecl();
+ else
+ FD = cast<FunctionDecl>(D);
+
+ // We cannot skip the body of a function (or function template) which is
+ // constexpr, since we may need to evaluate its body in order to parse the
+ // rest of the file.
+ return !FD->isConstexpr();
+}
+
Decl *Sema::ActOnFinishFunctionBody(Decl *D, Stmt *BodyArg) {
return ActOnFinishFunctionBody(D, BodyArg, false);
}
OpenPOWER on IntegriCloud