[cfe-commits] r73234 - in /cfe/trunk: include/clang/Basic/DiagnosticSemaKinds.td include/clang/Parse/Action.h lib/Frontend/PrintParserCallbacks.cpp lib/Parse/ParseDecl.cpp lib/Sema/Sema.h lib/Sema/SemaDeclCXX.cpp lib/Sema/SemaExpr.cpp test/SemaCXX/default2.cpp
Douglas Gregor
dgregor at apple.com
Fri Jun 12 15:41:26 PDT 2009
On Jun 12, 2009, at 9:51 AM, Anders Carlsson wrote:
> Author: andersca
> Date: Fri Jun 12 11:51:40 2009
> New Revision: 73234
>
> URL: http://llvm.org/viewvc/llvm-project?rev=73234&view=rev
> Log:
> It's an error to use a function declared in a class definition as a
> default argument before the function has been declared.
Nice.
> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
> --- cfe/trunk/lib/Sema/Sema.h (original)
> +++ cfe/trunk/lib/Sema/Sema.h Fri Jun 12 11:51:40 2009
> @@ -412,8 +412,14 @@
> SourceLocation EqualLoc,
> ExprArg defarg);
> virtual void ActOnParamUnparsedDefaultArgument(DeclPtrTy param,
> - SourceLocation
> EqualLoc);
> + SourceLocation
> EqualLoc,
> + SourceLocation
> ArgLoc);
> virtual void ActOnParamDefaultArgumentError(DeclPtrTy param);
> +
> + // Contains the locations of the beginning of unparsed default
> + // argument locations.
> + llvm::DenseMap<ParmVarDecl *,SourceLocation>
> UnparsedDefaultArgLocs;
> +
It's unfortunate that we need a dense map here in Sema to track these
source locations, especially since the parser already has all of the
tokens (with locations) for the default argument. Unfortunately, I
can't think of a good way to give Sema access to those tokens. Any
ideas?
- Doug
More information about the cfe-commits
mailing list