edits
[cdsspec-compiler.git] / src / edu / uci / eecs / specExtraction / SpecExtractor.java
index 0e470e0e5361bc9f476b6e69f06d21709faffcd2..a7b4fe591926defe578dd785351bc95aaf7b9a0b 100644 (file)
@@ -37,6 +37,9 @@ public class SpecExtractor {
        public final HashMap<File, EntryConstruct> entryMap;
 
        public final HashSet<String> headerFiles;
+       
+       // In the generated header file, we need to forward the user-defined 
+       public final HashSet<String> forwardClass;
 
        private GlobalConstruct globalConstruct;
 
@@ -46,6 +49,7 @@ public class SpecExtractor {
                OPLabelSet = new HashSet<String>();
                entryMap = new HashMap<File, EntryConstruct>();
                headerFiles = new HashSet<String>();
+               forwardClass = new HashSet<String>();
                globalConstruct = null;
        }
 
@@ -410,6 +414,18 @@ public class SpecExtractor {
                        line = lineReader.readLine();
                        lineNum = lineReader.getLineNumber();
                        construct.processFunctionDeclaration(line);
+                       
+                       // Record those user-defined struct
+                       // RET
+                       String returnType = construct.getFunctionHeader().returnType;
+                       if (SpecUtils.isUserDefinedStruct(returnType))
+                               forwardClass.add(SpecUtils.getPlainType(returnType));
+                       // Arguments
+                       for (VariableDeclaration decl : construct.getFunctionHeader().args) {
+                               if (SpecUtils.isUserDefinedStruct(decl.type))
+                                       forwardClass.add(SpecUtils.getPlainType(decl.type));
+                       }
+                       
                } catch (IOException e) {
                        errMsg = "Spec error in file \""
                                        + file.getName()