On Apr 10, 2012, at 5:17 AM, Manuel Klimek <[email protected]> wrote:

> Added parsing code and integrated it into clang-check (which I'm now
> heavily testing in my vim session :)
> 
> As a nice side effect this gives us a beautiful way to write FileCheck
> integration tests for clang tools.
> I'd still like to be able to pull something out that encapsulates most
> of the command line parsing for tools, so it's less code, but I want
> to leave that for later.

Patch generally looks good, although this…

+std::vector<CompileCommand>
+FixedCompilationDatabase::getCompileCommands(StringRef FilePath) const {
+  std::vector<CompileCommand> Result(CompileCommands);
+  Result[0].CommandLine.push_back(FilePath);
+  return Result;
+}

doesn't actually seem right. What if the CompileCommands contains multiple 
source files, e.g.,

        clang-check -- a.cpp b.cpp

shouldn't we filter out the other non-source files, or return an empty compile 
command if the command line didn't specify the given file name (say, if the 
CompilationDatabase is asked to return a compile command for c.cpp)?

        - Doug


_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to