csmith-project / creduce

C-Reduce, a C and C++ program reducer
Other
1.23k stars 124 forks source link

Support Objective-C files #31

Open rgov opened 10 years ago

rgov commented 10 years ago
clang_delta --query-instances=replace-function-def-with-decl file.mm
Error: Unsupported file type!

Seems that only C and C++ are supported right now.

regehr commented 10 years ago

Hi rgov, C-Reduce operates (mostly) at the syntax level, and Objective C is very similar to C/C++ at this level. Therefore, C-Reduce should reduce Objective C perfectly well right out of the box. Could you please give this us a try and let us know how it works? If it does not work (that is, it does not do a good job reduction) please send us a test case and we'll look into it.

rgov commented 9 years ago

Please re-open. The code explicitly prevents processing Objective-C and Objective-C++ and results in the error message above, due to this code in the TransformationManager:

  if ((IK == IK_C) || (IK == IK_PreprocessedC)) {
...
  else if ((IK == IK_CXX) || (IK == IK_PreprocessedCXX)) {
...
  else {
    ErrorMsg = "Unsupported file type!";
    return false;
  }

If these languages are supported, then it should also check for IK_ObjC, IK_ObjCXX, and the preprocessed forms of each.

Although it seems like an easy change, I haven't tried patching the code to address this case myself, and I do not have a test suite of Objective-C features to see if there are any that cause problems for the reduction.

regehr commented 9 years ago

Ok, but since none of us do any ObjC development I doubt we'll get around to this. The rest of C-Reduce should work just fine for reducing ObjC, yes?

regehr commented 8 years ago

Does anyone have time to try to support ObjC here? Do you @rgov? It doesn't look like probably very much code is required. clang_delta might crash like crazy on objc but perhaps it'll accomplish something...

regehr commented 8 years ago

@rgov have you tried using C-Reduce on Objective C and ignoring any errors that it reports? My guess is this works decently well but I'd like confirmation.

cooljeanius commented 7 years ago

I'd be interested in doing what I can to help see this added; I'd have to learn the creduce codebase and become a better programmer first though.