Bug 375647 - Displaying correct header version when using hyperlinks to access it
Summary: Displaying correct header version when using hyperlinks to access it
Status: NEW
Alias: None
Product: CDT
Classification: Tools
Component: cdt-indexer (show other bugs)
Version: Next   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact: Jonah Graham CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-03-29 12:46 EDT by Marek Białowąs CLA
Modified: 2020-09-04 15:24 EDT (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Marek Białowąs CLA 2012-03-29 12:46:58 EDT
Build Identifier: M20120208-0800

Hi,
the bug is related to "Bug 197989" (Headers included in different variants are not supported). I am testing trunk version (main branch from git repository).


As far as I understand, from discussion about "Bug 197989", currently when we open a header file, we will get the "most significant" version (this defining the highest number of macros). That is good when using for ex. "project explorer" to open a file.

But when we're clicking on #include directive in a file we want to see the "correct" header version - which was created by parsing it at that given location. As far as I understand it is possible - we're keeping "IncludedBy" relations in PDOM.

The case gets more complicated when we're clicking on some identifier ("go to declaration") - we can get wrong header version, for example version where that declaration code would be inactive. That may cause some confusion. 
As we store location information as (file, offset) in PDOM, we cannot deduce file version from it. Any ideas about how to solve that? 


Reproducible: Always
Comment 1 Nathan Ridge CLA 2014-05-01 02:11:38 EDT
Confirmed. To demonstrate, create a project with the following files:

test.hpp:
  #ifdef WALDO
  int x = 42;
  #else
  int y = 42;
  #endif

test.cpp:
  #define WALDO
  #include "test.hpp"

test2.cpp:
  #include "test.hpp"

When you follow the include from test2.cpp, it still opens the variant of test.hpp where "WALDO" is defined.