r200132 - Enforce safe usage of DiagnosticsEngine::getCustomDiagID()

Alp Toker alp at nuanti.com
Sat Jan 25 22:48:59 PST 2014


On 26/01/2014 06:41, Rafael EspĂ­ndola wrote:
>> -  /// \brief Return an ID for a diagnostic with the specified message and level.
>> +  /// \brief Return an ID for a diagnostic with the specified format string and
>> +  /// level.
>>     ///
>>     /// If this is the first request for this diagnostic, it is registered and
>>     /// created, otherwise the existing ID is returned.
>>     ///
>>     /// \param Message A fixed diagnostic format string that will be hashed and
>>     /// mapped to a unique DiagID.
>> -  unsigned getCustomDiagID(Level L, StringRef Message) {
>> -    return Diags->getCustomDiagID((DiagnosticIDs::Level)L, Message);
>> +  template <unsigned N>
>> +  unsigned getCustomDiagID(Level L, const char (&FormatString)[N]) {
>> +    return Diags->getCustomDiagID((DiagnosticIDs::Level)L,
>> +                                  StringRef(FormatString, N));
>>     }
> This now warns:
>
> /home/espindola/llvm/llvm/tools/clang/include/clang/Basic/Diagnostic.h:596:14:
> warning: parameter 'Message' not found in the function declaration
> [-Wdocumentation]
>    /// \param Message A fixed diagnostic format string that will be hashed and
>               ^~~~~~~
> 1 warning generated.

Docstrings updated in r200137.

It the builders are enforcing -Wdocumentation it should really also be 
enabled in the default CMake configuration.

Alp.


>
>
> Cheers,
> Rafael

-- 
http://www.nuanti.com
the browser experts




More information about the cfe-commits mailing list