This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 249325 - can not navigate to field from macro based expression; Find Usages doesn't find the field
Summary: can not navigate to field from macro based expression; Find Usages doesn't fi...
Status: NEW
Alias: None
Product: cnd
Classification: Unclassified
Component: Code Model (show other bugs)
Version: 8.0.2
Hardware: All All
: P3 normal (vote)
Assignee: Vladimir Voskresensky
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-12-12 14:18 UTC by Vladimir Voskresensky
Modified: 2016-11-08 12:30 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Vladimir Voskresensky 2014-12-12 14:18:44 UTC
iFileStatus is not found in line marked as "doesn't work"
----------------------
#define OffsetOf(StructName,MemberName) (size_t)&(((StructName *)0)->MemberName)

/* Example object structure */
typedef struct _ObjFileName
{
    int     iFileStatus;
} ObjFileName;

struct Delegate {
  ObjFileName* pointer;
};
#define DEREF(Obj, Field) ((Obj)->pointer)
int main(int argc, char** argv) {
  OffsetOf(ObjFileName, iFileStatus); // doesn't work
  ((( ObjFileName *)0)-> iFileStatus ); // works
  Delegate *a = 0;
  
  DEREF(a)->iFileStatus; // works
  
}
---------------------
Comment 1 Vladimir Kvashin 2015-11-05 09:20:28 UTC
Another example is as follows

class ClassToFind { // try to find ClassToFind
public:
    void method() {}
};

#define CLASS_TO_FIND ClassToFind // found (should it be found?)

static void funct_in_the_same_file(CLASS_TO_FIND *instance) { // not found
    CLASS_TO_FIND *p = instance; // not found
    p->method(); // found ok
    instance->method(); // found ok
}   

Today I was asked by an rdbms guy, whether we will find usages of functions or variables that are used in macros. Unfortunately we can not.

I guess it does not make sense to fix this until we get new code model...

I was going to file a separate IZ in this respect, then decided that this one suites, so I'm just adding another example.