Skip to content

Commit

Permalink
Make clang report invalid target versions for all environment.
Browse files Browse the repository at this point in the history
Followup for llvm#75373

1. Make this feature not just available for android, but everyone.
2. Correct some target triples.
3. Add opencl to the environment type list.
  • Loading branch information
ZijunZhaoCCK committed Feb 1, 2024
1 parent 6173010 commit c016d09
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions clang/test/Driver/mips-features.c
Original file line number Diff line number Diff line change
Expand Up @@ -400,12 +400,12 @@
// LONG-CALLS-DEF-NOT: "long-calls"
//
// -mbranch-likely
// RUN: %clang -target mips-mti-linux-gnu -### -c %s -mbranch-likely 2>&1 \
// RUN: %clang --target=mips-mti-linux-gnu -### -c %s -mbranch-likely 2>&1 \
// RUN: | FileCheck --check-prefix=BRANCH-LIKELY %s
// BRANCH-LIKELY: argument unused during compilation: '-mbranch-likely'
//
// -mno-branch-likely
// RUN: %clang -target mips-mti-linux-gnu -### -c %s -mno-branch-likely 2>&1 \
// RUN: %clang --target=mips-mti-linux-gnu -### -c %s -mno-branch-likely 2>&1 \
// RUN: | FileCheck --check-prefix=NO-BRANCH-LIKELY %s
// NO-BRANCH-LIKELY: argument unused during compilation: '-mno-branch-likely'

Expand Down
3 changes: 2 additions & 1 deletion llvm/lib/TargetParser/Triple.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1236,7 +1236,8 @@ StringRef Triple::getEnvironmentVersionString() const {
if (getObjectFormat() != Triple::UnknownObjectFormat) {
StringRef ObjectFormatTypeName =
getObjectFormatTypeName(getObjectFormat());
StringRef Suffix = (Twine("-") + ObjectFormatTypeName).str();
const std::string &tmp = (Twine("-") + ObjectFormatTypeName).str();
StringRef Suffix = tmp;
EnvironmentName.consume_back(Suffix);
}
}
Expand Down

0 comments on commit c016d09

Please sign in to comment.