Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-dev] IName vs IASTName in CDT 4.0

We're converting our PTP analysis code to CDT 4.0

I have an expression  that formerly returned IASTName[] but now seems to
return IName[].

IASTName[] decls = funcName.getTranslationUnit().getDeclarations(binding);
Gives: - Type mismatch: cannot convert from IName[] to IASTName[]

IName has this scary :-) description about not using it since it's
EXPERIMENTAL.
Aha. Now I see Markus' name in there.
Any advice, Markus?
Can you, or anyone, suggest what we should do, or suggest a workaround for
now?.


How does IName relate to IASTName and can I translate between them?

I'm using this to determine if a function i find in the source file is
declared in a particular include path,
and thus is an "artifact" that I want to place a marker upon.

More complete context of how I'm using it follows:
      /**
       * Determines if the funcName is an instance of the type of artifact
in
       * which we are interested. <br>
       * That is, is, it, declared in the include path?
       *
       * @param funcName
       */
      protected boolean isArtifact(IASTName funcName) {
            IBinding binding = funcName.resolveBinding();
      ==>   IASTName[] decls = funcName.getTranslationUnit
().getDeclarations(binding);

            for> (int> i = 0; i < decls.length;; ++i) {
                  IASTFileLocation loc = decls[i].getFileLocation();.
                  String filename = loc.getFileName();
                  System.out.println(."PldtAstVisitor found filename " +
filename);
                  IPath path = new Path(filename);
                  // is this path valid?
                  if (isInIncludePath(path))
                        return true;
            }
            return false;
      }

...Beth
High Productivity Tools / Parallel Tools  http://eclipse.org/ptp
T.J.Watson Research Center
Lexington, KY 40511



Back to the top