private Map<IMacroBinding, IASTFileLocation> getMacroLocations(final ILocationResolver resolver) {
   final Map<IMacroBinding, IASTFileLocation> result =
       new HashMap<IMacroBinding, IASTFileLocation>();
   addLocations(resolver.getBuiltinMacroDefinitions(), result);
   addLocations(resolver.getMacroDefinitions(), result);
   return result;
 }
  public MultiMacroExpansionExplorer(IASTTranslationUnit tu, IASTFileLocation loc) {
    if (tu == null || loc == null || loc.getNodeLength() == 0) {
      throw new IllegalArgumentException();
    }
    final ILocationResolver resolver = getResolver(tu);
    final IASTNodeSelector nodeLocator = tu.getNodeSelector(null);
    final IASTPreprocessorMacroExpansion[] expansions = resolver.getMacroExpansions(loc);
    final int count = expansions.length;

    loc = extendLocation(loc, expansions);
    fMacroLocations = getMacroLocations(resolver);
    fFilePath = tu.getFilePath();
    fSource = resolver.getUnpreprocessedSignature(loc);
    fBoundaries = new int[count * 2 + 1];
    fDelegates = new SingleMacroExpansionExplorer[count];

    final int firstOffset = loc.getNodeOffset();
    int bidx = -1;
    int didx = -1;
    for (IASTPreprocessorMacroExpansion expansion : expansions) {
      IASTName ref = expansion.getMacroReference();
      if (ref != null) {
        ArrayList<IASTName> refs = new ArrayList<IASTName>();
        refs.add(ref);
        refs.addAll(Arrays.asList(expansion.getNestedMacroReferences()));
        IASTFileLocation refLoc = expansion.getFileLocation();
        int from = refLoc.getNodeOffset() - firstOffset;
        int to = from + refLoc.getNodeLength();
        IASTNode enclosing = nodeLocator.findEnclosingNode(from + firstOffset - 1, 2);
        boolean isPPCond =
            enclosing instanceof IASTPreprocessorIfStatement
                || enclosing instanceof IASTPreprocessorElifStatement;
        fBoundaries[++bidx] = from;
        fBoundaries[++bidx] = to;
        fDelegates[++didx] =
            new SingleMacroExpansionExplorer(
                new String(fSource, from, to - from),
                refs.toArray(new IASTName[refs.size()]),
                fMacroLocations,
                fFilePath,
                refLoc.getStartingLineNumber(),
                isPPCond,
                (LexerOptions) tu.getAdapter(LexerOptions.class));
      }
    }
    fBoundaries[++bidx] = fSource.length;
  }