Changeset View
Changeset View
Standalone View
Standalone View
clang/lib/Driver/ToolChains/AVR.cpp
Show First 20 Lines • Show All 447 Lines • ▼ Show 20 Lines | void AVR::Linker::ConstructJob(Compilation &C, const JobAction &JA, | ||||
} | } | ||||
C.addCommand(std::make_unique<Command>( | C.addCommand(std::make_unique<Command>( | ||||
JA, *this, ResponseFileSupport::AtFileCurCP(), Args.MakeArgString(Linker), | JA, *this, ResponseFileSupport::AtFileCurCP(), Args.MakeArgString(Linker), | ||||
CmdArgs, Inputs, Output)); | CmdArgs, Inputs, Output)); | ||||
} | } | ||||
llvm::Optional<std::string> AVRToolChain::findAVRLibcInstallation() const { | llvm::Optional<std::string> AVRToolChain::findAVRLibcInstallation() const { | ||||
// Search avr-libc installation according to avr-gcc installation. | |||||
std::string GCCRoot(GCCInstallation.getInstallPath()); | |||||
mhjacobson: Would it be worth encapsulating this logic in an accessor method on GCCInstallation? | |||||
std::string Path(GCCRoot + "/../../../avr"); | |||||
if (llvm::sys::fs::is_directory(Path)) | |||||
return Optional<std::string>(Path); | |||||
return Path; MaskRay: `return Path;` | |||||
// Search avr-libc installation from possible locations, and return the first | |||||
// one that exists, if there is no avr-gcc installed. | |||||
for (StringRef PossiblePath : PossibleAVRLibcLocations) { | for (StringRef PossiblePath : PossibleAVRLibcLocations) { | ||||
std::string Path = getDriver().SysRoot + PossiblePath.str(); | std::string Path = getDriver().SysRoot + PossiblePath.str(); | ||||
// Return the first avr-libc installation that exists. | |||||
if (llvm::sys::fs::is_directory(Path)) | if (llvm::sys::fs::is_directory(Path)) | ||||
return Optional<std::string>(Path); | return Optional<std::string>(Path); | ||||
} | } | ||||
return llvm::None; | return llvm::None; | ||||
} | } |
Would it be worth encapsulating this logic in an accessor method on GCCInstallation?