@@ -451,10 +451,18 @@ static std::string normalizeProgramName(llvm::StringRef Argv0) {
451451 return ProgName;
452452}
453453
454- static const DriverSuffix *parseDriverSuffix (StringRef ProgName, size_t &Pos) {
454+ static const DriverSuffix *parseDriverSuffix (StringRef ProgName, size_t &Pos, bool &FlangNew ) {
455455 // Try to infer frontend type and default target from the program name by
456456 // comparing it against DriverSuffixes in order.
457457
458+ // Part I: Warn if invocation happens with flang-new (for Flang); this is for
459+ // the time being and should be removed once AMD Classic Flang has been
460+ // removed from ROCm.
461+ FlangNew = false ;
462+ if (ProgName.ends_with (" flang-new" )) {
463+ FlangNew = true ;
464+ }
465+
458466 // If there is a match, the function tries to identify a target as prefix.
459467 // E.g. "x86_64-linux-clang" as interpreted as suffix "clang" with target
460468 // prefix "x86_64-linux". If such a target prefix is found, it may be
@@ -488,7 +496,22 @@ ParsedClangName
488496ToolChain::getTargetAndModeFromProgramName (StringRef PN) {
489497 std::string ProgName = normalizeProgramName (PN);
490498 size_t SuffixPos;
491- const DriverSuffix *DS = parseDriverSuffix (ProgName, SuffixPos);
499+ bool FlangNew = false ;
500+ const DriverSuffix *DS = parseDriverSuffix (ProgName, SuffixPos, FlangNew);
501+
502+ // Part II: Warn if invocation happens with flang-new (for Flang); this is for
503+ // the time being and should be removed once AMD Classic Flang has been
504+ // removed from ROCm.
505+ if (FlangNew) {
506+ if (!::getenv (" AMD_NOWARN_FLANG_NEW" )) {
507+ // The solution with "llvm::errs()" is not ideal, but the driver object
508+ // is not been constructed yet, so we cannot use the Diag() infrastructure
509+ // for this.
510+ llvm::errs () << " warning: the 'amdflang-new' and 'flang-new' commmands "
511+ " have been deprecated; please use 'amdflang' instead\n " ;
512+ }
513+ }
514+
492515 if (!DS)
493516 return {};
494517 size_t SuffixEnd = SuffixPos + strlen (DS->Suffix );
0 commit comments