[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

Anders Carlsson andersca at mac.com
Fri Jun 12 15:44:14 PDT 2009


On Jun 12, 2009, at 3:41 PM, Douglas Gregor wrote:
>
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =====================================================================
>> --- 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?

I agree that it's unfortunate, and I couldn't come up with a better  
way. I don't think it's very bad to have the dense map around. Maybe  
once we can parse more of the STL we could measure the maximum size  
and rethink this.

Anders




More information about the cfe-commits mailing list