[PATCH] D107682: [AVR][clang] Improve search for avr-libc installation path
Ben Shi via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sat Aug 7 00:01:13 PDT 2021
benshi001 updated this revision to Diff 364938.
benshi001 retitled this revision from "[AVR][clang] Search avr-libc installtion path according to avr-gcc's" to "[AVR][clang] Improve search for avr-libc installation path".
benshi001 edited the summary of this revision.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D107682/new/
https://reviews.llvm.org/D107682
Files:
clang/lib/Driver/ToolChains/AVR.cpp
clang/test/Driver/avr-toolchain.c
Index: clang/test/Driver/avr-toolchain.c
===================================================================
--- clang/test/Driver/avr-toolchain.c
+++ clang/test/Driver/avr-toolchain.c
@@ -4,7 +4,7 @@
// CC1: clang{{.*}} "-cc1" "-triple" "avr" {{.*}} "-fno-use-init-array"
// RUN: %clang %s -### -no-canonical-prefixes -target avr --sysroot %S/Inputs/basic_avr_tree 2>&1 | FileCheck -check-prefix CC1A %s
-// CC1A: clang{{.*}} "-cc1" "-triple" "avr" {{.*}} "-internal-isystem" {{".*avr/include"}}
+// CC1A: clang{{.*}} "-cc1" "-triple" "avr" {{.*}} "-internal-isystem" {{".*../../../avr/include"}}
// RUN: %clang %s -### -target avr --sysroot %S/Inputs/basic_avr_tree 2>&1 -nostdinc | FileCheck -check-prefix CC1B %s
// CC1B-NOT: "-internal-isystem" {{".*avr/include"}}
Index: clang/lib/Driver/ToolChains/AVR.cpp
===================================================================
--- clang/lib/Driver/ToolChains/AVR.cpp
+++ clang/lib/Driver/ToolChains/AVR.cpp
@@ -453,6 +453,11 @@
}
llvm::Optional<std::string> AVRToolChain::findAVRLibcInstallation() const {
+ std::string GCCRoot(GCCInstallation.getInstallPath());
+ std::string Path(GCCRoot + "/../../../avr");
+ if (llvm::sys::fs::is_directory(Path))
+ return Optional<std::string>(Path);
+
for (StringRef PossiblePath : PossibleAVRLibcLocations) {
std::string Path = getDriver().SysRoot + PossiblePath.str();
// Return the first avr-libc installation that exists.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D107682.364938.patch
Type: text/x-patch
Size: 1450 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210807/f740575c/attachment-0001.bin>
More information about the cfe-commits
mailing list