public void testObjectStyleMacroExpansionSimpleDeclarator() throws Exception {
   StringBuffer buffer = new StringBuffer("#define ABC D\n"); // $NON-NLS-1$
   buffer.append("int ABC;"); // $NON-NLS-1$
   String code = buffer.toString();
   for (ParserLanguage language : languages) {
     IASTTranslationUnit tu = parse(code, language);
     IASTPreprocessorObjectStyleMacroDefinition ABC =
         (IASTPreprocessorObjectStyleMacroDefinition) tu.getMacroDefinitions()[0];
     IASTSimpleDeclaration var = (IASTSimpleDeclaration) tu.getDeclarations()[0];
     IASTDeclarator d = var.getDeclarators()[0];
     assertEquals(d.getName().toString(), "D"); // $NON-NLS-1$
     IASTNodeLocation[] declaratorLocations = d.getNodeLocations();
     assertEquals(declaratorLocations.length, 1);
     IASTMacroExpansionLocation expansion = (IASTMacroExpansionLocation) declaratorLocations[0];
     IASTPreprocessorObjectStyleMacroDefinition fromExpansion =
         (IASTPreprocessorObjectStyleMacroDefinition)
             expansion.getExpansion().getMacroDefinition();
     assertEqualsMacros(fromExpansion, ABC);
     assertEquals(expansion.getNodeOffset(), 0);
     assertEquals(expansion.getNodeLength(), 1);
     IASTNodeLocation[] macroLocation = expansion.getExpansion().getNodeLocations();
     assertEquals(macroLocation.length, 1);
     assertTrue(macroLocation[0] instanceof IASTFileLocation);
     assertEquals(
         macroLocation[0].getNodeOffset(),
         code.indexOf("int ABC;") + "int ".length()); // $NON-NLS-1$ //$NON-NLS-2$
     assertEquals(macroLocation[0].getNodeLength(), "ABC".length()); // $NON-NLS-1$
   }
 }
 private String getDeclaratorName(IASTDeclarator node) {
   node = getInnermostDeclarator(node);
   IASTName name = node.getName();
   String nodeName = ASTStringUtil.getQualifiedName(name);
   if (nodeName.length() == 0) {
     nodeName = ANONYMOUS_NAME;
   }
   return nodeName;
 }
 protected void writeDefaultDeclarator(IASTDeclarator declarator) {
   IASTPointerOperator[] pointOps = declarator.getPointerOperators();
   writePointerOperators(declarator, pointOps);
   IASTName name = declarator.getName();
   name.accept(visitor);
   writeNestedDeclarator(declarator);
   IASTInitializer init = getInitializer(declarator);
   if (init != null) {
     init.accept(visitor);
   }
 }
 @Override
 protected IASTName getASTName() {
   IASTDeclarator dtor =
       (declarations != null && declarations.length > 0) ? declarations[0] : definition;
   dtor = ASTQueries.findInnermostDeclarator(dtor);
   IASTName name = dtor.getName();
   if (name instanceof ICPPASTQualifiedName) {
     IASTName[] ns = ((ICPPASTQualifiedName) name).getNames();
     name = ns[ns.length - 1];
   }
   return name;
 }