mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-19 15:05:36 +02:00
Bug 307738: Add include for enumerators.
This commit is contained in:
parent
b07eedb957
commit
72fd8f6158
5 changed files with 18 additions and 2 deletions
|
@ -0,0 +1,3 @@
|
|||
void test() {
|
||||
int i = Ns::ENUM_VALUE;
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
#include "Enumerator_307738.h"
|
||||
void test() {
|
||||
int i = Ns::ENUM_VALUE;
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
namespace Ns {
|
||||
enum MyEnum {ENUM_VALUE};
|
||||
}
|
|
@ -149,4 +149,9 @@ public class AddIncludeTest extends TestCase {
|
|||
select("func306670");
|
||||
assertAddIncludeResult();
|
||||
}
|
||||
|
||||
public void testEnumerator_307738() throws Exception {
|
||||
select("ENUM_VALUE");
|
||||
assertAddIncludeResult();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -55,6 +55,7 @@ import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
|||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||
import org.eclipse.cdt.core.dom.ast.ICompositeType;
|
||||
import org.eclipse.cdt.core.dom.ast.IEnumeration;
|
||||
import org.eclipse.cdt.core.dom.ast.IEnumerator;
|
||||
import org.eclipse.cdt.core.dom.ast.IFunction;
|
||||
import org.eclipse.cdt.core.dom.ast.IType;
|
||||
import org.eclipse.cdt.core.dom.ast.ITypedef;
|
||||
|
@ -260,8 +261,8 @@ public class AddIncludeOnSelectionAction extends TextEditorAction {
|
|||
}
|
||||
}
|
||||
IIndexName[] definitions= null;
|
||||
// class, struct, union, enum
|
||||
if (indexBinding instanceof ICompositeType || indexBinding instanceof IEnumeration) {
|
||||
// class, struct, union, enum-type, enum-item
|
||||
if (indexBinding instanceof ICompositeType || indexBinding instanceof IEnumeration || indexBinding instanceof IEnumerator) {
|
||||
definitions= index.findDefinitions(indexBinding);
|
||||
} else if (indexBinding instanceof ITypedef || (indexBinding instanceof IFunction)) {
|
||||
definitions = index.findDeclarations(indexBinding);
|
||||
|
|
Loading…
Add table
Reference in a new issue