Hello,
I'm sending a patch that fixes some diagnostic messages that used to embed english words as arguments.
Previously, those string were flying around the various Sema*.cpp files as a const char *Flavor argument passed
to the DiagnoseAssignmentResult() method and a couple of others.
I've replaced those strings with values from an AssignmentAction enumeration declared in Sema.h around line 830. Is it ok to do things like that? The constants' name of the enumeration are very similar to the strings that they represents.
In the meantime, I've found that a similar Flavor argument was passed to BuildCXXDerivedToBaseExpr() method but that it wasn't used anywhere so I've removed it, is it ok?
I've run the tests and everything seems ok.
I hope this is useful, bye bye,
Nicola
diag_assignment_messages.patch (31.1 KB)
Hello,
I'm sending a patch that fixes some diagnostic messages that used to embed english words as arguments.
Previously, those string were flying around the various Sema*.cpp files as a const char *Flavor argument passed
to the DiagnoseAssignmentResult() method and a couple of others.
I've replaced those strings with values from an AssignmentAction enumeration declared in Sema.h around line 830. Is it ok to do things like that? The constants' name of the enumeration are very similar to the strings that they represents.
Yes, this is very helpful! We generally prefix enumerator names with something resembling the enumeration name, so that we're less likely to have conflicts. For example, in the names here:
+ enum AssignmentAction {
+ Assigning,
+ Copying,
+ Passing,
+ Returning,
+ Converting,
+ Initializing,
+ Sending,
+ Casting
+ };
we would prefer to use the names AA_Assigning, AA_Copying, AA_Passing, etc.
In the meantime, I've found that a similar Flavor argument was passed to BuildCXXDerivedToBaseExpr() method but that it wasn't used anywhere so I've removed it, is it ok?
Yes, thanks!
Thank you for fixing this; if you could perform the rename mentioned above, I'd be happy to commit your patch.
- Doug
Thank you for fixing this; if you could perform the rename mentioned above, I'd be happy to commit your patch.
Here it is 
- Doug
Nicola
diag_assignment_messages.patch (31.1 KB)
Hi All,
Make sure to remove clang-cc from you path when testing. Not all tests have been converted to
use 'clang -cc1...'. I am modifying all objc test now.
- Fariborz