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,
400
400
void AVRToolChain::addClangTargetOptions (
401
401
const llvm::opt::ArgList &DriverArgs, llvm::opt::ArgStringList &CC1Args,
402
402
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
+
403
411
// By default, use `.ctors` (not `.init_array`), as required by libgcc, which
404
412
// runs constructors/destructors on AVR.
405
413
if (!DriverArgs.hasFlag (options::OPT_fuse_init_array,
Original file line number Diff line number Diff line change 1
1
// A test for the propagation of the -mmcu option to -cc1 and -cc1as
2
2
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++
6
5
7
6
// RUN: %clang -### --target=avr -mmcu=at90s2313 -save-temps %s 2>&1 | FileCheck -check-prefix=CHECK1 %s
8
7
// CHECK1: "-cc1" {{.*}} "-target-cpu" "at90s2313"
You can’t perform that action at this time.
0 commit comments