Almost the best possible handling of stdin/stdout for llvm-emit-bc!
llvm-svn: 45346
This commit is contained in:
		
							parent
							
								
									1c0f5d2436
								
							
						
					
					
						commit
						d01dea749e
					
				| 
						 | 
					@ -644,14 +644,18 @@ ASTConsumer *clang::CreateBCWriter(const std::string& InFile,
 | 
				
			||||||
  std::string FileName = OutputFile;
 | 
					  std::string FileName = OutputFile;
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
  std::ostream *Out;
 | 
					  std::ostream *Out;
 | 
				
			||||||
  if (OutputFile == "-" || InFile == "-")
 | 
					  if (OutputFile == "-")
 | 
				
			||||||
    Out = llvm::cout.stream();
 | 
					    Out = llvm::cout.stream();
 | 
				
			||||||
  else if (!OutputFile.size()) {
 | 
					  else if (!OutputFile.size()) {
 | 
				
			||||||
    llvm::sys::Path Path(InFile);
 | 
					    if (InFile == "-")
 | 
				
			||||||
    Path.eraseSuffix();
 | 
					      Out = llvm::cout.stream();
 | 
				
			||||||
    Path.appendSuffix("bc");
 | 
					    else {
 | 
				
			||||||
    FileName = Path.toString();
 | 
					      llvm::sys::Path Path(InFile);
 | 
				
			||||||
    Out = new std::ofstream(FileName.c_str());
 | 
					      Path.eraseSuffix();
 | 
				
			||||||
 | 
					      Path.appendSuffix("bc");
 | 
				
			||||||
 | 
					      FileName = Path.toString();
 | 
				
			||||||
 | 
					      Out = new std::ofstream(FileName.c_str());
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
  } else {
 | 
					  } else {
 | 
				
			||||||
    Out = new std::ofstream(FileName.c_str());
 | 
					    Out = new std::ofstream(FileName.c_str());
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue