From a97bd9d1c471f6545e6ec74bd1ce80899d6fb74f Mon Sep 17 00:00:00 2001 From: Jacob Dufault Date: Mon, 8 May 2017 18:21:21 -0700 Subject: [PATCH] WIP better command line parsing --- src/project.cc | 66 +++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 62 insertions(+), 4 deletions(-) diff --git a/src/project.cc b/src/project.cc index de1b80eb..7ea4e37a 100644 --- a/src/project.cc +++ b/src/project.cc @@ -22,9 +22,61 @@ MAKE_REFLECT_STRUCT(CompileCommandsEntry, directory, file, command, args); namespace { + +static const char* kBlacklistMulti[] = { + "-MF", + "-Xclang" +}; + // Blacklisted flags which are always removed from the command line. static const char *kBlacklist[] = { - "-stdlib=libc++" + "--param", + "-M", + "-MD", + "-MG", + "-MM", + "-MMD", + "-MP", + "-MQ", + "-MT", + "-Og", + "-Wa,--32", + "-Wa,--64", + "-Wl,--incremental-full", + "-Wl,--incremental-patch,1", + "-Wl,--no-incremental", + "-fbuild-session-file=", + "-fbuild-session-timestamp=", + "-fembed-bitcode", + "-fembed-bitcode-marker", + "-fmodules-validate-once-per-build-session", + "-fno-delete-null-pointer-checks", + "-fno-use-linker-plugin" + "-fno-var-tracking", + "-fno-var-tracking-assignments", + "-fno-enforce-eh-specs", + "-fvar-tracking", + "-fvar-tracking-assignments", + "-fvar-tracking-assignments-toggle", + "-gcc-toolchain", + "-march=", + "-masm=", + "-mcpu=", + "-mfpmath=", + "-mtune=", + "-s", + + "-B", + //"-f", + //"-pipe", + //"-W", + // TODO: make sure we consume includes before stripping all path-like args. + "/work/goma/gomacc", + "../../third_party/llvm-build/Release+Asserts/bin/clang++", + "-Wno-unused-lambda-capture", + "/", + "..", + //"-stdlib=libc++" }; // Arguments which are followed by a potentially relative path. We need to make @@ -47,6 +99,12 @@ Project::Entry GetCompilationEntryFromCompileCommandEntry(const std::vector