diff options
author | Douglas Gregor <dgregor@apple.com> | 2009-06-19 23:52:42 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2009-06-19 23:52:42 +0000 |
commit | e0762c92110dfdcdd207db461a4ea17afd168f1e (patch) | |
tree | ca454873887ffee6570e846ff9e56289360f18f2 /lib/Parse/ParseDecl.cpp | |
parent | 7d5c74ecbbd8719436c071f38657bc8e97ee4a24 (diff) |
Keep track of when declarations are "used" according to C and
C++. This logic is required to trigger implicit instantiation of
function templates and member functions of class templates, which will
be implemented separately.
This commit includes support for -Wunused-parameter, printing warnings
for named parameters that are not used within a function/Objective-C
method/block. Fixes <rdar://problem/6505209>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73797 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Parse/ParseDecl.cpp')
-rw-r--r-- | lib/Parse/ParseDecl.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/Parse/ParseDecl.cpp b/lib/Parse/ParseDecl.cpp index efabf3a7c6..69152523a1 100644 --- a/lib/Parse/ParseDecl.cpp +++ b/lib/Parse/ParseDecl.cpp @@ -2699,8 +2699,12 @@ void Parser::ParseBracketDeclarator(Declarator &D) { // things like '=' and '*='. Sema rejects these in C89 mode because they // are not i-c-e's, so we don't need to distinguish between the two here. - // Parse the assignment-expression now. - NumElements = ParseAssignmentExpression(); + // Parse the constant-expression or assignment-expression now (depending + // on dialect). + if (getLang().CPlusPlus) + NumElements = ParseConstantExpression(); + else + NumElements = ParseAssignmentExpression(); } // If there was an error parsing the assignment-expression, recover. |