Source (C preprocessor):

#define A 1

#define A 2

#undef A

#pragma once

 

<?xml version="1.0" encoding="UTF-8"?>
<kdm:Segment xmi:version="2.1"

xmlns:xmi="http://www.omg.org/XMI"

xmlns:code="http://kdm.omg.org/code"

xmlns:kdm="http://kdm.omg.org/kdm"

name="Preprocessor Directives example">
 
<model xmi:id="id.0" xmi:type="code:CodeModel">
    <extensionFamily xmi:id="id.1" >
      <stereotype xmi:id="id.2" name="directive">
       
<tag xmi:id="id.3" tag="directive_type" type="String"/>
      </stereotype>
    </extensionFamily>
    <codeElement xmi:id="id.4" xmi:type="code:MacroUnit" name="A">
      <source language="Cpreprocessor" snippet="#define A 1"/>
    </codeElement>
    <codeElement xmi:id="id.5" xmi:type="code:MacroUnit" name="DEBUG" kind="option">
      <source language="Cpreprocessor" snippet="#define DEBUG"/>
    </codeElement>
    <codeElement xmi:id="id.6" xmi:type="code:MacroUnit" name="A">
      <source language="Cpreprocessor" snippet="#define A 2"/>
      <codeRelation xmi:id="id.7" xmi:type="code:Redefines" to="id.4" from="id.6"/>
    </codeElement>
    <codeElement xmi:id="id.8" xmi:type="code:MacroUnit" name="A" kind="undefined">
      <source language="Cpreprocessor" snippet="#undef A"/>
      <codeRelation xmi:id="id.9" xmi:type="code:Redefines" to="id.6" from="id.8"/>
    </codeElement>
    <codeElement xmi:id="id.10" xmi:type="code:PreprocessorDirective" stereotype="id.2" name="d1">
      <taggedValue xmi:id="id.11" xmi:type="kdm:TaggedValue" tag="id.3" value="pragma once"/>
      <source language="Cpreprocessor" snippet="#pragma once"/>
   
</codeElement>
  </model>
</kdm:Segment>