From c9c02ed8f499f005b5a8e68f1ecd87401f90daa9 Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Fri, 19 Jun 2009 23:52:42 +0000 Subject: 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 . llvm-svn: 73797 --- clang/lib/Parse/ParseDecl.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'clang/lib/Parse/ParseDecl.cpp') diff --git a/clang/lib/Parse/ParseDecl.cpp b/clang/lib/Parse/ParseDecl.cpp index efabf3a7c6d..69152523a11 100644 --- a/clang/lib/Parse/ParseDecl.cpp +++ b/clang/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. -- cgit v1.2.3