mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-07 09:46:02 +02:00
FIx to make it backward compatible with CDT 6.0
This commit is contained in:
parent
f004315ce5
commit
05dc3fac9a
1 changed files with 15 additions and 10 deletions
|
@ -19,24 +19,29 @@ import org.eclipse.cdt.core.dom.ast.ITypedef;
|
||||||
*/
|
*/
|
||||||
public final class CxxAstUtils {
|
public final class CxxAstUtils {
|
||||||
private static CxxAstUtils instance;
|
private static CxxAstUtils instance;
|
||||||
private CxxAstUtils(){
|
|
||||||
|
private CxxAstUtils() {
|
||||||
// private constructor
|
// private constructor
|
||||||
}
|
}
|
||||||
public synchronized static CxxAstUtils getInstance(){
|
|
||||||
if (instance==null) instance = new CxxAstUtils();
|
public synchronized static CxxAstUtils getInstance() {
|
||||||
|
if (instance == null) instance = new CxxAstUtils();
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IType unwindTypedef(IType type) {
|
public IType unwindTypedef(IType type) {
|
||||||
if (!(type instanceof IBinding)) return type;
|
if (!(type instanceof IBinding)) return type;
|
||||||
IBinding typeName = (IBinding) type;
|
IBinding typeName = (IBinding) type;
|
||||||
// unwind typedef chain
|
// unwind typedef chain
|
||||||
while (typeName instanceof ITypedef) {
|
try {
|
||||||
IType t = ((ITypedef) typeName).getType();
|
while (typeName instanceof ITypedef) {
|
||||||
if (t instanceof IBinding)
|
IType t = ((ITypedef) typeName).getType();
|
||||||
typeName = (IBinding) t;
|
if (t instanceof IBinding) typeName = (IBinding) t;
|
||||||
else
|
else return t;
|
||||||
return t;
|
}
|
||||||
|
} catch (Exception e) { // in CDT 6.0 getType throws DOMException
|
||||||
|
Activator.log(e);
|
||||||
}
|
}
|
||||||
return (IType)typeName;
|
return (IType) typeName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue