public void testBug90978() throws Exception {
   StringBuffer buffer = new StringBuffer("#define MACRO mm\n"); // $NON-NLS-1$
   buffer.append("int MACRO;\n"); // $NON-NLS-1$
   String code = buffer.toString();
   for (ParserLanguage language : languages) {
     IASTTranslationUnit tu = parse(code, language);
     IASTPreprocessorObjectStyleMacroDefinition MACRO =
         (IASTPreprocessorObjectStyleMacroDefinition) tu.getMacroDefinitions()[0];
     IASTName macro_name = MACRO.getName();
     IMacroBinding binding = (IMacroBinding) macro_name.resolveBinding();
     IASTName[] references = tu.getReferences(binding);
     assertEquals(references.length, 1);
     IASTName reference = references[0];
     IASTNodeLocation[] nodeLocations = reference.getNodeLocations();
     assertEquals(nodeLocations.length, 1);
     assertTrue(nodeLocations[0] instanceof IASTFileLocation);
     IASTFileLocation loc = (IASTFileLocation) nodeLocations[0];
     assertEquals(
         code.indexOf("int MACRO") + "int ".length(),
         loc.getNodeOffset()); // $NON-NLS-1$ //$NON-NLS-2$
     assertEquals("MACRO".length(), loc.getNodeLength()); // $NON-NLS-1$
   }
 }
 public void testMacroBindings() throws Exception {
   StringBuffer buffer = new StringBuffer("#define ABC def\n"); // $NON-NLS-1$
   buffer.append("int ABC;\n"); // $NON-NLS-1$
   buffer.append("#undef ABC\n"); // $NON-NLS-1$
   buffer.append("#define ABC ghi\n"); // $NON-NLS-1$
   buffer.append("int ABC;\n"); // $NON-NLS-1$
   String code = buffer.toString();
   for (ParserLanguage language : languages) {
     IASTTranslationUnit tu = parse(code, language);
     IASTPreprocessorMacroDefinition[] macros = tu.getMacroDefinitions();
     assertEquals(macros.length, 2);
     IASTPreprocessorObjectStyleMacroDefinition ABC1 =
         (IASTPreprocessorObjectStyleMacroDefinition) macros[0];
     IASTPreprocessorObjectStyleMacroDefinition ABC2 =
         (IASTPreprocessorObjectStyleMacroDefinition) macros[1];
     IMacroBinding binding1 = (IMacroBinding) ABC1.getName().resolveBinding();
     assertNotNull(binding1);
     IMacroBinding binding2 = (IMacroBinding) ABC2.getName().resolveBinding();
     assertNotNull(binding2);
     assertNotSame(binding1, binding2);
     IASTName[] firstReferences = tu.getReferences(binding1);
     IASTName[] firstDeclarations = tu.getDeclarationsInAST(binding1);
     assertEquals(firstReferences.length, 2);
     assertEquals(
         firstReferences[0].getPropertyInParent(), IASTPreprocessorMacroExpansion.EXPANSION_NAME);
     assertEquals(firstReferences[0].getParent().getParent(), tu);
     assertEquals(firstReferences[1].getPropertyInParent(), IASTPreprocessorStatement.MACRO_NAME);
     assertTrue(firstReferences[1].getParent() instanceof IASTPreprocessorUndefStatement);
     assertEquals(firstDeclarations.length, 1);
     assertSame(ABC1.getName(), firstDeclarations[0]);
     IASTName[] secondReferences = tu.getReferences(binding2);
     IASTName[] secondDeclarations = tu.getDeclarationsInAST(binding2);
     assertEquals(1, secondReferences.length);
     assertEquals(
         secondReferences[0].getPropertyInParent(), IASTPreprocessorMacroExpansion.EXPANSION_NAME);
     assertEquals(secondReferences[0].getParent().getParent(), tu);
     assertSame(ABC2.getName(), secondDeclarations[0]);
   }
 }