diff options
author | Alena Laskavaia | 2010-05-17 18:14:01 +0000 |
---|---|---|
committer | Alena Laskavaia | 2010-05-17 18:14:01 +0000 |
commit | 05dc3fac9a21d6df3303d5b9be33e0260d1433c8 (patch) | |
tree | 81e90d43d65cbfbfd9e15ea36f40c222f752ee46 /codan/org.eclipse.cdt.codan.core.cxx/src/org/eclipse | |
parent | f004315ce53b8052256a1c1ad296c490a06f83cb (diff) | |
download | org.eclipse.cdt-05dc3fac9a21d6df3303d5b9be33e0260d1433c8.tar.gz org.eclipse.cdt-05dc3fac9a21d6df3303d5b9be33e0260d1433c8.tar.xz org.eclipse.cdt-05dc3fac9a21d6df3303d5b9be33e0260d1433c8.zip |
FIx to make it backward compatible with CDT 6.0
Diffstat (limited to 'codan/org.eclipse.cdt.codan.core.cxx/src/org/eclipse')
-rw-r--r-- | codan/org.eclipse.cdt.codan.core.cxx/src/org/eclipse/cdt/codan/core/cxx/CxxAstUtils.java | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/codan/org.eclipse.cdt.codan.core.cxx/src/org/eclipse/cdt/codan/core/cxx/CxxAstUtils.java b/codan/org.eclipse.cdt.codan.core.cxx/src/org/eclipse/cdt/codan/core/cxx/CxxAstUtils.java index 11670790826..82c49b3d9f1 100644 --- a/codan/org.eclipse.cdt.codan.core.cxx/src/org/eclipse/cdt/codan/core/cxx/CxxAstUtils.java +++ b/codan/org.eclipse.cdt.codan.core.cxx/src/org/eclipse/cdt/codan/core/cxx/CxxAstUtils.java @@ -19,24 +19,29 @@ import org.eclipse.cdt.core.dom.ast.ITypedef; */ public final class CxxAstUtils { private static CxxAstUtils instance; - private CxxAstUtils(){ + + private CxxAstUtils() { // 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; } + public IType unwindTypedef(IType type) { if (!(type instanceof IBinding)) return type; IBinding typeName = (IBinding) type; // unwind typedef chain - while (typeName instanceof ITypedef) { - IType t = ((ITypedef) typeName).getType(); - if (t instanceof IBinding) - typeName = (IBinding) t; - else - return t; + try { + while (typeName instanceof ITypedef) { + IType t = ((ITypedef) typeName).getType(); + if (t instanceof IBinding) typeName = (IBinding) t; + else return t; + } + } catch (Exception e) { // in CDT 6.0 getType throws DOMException + Activator.log(e); } - return (IType)typeName; + return (IType) typeName; } } |