summaryrefslogtreecommitdiff
path: root/lib/Parse/ParseCXXInlineMethods.cpp
diff options
context:
space:
mode:
authorMomchil Velikov <momchil.velikov@arm.com>2017-08-10 15:43:06 +0000
committerMomchil Velikov <momchil.velikov@arm.com>2017-08-10 15:43:06 +0000
commit9a0efb9546712305b091031889ceccfbc73b6afc (patch)
tree98ac986d83ffb15e99a2694ba6d1e13a7355f033 /lib/Parse/ParseCXXInlineMethods.cpp
parent952359d59e087523e47896d539150ea69a15e3da (diff)
downloadclang-9a0efb9546712305b091031889ceccfbc73b6afc.tar.gz
Place implictly declared functions at block scope
Such implicitly declared functions behave as if the enclosing block contained the declaration extern int name() (C90, 6.3.3.2 Function calls), thus their names should have block scope (C90, 6.1.2.1 Scope of identifiers). This patch fixes https://bugs.llvm.org/show_bug.cgi?id=33224 Differential Revision: https://reviews.llvm.org/D33676 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@310616 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Parse/ParseCXXInlineMethods.cpp')
-rw-r--r--lib/Parse/ParseCXXInlineMethods.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/Parse/ParseCXXInlineMethods.cpp b/lib/Parse/ParseCXXInlineMethods.cpp
index b68559485a..c9a895d7d5 100644
--- a/lib/Parse/ParseCXXInlineMethods.cpp
+++ b/lib/Parse/ParseCXXInlineMethods.cpp
@@ -518,7 +518,8 @@ void Parser::ParseLexedMethodDef(LexedMethod &LM) {
// Parse the method body. Function body parsing code is similar enough
// to be re-used for method bodies as well.
- ParseScope FnScope(this, Scope::FnScope|Scope::DeclScope);
+ ParseScope FnScope(this, Scope::FnScope | Scope::DeclScope |
+ Scope::CompoundStmtScope);
Actions.ActOnStartOfFunctionDef(getCurScope(), LM.D);
if (Tok.is(tok::kw_try)) {