-
Notifications
You must be signed in to change notification settings - Fork 207
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix pack expansion for array elements
When parameter pack contains array type the EvalCompositeAccess.getType() will attempt to return type of array element. Fix this by providing EvalPackAccess which returns pack elements as is.
- Loading branch information
1 parent
7911ac8
commit 8fc812e
Showing
6 changed files
with
77 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
...dt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/EvalPackAccess.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2016,2022 Institute for Software, HSR Hochschule fuer Technik and others | ||
* Rapperswil, University of applied sciences and others | ||
* | ||
* This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License 2.0 | ||
* which accompanies this distribution, and is available at | ||
* https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* Igor V. Kovalenko - factor out EvalPackAccess | ||
*******************************************************************************/ | ||
package org.eclipse.cdt.internal.core.dom.parser.cpp.semantics; | ||
|
||
import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil.CVTYPE; | ||
import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil.REF; | ||
import static org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.SemanticUtil.TDEF; | ||
|
||
import org.eclipse.cdt.core.dom.ast.IType; | ||
import org.eclipse.cdt.internal.core.dom.parser.ITypeMarshalBuffer; | ||
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPEvaluation; | ||
import org.eclipse.core.runtime.CoreException; | ||
|
||
public class EvalPackAccess extends EvalCompositeAccess { | ||
|
||
public EvalPackAccess(ICPPEvaluation parent, int elementId) { | ||
super(parent, elementId); | ||
} | ||
|
||
@Override | ||
public IType getType() { | ||
IType type = getParent().getType(); | ||
type = SemanticUtil.getNestedType(type, TDEF | REF | CVTYPE); | ||
|
||
return type; | ||
} | ||
|
||
@Override | ||
public void marshal(ITypeMarshalBuffer buffer, boolean includeValue) throws CoreException { | ||
buffer.putShort(ITypeMarshalBuffer.EVAL_PACK_ACCESS); | ||
buffer.marshalEvaluation(getParent(), includeValue); | ||
buffer.putInt(getElementId()); | ||
} | ||
|
||
public static ICPPEvaluation unmarshal(short firstBytes, ITypeMarshalBuffer buffer) throws CoreException { | ||
ICPPEvaluation parent = buffer.unmarshalEvaluation(); | ||
int elementId = buffer.getInt(); | ||
return new EvalPackAccess(parent, elementId); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters