Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorMarco Stornelli2020-04-08 12:23:20 +0000
committerMarco Stornelli2020-04-10 05:21:51 +0000
commit2a0bc541f0ec5d8cc3fbd09e3ef6200e33624e93 (patch)
tree0ec16cab5c878af8b9a0b867d9ac00317556a1eb /core
parent87a3be448e7adb34b4da166f890f9c9720516331 (diff)
downloadorg.eclipse.cdt-2a0bc541f0ec5d8cc3fbd09e3ef6200e33624e93.tar.gz
org.eclipse.cdt-2a0bc541f0ec5d8cc3fbd09e3ef6200e33624e93.tar.xz
org.eclipse.cdt-2a0bc541f0ec5d8cc3fbd09e3ef6200e33624e93.zip
Bug 534420 - Fix enums nodiscard flag size in the index
Diffstat (limited to 'core')
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOM.java7
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPEnumeration.java23
2 files changed, 21 insertions, 9 deletions
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOM.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOM.java
index d20d37e90bd..b7153a85968 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOM.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOM.java
@@ -307,10 +307,11 @@ public class PDOM extends PlatformObject implements IPDOM {
* 216.0 - Added nodiscard function information, bug 534420
* 217.0 - Added nodiscard class/struct information, bug 534420
* 218.0 - Added nodiscard enums information, bug 534420
+ * 219.0 - Fix enums nodiscard information in the index from 8 byte to 1 byte, bug 534420
*/
- private static final int MIN_SUPPORTED_VERSION = version(218, 0);
- private static final int MAX_SUPPORTED_VERSION = version(218, Short.MAX_VALUE);
- private static final int DEFAULT_VERSION = version(218, 0);
+ private static final int MIN_SUPPORTED_VERSION = version(219, 0);
+ private static final int MAX_SUPPORTED_VERSION = version(219, Short.MAX_VALUE);
+ private static final int DEFAULT_VERSION = version(219, 0);
private static int version(int major, int minor) {
return (major << 16) + minor;
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPEnumeration.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPEnumeration.java
index 6df692dc331..2319f9c6110 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPEnumeration.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/dom/cpp/PDOMCPPEnumeration.java
@@ -49,8 +49,10 @@ class PDOMCPPEnumeration extends PDOMCPPBinding implements IPDOMCPPEnumType, IPD
private static final int OFFSET_MIN_VALUE = OFFSET_ENUMERATOR_LIST + Database.PTR_SIZE;
private static final int OFFSET_MAX_VALUE = OFFSET_MIN_VALUE + 8;
private static final int OFFSET_FIXED_TYPE = OFFSET_MAX_VALUE + 8;
- private static final int OFFSET_NO_DISCARD = OFFSET_FIXED_TYPE + 8;
- private static final int OFFSET_FLAGS = OFFSET_NO_DISCARD + Database.TYPE_SIZE;
+ private static final int OFFSET_FLAGS = OFFSET_FIXED_TYPE + Database.TYPE_SIZE;
+
+ private static final byte FLAG_SCOPED = 0x1;
+ private static final byte FLAG_NODISCARD = 0x2;
@SuppressWarnings("hiding")
protected static final int RECORD_SIZE = OFFSET_FLAGS + 1;
@@ -76,8 +78,15 @@ class PDOMCPPEnumeration extends PDOMCPPBinding implements IPDOMCPPEnumType, IPD
private void storeProperties(ICPPEnumeration enumeration) throws CoreException {
final Database db = getDB();
- db.putByte(record + OFFSET_FLAGS, enumeration.isScoped() ? (byte) 1 : (byte) 0);
- db.putByte(record + OFFSET_NO_DISCARD, enumeration.isNoDiscard() ? (byte) 1 : (byte) 0);
+ byte flags = 0;
+ if (enumeration.isScoped()) {
+ flags |= FLAG_SCOPED;
+ }
+ if (enumeration.isNoDiscard()) {
+ flags |= FLAG_NODISCARD;
+ }
+
+ db.putByte(record + OFFSET_FLAGS, flags);
getLinkage().storeType(record + OFFSET_FIXED_TYPE, enumeration.getFixedType());
@@ -190,7 +199,8 @@ class PDOMCPPEnumeration extends PDOMCPPBinding implements IPDOMCPPEnumType, IPD
@Override
public boolean isScoped() {
try {
- return getDB().getByte(record + OFFSET_FLAGS) != 0;
+ byte flags = getDB().getByte(record + OFFSET_FLAGS);
+ return (flags & FLAG_SCOPED) != 0;
} catch (CoreException e) {
return false;
}
@@ -199,7 +209,8 @@ class PDOMCPPEnumeration extends PDOMCPPBinding implements IPDOMCPPEnumType, IPD
@Override
public boolean isNoDiscard() {
try {
- return getDB().getByte(record + OFFSET_NO_DISCARD) != 0;
+ byte flags = getDB().getByte(record + OFFSET_FLAGS);
+ return (flags & FLAG_NODISCARD) != 0;
} catch (CoreException e) {
return false;
}

Back to the top