ICG should ignore FILE * variables

In ICG if we encounter a FILE * variable, we ignore it setting the IO specification to 0.

refs #244
This commit is contained in:
Alex Lin 2016-06-02 08:43:12 -05:00
parent 54039b0084
commit 1615e0f13b
2 changed files with 7 additions and 3 deletions

View File

@ -389,6 +389,11 @@ bool FieldVisitor::VisitRecordType(clang::RecordType *rt) {
fdes->setTypeName("std::string") ;
return false ;
}
// FILE * types resolve to these typenames. We need to ignore them
if (!type_name.compare("__sFILE") || !type_name.compare("_IO_FILE")) {
fdes->setIO(0) ;
return false ;
}
std::string tst_string = rt->desugar().getAsString() ;
// remove class keyword if it exists
@ -406,7 +411,6 @@ bool FieldVisitor::VisitRecordType(clang::RecordType *rt) {
while ((pos = tst_string.find(" _Bool")) != std::string::npos ) {
tst_string.replace(pos , 6, " bool") ;
}
// NOTE: clang also changes FILE * to struct _SFILE *. We may need to change that too.
// Test if we have some type from STL.
if (!tst_string.compare( 0 , 5 , "std::")) {

View File

@ -54,7 +54,7 @@ endif
all: $(ICG)
$(ICG): $(OBJECTS) $(UDUNITS_OBJS)
$(CXX) -o $@ $(OBJECTS) $(UNITS_CONV_OBJ) $(UDUNITS_OBJS) $(LLVMLDFLAGS) $(CLANGLIBS)
$(CXX) -o $@ $(OBJECTS) $(UDUNITS_OBJS) $(LLVMLDFLAGS) $(CLANGLIBS)
# Only FieldDescription.cpp includes the units conversion header.
$(OBJ_DIR)/FieldDescription.o : CXXFLAGS += -I$(TRICK_HOME)/include
@ -67,7 +67,7 @@ $(OBJECTS): $(OBJ_DIR)/%.o : %.cpp
$(UDUNITS_OBJS): $(OBJ_DIR)/%.o : ${TRICK_HOME}/trick_source/sim_services/UdUnits/%.cpp
$(CXX) -c $< -o $@
$(OBJECTS) $(UNITS_CONV_OBJ) : | $(OBJ_DIR)
$(OBJECTS) $(UDUNITS_OBJS) : | $(OBJ_DIR)
$(OBJ_DIR):
mkdir -p $(OBJ_DIR)