mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-06 00:25:25 +02:00
Bug 352258 - Generate Getters and Setters can generate code containing
reserved keywords.
This commit is contained in:
parent
dc771f5b29
commit
8a91fc9ed2
1 changed files with 12 additions and 3 deletions
|
@ -292,7 +292,7 @@ public class CConventions {
|
|||
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);
|
||||
}
|
||||
|
||||
|
@ -370,6 +370,15 @@ public class CConventions {
|
|||
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) {
|
||||
if (name == null || name.length() == 0) {
|
||||
return false;
|
||||
|
|
Loading…
Add table
Reference in a new issue