File tree Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -400,6 +400,14 @@ void AVRToolChain::AddClangSystemIncludeArgs(const ArgList &DriverArgs,
400400void AVRToolChain::addClangTargetOptions (
401401 const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args,
402402 Action::OffloadKind DeviceOffloadKind) const {
403+ // Reject C/C++ compilation for avr1 devices.
404+ const Driver &D = getDriver ();
405+ std::string CPU = getCPUName (D, DriverArgs, getTriple ());
406+ std::optional<StringRef> FamilyName = GetMCUFamilyName (CPU);
407+ if (CPU == " avr1" || (FamilyName && FamilyName->compare (" avr1" ) == 0 ))
408+ D.Diag (diag::err_drv_opt_unsupported_input_type) << " avr1"
409+ << " c/c++" ;
410+
403411 // By default, use `.ctors` (not `.init_array`), as required by libgcc, which
404412 // runs constructors/destructors on AVR.
405413 if (!DriverArgs.hasFlag (options::OPT_fuse_init_array,
Original file line number Diff line number Diff line change 11// A test for the propagation of the -mmcu option to -cc1 and -cc1as
22
3- // RUN: %clang -### --target=avr -mmcu=attiny11 -save-temps %s 2>&1 | FileCheck -check-prefix=CHECK0 %s
4- // CHECK0: "-cc1" {{.*}} "-target-cpu" "attiny11"
5- // CHECK0: "-cc1as" {{.*}} "-target-cpu" "attiny11"
3+ // RUN: not %clang -### --target=avr -mmcu=attiny11 %s 2>&1 | FileCheck -check-prefix=CHECK0 %s
4+ // CHECK0: error: 'avr1' invalid for input of type c/c++
65
76// RUN: %clang -### --target=avr -mmcu=at90s2313 -save-temps %s 2>&1 | FileCheck -check-prefix=CHECK1 %s
87// CHECK1: "-cc1" {{.*}} "-target-cpu" "at90s2313"
You can’t perform that action at this time.
0 commit comments