Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSergey Prigogin2012-01-25 19:11:05 -0500
committerSergey Prigogin2012-01-25 19:14:46 -0500
commitee0eb1bb4811d40bb9380f743421122d9cafa635 (patch)
tree66ef7454a831a15984e7437604c837fdd17fd1f4
parenta6ca3ea2353f3b2ef221296a45ee4f43481991ca (diff)
downloadorg.eclipse.cdt-ee0eb1bb4811d40bb9380f743421122d9cafa635.tar.gz
org.eclipse.cdt-ee0eb1bb4811d40bb9380f743421122d9cafa635.tar.xz
org.eclipse.cdt-ee0eb1bb4811d40bb9380f743421122d9cafa635.zip
Bug 352258 - Generate Getters and Setters can generate code containing
reserved keywords.
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CConventions.java15
1 files changed, 12 insertions, 3 deletions
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CConventions.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CConventions.java
index 330d94e220..f88b9830d4 100644
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CConventions.java
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/CConventions.java
@@ -291,8 +291,8 @@ public class CConventions {
if (!isValidIdentifier(id)) {
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);
}
@@ -369,7 +369,16 @@ 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.isEmpty()) {
return false;

Back to the top