diff options
| author | James Molloy <james.molloy@arm.com> | 2012-02-28 18:12:11 +0000 |
|---|---|---|
| committer | James Molloy <james.molloy@arm.com> | 2012-02-28 18:12:11 +0000 |
| commit | 051390fffab6f63a76ca919d2fe8e4c5f1ba13f2 (patch) | |
| tree | f00aebf83d6f192405852f5afb442374bcd0e75c /clang/lib/Sema/Scope.cpp | |
| parent | 0c281a7deb6a4b9c64bf4a4a7289e69cced4c275 (diff) | |
| download | bcm5719-llvm-051390fffab6f63a76ca919d2fe8e4c5f1ba13f2.tar.gz bcm5719-llvm-051390fffab6f63a76ca919d2fe8e4c5f1ba13f2.zip | |
Correctly track tags and enum members defined in the prototype of a function, and ensure they are properly scoped.
This fixes code such as:
enum e {x, y};
int f(enum {y, x} n) {
return 0;
}
This finally fixes PR5464 and PR5477.
llvm-svn: 151638
Diffstat (limited to 'clang/lib/Sema/Scope.cpp')
| -rw-r--r-- | clang/lib/Sema/Scope.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/clang/lib/Sema/Scope.cpp b/clang/lib/Sema/Scope.cpp index c76f61af6c7..10f12ce844f 100644 --- a/clang/lib/Sema/Scope.cpp +++ b/clang/lib/Sema/Scope.cpp @@ -59,3 +59,13 @@ void Scope::Init(Scope *parent, unsigned flags) { Entity = 0; ErrorTrap.reset(); } + +bool Scope::containedInPrototypeScope() const { + const Scope *S = this; + while (S) { + if (S->isFunctionPrototypeScope()) + return true; + S = S->getParent(); + } + return false; +} |

