Uploaded image for project: 'Qt Creator'
  1. Qt Creator
  2. QTCREATORBUG-14997

Clang: Inclusion gathering isn't working after the first time

    XMLWordPrintable

Details

    Description

      Has to be fixed in clang.

      Index: CIndexInclusionStack.cpp
      ===================================================================
      --- CIndexInclusionStack.cpp	(revision 246452)
      +++ CIndexInclusionStack.cpp	(working copy)
      @@ -35,12 +35,28 @@
       
         SmallVector<CXSourceLocation, 10> InclusionStack;
         unsigned n =  SM.local_sloc_entry_size();
      +  unsigned n2 = 0;
       
      +  const SrcMgr::SLocEntry &(SourceManager::*Getter)(unsigned, bool*) const;
      +  Getter = &SourceManager::getLocalSLocEntry;
      +
      +  for (unsigned i = 0 ; i < n ; ++i) {
      +    bool Invalid = false;
      +    const SrcMgr::SLocEntry &SL = (SM.*Getter)(i, &Invalid);
      +
      +    if (!SL.isFile() || Invalid)
      +      continue;
      +
      +    const SrcMgr::FileInfo &FI = SL.getFile();
      +    if (!FI.getContentCache()->OrigEntry)
      +      continue;
      +
      +    ++n2;
      +    }
         // In the case where all the SLocEntries are in an external source, traverse
         // those SLocEntries as well.  This is the case where we are looking
         // at the inclusion stack of an AST/PCH file.
      -  const SrcMgr::SLocEntry &(SourceManager::*Getter)(unsigned, bool*) const;
      -  if (n == 1) {
      +  if (n2 == 1) {
           Getter = &SourceManager::getLoadedSLocEntry;
           n = SM.loaded_sloc_entry_size();
         } else
      

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            kosjar Nikolai Kosjar
            bubke Marco Bubke
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes