[PATCH] Transform all files in a compilation database if no source files are provided.

Edwin Vane edwin.vane at intel.com
Thu Aug 29 08:25:40 PDT 2013


  Sorry for taking so long to respond to this review. I've been heads down trying to prepare D1545 for review.

  I'm going to break this down into two cases:

  === 1. Explicitly provided files ===
  If a user explicitly lists a source on the command-line it should be transformed. The only time I see that it wouldn't be is if there's an explicit -exclude that would exclude that source. In that case, there should be a warning. If the user explicitly lists files, **only** those files should be transformed. If a compilation database is explicitly provided or auto-detected from the first source file, we still only transform those specific files. In the situation of a fixed compilation database, the user needs to provide files explicitly so the same logic applies.

  -inlude has no effect on which sources to process. It only affects which other files (i.e. headers) we can change while transforming the given sources. -exclude explicitly excludes files from being changed and to be consistent, this includes even sources. As I mentioned above, a warning should be given if an explicitly provided file is going to be excluded because of an -exclude.

  === 2. No explicitly provided files ===
  This is basically the case of the user providing -p since there's no other way to run the migrator if you don't provide files. I think I want to change slightly what I said earlier about priming the Include/Exclude info. I'm open to suggestions but here's somewhere to start. I think we all agree the default behaviour should be to transform all files in the compilation database. So that means populating the sources list based on info from the compilation database. What do we do with include/exclude info? Two situations:
  # No -include/-exclude provided. One option is to transform all sources but don't make changes to any other files (i.e. don't prime include/exclude info). Is that useful? Another option is prime include/exclude with the directories the sources live in, hopefully including other files the sources might use (i.e. headers). This wouldn't work for LLVM since headers don't live beside sources. I'm not really a big fan of this option. A third option is to allow changes to any other files. This is dangerous and so probably not a good idea. That leaves us with option #1 or forcing user to provide -include/-exclude info to specify what they want.
  # -include/-exclude provided. Thinking of the LLDB case it sounds like we want something like this:

    cpp11-migrate -p compdb_location -include llmv/tools/clang/tools/lldb

  This implies that if the user provides -include/-exclude, we start with an empty source list and include only those sources covered by -include/-exclude. Therefore, we do no priming of include/exclude and use only what's provided explicitly on the command-line. The include/exclude info is then used to determine which sources to transform.

http://llvm-reviews.chandlerc.com/D1517



More information about the cfe-commits mailing list