llvm.org GIT mirror llvm / b4e971f
Enable response files in all tools. Patch by Liu, Yaxun (Sam). I have simplified the test. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165535 91177308-0d34-0410-b5e6-96231b3b80d8 Rafael Espindola 6 years ago
3 changed file(s) with 22 addition(s) and 19 deletion(s). Raw diff Collapse all Expand all
4040 // ParseCommandLineOptions - Command line option processing entry point.
4141 //
4242 void ParseCommandLineOptions(int argc, const char * const *argv,
43 const char *Overview = 0,
44 bool ReadResponseFiles = false);
43 const char *Overview = 0);
4544
4645 //===----------------------------------------------------------------------===//
4746 // ParseEnvironmentOptions - Environment variable option processing alternate
4847 // entry point.
4948 //
5049 void ParseEnvironmentOptions(const char *progName, const char *envvar,
51 const char *Overview = 0,
52 bool ReadResponseFiles = false);
50 const char *Overview = 0);
5351
5452 ///===---------------------------------------------------------------------===//
5553 /// SetVersionPrinter - Override the default (LLVM specific) version printer
463463 /// an environment variable (whose name is given in ENVVAR).
464464 ///
465465 void cl::ParseEnvironmentOptions(const char *progName, const char *envVar,
466 const char *Overview, bool ReadResponseFiles) {
466 const char *Overview) {
467467 // Check args.
468468 assert(progName && "Program name not specified");
469469 assert(envVar && "Environment variable name missing");
482482 // and hand it off to ParseCommandLineOptions().
483483 ParseCStringVector(newArgv, envValue);
484484 int newArgc = static_cast(newArgv.size());
485 ParseCommandLineOptions(newArgc, &newArgv[0], Overview, ReadResponseFiles);
485 ParseCommandLineOptions(newArgc, &newArgv[0], Overview);
486486
487487 // Free all the strdup()ed strings.
488488 for (std::vector::iterator i = newArgv.begin(), e = newArgv.end();
528528 }
529529
530530 void cl::ParseCommandLineOptions(int argc, const char * const *argv,
531 const char *Overview, bool ReadResponseFiles) {
531 const char *Overview) {
532532 // Process all registered options.
533533 SmallVector PositionalOpts;
534534 SmallVector SinkOpts;
540540
541541 // Expand response files.
542542 std::vector newArgv;
543 if (ReadResponseFiles) {
544 newArgv.push_back(strdup(argv[0]));
545 ExpandResponseFiles(argc, argv, newArgv);
546 argv = &newArgv[0];
547 argc = static_cast(newArgv.size());
548 }
543 newArgv.push_back(strdup(argv[0]));
544 ExpandResponseFiles(argc, argv, newArgv);
545 argv = &newArgv[0];
546 argc = static_cast(newArgv.size());
549547
550548 // Copy the program name into ProgName, making sure not to overflow it.
551549 std::string ProgName = sys::path::filename(argv[0]);
838836 MoreHelp->clear();
839837
840838 // Free the memory allocated by ExpandResponseFiles.
841 if (ReadResponseFiles) {
842 // Free all the strdup()ed strings.
843 for (std::vector::iterator i = newArgv.begin(), e = newArgv.end();
844 i != e; ++i)
845 free(*i);
846 }
839 // Free all the strdup()ed strings.
840 for (std::vector::iterator i = newArgv.begin(), e = newArgv.end();
841 i != e; ++i)
842 free(*i);
847843
848844 // If we had an error processing our arguments, don't let the program execute
849845 if (ErrorParsing) exit(1);
0 ; RUN: echo %s > %t.list
1 ; RUN: llvm-as @%t.list -o %t.bc
2 ; RUN: llvm-nm %t.bc 2>&1 | FileCheck %s
3
4 ; CHECK: T foobar
5
6 define void @foobar() {
7 ret void
8 }