1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-07 17:56:01 +02:00

Bug 352258 - Generate Getters and Setters can generate code containing

reserved keywords.
This commit is contained in:
Sergey Prigogin 2012-01-25 16:11:05 -08:00
parent a6ca3ea235
commit ee0eb1bb48

View file

@ -291,8 +291,8 @@ public class CConventions {
if (!isValidIdentifier(id)) { if (!isValidIdentifier(id)) {
return new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, -1, NLS.bind(Messages.convention_invalid, id), null); return new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, -1, NLS.bind(Messages.convention_invalid, id), null);
} }
if (isReservedKeyword(id, language)) { if (isReservedKeyword(id, language) || isBuiltinType(id, language)) {
return new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, -1, NLS.bind(Messages.convention_reservedKeyword, id), null); return new Status(IStatus.ERROR, CCorePlugin.PLUGIN_ID, -1, NLS.bind(Messages.convention_reservedKeyword, id), null);
} }
@ -369,7 +369,16 @@ public class CConventions {
} }
return false; return false;
} }
private static boolean isBuiltinType(String name, AbstractCLikeLanguage language) {
String[] types = language.getBuiltinTypes();
for (String type : types) {
if (type.equals(name))
return true;
}
return false;
}
private static boolean isLegalFilename(String name) { private static boolean isLegalFilename(String name) {
if (name == null || name.isEmpty()) { if (name == null || name.isEmpty()) {
return false; return false;