diff --git a/.ci/generate-buildkite-pipeline-premerge b/.ci/generate-buildkite-pipeline-premerge index e1c66ac18e7ac..3ed5eb96eceb5 100755 --- a/.ci/generate-buildkite-pipeline-premerge +++ b/.ci/generate-buildkite-pipeline-premerge @@ -85,6 +85,22 @@ function compute-projects-to-test() { done } +function compute-runtimes-to-test() { + projects=${@} + for project in ${projects}; do + case ${project} in + clang) + for p in libcxx libcxxabi libunwind; do + echo $p + done + ;; + *) + # Nothing to do + ;; + esac + done +} + function add-dependencies() { projects=${@} for project in ${projects}; do @@ -178,6 +194,15 @@ function check-targets() { cross-project-tests) echo "check-cross-project" ;; + libcxx) + echo "check-cxx" + ;; + libcxxabi) + echo "check-cxxabi" + ;; + libunwind) + echo "check-unwind" + ;; lldb) echo "check-all" # TODO: check-lldb may not include all the LLDB tests? ;; @@ -207,17 +232,6 @@ if echo "$modified_dirs" | grep -q -E "^(libcxx|libcxxabi|libunwind|runtimes|cma EOF fi -# If clang changed. -if echo "$modified_dirs" | grep -q -E "^(clang)$"; then - cat <::max()}; @@ -1220,8 +1224,7 @@ class BinaryContext { /// Return a signed value of \p Size stored at \p Address. The address has /// to be a valid statically allocated address for the binary. - ErrorOr getSignedValueAtAddress(uint64_t Address, - size_t Size) const; + ErrorOr getSignedValueAtAddress(uint64_t Address, size_t Size) const; /// Special case of getUnsignedValueAtAddress() that uses a pointer size. ErrorOr getPointerAtAddress(uint64_t Address) const { diff --git a/bolt/include/bolt/Passes/BinaryPasses.h b/bolt/include/bolt/Passes/BinaryPasses.h index a07c9130041fd..ad8473c4aae02 100644 --- a/bolt/include/bolt/Passes/BinaryPasses.h +++ b/bolt/include/bolt/Passes/BinaryPasses.h @@ -53,15 +53,31 @@ class BinaryFunctionPass { virtual Error runOnFunctions(BinaryContext &BC) = 0; }; +/// A pass to set initial program-wide dynostats. +class DynoStatsSetPass : public BinaryFunctionPass { +public: + DynoStatsSetPass() : BinaryFunctionPass(false) {} + + const char *getName() const override { + return "set dyno-stats before optimizations"; + } + + bool shouldPrint(const BinaryFunction &BF) const override { return false; } + + Error runOnFunctions(BinaryContext &BC) override { + BC.InitialDynoStats = getDynoStats(BC.getBinaryFunctions(), BC.isAArch64()); + return Error::success(); + } +}; + /// A pass to print program-wide dynostats. class DynoStatsPrintPass : public BinaryFunctionPass { protected: - DynoStats PrevDynoStats; std::string Title; public: - DynoStatsPrintPass(const DynoStats &PrevDynoStats, const char *Title) - : BinaryFunctionPass(false), PrevDynoStats(PrevDynoStats), Title(Title) {} + DynoStatsPrintPass(const char *Title) + : BinaryFunctionPass(false), Title(Title) {} const char *getName() const override { return "print dyno-stats after optimizations"; @@ -70,6 +86,7 @@ class DynoStatsPrintPass : public BinaryFunctionPass { bool shouldPrint(const BinaryFunction &BF) const override { return false; } Error runOnFunctions(BinaryContext &BC) override { + const DynoStats PrevDynoStats = BC.InitialDynoStats; const DynoStats NewDynoStats = getDynoStats(BC.getBinaryFunctions(), BC.isAArch64()); const bool Changed = (NewDynoStats != PrevDynoStats); diff --git a/bolt/include/bolt/Profile/BoltAddressTranslation.h b/bolt/include/bolt/Profile/BoltAddressTranslation.h index a249bc4498e46..65b9ba874368f 100644 --- a/bolt/include/bolt/Profile/BoltAddressTranslation.h +++ b/bolt/include/bolt/Profile/BoltAddressTranslation.h @@ -70,7 +70,7 @@ class BinaryFunction; class BoltAddressTranslation { public: // In-memory representation of the address translation table - using MapTy = std::map; + using MapTy = std::multimap; // List of taken fall-throughs using FallthroughListTy = SmallVector, 16>; @@ -218,6 +218,7 @@ class BoltAddressTranslation { auto begin() const { return Map.begin(); } auto end() const { return Map.end(); } auto upper_bound(uint32_t Offset) const { return Map.upper_bound(Offset); } + auto size() const { return Map.size(); } }; /// Map function output address to its hash and basic blocks hash map. diff --git a/bolt/lib/Core/BinaryContext.cpp b/bolt/lib/Core/BinaryContext.cpp index 876934b4ddf10..db02dc0fae4ee 100644 --- a/bolt/lib/Core/BinaryContext.cpp +++ b/bolt/lib/Core/BinaryContext.cpp @@ -142,7 +142,7 @@ BinaryContext::BinaryContext(std::unique_ptr Ctx, AsmInfo(std::move(AsmInfo)), MII(std::move(MII)), STI(std::move(STI)), InstPrinter(std::move(InstPrinter)), MIA(std::move(MIA)), MIB(std::move(MIB)), MRI(std::move(MRI)), DisAsm(std::move(DisAsm)), - Logger(Logger) { + Logger(Logger), InitialDynoStats(isAArch64()) { Relocation::Arch = this->TheTriple->getArch(); RegularPageSize = isAArch64() ? RegularPageSizeAArch64 : RegularPageSizeX86; PageAlign = opts::NoHugePages ? RegularPageSize : HugePageSize; @@ -2217,8 +2217,8 @@ ErrorOr BinaryContext::getUnsignedValueAtAddress(uint64_t Address, return DE.getUnsigned(&ValueOffset, Size); } -ErrorOr BinaryContext::getSignedValueAtAddress(uint64_t Address, - size_t Size) const { +ErrorOr BinaryContext::getSignedValueAtAddress(uint64_t Address, + size_t Size) const { const ErrorOr Section = getSectionForAddress(Address); if (!Section) return std::make_error_code(std::errc::bad_address); diff --git a/bolt/lib/Core/BinaryFunction.cpp b/bolt/lib/Core/BinaryFunction.cpp index 1bb05f044fc8b..c897392f2a574 100644 --- a/bolt/lib/Core/BinaryFunction.cpp +++ b/bolt/lib/Core/BinaryFunction.cpp @@ -851,15 +851,19 @@ BinaryFunction::processIndirectBranch(MCInst &Instruction, unsigned Size, return IndirectBranchType::UNKNOWN; } - // RIP-relative addressing should be converted to symbol form by now - // in processed instructions (but not in jump). - if (DispExpr) { + auto getExprValue = [&](const MCExpr *Expr) { const MCSymbol *TargetSym; uint64_t TargetOffset; - std::tie(TargetSym, TargetOffset) = BC.MIB->getTargetSymbolInfo(DispExpr); + std::tie(TargetSym, TargetOffset) = BC.MIB->getTargetSymbolInfo(Expr); ErrorOr SymValueOrError = BC.getSymbolValue(*TargetSym); - assert(SymValueOrError && "global symbol needs a value"); - ArrayStart = *SymValueOrError + TargetOffset; + assert(SymValueOrError && "Global symbol needs a value"); + return *SymValueOrError + TargetOffset; + }; + + // RIP-relative addressing should be converted to symbol form by now + // in processed instructions (but not in jump). + if (DispExpr) { + ArrayStart = getExprValue(DispExpr); BaseRegNum = BC.MIB->getNoRegister(); if (BC.isAArch64()) { ArrayStart &= ~0xFFFULL; @@ -3698,6 +3702,13 @@ BinaryFunction::BasicBlockListType BinaryFunction::dfs() const { size_t BinaryFunction::computeHash(bool UseDFS, HashFunction HashFunction, OperandHashFuncTy OperandHashFunc) const { + LLVM_DEBUG({ + dbgs() << "BOLT-DEBUG: computeHash " << getPrintName() << ' ' + << (UseDFS ? "dfs" : "bin") << " order " + << (HashFunction == HashFunction::StdHash ? "std::hash" : "xxh3") + << '\n'; + }); + if (size() == 0) return 0; diff --git a/bolt/lib/Core/DebugNames.cpp b/bolt/lib/Core/DebugNames.cpp index 049244c4b5151..791cbc6df0828 100644 --- a/bolt/lib/Core/DebugNames.cpp +++ b/bolt/lib/Core/DebugNames.cpp @@ -112,8 +112,6 @@ void DWARF5AcceleratorTable::addUnit(DWARFUnit &Unit, // Returns true if DW_TAG_variable should be included in .debug-names based on // section 6.1.1.1 for DWARF5 spec. static bool shouldIncludeVariable(const DWARFUnit &Unit, const DIE &Die) { - if (Die.findAttribute(dwarf::Attribute::DW_AT_declaration)) - return false; const DIEValue LocAttrInfo = Die.findAttribute(dwarf::Attribute::DW_AT_location); if (!LocAttrInfo) @@ -148,6 +146,8 @@ static bool shouldIncludeVariable(const DWARFUnit &Unit, const DIE &Die) { bool static canProcess(const DWARFUnit &Unit, const DIE &Die, std::string &NameToUse, const bool TagsOnly) { + if (Die.findAttribute(dwarf::Attribute::DW_AT_declaration)) + return false; switch (Die.getTag()) { case dwarf::DW_TAG_base_type: case dwarf::DW_TAG_class_type: diff --git a/bolt/lib/Profile/BoltAddressTranslation.cpp b/bolt/lib/Profile/BoltAddressTranslation.cpp index a9d56875f5a02..cdfca2b9871ac 100644 --- a/bolt/lib/Profile/BoltAddressTranslation.cpp +++ b/bolt/lib/Profile/BoltAddressTranslation.cpp @@ -54,7 +54,7 @@ void BoltAddressTranslation::writeEntriesForBB( // and this deleted block will both share the same output address (the same // key), and we need to map back. We choose here to privilege the successor by // allowing it to overwrite the previously inserted key in the map. - Map[BBOutputOffset] = BBInputOffset << 1; + Map.emplace(BBOutputOffset, BBInputOffset << 1); const auto &IOAddressMap = BB.getFunction()->getBinaryContext().getIOAddressMap(); @@ -71,8 +71,7 @@ void BoltAddressTranslation::writeEntriesForBB( LLVM_DEBUG(dbgs() << " Key: " << Twine::utohexstr(OutputOffset) << " Val: " << Twine::utohexstr(InputOffset) << " (branch)\n"); - Map.insert(std::pair(OutputOffset, - (InputOffset << 1) | BRANCHENTRY)); + Map.emplace(OutputOffset, (InputOffset << 1) | BRANCHENTRY); } } @@ -107,6 +106,19 @@ void BoltAddressTranslation::write(const BinaryContext &BC, raw_ostream &OS) { for (const BinaryBasicBlock *const BB : Function.getLayout().getMainFragment()) writeEntriesForBB(Map, *BB, InputAddress, OutputAddress); + // Add entries for deleted blocks. They are still required for correct BB + // mapping of branches modified by SCTC. By convention, they would have the + // end of the function as output address. + const BBHashMapTy &BBHashMap = getBBHashMap(InputAddress); + if (BBHashMap.size() != Function.size()) { + const uint64_t EndOffset = Function.getOutputSize(); + std::unordered_set MappedInputOffsets; + for (const BinaryBasicBlock &BB : Function) + MappedInputOffsets.emplace(BB.getInputOffset()); + for (const auto &[InputOffset, _] : BBHashMap) + if (!llvm::is_contained(MappedInputOffsets, InputOffset)) + Map.emplace(EndOffset, InputOffset << 1); + } Maps.emplace(Function.getOutputAddress(), std::move(Map)); ReverseMap.emplace(OutputAddress, InputAddress); diff --git a/bolt/lib/Profile/DataAggregator.cpp b/bolt/lib/Profile/DataAggregator.cpp index ea8e353a9f50c..ce6ec0a04ac16 100644 --- a/bolt/lib/Profile/DataAggregator.cpp +++ b/bolt/lib/Profile/DataAggregator.cpp @@ -2349,11 +2349,11 @@ std::error_code DataAggregator::writeBATYAML(BinaryContext &BC, BAT->getBBHashMap(FuncAddress); YamlBF.Blocks.resize(YamlBF.NumBasicBlocks); - for (auto &&[Idx, YamlBB] : llvm::enumerate(YamlBF.Blocks)) - YamlBB.Index = Idx; - - for (auto BI = BlockMap.begin(), BE = BlockMap.end(); BI != BE; ++BI) - YamlBF.Blocks[BI->second.Index].Hash = BI->second.Hash; + for (auto &&[Entry, YamlBB] : llvm::zip(BlockMap, YamlBF.Blocks)) { + const auto &Block = Entry.second; + YamlBB.Hash = Block.Hash; + YamlBB.Index = Block.Index; + } // Lookup containing basic block offset and index auto getBlock = [&BlockMap](uint32_t Offset) { diff --git a/bolt/lib/Profile/YAMLProfileReader.cpp b/bolt/lib/Profile/YAMLProfileReader.cpp index aa38dda47eb56..f25f59201f1cd 100644 --- a/bolt/lib/Profile/YAMLProfileReader.cpp +++ b/bolt/lib/Profile/YAMLProfileReader.cpp @@ -102,11 +102,14 @@ bool YAMLProfileReader::parseFunctionProfile( if (BF.empty()) return true; - if (!opts::IgnoreHash && - YamlBF.Hash != BF.computeHash(IsDFSOrder, HashFunction)) { - if (opts::Verbosity >= 1) - errs() << "BOLT-WARNING: function hash mismatch\n"; - ProfileMatched = false; + if (!opts::IgnoreHash) { + if (!BF.getHash()) + BF.computeHash(IsDFSOrder, HashFunction); + if (YamlBF.Hash != BF.getHash()) { + if (opts::Verbosity >= 1) + errs() << "BOLT-WARNING: function hash mismatch\n"; + ProfileMatched = false; + } } if (YamlBF.NumBasicBlocks != BF.size()) { diff --git a/bolt/lib/Rewrite/BinaryPassManager.cpp b/bolt/lib/Rewrite/BinaryPassManager.cpp index 0712330a524b0..aaa0e1ff4d46f 100644 --- a/bolt/lib/Rewrite/BinaryPassManager.cpp +++ b/bolt/lib/Rewrite/BinaryPassManager.cpp @@ -343,8 +343,7 @@ Error BinaryFunctionPassManager::runAllPasses(BinaryContext &BC) { Manager.registerPass( std::make_unique(PrintEstimateEdgeCounts)); - const DynoStats InitialDynoStats = - getDynoStats(BC.getBinaryFunctions(), BC.isAArch64()); + Manager.registerPass(std::make_unique()); Manager.registerPass(std::make_unique(), opts::AsmDump.getNumOccurrences()); @@ -456,10 +455,9 @@ Error BinaryFunctionPassManager::runAllPasses(BinaryContext &BC) { Manager.registerPass(std::make_unique(PrintSplit)); // Print final dyno stats right while CFG and instruction analysis are intact. - Manager.registerPass( - std::make_unique( - InitialDynoStats, "after all optimizations before SCTC and FOP"), - opts::PrintDynoStats || opts::DynoStatsAll); + Manager.registerPass(std::make_unique( + "after all optimizations before SCTC and FOP"), + opts::PrintDynoStats || opts::DynoStatsAll); // Add the StokeInfo pass, which extract functions for stoke optimization and // get the liveness information for them diff --git a/bolt/lib/Rewrite/DWARFRewriter.cpp b/bolt/lib/Rewrite/DWARFRewriter.cpp index d582ce7b33a27..ab46503621e9a 100644 --- a/bolt/lib/Rewrite/DWARFRewriter.cpp +++ b/bolt/lib/Rewrite/DWARFRewriter.cpp @@ -73,8 +73,7 @@ static void printDie(DWARFUnit &DU, uint64_t DIEOffset) { DWARFDataExtractor DebugInfoData = DU.getDebugInfoExtractor(); DWARFDebugInfoEntry DIEEntry; if (DIEEntry.extractFast(DU, &DIEOffset, DebugInfoData, NextCUOffset, 0)) { - if (const DWARFAbbreviationDeclaration *AbbrDecl = - DIEEntry.getAbbreviationDeclarationPtr()) { + if (DIEEntry.getAbbreviationDeclarationPtr()) { DWARFDie DDie(&DU, &DIEEntry); printDie(DDie); } else { diff --git a/bolt/lib/Rewrite/LinuxKernelRewriter.cpp b/bolt/lib/Rewrite/LinuxKernelRewriter.cpp index 99775ccfe38d3..b2c8b2446f7e1 100644 --- a/bolt/lib/Rewrite/LinuxKernelRewriter.cpp +++ b/bolt/lib/Rewrite/LinuxKernelRewriter.cpp @@ -393,7 +393,7 @@ void LinuxKernelRewriter::processLKKSymtab(bool IsGPL) { for (uint64_t I = 0; I < SectionSize; I += 4) { const uint64_t EntryAddress = SectionAddress + I; - ErrorOr Offset = BC.getSignedValueAtAddress(EntryAddress, 4); + ErrorOr Offset = BC.getSignedValueAtAddress(EntryAddress, 4); assert(Offset && "Reading valid PC-relative offset for a ksymtab entry"); const int32_t SignedOffset = *Offset; const uint64_t RefAddress = EntryAddress + SignedOffset; diff --git a/bolt/lib/Rewrite/RewriteInstance.cpp b/bolt/lib/Rewrite/RewriteInstance.cpp index 2816f669a149c..4b4913dd7a16c 100644 --- a/bolt/lib/Rewrite/RewriteInstance.cpp +++ b/bolt/lib/Rewrite/RewriteInstance.cpp @@ -3206,12 +3206,14 @@ void RewriteInstance::preprocessProfileData() { if (Error E = ProfileReader->preprocessProfile(*BC.get())) report_error("cannot pre-process profile", std::move(E)); - if (!BC->hasSymbolsWithFileName() && ProfileReader->hasLocalsWithFileName()) { + if (!BC->hasSymbolsWithFileName() && ProfileReader->hasLocalsWithFileName() && + !opts::AllowStripped) { BC->errs() << "BOLT-ERROR: input binary does not have local file symbols " "but profile data includes function names with embedded file " "names. It appears that the input binary was stripped while a " - "profiled binary was not\n"; + "profiled binary was not. If you know what you are doing and " + "wish to proceed, use -allow-stripped option.\n"; exit(1); } } diff --git a/bolt/lib/Target/X86/X86MCPlusBuilder.cpp b/bolt/lib/Target/X86/X86MCPlusBuilder.cpp index 8fdacffcb147b..a33a9dc8c013c 100644 --- a/bolt/lib/Target/X86/X86MCPlusBuilder.cpp +++ b/bolt/lib/Target/X86/X86MCPlusBuilder.cpp @@ -1932,6 +1932,19 @@ class X86MCPlusBuilder : public MCPlusBuilder { // = R_X86_64_PC32(Ln) + En - JT // = R_X86_64_PC32(Ln + offsetof(En)) // + auto isRIPRel = [&](X86MemOperand &MO) { + // NB: DispExpr should be set + return MO.DispExpr != nullptr && + MO.BaseRegNum == RegInfo->getProgramCounter() && + MO.IndexRegNum == X86::NoRegister && + MO.SegRegNum == X86::NoRegister; + }; + auto isIndexed = [](X86MemOperand &MO, MCPhysReg R) { + // NB: IndexRegNum should be set. + return MO.IndexRegNum != X86::NoRegister && MO.BaseRegNum == R && + MO.ScaleImm == 4 && MO.DispImm == 0 && + MO.SegRegNum == X86::NoRegister; + }; LLVM_DEBUG(dbgs() << "Checking for PIC jump table\n"); MCInst *MemLocInstr = nullptr; const MCInst *MovInstr = nullptr; @@ -1965,9 +1978,8 @@ class X86MCPlusBuilder : public MCPlusBuilder { std::optional MO = evaluateX86MemoryOperand(Instr); if (!MO) break; - if (MO->BaseRegNum != R1 || MO->ScaleImm != 4 || - MO->IndexRegNum == X86::NoRegister || MO->DispImm != 0 || - MO->SegRegNum != X86::NoRegister) + if (!isIndexed(*MO, R1)) + // POSSIBLE_PIC_JUMP_TABLE break; MovInstr = &Instr; } else { @@ -1986,9 +1998,7 @@ class X86MCPlusBuilder : public MCPlusBuilder { std::optional MO = evaluateX86MemoryOperand(Instr); if (!MO) break; - if (MO->BaseRegNum != RegInfo->getProgramCounter() || - MO->IndexRegNum != X86::NoRegister || - MO->SegRegNum != X86::NoRegister || MO->DispExpr == nullptr) + if (!isRIPRel(*MO)) break; MemLocInstr = &Instr; break; @@ -2105,13 +2115,15 @@ class X86MCPlusBuilder : public MCPlusBuilder { return IndirectBranchType::POSSIBLE_FIXED_BRANCH; } - if (Type == IndirectBranchType::POSSIBLE_PIC_JUMP_TABLE && - (MO->ScaleImm != 1 || MO->BaseRegNum != RIPRegister)) - return IndirectBranchType::UNKNOWN; - - if (Type != IndirectBranchType::POSSIBLE_PIC_JUMP_TABLE && - MO->ScaleImm != PtrSize) - return IndirectBranchType::UNKNOWN; + switch (Type) { + case IndirectBranchType::POSSIBLE_PIC_JUMP_TABLE: + if (MO->ScaleImm != 1 || MO->BaseRegNum != RIPRegister) + return IndirectBranchType::UNKNOWN; + break; + default: + if (MO->ScaleImm != PtrSize) + return IndirectBranchType::UNKNOWN; + } MemLocInstrOut = MemLocInstr; diff --git a/bolt/test/CMakeLists.txt b/bolt/test/CMakeLists.txt index 89862fd59eb8e..d468ff984840f 100644 --- a/bolt/test/CMakeLists.txt +++ b/bolt/test/CMakeLists.txt @@ -56,7 +56,7 @@ list(APPEND BOLT_TEST_DEPS ) add_custom_target(bolt-test-depends DEPENDS ${BOLT_TEST_DEPS}) -set_target_properties(bolt-test-depends PROPERTIES FOLDER "BOLT") +set_target_properties(bolt-test-depends PROPERTIES FOLDER "BOLT/Tests") add_lit_testsuite(check-bolt "Running the BOLT regression tests" ${CMAKE_CURRENT_BINARY_DIR} @@ -64,7 +64,6 @@ add_lit_testsuite(check-bolt "Running the BOLT regression tests" DEPENDS ${BOLT_TEST_DEPS} ARGS ${BOLT_TEST_EXTRA_ARGS} ) -set_target_properties(check-bolt PROPERTIES FOLDER "BOLT") add_lit_testsuites(BOLT ${CMAKE_CURRENT_SOURCE_DIR} PARAMS ${BOLT_TEST_PARAMS} diff --git a/bolt/test/X86/bb-with-two-tail-calls.s b/bolt/test/X86/bb-with-two-tail-calls.s index b6703e352ff4b..8bbecc498ed75 100644 --- a/bolt/test/X86/bb-with-two-tail-calls.s +++ b/bolt/test/X86/bb-with-two-tail-calls.s @@ -8,11 +8,21 @@ # RUN: %clang %cflags %t.o -o %t.exe -Wl,-q -nostdlib # RUN: llvm-bolt %t.exe -o %t.out --data %t.fdata --lite=0 --dyno-stats \ # RUN: --print-sctc --print-only=_start -enable-bat 2>&1 | FileCheck %s +# RUN: llvm-objdump --syms %t.out > %t.log +# RUN: llvm-bat-dump %t.out --dump-all >> %t.log +# RUN: FileCheck %s --input-file %t.log --check-prefix=CHECK-BAT + # CHECK-NOT: Assertion `BranchInfo.size() == 2 && "could only be called for blocks with 2 successors"' failed. # Two tail calls in the same basic block after SCTC: # CHECK: {{.*}}: ja {{.*}} # TAILCALL # Offset: 7 # CTCTakenCount: 4 # CHECK-NEXT: {{.*}}: jmp {{.*}} # TAILCALL # Offset: 13 +# Confirm that a deleted basic block is emitted at function end offset (0xe) +# CHECK-BAT: [[#%x,ADDR:]] g .text [[#%x,SIZE:]] _start +# CHECK-BAT: Function Address: 0x[[#%x,ADDR]] +# CHECK-BAT: 0x[[#%x,SIZE]] +# CHECK-BAT: NumBlocks: 5 + .globl _start _start: je x diff --git a/bolt/test/X86/bolt-address-translation-yaml.test b/bolt/test/X86/bolt-address-translation-yaml.test index 9f2c2ef3ab987..8f65eaba891ec 100644 --- a/bolt/test/X86/bolt-address-translation-yaml.test +++ b/bolt/test/X86/bolt-address-translation-yaml.test @@ -41,7 +41,7 @@ RUN: | FileCheck --check-prefix CHECK-BOLT-YAML %s WRITE-BAT-CHECK: BOLT-INFO: Wrote 5 BAT maps WRITE-BAT-CHECK: BOLT-INFO: Wrote 4 function and 22 basic block hashes -WRITE-BAT-CHECK: BOLT-INFO: BAT section size (bytes): 384 +WRITE-BAT-CHECK: BOLT-INFO: BAT section size (bytes): 404 READ-BAT-CHECK-NOT: BOLT-ERROR: unable to save profile in YAML format for input file processed by BOLT READ-BAT-CHECK: BOLT-INFO: Parsed 5 BAT entries diff --git a/bolt/test/X86/bolt-address-translation.test b/bolt/test/X86/bolt-address-translation.test index e6b21c14077b4..dfdd1eea32333 100644 --- a/bolt/test/X86/bolt-address-translation.test +++ b/bolt/test/X86/bolt-address-translation.test @@ -37,7 +37,7 @@ # CHECK: BOLT: 3 out of 7 functions were overwritten. # CHECK: BOLT-INFO: Wrote 6 BAT maps # CHECK: BOLT-INFO: Wrote 3 function and 58 basic block hashes -# CHECK: BOLT-INFO: BAT section size (bytes): 928 +# CHECK: BOLT-INFO: BAT section size (bytes): 940 # # usqrt mappings (hot part). We match against any key (left side containing # the bolted binary offsets) because BOLT may change where it puts instructions diff --git a/bolt/test/X86/dwarf5-debug-names-class-type-decl.s b/bolt/test/X86/dwarf5-debug-names-class-type-decl.s new file mode 100644 index 0000000000000..587eaaf6f4ffa --- /dev/null +++ b/bolt/test/X86/dwarf5-debug-names-class-type-decl.s @@ -0,0 +1,670 @@ +# REQUIRES: system-linux + +# RUN: llvm-mc -dwarf-version=5 -filetype=obj -triple x86_64-unknown-linux %s -o %t1.o +# RUN: %clang %cflags -dwarf-5 %t1.o -o %t.exe -Wl,-q +# RUN: llvm-bolt %t.exe -o %t.bolt --update-debug-sections +# RUN: llvm-dwarfdump --show-form --verbose --debug-info %t.bolt > %t.txt +# RUN: llvm-dwarfdump --show-form --verbose --debug-names %t.bolt >> %t.txt +# RUN: cat %t.txt | FileCheck --check-prefix=POSTCHECK %s + +## This tests that BOLT doesn't generate entry for a DW_TAG_class_type declaration with DW_AT_name. + +# POSTCHECK: DW_TAG_type_unit +# POSTCHECK: DW_TAG_class_type [7] +# POSTCHECK-NEXT: DW_AT_name [DW_FORM_strx1] (indexed (00000006) string = "InnerState") +# POSTCHECK-NEXT: DW_AT_declaration [DW_FORM_flag_present] (true) +# POSTCHECK: Name Index +# POSTCHECK-NOT: "InnerState" + +## -g2 -O0 -fdebug-types-section -gpubnames +## namespace A { +## namespace B { +## class State { +## public: +## class InnerState{ +## InnerState() {} +## }; +## State(){} +## State(InnerState S){} +## }; +## } +## } +## +## int main() { +## A::B::State S; +## return 0; +## } + + .text + .file "main.cpp" + .file 0 "/DW_TAG_class_type" "main.cpp" md5 0x80f261b124b76c481b8761c040ab4802 + .section .debug_info,"G",@progbits,16664150534606561860,comdat +.Ltu_begin0: + .long .Ldebug_info_end0-.Ldebug_info_start0 # Length of Unit +.Ldebug_info_start0: + .short 5 # DWARF version number + .byte 2 # DWARF Unit Type + .byte 8 # Address Size (in bytes) + .long .debug_abbrev # Offset Into Abbrev. Section + .quad -1782593539102989756 # Type Signature + .long 39 # Type DIE Offset + .byte 1 # Abbrev [1] 0x18:0x3b DW_TAG_type_unit + .short 33 # DW_AT_language + .long .Lline_table_start0 # DW_AT_stmt_list + .long .Lstr_offsets_base0 # DW_AT_str_offsets_base + .byte 2 # Abbrev [2] 0x23:0x2a DW_TAG_namespace + .byte 3 # DW_AT_name + .byte 2 # Abbrev [2] 0x25:0x27 DW_TAG_namespace + .byte 4 # DW_AT_name + .byte 3 # Abbrev [3] 0x27:0x24 DW_TAG_class_type + .byte 5 # DW_AT_calling_convention + .byte 5 # DW_AT_name + .byte 1 # DW_AT_byte_size + .byte 0 # DW_AT_decl_file + .byte 3 # DW_AT_decl_line + .byte 4 # Abbrev [4] 0x2d:0xb DW_TAG_subprogram + .byte 5 # DW_AT_name + .byte 0 # DW_AT_decl_file + .byte 8 # DW_AT_decl_line + # DW_AT_declaration + # DW_AT_external + .byte 1 # DW_AT_accessibility + # DW_ACCESS_public + .byte 5 # Abbrev [5] 0x32:0x5 DW_TAG_formal_parameter + .long 77 # DW_AT_type + # DW_AT_artificial + .byte 0 # End Of Children Mark + .byte 4 # Abbrev [4] 0x38:0x10 DW_TAG_subprogram + .byte 5 # DW_AT_name + .byte 0 # DW_AT_decl_file + .byte 9 # DW_AT_decl_line + # DW_AT_declaration + # DW_AT_external + .byte 1 # DW_AT_accessibility + # DW_ACCESS_public + .byte 5 # Abbrev [5] 0x3d:0x5 DW_TAG_formal_parameter + .long 77 # DW_AT_type + # DW_AT_artificial + .byte 6 # Abbrev [6] 0x42:0x5 DW_TAG_formal_parameter + .long 72 # DW_AT_type + .byte 0 # End Of Children Mark + .byte 7 # Abbrev [7] 0x48:0x2 DW_TAG_class_type + .byte 6 # DW_AT_name + # DW_AT_declaration + .byte 0 # End Of Children Mark + .byte 0 # End Of Children Mark + .byte 0 # End Of Children Mark + .byte 8 # Abbrev [8] 0x4d:0x5 DW_TAG_pointer_type + .long 39 # DW_AT_type + .byte 0 # End Of Children Mark +.Ldebug_info_end0: + .text + .globl main # -- Begin function main + .p2align 4, 0x90 + .type main,@function +main: # @main +.Lfunc_begin0: + .loc 0 14 0 # main.cpp:14:0 + .cfi_startproc +# %bb.0: # %entry + pushq %rbp + .cfi_def_cfa_offset 16 + .cfi_offset %rbp, -16 + movq %rsp, %rbp + .cfi_def_cfa_register %rbp + subq $16, %rsp + movl $0, -4(%rbp) +.Ltmp0: + .loc 0 15 15 prologue_end # main.cpp:15:15 + leaq -5(%rbp), %rdi + callq _ZN1A1B5StateC2Ev + .loc 0 16 3 # main.cpp:16:3 + xorl %eax, %eax + .loc 0 16 3 epilogue_begin is_stmt 0 # main.cpp:16:3 + addq $16, %rsp + popq %rbp + .cfi_def_cfa %rsp, 8 + retq +.Ltmp1: +.Lfunc_end0: + .size main, .Lfunc_end0-main + .cfi_endproc + # -- End function + .section .text._ZN1A1B5StateC2Ev,"axG",@progbits,_ZN1A1B5StateC2Ev,comdat + .weak _ZN1A1B5StateC2Ev # -- Begin function _ZN1A1B5StateC2Ev + .p2align 4, 0x90 + .type _ZN1A1B5StateC2Ev,@function +_ZN1A1B5StateC2Ev: # @_ZN1A1B5StateC2Ev +.Lfunc_begin1: + .loc 0 8 0 is_stmt 1 # main.cpp:8:0 + .cfi_startproc +# %bb.0: # %entry + pushq %rbp + .cfi_def_cfa_offset 16 + .cfi_offset %rbp, -16 + movq %rsp, %rbp + .cfi_def_cfa_register %rbp + movq %rdi, -8(%rbp) +.Ltmp2: + .loc 0 8 15 prologue_end epilogue_begin # main.cpp:8:15 + popq %rbp + .cfi_def_cfa %rsp, 8 + retq +.Ltmp3: +.Lfunc_end1: + .size _ZN1A1B5StateC2Ev, .Lfunc_end1-_ZN1A1B5StateC2Ev + .cfi_endproc + # -- End function + .section .debug_abbrev,"",@progbits + .byte 1 # Abbreviation Code + .byte 65 # DW_TAG_type_unit + .byte 1 # DW_CHILDREN_yes + .byte 19 # DW_AT_language + .byte 5 # DW_FORM_data2 + .byte 16 # DW_AT_stmt_list + .byte 23 # DW_FORM_sec_offset + .byte 114 # DW_AT_str_offsets_base + .byte 23 # DW_FORM_sec_offset + .byte 0 # EOM(1) + .byte 0 # EOM(2) + .byte 2 # Abbreviation Code + .byte 57 # DW_TAG_namespace + .byte 1 # DW_CHILDREN_yes + .byte 3 # DW_AT_name + .byte 37 # DW_FORM_strx1 + .byte 0 # EOM(1) + .byte 0 # EOM(2) + .byte 3 # Abbreviation Code + .byte 2 # DW_TAG_class_type + .byte 1 # DW_CHILDREN_yes + .byte 54 # DW_AT_calling_convention + .byte 11 # DW_FORM_data1 + .byte 3 # DW_AT_name + .byte 37 # DW_FORM_strx1 + .byte 11 # DW_AT_byte_size + .byte 11 # DW_FORM_data1 + .byte 58 # DW_AT_decl_file + .byte 11 # DW_FORM_data1 + .byte 59 # DW_AT_decl_line + .byte 11 # DW_FORM_data1 + .byte 0 # EOM(1) + .byte 0 # EOM(2) + .byte 4 # Abbreviation Code + .byte 46 # DW_TAG_subprogram + .byte 1 # DW_CHILDREN_yes + .byte 3 # DW_AT_name + .byte 37 # DW_FORM_strx1 + .byte 58 # DW_AT_decl_file + .byte 11 # DW_FORM_data1 + .byte 59 # DW_AT_decl_line + .byte 11 # DW_FORM_data1 + .byte 60 # DW_AT_declaration + .byte 25 # DW_FORM_flag_present + .byte 63 # DW_AT_external + .byte 25 # DW_FORM_flag_present + .byte 50 # DW_AT_accessibility + .byte 11 # DW_FORM_data1 + .byte 0 # EOM(1) + .byte 0 # EOM(2) + .byte 5 # Abbreviation Code + .byte 5 # DW_TAG_formal_parameter + .byte 0 # DW_CHILDREN_no + .byte 73 # DW_AT_type + .byte 19 # DW_FORM_ref4 + .byte 52 # DW_AT_artificial + .byte 25 # DW_FORM_flag_present + .byte 0 # EOM(1) + .byte 0 # EOM(2) + .byte 6 # Abbreviation Code + .byte 5 # DW_TAG_formal_parameter + .byte 0 # DW_CHILDREN_no + .byte 73 # DW_AT_type + .byte 19 # DW_FORM_ref4 + .byte 0 # EOM(1) + .byte 0 # EOM(2) + .byte 7 # Abbreviation Code + .byte 2 # DW_TAG_class_type + .byte 0 # DW_CHILDREN_no + .byte 3 # DW_AT_name + .byte 37 # DW_FORM_strx1 + .byte 60 # DW_AT_declaration + .byte 25 # DW_FORM_flag_present + .byte 0 # EOM(1) + .byte 0 # EOM(2) + .byte 8 # Abbreviation Code + .byte 15 # DW_TAG_pointer_type + .byte 0 # DW_CHILDREN_no + .byte 73 # DW_AT_type + .byte 19 # DW_FORM_ref4 + .byte 0 # EOM(1) + .byte 0 # EOM(2) + .byte 9 # Abbreviation Code + .byte 17 # DW_TAG_compile_unit + .byte 1 # DW_CHILDREN_yes + .byte 37 # DW_AT_producer + .byte 37 # DW_FORM_strx1 + .byte 19 # DW_AT_language + .byte 5 # DW_FORM_data2 + .byte 3 # DW_AT_name + .byte 37 # DW_FORM_strx1 + .byte 114 # DW_AT_str_offsets_base + .byte 23 # DW_FORM_sec_offset + .byte 16 # DW_AT_stmt_list + .byte 23 # DW_FORM_sec_offset + .byte 27 # DW_AT_comp_dir + .byte 37 # DW_FORM_strx1 + .byte 17 # DW_AT_low_pc + .byte 1 # DW_FORM_addr + .byte 85 # DW_AT_ranges + .byte 35 # DW_FORM_rnglistx + .byte 115 # DW_AT_addr_base + .byte 23 # DW_FORM_sec_offset + .byte 116 # DW_AT_rnglists_base + .byte 23 # DW_FORM_sec_offset + .byte 0 # EOM(1) + .byte 0 # EOM(2) + .byte 10 # Abbreviation Code + .byte 2 # DW_TAG_class_type + .byte 1 # DW_CHILDREN_yes + .byte 60 # DW_AT_declaration + .byte 25 # DW_FORM_flag_present + .byte 105 # DW_AT_signature + .byte 32 # DW_FORM_ref_sig8 + .byte 0 # EOM(1) + .byte 0 # EOM(2) + .byte 11 # Abbreviation Code + .byte 46 # DW_TAG_subprogram + .byte 1 # DW_CHILDREN_yes + .byte 17 # DW_AT_low_pc + .byte 27 # DW_FORM_addrx + .byte 18 # DW_AT_high_pc + .byte 6 # DW_FORM_data4 + .byte 64 # DW_AT_frame_base + .byte 24 # DW_FORM_exprloc + .byte 3 # DW_AT_name + .byte 37 # DW_FORM_strx1 + .byte 58 # DW_AT_decl_file + .byte 11 # DW_FORM_data1 + .byte 59 # DW_AT_decl_line + .byte 11 # DW_FORM_data1 + .byte 73 # DW_AT_type + .byte 19 # DW_FORM_ref4 + .byte 63 # DW_AT_external + .byte 25 # DW_FORM_flag_present + .byte 0 # EOM(1) + .byte 0 # EOM(2) + .byte 12 # Abbreviation Code + .byte 52 # DW_TAG_variable + .byte 0 # DW_CHILDREN_no + .byte 2 # DW_AT_location + .byte 24 # DW_FORM_exprloc + .byte 3 # DW_AT_name + .byte 37 # DW_FORM_strx1 + .byte 58 # DW_AT_decl_file + .byte 11 # DW_FORM_data1 + .byte 59 # DW_AT_decl_line + .byte 11 # DW_FORM_data1 + .byte 73 # DW_AT_type + .byte 19 # DW_FORM_ref4 + .byte 0 # EOM(1) + .byte 0 # EOM(2) + .byte 13 # Abbreviation Code + .byte 46 # DW_TAG_subprogram + .byte 1 # DW_CHILDREN_yes + .byte 17 # DW_AT_low_pc + .byte 27 # DW_FORM_addrx + .byte 18 # DW_AT_high_pc + .byte 6 # DW_FORM_data4 + .byte 64 # DW_AT_frame_base + .byte 24 # DW_FORM_exprloc + .byte 100 # DW_AT_object_pointer + .byte 19 # DW_FORM_ref4 + .byte 110 # DW_AT_linkage_name + .byte 37 # DW_FORM_strx1 + .byte 71 # DW_AT_specification + .byte 19 # DW_FORM_ref4 + .byte 0 # EOM(1) + .byte 0 # EOM(2) + .byte 14 # Abbreviation Code + .byte 5 # DW_TAG_formal_parameter + .byte 0 # DW_CHILDREN_no + .byte 2 # DW_AT_location + .byte 24 # DW_FORM_exprloc + .byte 3 # DW_AT_name + .byte 37 # DW_FORM_strx1 + .byte 73 # DW_AT_type + .byte 19 # DW_FORM_ref4 + .byte 52 # DW_AT_artificial + .byte 25 # DW_FORM_flag_present + .byte 0 # EOM(1) + .byte 0 # EOM(2) + .byte 15 # Abbreviation Code + .byte 36 # DW_TAG_base_type + .byte 0 # DW_CHILDREN_no + .byte 3 # DW_AT_name + .byte 37 # DW_FORM_strx1 + .byte 62 # DW_AT_encoding + .byte 11 # DW_FORM_data1 + .byte 11 # DW_AT_byte_size + .byte 11 # DW_FORM_data1 + .byte 0 # EOM(1) + .byte 0 # EOM(2) + .byte 0 # EOM(3) + .section .debug_info,"",@progbits +.Lcu_begin0: + .long .Ldebug_info_end1-.Ldebug_info_start1 # Length of Unit +.Ldebug_info_start1: + .short 5 # DWARF version number + .byte 1 # DWARF Unit Type + .byte 8 # Address Size (in bytes) + .long .debug_abbrev # Offset Into Abbrev. Section + .byte 9 # Abbrev [9] 0xc:0x7f DW_TAG_compile_unit + .byte 0 # DW_AT_producer + .short 33 # DW_AT_language + .byte 1 # DW_AT_name + .long .Lstr_offsets_base0 # DW_AT_str_offsets_base + .long .Lline_table_start0 # DW_AT_stmt_list + .byte 2 # DW_AT_comp_dir + .quad 0 # DW_AT_low_pc + .byte 0 # DW_AT_ranges + .long .Laddr_table_base0 # DW_AT_addr_base + .long .Lrnglists_table_base0 # DW_AT_rnglists_base + .byte 2 # Abbrev [2] 0x2b:0x1b DW_TAG_namespace + .byte 3 # DW_AT_name + .byte 2 # Abbrev [2] 0x2d:0x18 DW_TAG_namespace + .byte 4 # DW_AT_name + .byte 10 # Abbrev [10] 0x2f:0x15 DW_TAG_class_type + # DW_AT_declaration + .quad -1782593539102989756 # DW_AT_signature + .byte 4 # Abbrev [4] 0x38:0xb DW_TAG_subprogram + .byte 5 # DW_AT_name + .byte 0 # DW_AT_decl_file + .byte 8 # DW_AT_decl_line + # DW_AT_declaration + # DW_AT_external + .byte 1 # DW_AT_accessibility + # DW_ACCESS_public + .byte 5 # Abbrev [5] 0x3d:0x5 DW_TAG_formal_parameter + .long 97 # DW_AT_type + # DW_AT_artificial + .byte 0 # End Of Children Mark + .byte 0 # End Of Children Mark + .byte 0 # End Of Children Mark + .byte 0 # End Of Children Mark + .byte 11 # Abbrev [11] 0x46:0x1b DW_TAG_subprogram + .byte 0 # DW_AT_low_pc + .long .Lfunc_end0-.Lfunc_begin0 # DW_AT_high_pc + .byte 1 # DW_AT_frame_base + .byte 86 + .byte 7 # DW_AT_name + .byte 0 # DW_AT_decl_file + .byte 14 # DW_AT_decl_line + .long 129 # DW_AT_type + # DW_AT_external + .byte 12 # Abbrev [12] 0x55:0xb DW_TAG_variable + .byte 2 # DW_AT_location + .byte 145 + .byte 123 + .byte 10 # DW_AT_name + .byte 0 # DW_AT_decl_file + .byte 15 # DW_AT_decl_line + .long 47 # DW_AT_type + .byte 0 # End Of Children Mark + .byte 8 # Abbrev [8] 0x61:0x5 DW_TAG_pointer_type + .long 47 # DW_AT_type + .byte 13 # Abbrev [13] 0x66:0x1b DW_TAG_subprogram + .byte 1 # DW_AT_low_pc + .long .Lfunc_end1-.Lfunc_begin1 # DW_AT_high_pc + .byte 1 # DW_AT_frame_base + .byte 86 + .long 119 # DW_AT_object_pointer + .byte 9 # DW_AT_linkage_name + .long 56 # DW_AT_specification + .byte 14 # Abbrev [14] 0x77:0x9 DW_TAG_formal_parameter + .byte 2 # DW_AT_location + .byte 145 + .byte 120 + .byte 11 # DW_AT_name + .long 133 # DW_AT_type + # DW_AT_artificial + .byte 0 # End Of Children Mark + .byte 15 # Abbrev [15] 0x81:0x4 DW_TAG_base_type + .byte 8 # DW_AT_name + .byte 5 # DW_AT_encoding + .byte 4 # DW_AT_byte_size + .byte 8 # Abbrev [8] 0x85:0x5 DW_TAG_pointer_type + .long 47 # DW_AT_type + .byte 0 # End Of Children Mark +.Ldebug_info_end1: + .section .debug_rnglists,"",@progbits + .long .Ldebug_list_header_end0-.Ldebug_list_header_start0 # Length +.Ldebug_list_header_start0: + .short 5 # Version + .byte 8 # Address size + .byte 0 # Segment selector size + .long 1 # Offset entry count +.Lrnglists_table_base0: + .long .Ldebug_ranges0-.Lrnglists_table_base0 +.Ldebug_ranges0: + .byte 3 # DW_RLE_startx_length + .byte 0 # start index + .uleb128 .Lfunc_end0-.Lfunc_begin0 # length + .byte 3 # DW_RLE_startx_length + .byte 1 # start index + .uleb128 .Lfunc_end1-.Lfunc_begin1 # length + .byte 0 # DW_RLE_end_of_list +.Ldebug_list_header_end0: + .section .debug_str_offsets,"",@progbits + .long 52 # Length of String Offsets Set + .short 5 + .short 0 +.Lstr_offsets_base0: + .section .debug_str,"MS",@progbits,1 +.Linfo_string0: + .asciz "clang version 19.0.0git" # string offset=0 +.Linfo_string1: + .asciz "main.cpp" # string offset=24 +.Linfo_string2: + .asciz "/home/ayermolo/local/tasks/T190087639/DW_TAG_class_type" # string offset=33 +.Linfo_string3: + .asciz "A" # string offset=89 +.Linfo_string4: + .asciz "B" # string offset=91 +.Linfo_string5: + .asciz "State" # string offset=93 +.Linfo_string6: + .asciz "InnerState" # string offset=99 +.Linfo_string7: + .asciz "main" # string offset=110 +.Linfo_string8: + .asciz "_ZN1A1B5StateC2Ev" # string offset=115 +.Linfo_string9: + .asciz "int" # string offset=133 +.Linfo_string10: + .asciz "S" # string offset=137 +.Linfo_string11: + .asciz "this" # string offset=139 + .section .debug_str_offsets,"",@progbits + .long .Linfo_string0 + .long .Linfo_string1 + .long .Linfo_string2 + .long .Linfo_string3 + .long .Linfo_string4 + .long .Linfo_string5 + .long .Linfo_string6 + .long .Linfo_string7 + .long .Linfo_string9 + .long .Linfo_string8 + .long .Linfo_string10 + .long .Linfo_string11 + .section .debug_addr,"",@progbits + .long .Ldebug_addr_end0-.Ldebug_addr_start0 # Length of contribution +.Ldebug_addr_start0: + .short 5 # DWARF version number + .byte 8 # Address size + .byte 0 # Segment selector size +.Laddr_table_base0: + .quad .Lfunc_begin0 + .quad .Lfunc_begin1 +.Ldebug_addr_end0: + .section .debug_names,"",@progbits + .long .Lnames_end0-.Lnames_start0 # Header: unit length +.Lnames_start0: + .short 5 # Header: version + .short 0 # Header: padding + .long 1 # Header: compilation unit count + .long 1 # Header: local type unit count + .long 0 # Header: foreign type unit count + .long 6 # Header: bucket count + .long 6 # Header: name count + .long .Lnames_abbrev_end0-.Lnames_abbrev_start0 # Header: abbreviation table size + .long 8 # Header: augmentation string size + .ascii "LLVM0700" # Header: augmentation string + .long .Lcu_begin0 # Compilation unit 0 + .long .Ltu_begin0 # Type unit 0 + .long 0 # Bucket 0 + .long 0 # Bucket 1 + .long 1 # Bucket 2 + .long 2 # Bucket 3 + .long 3 # Bucket 4 + .long 6 # Bucket 5 + .long 193495088 # Hash in Bucket 2 + .long 1059643959 # Hash in Bucket 3 + .long 177670 # Hash in Bucket 4 + .long 274811398 # Hash in Bucket 4 + .long 2090499946 # Hash in Bucket 4 + .long 177671 # Hash in Bucket 5 + .long .Linfo_string9 # String in Bucket 2: int + .long .Linfo_string8 # String in Bucket 3: _ZN1A1B5StateC2Ev + .long .Linfo_string3 # String in Bucket 4: A + .long .Linfo_string5 # String in Bucket 4: State + .long .Linfo_string7 # String in Bucket 4: main + .long .Linfo_string4 # String in Bucket 5: B + .long .Lnames5-.Lnames_entries0 # Offset in Bucket 2 + .long .Lnames4-.Lnames_entries0 # Offset in Bucket 3 + .long .Lnames0-.Lnames_entries0 # Offset in Bucket 4 + .long .Lnames2-.Lnames_entries0 # Offset in Bucket 4 + .long .Lnames3-.Lnames_entries0 # Offset in Bucket 4 + .long .Lnames1-.Lnames_entries0 # Offset in Bucket 5 +.Lnames_abbrev_start0: + .byte 1 # Abbrev code + .byte 36 # DW_TAG_base_type + .byte 3 # DW_IDX_die_offset + .byte 19 # DW_FORM_ref4 + .byte 4 # DW_IDX_parent + .byte 25 # DW_FORM_flag_present + .byte 0 # End of abbrev + .byte 0 # End of abbrev + .byte 2 # Abbrev code + .byte 46 # DW_TAG_subprogram + .byte 3 # DW_IDX_die_offset + .byte 19 # DW_FORM_ref4 + .byte 4 # DW_IDX_parent + .byte 25 # DW_FORM_flag_present + .byte 0 # End of abbrev + .byte 0 # End of abbrev + .byte 3 # Abbrev code + .byte 57 # DW_TAG_namespace + .byte 2 # DW_IDX_type_unit + .byte 11 # DW_FORM_data1 + .byte 3 # DW_IDX_die_offset + .byte 19 # DW_FORM_ref4 + .byte 4 # DW_IDX_parent + .byte 25 # DW_FORM_flag_present + .byte 0 # End of abbrev + .byte 0 # End of abbrev + .byte 4 # Abbrev code + .byte 57 # DW_TAG_namespace + .byte 3 # DW_IDX_die_offset + .byte 19 # DW_FORM_ref4 + .byte 4 # DW_IDX_parent + .byte 25 # DW_FORM_flag_present + .byte 0 # End of abbrev + .byte 0 # End of abbrev + .byte 5 # Abbrev code + .byte 2 # DW_TAG_class_type + .byte 2 # DW_IDX_type_unit + .byte 11 # DW_FORM_data1 + .byte 3 # DW_IDX_die_offset + .byte 19 # DW_FORM_ref4 + .byte 4 # DW_IDX_parent + .byte 19 # DW_FORM_ref4 + .byte 0 # End of abbrev + .byte 0 # End of abbrev + .byte 6 # Abbrev code + .byte 57 # DW_TAG_namespace + .byte 2 # DW_IDX_type_unit + .byte 11 # DW_FORM_data1 + .byte 3 # DW_IDX_die_offset + .byte 19 # DW_FORM_ref4 + .byte 4 # DW_IDX_parent + .byte 19 # DW_FORM_ref4 + .byte 0 # End of abbrev + .byte 0 # End of abbrev + .byte 7 # Abbrev code + .byte 57 # DW_TAG_namespace + .byte 3 # DW_IDX_die_offset + .byte 19 # DW_FORM_ref4 + .byte 4 # DW_IDX_parent + .byte 19 # DW_FORM_ref4 + .byte 0 # End of abbrev + .byte 0 # End of abbrev + .byte 0 # End of abbrev list +.Lnames_abbrev_end0: +.Lnames_entries0: +.Lnames5: +.L2: + .byte 1 # Abbreviation code + .long 129 # DW_IDX_die_offset + .byte 0 # DW_IDX_parent + # End of list: int +.Lnames4: +.L3: + .byte 2 # Abbreviation code + .long 102 # DW_IDX_die_offset + .byte 0 # DW_IDX_parent + # End of list: _ZN1A1B5StateC2Ev +.Lnames0: +.L4: + .byte 3 # Abbreviation code + .byte 0 # DW_IDX_type_unit + .long 35 # DW_IDX_die_offset +.L7: # DW_IDX_parent + .byte 4 # Abbreviation code + .long 43 # DW_IDX_die_offset + .byte 0 # DW_IDX_parent + # End of list: A +.Lnames2: +.L1: + .byte 5 # Abbreviation code + .byte 0 # DW_IDX_type_unit + .long 39 # DW_IDX_die_offset + .long .L5-.Lnames_entries0 # DW_IDX_parent + .byte 2 # Abbreviation code + .long 102 # DW_IDX_die_offset + .byte 0 # DW_IDX_parent + # End of list: State +.Lnames3: +.L0: + .byte 2 # Abbreviation code + .long 70 # DW_IDX_die_offset + .byte 0 # DW_IDX_parent + # End of list: main +.Lnames1: +.L5: + .byte 6 # Abbreviation code + .byte 0 # DW_IDX_type_unit + .long 37 # DW_IDX_die_offset + .long .L4-.Lnames_entries0 # DW_IDX_parent +.L6: + .byte 7 # Abbreviation code + .long 45 # DW_IDX_die_offset + .long .L7-.Lnames_entries0 # DW_IDX_parent + .byte 0 # End of list: B + .p2align 2, 0x0 +.Lnames_end0: + .ident "clang version 19.0.0git" + .section ".note.GNU-stack","",@progbits + .addrsig + .section .debug_line,"",@progbits +.Lline_table_start0: diff --git a/bolt/test/X86/dwarf5-debug-names-enumeration-type-decl.s b/bolt/test/X86/dwarf5-debug-names-enumeration-type-decl.s new file mode 100644 index 0000000000000..031175763d794 --- /dev/null +++ b/bolt/test/X86/dwarf5-debug-names-enumeration-type-decl.s @@ -0,0 +1,485 @@ +# REQUIRES: system-linux + +# RUN: llvm-mc -dwarf-version=5 -filetype=obj -triple x86_64-unknown-linux %s -o %t1.o +# RUN: %clang %cflags -dwarf-5 %t1.o -o %t.exe -Wl,-q +# RUN: llvm-bolt %t.exe -o %t.bolt --update-debug-sections +# RUN: llvm-dwarfdump --show-form --verbose --debug-info %t.bolt > %t.txt +# RUN: llvm-dwarfdump --show-form --verbose --debug-names %t.bolt >> %t.txt +# RUN: cat %t.txt | FileCheck --check-prefix=POSTCHECK %s + +## This tests that BOLT doesn't generate entry for a DW_TAG_enumeration_type declaration with DW_AT_name. + +# POSTCHECK: DW_TAG_type_unit +# POSTCHECK: DW_TAG_enumeration_type [6] +# POSTCHECK-NEXT: DW_AT_name [DW_FORM_strx1] (indexed (00000009) string = "InnerState") +# POSTCHECK-NEXT: DW_AT_byte_size [DW_FORM_data1] (0x04) +# POSTCHECK-NEXT: DW_AT_declaration [DW_FORM_flag_present] (true) +# POSTCHECK: Name Index +# POSTCHECK-NOT: "InnerState" + +## -g2 -O0 -fdebug-types-section -gpubnames +## namespace B { +## template +## class State { +## public: +## enum class InnerState { STATE0 }; +## InnerState St; +## }; +## } +## +## int main() { +## B::State S; +## return 0; +## } + + .text + .file "main.cpp" + .globl main # -- Begin function main + .p2align 4, 0x90 + .type main,@function +main: # @main +.Lfunc_begin0: + .file 0 "/DW_TAG_enumeration_type" "main.cpp" md5 0x2e8962f8ef4bf6eb6f8bd92966c0848b + .loc 0 10 0 # main.cpp:10:0 + .cfi_startproc +# %bb.0: # %entry + pushq %rbp + .cfi_def_cfa_offset 16 + .cfi_offset %rbp, -16 + movq %rsp, %rbp + .cfi_def_cfa_register %rbp + movl $0, -4(%rbp) +.Ltmp0: + .loc 0 12 3 prologue_end # main.cpp:12:3 + xorl %eax, %eax + .loc 0 12 3 epilogue_begin is_stmt 0 # main.cpp:12:3 + popq %rbp + .cfi_def_cfa %rsp, 8 + retq +.Ltmp1: +.Lfunc_end0: + .size main, .Lfunc_end0-main + .cfi_endproc + # -- End function + .section .debug_info,"G",@progbits,8822129917070965541,comdat +.Ltu_begin0: + .long .Ldebug_info_end0-.Ldebug_info_start0 # Length of Unit +.Ldebug_info_start0: + .short 5 # DWARF version number + .byte 2 # DWARF Unit Type + .byte 8 # Address Size (in bytes) + .long .debug_abbrev # Offset Into Abbrev. Section + .quad 8822129917070965541 # Type Signature + .long 37 # Type DIE Offset + .byte 1 # Abbrev [1] 0x18:0x2d DW_TAG_type_unit + .short 33 # DW_AT_language + .long .Lline_table_start0 # DW_AT_stmt_list + .long .Lstr_offsets_base0 # DW_AT_str_offsets_base + .byte 2 # Abbrev [2] 0x23:0x1d DW_TAG_namespace + .byte 6 # DW_AT_name + .byte 3 # Abbrev [3] 0x25:0x1a DW_TAG_class_type + .byte 5 # DW_AT_calling_convention + .byte 10 # DW_AT_name + .byte 4 # DW_AT_byte_size + .byte 0 # DW_AT_decl_file + .byte 3 # DW_AT_decl_line + .byte 4 # Abbrev [4] 0x2b:0x6 DW_TAG_template_type_parameter + .long 64 # DW_AT_type + .byte 7 # DW_AT_name + .byte 5 # Abbrev [5] 0x31:0xa DW_TAG_member + .byte 8 # DW_AT_name + .long 59 # DW_AT_type + .byte 0 # DW_AT_decl_file + .byte 6 # DW_AT_decl_line + .byte 0 # DW_AT_data_member_location + .byte 1 # DW_AT_accessibility + # DW_ACCESS_public + .byte 6 # Abbrev [6] 0x3b:0x3 DW_TAG_enumeration_type + .byte 9 # DW_AT_name + .byte 4 # DW_AT_byte_size + # DW_AT_declaration + .byte 0 # End Of Children Mark + .byte 0 # End Of Children Mark + .byte 7 # Abbrev [7] 0x40:0x4 DW_TAG_base_type + .byte 4 # DW_AT_name + .byte 5 # DW_AT_encoding + .byte 4 # DW_AT_byte_size + .byte 0 # End Of Children Mark +.Ldebug_info_end0: + .section .debug_abbrev,"",@progbits + .byte 1 # Abbreviation Code + .byte 65 # DW_TAG_type_unit + .byte 1 # DW_CHILDREN_yes + .byte 19 # DW_AT_language + .byte 5 # DW_FORM_data2 + .byte 16 # DW_AT_stmt_list + .byte 23 # DW_FORM_sec_offset + .byte 114 # DW_AT_str_offsets_base + .byte 23 # DW_FORM_sec_offset + .byte 0 # EOM(1) + .byte 0 # EOM(2) + .byte 2 # Abbreviation Code + .byte 57 # DW_TAG_namespace + .byte 1 # DW_CHILDREN_yes + .byte 3 # DW_AT_name + .byte 37 # DW_FORM_strx1 + .byte 0 # EOM(1) + .byte 0 # EOM(2) + .byte 3 # Abbreviation Code + .byte 2 # DW_TAG_class_type + .byte 1 # DW_CHILDREN_yes + .byte 54 # DW_AT_calling_convention + .byte 11 # DW_FORM_data1 + .byte 3 # DW_AT_name + .byte 37 # DW_FORM_strx1 + .byte 11 # DW_AT_byte_size + .byte 11 # DW_FORM_data1 + .byte 58 # DW_AT_decl_file + .byte 11 # DW_FORM_data1 + .byte 59 # DW_AT_decl_line + .byte 11 # DW_FORM_data1 + .byte 0 # EOM(1) + .byte 0 # EOM(2) + .byte 4 # Abbreviation Code + .byte 47 # DW_TAG_template_type_parameter + .byte 0 # DW_CHILDREN_no + .byte 73 # DW_AT_type + .byte 19 # DW_FORM_ref4 + .byte 3 # DW_AT_name + .byte 37 # DW_FORM_strx1 + .byte 0 # EOM(1) + .byte 0 # EOM(2) + .byte 5 # Abbreviation Code + .byte 13 # DW_TAG_member + .byte 0 # DW_CHILDREN_no + .byte 3 # DW_AT_name + .byte 37 # DW_FORM_strx1 + .byte 73 # DW_AT_type + .byte 19 # DW_FORM_ref4 + .byte 58 # DW_AT_decl_file + .byte 11 # DW_FORM_data1 + .byte 59 # DW_AT_decl_line + .byte 11 # DW_FORM_data1 + .byte 56 # DW_AT_data_member_location + .byte 11 # DW_FORM_data1 + .byte 50 # DW_AT_accessibility + .byte 11 # DW_FORM_data1 + .byte 0 # EOM(1) + .byte 0 # EOM(2) + .byte 6 # Abbreviation Code + .byte 4 # DW_TAG_enumeration_type + .byte 0 # DW_CHILDREN_no + .byte 3 # DW_AT_name + .byte 37 # DW_FORM_strx1 + .byte 11 # DW_AT_byte_size + .byte 11 # DW_FORM_data1 + .byte 60 # DW_AT_declaration + .byte 25 # DW_FORM_flag_present + .byte 0 # EOM(1) + .byte 0 # EOM(2) + .byte 7 # Abbreviation Code + .byte 36 # DW_TAG_base_type + .byte 0 # DW_CHILDREN_no + .byte 3 # DW_AT_name + .byte 37 # DW_FORM_strx1 + .byte 62 # DW_AT_encoding + .byte 11 # DW_FORM_data1 + .byte 11 # DW_AT_byte_size + .byte 11 # DW_FORM_data1 + .byte 0 # EOM(1) + .byte 0 # EOM(2) + .byte 8 # Abbreviation Code + .byte 17 # DW_TAG_compile_unit + .byte 1 # DW_CHILDREN_yes + .byte 37 # DW_AT_producer + .byte 37 # DW_FORM_strx1 + .byte 19 # DW_AT_language + .byte 5 # DW_FORM_data2 + .byte 3 # DW_AT_name + .byte 37 # DW_FORM_strx1 + .byte 114 # DW_AT_str_offsets_base + .byte 23 # DW_FORM_sec_offset + .byte 16 # DW_AT_stmt_list + .byte 23 # DW_FORM_sec_offset + .byte 27 # DW_AT_comp_dir + .byte 37 # DW_FORM_strx1 + .byte 17 # DW_AT_low_pc + .byte 27 # DW_FORM_addrx + .byte 18 # DW_AT_high_pc + .byte 6 # DW_FORM_data4 + .byte 115 # DW_AT_addr_base + .byte 23 # DW_FORM_sec_offset + .byte 0 # EOM(1) + .byte 0 # EOM(2) + .byte 9 # Abbreviation Code + .byte 46 # DW_TAG_subprogram + .byte 1 # DW_CHILDREN_yes + .byte 17 # DW_AT_low_pc + .byte 27 # DW_FORM_addrx + .byte 18 # DW_AT_high_pc + .byte 6 # DW_FORM_data4 + .byte 64 # DW_AT_frame_base + .byte 24 # DW_FORM_exprloc + .byte 3 # DW_AT_name + .byte 37 # DW_FORM_strx1 + .byte 58 # DW_AT_decl_file + .byte 11 # DW_FORM_data1 + .byte 59 # DW_AT_decl_line + .byte 11 # DW_FORM_data1 + .byte 73 # DW_AT_type + .byte 19 # DW_FORM_ref4 + .byte 63 # DW_AT_external + .byte 25 # DW_FORM_flag_present + .byte 0 # EOM(1) + .byte 0 # EOM(2) + .byte 10 # Abbreviation Code + .byte 52 # DW_TAG_variable + .byte 0 # DW_CHILDREN_no + .byte 2 # DW_AT_location + .byte 24 # DW_FORM_exprloc + .byte 3 # DW_AT_name + .byte 37 # DW_FORM_strx1 + .byte 58 # DW_AT_decl_file + .byte 11 # DW_FORM_data1 + .byte 59 # DW_AT_decl_line + .byte 11 # DW_FORM_data1 + .byte 73 # DW_AT_type + .byte 19 # DW_FORM_ref4 + .byte 0 # EOM(1) + .byte 0 # EOM(2) + .byte 11 # Abbreviation Code + .byte 2 # DW_TAG_class_type + .byte 0 # DW_CHILDREN_no + .byte 60 # DW_AT_declaration + .byte 25 # DW_FORM_flag_present + .byte 105 # DW_AT_signature + .byte 32 # DW_FORM_ref_sig8 + .byte 0 # EOM(1) + .byte 0 # EOM(2) + .byte 0 # EOM(3) + .section .debug_info,"",@progbits +.Lcu_begin0: + .long .Ldebug_info_end1-.Ldebug_info_start1 # Length of Unit +.Ldebug_info_start1: + .short 5 # DWARF version number + .byte 1 # DWARF Unit Type + .byte 8 # Address Size (in bytes) + .long .debug_abbrev # Offset Into Abbrev. Section + .byte 8 # Abbrev [8] 0xc:0x43 DW_TAG_compile_unit + .byte 0 # DW_AT_producer + .short 33 # DW_AT_language + .byte 1 # DW_AT_name + .long .Lstr_offsets_base0 # DW_AT_str_offsets_base + .long .Lline_table_start0 # DW_AT_stmt_list + .byte 2 # DW_AT_comp_dir + .byte 0 # DW_AT_low_pc + .long .Lfunc_end0-.Lfunc_begin0 # DW_AT_high_pc + .long .Laddr_table_base0 # DW_AT_addr_base + .byte 9 # Abbrev [9] 0x23:0x1b DW_TAG_subprogram + .byte 0 # DW_AT_low_pc + .long .Lfunc_end0-.Lfunc_begin0 # DW_AT_high_pc + .byte 1 # DW_AT_frame_base + .byte 86 + .byte 3 # DW_AT_name + .byte 0 # DW_AT_decl_file + .byte 10 # DW_AT_decl_line + .long 62 # DW_AT_type + # DW_AT_external + .byte 10 # Abbrev [10] 0x32:0xb DW_TAG_variable + .byte 2 # DW_AT_location + .byte 145 + .byte 120 + .byte 5 # DW_AT_name + .byte 0 # DW_AT_decl_file + .byte 11 # DW_AT_decl_line + .long 68 # DW_AT_type + .byte 0 # End Of Children Mark + .byte 7 # Abbrev [7] 0x3e:0x4 DW_TAG_base_type + .byte 4 # DW_AT_name + .byte 5 # DW_AT_encoding + .byte 4 # DW_AT_byte_size + .byte 2 # Abbrev [2] 0x42:0xc DW_TAG_namespace + .byte 6 # DW_AT_name + .byte 11 # Abbrev [11] 0x44:0x9 DW_TAG_class_type + # DW_AT_declaration + .quad 8822129917070965541 # DW_AT_signature + .byte 0 # End Of Children Mark + .byte 0 # End Of Children Mark +.Ldebug_info_end1: + .section .debug_str_offsets,"",@progbits + .long 48 # Length of String Offsets Set + .short 5 + .short 0 +.Lstr_offsets_base0: + .section .debug_str,"MS",@progbits,1 +.Linfo_string0: + .asciz "clang version 19.0.0git" # string offset=0 +.Linfo_string1: + .asciz "main.cpp" # string offset=24 +.Linfo_string2: + .asciz "/home/ayermolo/local/tasks/T190087639/DW_TAG_enumeration_type" # string offset=33 +.Linfo_string3: + .asciz "main" # string offset=95 +.Linfo_string4: + .asciz "int" # string offset=100 +.Linfo_string5: + .asciz "S" # string offset=104 +.Linfo_string6: + .asciz "B" # string offset=106 +.Linfo_string7: + .asciz "Task" # string offset=108 +.Linfo_string8: + .asciz "St" # string offset=113 +.Linfo_string9: + .asciz "InnerState" # string offset=116 +.Linfo_string10: + .asciz "State" # string offset=127 + .section .debug_str_offsets,"",@progbits + .long .Linfo_string0 + .long .Linfo_string1 + .long .Linfo_string2 + .long .Linfo_string3 + .long .Linfo_string4 + .long .Linfo_string5 + .long .Linfo_string6 + .long .Linfo_string7 + .long .Linfo_string8 + .long .Linfo_string9 + .long .Linfo_string10 + .section .debug_addr,"",@progbits + .long .Ldebug_addr_end0-.Ldebug_addr_start0 # Length of contribution +.Ldebug_addr_start0: + .short 5 # DWARF version number + .byte 8 # Address size + .byte 0 # Segment selector size +.Laddr_table_base0: + .quad .Lfunc_begin0 +.Ldebug_addr_end0: + .section .debug_names,"",@progbits + .long .Lnames_end0-.Lnames_start0 # Header: unit length +.Lnames_start0: + .short 5 # Header: version + .short 0 # Header: padding + .long 1 # Header: compilation unit count + .long 1 # Header: local type unit count + .long 0 # Header: foreign type unit count + .long 4 # Header: bucket count + .long 4 # Header: name count + .long .Lnames_abbrev_end0-.Lnames_abbrev_start0 # Header: abbreviation table size + .long 8 # Header: augmentation string size + .ascii "LLVM0700" # Header: augmentation string + .long .Lcu_begin0 # Compilation unit 0 + .long .Ltu_begin0 # Type unit 0 + .long 1 # Bucket 0 + .long 0 # Bucket 1 + .long 2 # Bucket 2 + .long 3 # Bucket 3 + .long 193495088 # Hash in Bucket 0 + .long 2090499946 # Hash in Bucket 2 + .long 177671 # Hash in Bucket 3 + .long 624407275 # Hash in Bucket 3 + .long .Linfo_string4 # String in Bucket 0: int + .long .Linfo_string3 # String in Bucket 2: main + .long .Linfo_string6 # String in Bucket 3: B + .long .Linfo_string10 # String in Bucket 3: State + .long .Lnames1-.Lnames_entries0 # Offset in Bucket 0 + .long .Lnames0-.Lnames_entries0 # Offset in Bucket 2 + .long .Lnames2-.Lnames_entries0 # Offset in Bucket 3 + .long .Lnames3-.Lnames_entries0 # Offset in Bucket 3 +.Lnames_abbrev_start0: + .byte 1 # Abbrev code + .byte 36 # DW_TAG_base_type + .byte 3 # DW_IDX_die_offset + .byte 19 # DW_FORM_ref4 + .byte 4 # DW_IDX_parent + .byte 25 # DW_FORM_flag_present + .byte 0 # End of abbrev + .byte 0 # End of abbrev + .byte 2 # Abbrev code + .byte 36 # DW_TAG_base_type + .byte 2 # DW_IDX_type_unit + .byte 11 # DW_FORM_data1 + .byte 3 # DW_IDX_die_offset + .byte 19 # DW_FORM_ref4 + .byte 4 # DW_IDX_parent + .byte 25 # DW_FORM_flag_present + .byte 0 # End of abbrev + .byte 0 # End of abbrev + .byte 3 # Abbrev code + .byte 46 # DW_TAG_subprogram + .byte 3 # DW_IDX_die_offset + .byte 19 # DW_FORM_ref4 + .byte 4 # DW_IDX_parent + .byte 25 # DW_FORM_flag_present + .byte 0 # End of abbrev + .byte 0 # End of abbrev + .byte 4 # Abbrev code + .byte 57 # DW_TAG_namespace + .byte 2 # DW_IDX_type_unit + .byte 11 # DW_FORM_data1 + .byte 3 # DW_IDX_die_offset + .byte 19 # DW_FORM_ref4 + .byte 4 # DW_IDX_parent + .byte 25 # DW_FORM_flag_present + .byte 0 # End of abbrev + .byte 0 # End of abbrev + .byte 5 # Abbrev code + .byte 57 # DW_TAG_namespace + .byte 3 # DW_IDX_die_offset + .byte 19 # DW_FORM_ref4 + .byte 4 # DW_IDX_parent + .byte 25 # DW_FORM_flag_present + .byte 0 # End of abbrev + .byte 0 # End of abbrev + .byte 6 # Abbrev code + .byte 2 # DW_TAG_class_type + .byte 2 # DW_IDX_type_unit + .byte 11 # DW_FORM_data1 + .byte 3 # DW_IDX_die_offset + .byte 19 # DW_FORM_ref4 + .byte 4 # DW_IDX_parent + .byte 19 # DW_FORM_ref4 + .byte 0 # End of abbrev + .byte 0 # End of abbrev + .byte 0 # End of abbrev list +.Lnames_abbrev_end0: +.Lnames_entries0: +.Lnames1: +.L0: + .byte 1 # Abbreviation code + .long 62 # DW_IDX_die_offset +.L2: # DW_IDX_parent + .byte 2 # Abbreviation code + .byte 0 # DW_IDX_type_unit + .long 64 # DW_IDX_die_offset + .byte 0 # DW_IDX_parent + # End of list: int +.Lnames0: +.L3: + .byte 3 # Abbreviation code + .long 35 # DW_IDX_die_offset + .byte 0 # DW_IDX_parent + # End of list: main +.Lnames2: + .byte 4 # Abbreviation code + .byte 0 # DW_IDX_type_unit + .long 35 # DW_IDX_die_offset +.L1: # DW_IDX_parent + .byte 5 # Abbreviation code + .long 66 # DW_IDX_die_offset + .byte 0 # DW_IDX_parent + # End of list: B +.Lnames3: +.L4: + .byte 6 # Abbreviation code + .byte 0 # DW_IDX_type_unit + .long 37 # DW_IDX_die_offset + .long .L3-.Lnames_entries0 # DW_IDX_parent + .byte 0 # End of list: State + .p2align 2, 0x0 +.Lnames_end0: + .ident "clang version 19.0.0git" + .section ".note.GNU-stack","",@progbits + .addrsig + .section .debug_line,"",@progbits +.Lline_table_start0: diff --git a/bolt/test/X86/dwarf5-debug-names-structure-type-decl.s b/bolt/test/X86/dwarf5-debug-names-structure-type-decl.s new file mode 100644 index 0000000000000..6eb2852c26ba0 --- /dev/null +++ b/bolt/test/X86/dwarf5-debug-names-structure-type-decl.s @@ -0,0 +1,671 @@ +# REQUIRES: system-linux + +# RUN: llvm-mc -dwarf-version=5 -filetype=obj -triple x86_64-unknown-linux %s -o %t1.o +# RUN: %clang %cflags -dwarf-5 %t1.o -o %t.exe -Wl,-q +# RUN: llvm-bolt %t.exe -o %t.bolt --update-debug-sections +# RUN: llvm-dwarfdump --show-form --verbose --debug-info %t.bolt > %t.txt +# RUN: llvm-dwarfdump --show-form --verbose --debug-names %t.bolt >> %t.txt +# RUN: cat %t.txt | FileCheck --check-prefix=POSTCHECK %s + +## This tests that BOLT doesn't generate entry for a DW_TAG_structure_type declaration with DW_AT_name. + +# POSTCHECK: DW_TAG_type_unit +# POSTCHECK: DW_TAG_structure_type [7] +# POSTCHECK-NEXT: DW_AT_name [DW_FORM_strx1] (indexed (00000006) string = "InnerState") +# POSTCHECK-NEXT: DW_AT_declaration [DW_FORM_flag_present] (true) +# POSTCHECK: Name Index +# POSTCHECK-NOT: "InnerState" + +## -g2 -O0 -fdebug-types-section -gpubnames +## namespace A { +## namespace B { +## class State { +## public: +## struct InnerState{ +## InnerState() {} +## }; +## State(){} +## State(InnerState S){} +## }; +## } +## } +## +## int main() { +## A::B::State S; +## return 0; +## } + + + .text + .file "main.cpp" + .file 0 "/DW_TAG_structure_type" "main.cpp" md5 0xd43ba503b70d00353c195087e1fe16e2 + .section .debug_info,"G",@progbits,16664150534606561860,comdat +.Ltu_begin0: + .long .Ldebug_info_end0-.Ldebug_info_start0 # Length of Unit +.Ldebug_info_start0: + .short 5 # DWARF version number + .byte 2 # DWARF Unit Type + .byte 8 # Address Size (in bytes) + .long .debug_abbrev # Offset Into Abbrev. Section + .quad -1782593539102989756 # Type Signature + .long 39 # Type DIE Offset + .byte 1 # Abbrev [1] 0x18:0x3b DW_TAG_type_unit + .short 33 # DW_AT_language + .long .Lline_table_start0 # DW_AT_stmt_list + .long .Lstr_offsets_base0 # DW_AT_str_offsets_base + .byte 2 # Abbrev [2] 0x23:0x2a DW_TAG_namespace + .byte 3 # DW_AT_name + .byte 2 # Abbrev [2] 0x25:0x27 DW_TAG_namespace + .byte 4 # DW_AT_name + .byte 3 # Abbrev [3] 0x27:0x24 DW_TAG_class_type + .byte 5 # DW_AT_calling_convention + .byte 5 # DW_AT_name + .byte 1 # DW_AT_byte_size + .byte 0 # DW_AT_decl_file + .byte 3 # DW_AT_decl_line + .byte 4 # Abbrev [4] 0x2d:0xb DW_TAG_subprogram + .byte 5 # DW_AT_name + .byte 0 # DW_AT_decl_file + .byte 8 # DW_AT_decl_line + # DW_AT_declaration + # DW_AT_external + .byte 1 # DW_AT_accessibility + # DW_ACCESS_public + .byte 5 # Abbrev [5] 0x32:0x5 DW_TAG_formal_parameter + .long 77 # DW_AT_type + # DW_AT_artificial + .byte 0 # End Of Children Mark + .byte 4 # Abbrev [4] 0x38:0x10 DW_TAG_subprogram + .byte 5 # DW_AT_name + .byte 0 # DW_AT_decl_file + .byte 9 # DW_AT_decl_line + # DW_AT_declaration + # DW_AT_external + .byte 1 # DW_AT_accessibility + # DW_ACCESS_public + .byte 5 # Abbrev [5] 0x3d:0x5 DW_TAG_formal_parameter + .long 77 # DW_AT_type + # DW_AT_artificial + .byte 6 # Abbrev [6] 0x42:0x5 DW_TAG_formal_parameter + .long 72 # DW_AT_type + .byte 0 # End Of Children Mark + .byte 7 # Abbrev [7] 0x48:0x2 DW_TAG_structure_type + .byte 6 # DW_AT_name + # DW_AT_declaration + .byte 0 # End Of Children Mark + .byte 0 # End Of Children Mark + .byte 0 # End Of Children Mark + .byte 8 # Abbrev [8] 0x4d:0x5 DW_TAG_pointer_type + .long 39 # DW_AT_type + .byte 0 # End Of Children Mark +.Ldebug_info_end0: + .text + .globl main # -- Begin function main + .p2align 4, 0x90 + .type main,@function +main: # @main +.Lfunc_begin0: + .loc 0 14 0 # main.cpp:14:0 + .cfi_startproc +# %bb.0: # %entry + pushq %rbp + .cfi_def_cfa_offset 16 + .cfi_offset %rbp, -16 + movq %rsp, %rbp + .cfi_def_cfa_register %rbp + subq $16, %rsp + movl $0, -4(%rbp) +.Ltmp0: + .loc 0 15 15 prologue_end # main.cpp:15:15 + leaq -5(%rbp), %rdi + callq _ZN1A1B5StateC2Ev + .loc 0 16 3 # main.cpp:16:3 + xorl %eax, %eax + .loc 0 16 3 epilogue_begin is_stmt 0 # main.cpp:16:3 + addq $16, %rsp + popq %rbp + .cfi_def_cfa %rsp, 8 + retq +.Ltmp1: +.Lfunc_end0: + .size main, .Lfunc_end0-main + .cfi_endproc + # -- End function + .section .text._ZN1A1B5StateC2Ev,"axG",@progbits,_ZN1A1B5StateC2Ev,comdat + .weak _ZN1A1B5StateC2Ev # -- Begin function _ZN1A1B5StateC2Ev + .p2align 4, 0x90 + .type _ZN1A1B5StateC2Ev,@function +_ZN1A1B5StateC2Ev: # @_ZN1A1B5StateC2Ev +.Lfunc_begin1: + .loc 0 8 0 is_stmt 1 # main.cpp:8:0 + .cfi_startproc +# %bb.0: # %entry + pushq %rbp + .cfi_def_cfa_offset 16 + .cfi_offset %rbp, -16 + movq %rsp, %rbp + .cfi_def_cfa_register %rbp + movq %rdi, -8(%rbp) +.Ltmp2: + .loc 0 8 15 prologue_end epilogue_begin # main.cpp:8:15 + popq %rbp + .cfi_def_cfa %rsp, 8 + retq +.Ltmp3: +.Lfunc_end1: + .size _ZN1A1B5StateC2Ev, .Lfunc_end1-_ZN1A1B5StateC2Ev + .cfi_endproc + # -- End function + .section .debug_abbrev,"",@progbits + .byte 1 # Abbreviation Code + .byte 65 # DW_TAG_type_unit + .byte 1 # DW_CHILDREN_yes + .byte 19 # DW_AT_language + .byte 5 # DW_FORM_data2 + .byte 16 # DW_AT_stmt_list + .byte 23 # DW_FORM_sec_offset + .byte 114 # DW_AT_str_offsets_base + .byte 23 # DW_FORM_sec_offset + .byte 0 # EOM(1) + .byte 0 # EOM(2) + .byte 2 # Abbreviation Code + .byte 57 # DW_TAG_namespace + .byte 1 # DW_CHILDREN_yes + .byte 3 # DW_AT_name + .byte 37 # DW_FORM_strx1 + .byte 0 # EOM(1) + .byte 0 # EOM(2) + .byte 3 # Abbreviation Code + .byte 2 # DW_TAG_class_type + .byte 1 # DW_CHILDREN_yes + .byte 54 # DW_AT_calling_convention + .byte 11 # DW_FORM_data1 + .byte 3 # DW_AT_name + .byte 37 # DW_FORM_strx1 + .byte 11 # DW_AT_byte_size + .byte 11 # DW_FORM_data1 + .byte 58 # DW_AT_decl_file + .byte 11 # DW_FORM_data1 + .byte 59 # DW_AT_decl_line + .byte 11 # DW_FORM_data1 + .byte 0 # EOM(1) + .byte 0 # EOM(2) + .byte 4 # Abbreviation Code + .byte 46 # DW_TAG_subprogram + .byte 1 # DW_CHILDREN_yes + .byte 3 # DW_AT_name + .byte 37 # DW_FORM_strx1 + .byte 58 # DW_AT_decl_file + .byte 11 # DW_FORM_data1 + .byte 59 # DW_AT_decl_line + .byte 11 # DW_FORM_data1 + .byte 60 # DW_AT_declaration + .byte 25 # DW_FORM_flag_present + .byte 63 # DW_AT_external + .byte 25 # DW_FORM_flag_present + .byte 50 # DW_AT_accessibility + .byte 11 # DW_FORM_data1 + .byte 0 # EOM(1) + .byte 0 # EOM(2) + .byte 5 # Abbreviation Code + .byte 5 # DW_TAG_formal_parameter + .byte 0 # DW_CHILDREN_no + .byte 73 # DW_AT_type + .byte 19 # DW_FORM_ref4 + .byte 52 # DW_AT_artificial + .byte 25 # DW_FORM_flag_present + .byte 0 # EOM(1) + .byte 0 # EOM(2) + .byte 6 # Abbreviation Code + .byte 5 # DW_TAG_formal_parameter + .byte 0 # DW_CHILDREN_no + .byte 73 # DW_AT_type + .byte 19 # DW_FORM_ref4 + .byte 0 # EOM(1) + .byte 0 # EOM(2) + .byte 7 # Abbreviation Code + .byte 19 # DW_TAG_structure_type + .byte 0 # DW_CHILDREN_no + .byte 3 # DW_AT_name + .byte 37 # DW_FORM_strx1 + .byte 60 # DW_AT_declaration + .byte 25 # DW_FORM_flag_present + .byte 0 # EOM(1) + .byte 0 # EOM(2) + .byte 8 # Abbreviation Code + .byte 15 # DW_TAG_pointer_type + .byte 0 # DW_CHILDREN_no + .byte 73 # DW_AT_type + .byte 19 # DW_FORM_ref4 + .byte 0 # EOM(1) + .byte 0 # EOM(2) + .byte 9 # Abbreviation Code + .byte 17 # DW_TAG_compile_unit + .byte 1 # DW_CHILDREN_yes + .byte 37 # DW_AT_producer + .byte 37 # DW_FORM_strx1 + .byte 19 # DW_AT_language + .byte 5 # DW_FORM_data2 + .byte 3 # DW_AT_name + .byte 37 # DW_FORM_strx1 + .byte 114 # DW_AT_str_offsets_base + .byte 23 # DW_FORM_sec_offset + .byte 16 # DW_AT_stmt_list + .byte 23 # DW_FORM_sec_offset + .byte 27 # DW_AT_comp_dir + .byte 37 # DW_FORM_strx1 + .byte 17 # DW_AT_low_pc + .byte 1 # DW_FORM_addr + .byte 85 # DW_AT_ranges + .byte 35 # DW_FORM_rnglistx + .byte 115 # DW_AT_addr_base + .byte 23 # DW_FORM_sec_offset + .byte 116 # DW_AT_rnglists_base + .byte 23 # DW_FORM_sec_offset + .byte 0 # EOM(1) + .byte 0 # EOM(2) + .byte 10 # Abbreviation Code + .byte 2 # DW_TAG_class_type + .byte 1 # DW_CHILDREN_yes + .byte 60 # DW_AT_declaration + .byte 25 # DW_FORM_flag_present + .byte 105 # DW_AT_signature + .byte 32 # DW_FORM_ref_sig8 + .byte 0 # EOM(1) + .byte 0 # EOM(2) + .byte 11 # Abbreviation Code + .byte 46 # DW_TAG_subprogram + .byte 1 # DW_CHILDREN_yes + .byte 17 # DW_AT_low_pc + .byte 27 # DW_FORM_addrx + .byte 18 # DW_AT_high_pc + .byte 6 # DW_FORM_data4 + .byte 64 # DW_AT_frame_base + .byte 24 # DW_FORM_exprloc + .byte 3 # DW_AT_name + .byte 37 # DW_FORM_strx1 + .byte 58 # DW_AT_decl_file + .byte 11 # DW_FORM_data1 + .byte 59 # DW_AT_decl_line + .byte 11 # DW_FORM_data1 + .byte 73 # DW_AT_type + .byte 19 # DW_FORM_ref4 + .byte 63 # DW_AT_external + .byte 25 # DW_FORM_flag_present + .byte 0 # EOM(1) + .byte 0 # EOM(2) + .byte 12 # Abbreviation Code + .byte 52 # DW_TAG_variable + .byte 0 # DW_CHILDREN_no + .byte 2 # DW_AT_location + .byte 24 # DW_FORM_exprloc + .byte 3 # DW_AT_name + .byte 37 # DW_FORM_strx1 + .byte 58 # DW_AT_decl_file + .byte 11 # DW_FORM_data1 + .byte 59 # DW_AT_decl_line + .byte 11 # DW_FORM_data1 + .byte 73 # DW_AT_type + .byte 19 # DW_FORM_ref4 + .byte 0 # EOM(1) + .byte 0 # EOM(2) + .byte 13 # Abbreviation Code + .byte 46 # DW_TAG_subprogram + .byte 1 # DW_CHILDREN_yes + .byte 17 # DW_AT_low_pc + .byte 27 # DW_FORM_addrx + .byte 18 # DW_AT_high_pc + .byte 6 # DW_FORM_data4 + .byte 64 # DW_AT_frame_base + .byte 24 # DW_FORM_exprloc + .byte 100 # DW_AT_object_pointer + .byte 19 # DW_FORM_ref4 + .byte 110 # DW_AT_linkage_name + .byte 37 # DW_FORM_strx1 + .byte 71 # DW_AT_specification + .byte 19 # DW_FORM_ref4 + .byte 0 # EOM(1) + .byte 0 # EOM(2) + .byte 14 # Abbreviation Code + .byte 5 # DW_TAG_formal_parameter + .byte 0 # DW_CHILDREN_no + .byte 2 # DW_AT_location + .byte 24 # DW_FORM_exprloc + .byte 3 # DW_AT_name + .byte 37 # DW_FORM_strx1 + .byte 73 # DW_AT_type + .byte 19 # DW_FORM_ref4 + .byte 52 # DW_AT_artificial + .byte 25 # DW_FORM_flag_present + .byte 0 # EOM(1) + .byte 0 # EOM(2) + .byte 15 # Abbreviation Code + .byte 36 # DW_TAG_base_type + .byte 0 # DW_CHILDREN_no + .byte 3 # DW_AT_name + .byte 37 # DW_FORM_strx1 + .byte 62 # DW_AT_encoding + .byte 11 # DW_FORM_data1 + .byte 11 # DW_AT_byte_size + .byte 11 # DW_FORM_data1 + .byte 0 # EOM(1) + .byte 0 # EOM(2) + .byte 0 # EOM(3) + .section .debug_info,"",@progbits +.Lcu_begin0: + .long .Ldebug_info_end1-.Ldebug_info_start1 # Length of Unit +.Ldebug_info_start1: + .short 5 # DWARF version number + .byte 1 # DWARF Unit Type + .byte 8 # Address Size (in bytes) + .long .debug_abbrev # Offset Into Abbrev. Section + .byte 9 # Abbrev [9] 0xc:0x7f DW_TAG_compile_unit + .byte 0 # DW_AT_producer + .short 33 # DW_AT_language + .byte 1 # DW_AT_name + .long .Lstr_offsets_base0 # DW_AT_str_offsets_base + .long .Lline_table_start0 # DW_AT_stmt_list + .byte 2 # DW_AT_comp_dir + .quad 0 # DW_AT_low_pc + .byte 0 # DW_AT_ranges + .long .Laddr_table_base0 # DW_AT_addr_base + .long .Lrnglists_table_base0 # DW_AT_rnglists_base + .byte 2 # Abbrev [2] 0x2b:0x1b DW_TAG_namespace + .byte 3 # DW_AT_name + .byte 2 # Abbrev [2] 0x2d:0x18 DW_TAG_namespace + .byte 4 # DW_AT_name + .byte 10 # Abbrev [10] 0x2f:0x15 DW_TAG_class_type + # DW_AT_declaration + .quad -1782593539102989756 # DW_AT_signature + .byte 4 # Abbrev [4] 0x38:0xb DW_TAG_subprogram + .byte 5 # DW_AT_name + .byte 0 # DW_AT_decl_file + .byte 8 # DW_AT_decl_line + # DW_AT_declaration + # DW_AT_external + .byte 1 # DW_AT_accessibility + # DW_ACCESS_public + .byte 5 # Abbrev [5] 0x3d:0x5 DW_TAG_formal_parameter + .long 97 # DW_AT_type + # DW_AT_artificial + .byte 0 # End Of Children Mark + .byte 0 # End Of Children Mark + .byte 0 # End Of Children Mark + .byte 0 # End Of Children Mark + .byte 11 # Abbrev [11] 0x46:0x1b DW_TAG_subprogram + .byte 0 # DW_AT_low_pc + .long .Lfunc_end0-.Lfunc_begin0 # DW_AT_high_pc + .byte 1 # DW_AT_frame_base + .byte 86 + .byte 7 # DW_AT_name + .byte 0 # DW_AT_decl_file + .byte 14 # DW_AT_decl_line + .long 129 # DW_AT_type + # DW_AT_external + .byte 12 # Abbrev [12] 0x55:0xb DW_TAG_variable + .byte 2 # DW_AT_location + .byte 145 + .byte 123 + .byte 10 # DW_AT_name + .byte 0 # DW_AT_decl_file + .byte 15 # DW_AT_decl_line + .long 47 # DW_AT_type + .byte 0 # End Of Children Mark + .byte 8 # Abbrev [8] 0x61:0x5 DW_TAG_pointer_type + .long 47 # DW_AT_type + .byte 13 # Abbrev [13] 0x66:0x1b DW_TAG_subprogram + .byte 1 # DW_AT_low_pc + .long .Lfunc_end1-.Lfunc_begin1 # DW_AT_high_pc + .byte 1 # DW_AT_frame_base + .byte 86 + .long 119 # DW_AT_object_pointer + .byte 9 # DW_AT_linkage_name + .long 56 # DW_AT_specification + .byte 14 # Abbrev [14] 0x77:0x9 DW_TAG_formal_parameter + .byte 2 # DW_AT_location + .byte 145 + .byte 120 + .byte 11 # DW_AT_name + .long 133 # DW_AT_type + # DW_AT_artificial + .byte 0 # End Of Children Mark + .byte 15 # Abbrev [15] 0x81:0x4 DW_TAG_base_type + .byte 8 # DW_AT_name + .byte 5 # DW_AT_encoding + .byte 4 # DW_AT_byte_size + .byte 8 # Abbrev [8] 0x85:0x5 DW_TAG_pointer_type + .long 47 # DW_AT_type + .byte 0 # End Of Children Mark +.Ldebug_info_end1: + .section .debug_rnglists,"",@progbits + .long .Ldebug_list_header_end0-.Ldebug_list_header_start0 # Length +.Ldebug_list_header_start0: + .short 5 # Version + .byte 8 # Address size + .byte 0 # Segment selector size + .long 1 # Offset entry count +.Lrnglists_table_base0: + .long .Ldebug_ranges0-.Lrnglists_table_base0 +.Ldebug_ranges0: + .byte 3 # DW_RLE_startx_length + .byte 0 # start index + .uleb128 .Lfunc_end0-.Lfunc_begin0 # length + .byte 3 # DW_RLE_startx_length + .byte 1 # start index + .uleb128 .Lfunc_end1-.Lfunc_begin1 # length + .byte 0 # DW_RLE_end_of_list +.Ldebug_list_header_end0: + .section .debug_str_offsets,"",@progbits + .long 52 # Length of String Offsets Set + .short 5 + .short 0 +.Lstr_offsets_base0: + .section .debug_str,"MS",@progbits,1 +.Linfo_string0: + .asciz "clang version 19.0.0git" # string offset=0 +.Linfo_string1: + .asciz "main.cpp" # string offset=24 +.Linfo_string2: + .asciz "/home/ayermolo/local/tasks/T190087639/DW_TAG_structure_type" # string offset=33 +.Linfo_string3: + .asciz "A" # string offset=93 +.Linfo_string4: + .asciz "B" # string offset=95 +.Linfo_string5: + .asciz "State" # string offset=97 +.Linfo_string6: + .asciz "InnerState" # string offset=103 +.Linfo_string7: + .asciz "main" # string offset=114 +.Linfo_string8: + .asciz "_ZN1A1B5StateC2Ev" # string offset=119 +.Linfo_string9: + .asciz "int" # string offset=137 +.Linfo_string10: + .asciz "S" # string offset=141 +.Linfo_string11: + .asciz "this" # string offset=143 + .section .debug_str_offsets,"",@progbits + .long .Linfo_string0 + .long .Linfo_string1 + .long .Linfo_string2 + .long .Linfo_string3 + .long .Linfo_string4 + .long .Linfo_string5 + .long .Linfo_string6 + .long .Linfo_string7 + .long .Linfo_string9 + .long .Linfo_string8 + .long .Linfo_string10 + .long .Linfo_string11 + .section .debug_addr,"",@progbits + .long .Ldebug_addr_end0-.Ldebug_addr_start0 # Length of contribution +.Ldebug_addr_start0: + .short 5 # DWARF version number + .byte 8 # Address size + .byte 0 # Segment selector size +.Laddr_table_base0: + .quad .Lfunc_begin0 + .quad .Lfunc_begin1 +.Ldebug_addr_end0: + .section .debug_names,"",@progbits + .long .Lnames_end0-.Lnames_start0 # Header: unit length +.Lnames_start0: + .short 5 # Header: version + .short 0 # Header: padding + .long 1 # Header: compilation unit count + .long 1 # Header: local type unit count + .long 0 # Header: foreign type unit count + .long 6 # Header: bucket count + .long 6 # Header: name count + .long .Lnames_abbrev_end0-.Lnames_abbrev_start0 # Header: abbreviation table size + .long 8 # Header: augmentation string size + .ascii "LLVM0700" # Header: augmentation string + .long .Lcu_begin0 # Compilation unit 0 + .long .Ltu_begin0 # Type unit 0 + .long 0 # Bucket 0 + .long 0 # Bucket 1 + .long 1 # Bucket 2 + .long 2 # Bucket 3 + .long 3 # Bucket 4 + .long 6 # Bucket 5 + .long 193495088 # Hash in Bucket 2 + .long 1059643959 # Hash in Bucket 3 + .long 177670 # Hash in Bucket 4 + .long 274811398 # Hash in Bucket 4 + .long 2090499946 # Hash in Bucket 4 + .long 177671 # Hash in Bucket 5 + .long .Linfo_string9 # String in Bucket 2: int + .long .Linfo_string8 # String in Bucket 3: _ZN1A1B5StateC2Ev + .long .Linfo_string3 # String in Bucket 4: A + .long .Linfo_string5 # String in Bucket 4: State + .long .Linfo_string7 # String in Bucket 4: main + .long .Linfo_string4 # String in Bucket 5: B + .long .Lnames5-.Lnames_entries0 # Offset in Bucket 2 + .long .Lnames4-.Lnames_entries0 # Offset in Bucket 3 + .long .Lnames0-.Lnames_entries0 # Offset in Bucket 4 + .long .Lnames2-.Lnames_entries0 # Offset in Bucket 4 + .long .Lnames3-.Lnames_entries0 # Offset in Bucket 4 + .long .Lnames1-.Lnames_entries0 # Offset in Bucket 5 +.Lnames_abbrev_start0: + .byte 1 # Abbrev code + .byte 36 # DW_TAG_base_type + .byte 3 # DW_IDX_die_offset + .byte 19 # DW_FORM_ref4 + .byte 4 # DW_IDX_parent + .byte 25 # DW_FORM_flag_present + .byte 0 # End of abbrev + .byte 0 # End of abbrev + .byte 2 # Abbrev code + .byte 46 # DW_TAG_subprogram + .byte 3 # DW_IDX_die_offset + .byte 19 # DW_FORM_ref4 + .byte 4 # DW_IDX_parent + .byte 25 # DW_FORM_flag_present + .byte 0 # End of abbrev + .byte 0 # End of abbrev + .byte 3 # Abbrev code + .byte 57 # DW_TAG_namespace + .byte 2 # DW_IDX_type_unit + .byte 11 # DW_FORM_data1 + .byte 3 # DW_IDX_die_offset + .byte 19 # DW_FORM_ref4 + .byte 4 # DW_IDX_parent + .byte 25 # DW_FORM_flag_present + .byte 0 # End of abbrev + .byte 0 # End of abbrev + .byte 4 # Abbrev code + .byte 57 # DW_TAG_namespace + .byte 3 # DW_IDX_die_offset + .byte 19 # DW_FORM_ref4 + .byte 4 # DW_IDX_parent + .byte 25 # DW_FORM_flag_present + .byte 0 # End of abbrev + .byte 0 # End of abbrev + .byte 5 # Abbrev code + .byte 2 # DW_TAG_class_type + .byte 2 # DW_IDX_type_unit + .byte 11 # DW_FORM_data1 + .byte 3 # DW_IDX_die_offset + .byte 19 # DW_FORM_ref4 + .byte 4 # DW_IDX_parent + .byte 19 # DW_FORM_ref4 + .byte 0 # End of abbrev + .byte 0 # End of abbrev + .byte 6 # Abbrev code + .byte 57 # DW_TAG_namespace + .byte 2 # DW_IDX_type_unit + .byte 11 # DW_FORM_data1 + .byte 3 # DW_IDX_die_offset + .byte 19 # DW_FORM_ref4 + .byte 4 # DW_IDX_parent + .byte 19 # DW_FORM_ref4 + .byte 0 # End of abbrev + .byte 0 # End of abbrev + .byte 7 # Abbrev code + .byte 57 # DW_TAG_namespace + .byte 3 # DW_IDX_die_offset + .byte 19 # DW_FORM_ref4 + .byte 4 # DW_IDX_parent + .byte 19 # DW_FORM_ref4 + .byte 0 # End of abbrev + .byte 0 # End of abbrev + .byte 0 # End of abbrev list +.Lnames_abbrev_end0: +.Lnames_entries0: +.Lnames5: +.L2: + .byte 1 # Abbreviation code + .long 129 # DW_IDX_die_offset + .byte 0 # DW_IDX_parent + # End of list: int +.Lnames4: +.L3: + .byte 2 # Abbreviation code + .long 102 # DW_IDX_die_offset + .byte 0 # DW_IDX_parent + # End of list: _ZN1A1B5StateC2Ev +.Lnames0: +.L4: + .byte 3 # Abbreviation code + .byte 0 # DW_IDX_type_unit + .long 35 # DW_IDX_die_offset +.L7: # DW_IDX_parent + .byte 4 # Abbreviation code + .long 43 # DW_IDX_die_offset + .byte 0 # DW_IDX_parent + # End of list: A +.Lnames2: +.L1: + .byte 5 # Abbreviation code + .byte 0 # DW_IDX_type_unit + .long 39 # DW_IDX_die_offset + .long .L5-.Lnames_entries0 # DW_IDX_parent + .byte 2 # Abbreviation code + .long 102 # DW_IDX_die_offset + .byte 0 # DW_IDX_parent + # End of list: State +.Lnames3: +.L0: + .byte 2 # Abbreviation code + .long 70 # DW_IDX_die_offset + .byte 0 # DW_IDX_parent + # End of list: main +.Lnames1: +.L5: + .byte 6 # Abbreviation code + .byte 0 # DW_IDX_type_unit + .long 37 # DW_IDX_die_offset + .long .L4-.Lnames_entries0 # DW_IDX_parent +.L6: + .byte 7 # Abbreviation code + .long 45 # DW_IDX_die_offset + .long .L7-.Lnames_entries0 # DW_IDX_parent + .byte 0 # End of list: B + .p2align 2, 0x0 +.Lnames_end0: + .ident "clang version 19.0.0git" + .section ".note.GNU-stack","",@progbits + .addrsig + .section .debug_line,"",@progbits +.Lline_table_start0: diff --git a/bolt/unittests/CMakeLists.txt b/bolt/unittests/CMakeLists.txt index 77159e92dec55..64414b83d39fe 100644 --- a/bolt/unittests/CMakeLists.txt +++ b/bolt/unittests/CMakeLists.txt @@ -1,5 +1,5 @@ add_custom_target(BoltUnitTests) -set_target_properties(BoltUnitTests PROPERTIES FOLDER "BOLT tests") +set_target_properties(BoltUnitTests PROPERTIES FOLDER "BOLT/Tests") function(add_bolt_unittest test_dirname) add_unittest(BoltUnitTests ${test_dirname} ${ARGN}) diff --git a/clang-tools-extra/CMakeLists.txt b/clang-tools-extra/CMakeLists.txt index 6a3f741721ee6..f6a6b57b5ef0b 100644 --- a/clang-tools-extra/CMakeLists.txt +++ b/clang-tools-extra/CMakeLists.txt @@ -1,3 +1,5 @@ +set(LLVM_SUBPROJECT_TITLE "Clang Tools Extra") + include(CMakeDependentOption) include(GNUInstallDirs) diff --git a/clang-tools-extra/clang-tidy/CMakeLists.txt b/clang-tools-extra/clang-tidy/CMakeLists.txt index 7e1905aa897b7..430ea4cdbb38e 100644 --- a/clang-tools-extra/clang-tidy/CMakeLists.txt +++ b/clang-tools-extra/clang-tidy/CMakeLists.txt @@ -121,7 +121,7 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY) PATTERN "*.h" ) add_custom_target(clang-tidy-headers) - set_target_properties(clang-tidy-headers PROPERTIES FOLDER "Misc") + set_target_properties(clang-tidy-headers PROPERTIES FOLDER "Clang Tools Extra/Resources") if(NOT LLVM_ENABLE_IDE) add_llvm_install_targets(install-clang-tidy-headers DEPENDS clang-tidy-headers diff --git a/clang-tools-extra/clang-tidy/misc/CMakeLists.txt b/clang-tools-extra/clang-tidy/misc/CMakeLists.txt index d9ec268650c05..35e29b9a7d136 100644 --- a/clang-tools-extra/clang-tidy/misc/CMakeLists.txt +++ b/clang-tools-extra/clang-tidy/misc/CMakeLists.txt @@ -15,6 +15,7 @@ add_custom_command( DEPENDS ${clang_tidy_confusable_chars_gen_target} ConfusableTable/confusables.txt) add_custom_target(genconfusable DEPENDS Confusables.inc) +set_target_properties(genconfusable PROPERTIES FOLDER "Clang Tools Extra/Sourcegenning") add_clang_library(clangTidyMiscModule ConstCorrectnessCheck.cpp diff --git a/clang-tools-extra/clang-tidy/readability/ImplicitBoolConversionCheck.cpp b/clang-tools-extra/clang-tidy/readability/ImplicitBoolConversionCheck.cpp index 74152c6034510..28f5eada6d825 100644 --- a/clang-tools-extra/clang-tidy/readability/ImplicitBoolConversionCheck.cpp +++ b/clang-tools-extra/clang-tidy/readability/ImplicitBoolConversionCheck.cpp @@ -50,7 +50,9 @@ StringRef getZeroLiteralToCompareWithForType(CastKind CastExprKind, case CK_PointerToBoolean: case CK_MemberPointerToBoolean: // Fall-through on purpose. - return Context.getLangOpts().CPlusPlus11 ? "nullptr" : "0"; + return (Context.getLangOpts().CPlusPlus11 || Context.getLangOpts().C23) + ? "nullptr" + : "0"; default: llvm_unreachable("Unexpected cast kind"); @@ -165,6 +167,12 @@ bool needsSpacePrefix(SourceLocation Loc, ASTContext &Context) { void fixGenericExprCastFromBool(DiagnosticBuilder &Diag, const ImplicitCastExpr *Cast, ASTContext &Context, StringRef OtherType) { + if (!Context.getLangOpts().CPlusPlus) { + Diag << FixItHint::CreateInsertion(Cast->getBeginLoc(), + (Twine("(") + OtherType + ")").str()); + return; + } + const Expr *SubExpr = Cast->getSubExpr(); const bool NeedParens = !isa(SubExpr->IgnoreImplicit()); const bool NeedSpace = needsSpacePrefix(Cast->getBeginLoc(), Context); @@ -267,6 +275,10 @@ void ImplicitBoolConversionCheck::registerMatchers(MatchFinder *Finder) { auto BoolXor = binaryOperator(hasOperatorName("^"), hasLHS(ImplicitCastFromBool), hasRHS(ImplicitCastFromBool)); + auto ComparisonInCall = allOf( + hasParent(callExpr()), + hasSourceExpression(binaryOperator(hasAnyOperatorName("==", "!=")))); + Finder->addMatcher( traverse(TK_AsIs, implicitCastExpr( @@ -281,6 +293,8 @@ void ImplicitBoolConversionCheck::registerMatchers(MatchFinder *Finder) { stmt(anyOf(ifStmt(), whileStmt()), has(declStmt())))), // Exclude cases common to implicit cast to and from bool. unless(ExceptionCases), unless(has(BoolXor)), + // Exclude C23 cases common to implicit cast to bool. + unless(ComparisonInCall), // Retrieve also parent statement, to check if we need // additional parens in replacement. optionally(hasParent(stmt().bind("parentStmt"))), diff --git a/clang-tools-extra/clangd/unittests/CMakeLists.txt b/clang-tools-extra/clangd/unittests/CMakeLists.txt index 7f1ae5c43d80c..0d4628ccf25d8 100644 --- a/clang-tools-extra/clangd/unittests/CMakeLists.txt +++ b/clang-tools-extra/clangd/unittests/CMakeLists.txt @@ -29,6 +29,7 @@ include(${CMAKE_CURRENT_SOURCE_DIR}/../quality/CompletionModel.cmake) gen_decision_forest(${CMAKE_CURRENT_SOURCE_DIR}/decision_forest_model DecisionForestRuntimeTest ::ns1::ns2::test::Example) add_custom_target(ClangdUnitTests) +set_target_properties(ClangdUnitTests PROPERTIES FOLDER "Clang Tools Extra/Tests") add_unittest(ClangdUnitTests ClangdTests Annotations.cpp ASTTests.cpp diff --git a/clang-tools-extra/clangd/unittests/ClangdTests.cpp b/clang-tools-extra/clangd/unittests/ClangdTests.cpp index 864337b98f446..c324643498d94 100644 --- a/clang-tools-extra/clangd/unittests/ClangdTests.cpp +++ b/clang-tools-extra/clangd/unittests/ClangdTests.cpp @@ -392,7 +392,7 @@ TEST(ClangdServerTest, SearchLibDir) { ErrorCheckingCallbacks DiagConsumer; MockCompilationDatabase CDB; CDB.ExtraClangFlags.insert(CDB.ExtraClangFlags.end(), - {"-xc++", "-target", "x86_64-linux-unknown", + {"-xc++", "--target=x86_64-unknown-linux-gnu", "-m64", "--gcc-toolchain=/randomusr", "-stdlib=libstdc++"}); ClangdServer Server(CDB, FS, ClangdServer::optsForTest(), &DiagConsumer); diff --git a/clang-tools-extra/docs/CMakeLists.txt b/clang-tools-extra/docs/CMakeLists.txt index 8f442e1f661ed..272db266b5054 100644 --- a/clang-tools-extra/docs/CMakeLists.txt +++ b/clang-tools-extra/docs/CMakeLists.txt @@ -77,6 +77,7 @@ if (DOXYGEN_FOUND) COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/doxygen.cfg WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMENT "Generating clang doxygen documentation." VERBATIM) + set_target_properties(doxygen-clang-tools PROPERTIES FOLDER "Clang Tools Extra/Docs") if (LLVM_BUILD_DOCS) add_dependencies(doxygen doxygen-clang-tools) diff --git a/clang-tools-extra/docs/ReleaseNotes.rst b/clang-tools-extra/docs/ReleaseNotes.rst index 741abc0a199a7..3e3195f6f6813 100644 --- a/clang-tools-extra/docs/ReleaseNotes.rst +++ b/clang-tools-extra/docs/ReleaseNotes.rst @@ -381,7 +381,9 @@ Changes in existing checks - Improved :doc:`readability-implicit-bool-conversion ` check to provide valid fix suggestions for ``static_cast`` without a preceding space and - fixed problem with duplicate parentheses in double implicit casts. + fixed problem with duplicate parentheses in double implicit casts. Corrected + the fix suggestions for C23 and later by using C-style casts instead of + ``static_cast``. - Improved :doc:`readability-redundant-inline-specifier ` check to properly diff --git a/clang-tools-extra/docs/clang-tidy/checks/readability/implicit-bool-conversion.rst b/clang-tools-extra/docs/clang-tidy/checks/readability/implicit-bool-conversion.rst index 1ea67a0b55e96..1ab21ffeb4228 100644 --- a/clang-tools-extra/docs/clang-tidy/checks/readability/implicit-bool-conversion.rst +++ b/clang-tools-extra/docs/clang-tidy/checks/readability/implicit-bool-conversion.rst @@ -96,8 +96,8 @@ The rules for generating fix-it hints are: - ``if (!pointer)`` is changed to ``if (pointer == nullptr)``, - in case of conversions from bool to other built-in types, an explicit - ``static_cast`` is proposed to make it clear that a conversion is taking - place: + ``static_cast`` (or a C-style cast since C23) is proposed to make it clear + that a conversion is taking place: - ``int integer = boolean;`` is changed to ``int integer = static_cast(boolean);``, diff --git a/clang-tools-extra/include-cleaner/unittests/CMakeLists.txt b/clang-tools-extra/include-cleaner/unittests/CMakeLists.txt index 1e89534b51116..416535649f622 100644 --- a/clang-tools-extra/include-cleaner/unittests/CMakeLists.txt +++ b/clang-tools-extra/include-cleaner/unittests/CMakeLists.txt @@ -4,6 +4,7 @@ set(LLVM_LINK_COMPONENTS ) add_custom_target(ClangIncludeCleanerUnitTests) +set_target_properties(ClangIncludeCleanerUnitTests PROPERTIES FOLDER "Clang Tools Extra/Tests") add_unittest(ClangIncludeCleanerUnitTests ClangIncludeCleanerTests AnalysisTest.cpp FindHeadersTest.cpp diff --git a/clang-tools-extra/pseudo/include/CMakeLists.txt b/clang-tools-extra/pseudo/include/CMakeLists.txt index 2334cfa12e337..619b00f34a5ca 100644 --- a/clang-tools-extra/pseudo/include/CMakeLists.txt +++ b/clang-tools-extra/pseudo/include/CMakeLists.txt @@ -29,3 +29,4 @@ add_custom_command(OUTPUT ${cxx_bnf_inc} add_custom_target(cxx_gen DEPENDS ${cxx_symbols_inc} ${cxx_bnf_inc} VERBATIM) +set_target_properties(cxx_gen PROPERTIES FOLDER "Clang Tools Extra/Sourcegenning") diff --git a/clang-tools-extra/pseudo/tool/CMakeLists.txt b/clang-tools-extra/pseudo/tool/CMakeLists.txt index 49e1dc29a5a4e..bead383228396 100644 --- a/clang-tools-extra/pseudo/tool/CMakeLists.txt +++ b/clang-tools-extra/pseudo/tool/CMakeLists.txt @@ -26,4 +26,5 @@ add_custom_command(OUTPUT HTMLForestResources.inc DEPENDS ${CLANG_SOURCE_DIR}/utils/bundle_resources.py HTMLForest.css HTMLForest.js HTMLForest.html VERBATIM) add_custom_target(clang-pseudo-resources DEPENDS HTMLForestResources.inc) +set_target_properties(clang-pseudo-resources PROPERTIES FOLDER "Clang Tools Extra/Resources") add_dependencies(clang-pseudo clang-pseudo-resources) diff --git a/clang-tools-extra/pseudo/unittests/CMakeLists.txt b/clang-tools-extra/pseudo/unittests/CMakeLists.txt index 821ca4d0652e1..53583ceb61864 100644 --- a/clang-tools-extra/pseudo/unittests/CMakeLists.txt +++ b/clang-tools-extra/pseudo/unittests/CMakeLists.txt @@ -3,6 +3,7 @@ set(LLVM_LINK_COMPONENTS ) add_custom_target(ClangPseudoUnitTests) +set_target_properties(ClangPseudoUnitTests PROPERTIES FOLDER "Clang Tools Extra/Tests") add_unittest(ClangPseudoUnitTests ClangPseudoTests BracketTest.cpp CXXTest.cpp diff --git a/clang-tools-extra/test/CMakeLists.txt b/clang-tools-extra/test/CMakeLists.txt index 7a1c168e22f97..50546f62259ca 100644 --- a/clang-tools-extra/test/CMakeLists.txt +++ b/clang-tools-extra/test/CMakeLists.txt @@ -97,7 +97,6 @@ add_lit_testsuite(check-clang-extra "Running clang-tools-extra/test" ${CMAKE_CURRENT_BINARY_DIR} DEPENDS ${CLANG_TOOLS_TEST_DEPS} ) -set_target_properties(check-clang-extra PROPERTIES FOLDER "Clang extra tools' tests") add_lit_testsuites(CLANG-EXTRA ${CMAKE_CURRENT_SOURCE_DIR} DEPENDS ${CLANG_TOOLS_TEST_DEPS} diff --git a/clang-tools-extra/test/clang-tidy/checkers/readability/implicit-bool-conversion.c b/clang-tools-extra/test/clang-tidy/checkers/readability/implicit-bool-conversion.c new file mode 100644 index 0000000000000..a8c69858f76b6 --- /dev/null +++ b/clang-tools-extra/test/clang-tidy/checkers/readability/implicit-bool-conversion.c @@ -0,0 +1,354 @@ +// RUN: %check_clang_tidy %s readability-implicit-bool-conversion %t -- -- -std=c23 + +#undef NULL +#define NULL 0L + +void functionTakingBool(bool); +void functionTakingInt(int); +void functionTakingUnsignedLong(unsigned long); +void functionTakingChar(char); +void functionTakingFloat(float); +void functionTakingDouble(double); +void functionTakingSignedChar(signed char); + + +////////// Implicit conversion from bool. + +void implicitConversionFromBoolSimpleCases() { + bool boolean = true; + + functionTakingBool(boolean); + + functionTakingInt(boolean); + // CHECK-MESSAGES: :[[@LINE-1]]:21: warning: implicit conversion 'bool' -> 'int' [readability-implicit-bool-conversion] + // CHECK-FIXES: functionTakingInt((int)boolean); + + functionTakingUnsignedLong(boolean); + // CHECK-MESSAGES: :[[@LINE-1]]:30: warning: implicit conversion 'bool' -> 'unsigned long' + // CHECK-FIXES: functionTakingUnsignedLong((unsigned long)boolean); + + functionTakingChar(boolean); + // CHECK-MESSAGES: :[[@LINE-1]]:22: warning: implicit conversion 'bool' -> 'char' + // CHECK-FIXES: functionTakingChar((char)boolean); + + functionTakingFloat(boolean); + // CHECK-MESSAGES: :[[@LINE-1]]:23: warning: implicit conversion 'bool' -> 'float' + // CHECK-FIXES: functionTakingFloat((float)boolean); + + functionTakingDouble(boolean); + // CHECK-MESSAGES: :[[@LINE-1]]:24: warning: implicit conversion 'bool' -> 'double' + // CHECK-FIXES: functionTakingDouble((double)boolean); +} + +float implicitConversionFromBoolInReturnValue() { + bool boolean = false; + return boolean; + // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: implicit conversion 'bool' -> 'float' + // CHECK-FIXES: return (float)boolean; +} + +void implicitConversionFromBoolInSingleBoolExpressions(bool b1, bool b2) { + bool boolean = true; + boolean = b1 ^ b2; + boolean |= !b1 || !b2; + boolean &= b1; + + int integer = boolean - 3; + // CHECK-MESSAGES: :[[@LINE-1]]:17: warning: implicit conversion 'bool' -> 'int' + // CHECK-FIXES: int integer = (int)boolean - 3; + + float floating = boolean / 0.3f; + // CHECK-MESSAGES: :[[@LINE-1]]:20: warning: implicit conversion 'bool' -> 'float' + // CHECK-FIXES: float floating = (float)boolean / 0.3f; + + char character = boolean; + // CHECK-MESSAGES: :[[@LINE-1]]:20: warning: implicit conversion 'bool' -> 'char' + // CHECK-FIXES: char character = (char)boolean; +} + +void implicitConversionFromBoolInComplexBoolExpressions() { + bool boolean = true; + bool anotherBoolean = false; + + int integer = boolean && anotherBoolean; + // CHECK-MESSAGES: :[[@LINE-1]]:17: warning: implicit conversion 'bool' -> 'int' + // CHECK-MESSAGES: :[[@LINE-2]]:28: warning: implicit conversion 'bool' -> 'int' + // CHECK-FIXES: int integer = (int)boolean && (int)anotherBoolean; + + float floating = (boolean || anotherBoolean) * 0.3f; + // CHECK-MESSAGES: :[[@LINE-1]]:21: warning: implicit conversion 'bool' -> 'int' + // CHECK-MESSAGES: :[[@LINE-2]]:32: warning: implicit conversion 'bool' -> 'int' + // CHECK-FIXES: float floating = ((int)boolean || (int)anotherBoolean) * 0.3f; + + double doubleFloating = (boolean && (anotherBoolean || boolean)) * 0.3; + // CHECK-MESSAGES: :[[@LINE-1]]:28: warning: implicit conversion 'bool' -> 'int' + // CHECK-MESSAGES: :[[@LINE-2]]:40: warning: implicit conversion 'bool' -> 'int' + // CHECK-MESSAGES: :[[@LINE-3]]:58: warning: implicit conversion 'bool' -> 'int' + // CHECK-FIXES: double doubleFloating = ((int)boolean && ((int)anotherBoolean || (int)boolean)) * 0.3; +} + +void implicitConversionFromBoolLiterals() { + functionTakingInt(true); + // CHECK-MESSAGES: :[[@LINE-1]]:21: warning: implicit conversion 'bool' -> 'int' + // CHECK-FIXES: functionTakingInt(1); + + functionTakingUnsignedLong(false); + // CHECK-MESSAGES: :[[@LINE-1]]:30: warning: implicit conversion 'bool' -> 'unsigned long' + // CHECK-FIXES: functionTakingUnsignedLong(0u); + + functionTakingSignedChar(true); + // CHECK-MESSAGES: :[[@LINE-1]]:28: warning: implicit conversion 'bool' -> 'signed char' + // CHECK-FIXES: functionTakingSignedChar(1); + + functionTakingFloat(false); + // CHECK-MESSAGES: :[[@LINE-1]]:23: warning: implicit conversion 'bool' -> 'float' + // CHECK-FIXES: functionTakingFloat(0.0f); + + functionTakingDouble(true); + // CHECK-MESSAGES: :[[@LINE-1]]:24: warning: implicit conversion 'bool' -> 'double' + // CHECK-FIXES: functionTakingDouble(1.0); +} + +void implicitConversionFromBoolInComparisons() { + bool boolean = true; + int integer = 0; + + functionTakingBool(boolean == integer); + // CHECK-MESSAGES: :[[@LINE-1]]:22: warning: implicit conversion 'bool' -> 'int' + // CHECK-FIXES: functionTakingBool((int)boolean == integer); + + functionTakingBool(integer != boolean); + // CHECK-MESSAGES: :[[@LINE-1]]:33: warning: implicit conversion 'bool' -> 'int' + // CHECK-FIXES: functionTakingBool(integer != (int)boolean); +} + +void ignoreBoolComparisons() { + bool boolean = true; + bool anotherBoolean = false; + + functionTakingBool(boolean == anotherBoolean); + functionTakingBool(boolean != anotherBoolean); +} + +void ignoreExplicitCastsFromBool() { + bool boolean = true; + + int integer = (int)boolean + 3; + float floating = (float)boolean * 0.3f; + char character = (char)boolean; +} + +void ignoreImplicitConversionFromBoolInMacroExpansions() { + bool boolean = true; + + #define CAST_FROM_BOOL_IN_MACRO_BODY boolean + 3 + int integerFromMacroBody = CAST_FROM_BOOL_IN_MACRO_BODY; + + #define CAST_FROM_BOOL_IN_MACRO_ARGUMENT(x) x + 3 + int integerFromMacroArgument = CAST_FROM_BOOL_IN_MACRO_ARGUMENT(boolean); +} + +////////// Implicit conversions to bool. + +void implicitConversionToBoolSimpleCases() { + int integer = 10; + functionTakingBool(integer); + // CHECK-MESSAGES: :[[@LINE-1]]:22: warning: implicit conversion 'int' -> 'bool' + // CHECK-FIXES: functionTakingBool(integer != 0); + + unsigned long unsignedLong = 10; + functionTakingBool(unsignedLong); + // CHECK-MESSAGES: :[[@LINE-1]]:22: warning: implicit conversion 'unsigned long' -> 'bool' + // CHECK-FIXES: functionTakingBool(unsignedLong != 0u); + + float floating = 0.0f; + functionTakingBool(floating); + // CHECK-MESSAGES: :[[@LINE-1]]:22: warning: implicit conversion 'float' -> 'bool' + // CHECK-FIXES: functionTakingBool(floating != 0.0f); + + double doubleFloating = 1.0f; + functionTakingBool(doubleFloating); + // CHECK-MESSAGES: :[[@LINE-1]]:22: warning: implicit conversion 'double' -> 'bool' + // CHECK-FIXES: functionTakingBool(doubleFloating != 0.0); + + signed char character = 'a'; + functionTakingBool(character); + // CHECK-MESSAGES: :[[@LINE-1]]:22: warning: implicit conversion 'signed char' -> 'bool' + // CHECK-FIXES: functionTakingBool(character != 0); + + int* pointer = nullptr; + functionTakingBool(pointer); + // CHECK-MESSAGES: :[[@LINE-1]]:22: warning: implicit conversion 'int *' -> 'bool' + // CHECK-FIXES: functionTakingBool(pointer != nullptr); +} + +void implicitConversionToBoolInSingleExpressions() { + int integer = 10; + bool boolComingFromInt; + boolComingFromInt = integer; + // CHECK-MESSAGES: :[[@LINE-1]]:23: warning: implicit conversion 'int' -> 'bool' + // CHECK-FIXES: boolComingFromInt = (integer != 0); + + float floating = 10.0f; + bool boolComingFromFloat; + boolComingFromFloat = floating; + // CHECK-MESSAGES: :[[@LINE-1]]:25: warning: implicit conversion 'float' -> 'bool' + // CHECK-FIXES: boolComingFromFloat = (floating != 0.0f); + + signed char character = 'a'; + bool boolComingFromChar; + boolComingFromChar = character; + // CHECK-MESSAGES: :[[@LINE-1]]:24: warning: implicit conversion 'signed char' -> 'bool' + // CHECK-FIXES: boolComingFromChar = (character != 0); + + int* pointer = nullptr; + bool boolComingFromPointer; + boolComingFromPointer = pointer; + // CHECK-MESSAGES: :[[@LINE-1]]:27: warning: implicit conversion 'int *' -> 'bool' + // CHECK-FIXES: boolComingFromPointer = (pointer != nullptr); +} + +void implicitConversionToBoolInComplexExpressions() { + bool boolean = true; + + int integer = 10; + int anotherInteger = 20; + bool boolComingFromInteger; + boolComingFromInteger = integer + anotherInteger; + // CHECK-MESSAGES: :[[@LINE-1]]:27: warning: implicit conversion 'int' -> 'bool' + // CHECK-FIXES: boolComingFromInteger = ((integer + anotherInteger) != 0); +} + +void implicitConversionInNegationExpressions() { + int integer = 10; + bool boolComingFromNegatedInt; + boolComingFromNegatedInt = !integer; + // CHECK-MESSAGES: :[[@LINE-1]]:30: warning: implicit conversion 'int' -> 'bool' + // CHECK-FIXES: boolComingFromNegatedInt = ((!integer) != 0); +} + +bool implicitConversionToBoolInReturnValue() { + float floating = 1.0f; + return floating; + // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: implicit conversion 'float' -> 'bool' + // CHECK-FIXES: return floating != 0.0f; +} + +void implicitConversionToBoolFromLiterals() { + functionTakingBool(0); + // CHECK-MESSAGES: :[[@LINE-1]]:22: warning: implicit conversion 'int' -> 'bool' + // CHECK-FIXES: functionTakingBool(false); + + functionTakingBool(1); + // CHECK-MESSAGES: :[[@LINE-1]]:22: warning: implicit conversion 'int' -> 'bool' + // CHECK-FIXES: functionTakingBool(true); + + functionTakingBool(2ul); + // CHECK-MESSAGES: :[[@LINE-1]]:22: warning: implicit conversion 'unsigned long' -> 'bool' + // CHECK-FIXES: functionTakingBool(true); + + functionTakingBool(0.0f); + // CHECK-MESSAGES: :[[@LINE-1]]:22: warning: implicit conversion 'float' -> 'bool' + // CHECK-FIXES: functionTakingBool(false); + + functionTakingBool(1.0f); + // CHECK-MESSAGES: :[[@LINE-1]]:22: warning: implicit conversion 'float' -> 'bool' + // CHECK-FIXES: functionTakingBool(true); + + functionTakingBool(2.0); + // CHECK-MESSAGES: :[[@LINE-1]]:22: warning: implicit conversion 'double' -> 'bool' + // CHECK-FIXES: functionTakingBool(true); + + functionTakingBool('\0'); + // CHECK-MESSAGES: :[[@LINE-1]]:22: warning: implicit conversion 'int' -> 'bool' + // CHECK-FIXES: functionTakingBool(false); + + functionTakingBool('a'); + // CHECK-MESSAGES: :[[@LINE-1]]:22: warning: implicit conversion 'int' -> 'bool' + // CHECK-FIXES: functionTakingBool(true); + + functionTakingBool(""); + // CHECK-MESSAGES: :[[@LINE-1]]:22: warning: implicit conversion 'char *' -> 'bool' + // CHECK-FIXES: functionTakingBool(true); + + functionTakingBool("abc"); + // CHECK-MESSAGES: :[[@LINE-1]]:22: warning: implicit conversion 'char *' -> 'bool' + // CHECK-FIXES: functionTakingBool(true); + + functionTakingBool(NULL); + // CHECK-MESSAGES: :[[@LINE-1]]:22: warning: implicit conversion 'long' -> 'bool' + // CHECK-FIXES: functionTakingBool(false); +} + +void implicitConversionToBoolFromUnaryMinusAndZeroLiterals() { + functionTakingBool(-0); + // CHECK-MESSAGES: :[[@LINE-1]]:22: warning: implicit conversion 'int' -> 'bool' + // CHECK-FIXES: functionTakingBool((-0) != 0); + + functionTakingBool(-0.0f); + // CHECK-MESSAGES: :[[@LINE-1]]:22: warning: implicit conversion 'float' -> 'bool' + // CHECK-FIXES: functionTakingBool((-0.0f) != 0.0f); + + functionTakingBool(-0.0); + // CHECK-MESSAGES: :[[@LINE-1]]:22: warning: implicit conversion 'double' -> 'bool' + // CHECK-FIXES: functionTakingBool((-0.0) != 0.0); +} + +void ignoreExplicitCastsToBool() { + int integer = 10; + bool boolComingFromInt = (bool)integer; + + float floating = 10.0f; + bool boolComingFromFloat = (bool)floating; + + char character = 'a'; + bool boolComingFromChar = (bool)character; + + int* pointer = nullptr; + bool booleanComingFromPointer = (bool)pointer; +} + +void ignoreImplicitConversionToBoolInMacroExpansions() { + int integer = 3; + + #define CAST_TO_BOOL_IN_MACRO_BODY integer && false + bool boolFromMacroBody = CAST_TO_BOOL_IN_MACRO_BODY; + + #define CAST_TO_BOOL_IN_MACRO_ARGUMENT(x) x || true + bool boolFromMacroArgument = CAST_TO_BOOL_IN_MACRO_ARGUMENT(integer); +} + +int implicitConversionReturnInt() +{ + return true; + // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: implicit conversion 'bool' -> 'int' + // CHECK-FIXES: return 1 +} + +int implicitConversionReturnIntWithParens() +{ + return (true); + // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: implicit conversion 'bool' -> 'int' + // CHECK-FIXES: return 1 +} + +bool implicitConversionReturnBool() +{ + return 1; + // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: implicit conversion 'int' -> 'bool' + // CHECK-FIXES: return true +} + +bool implicitConversionReturnBoolWithParens() +{ + return (1); + // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: implicit conversion 'int' -> 'bool' + // CHECK-FIXES: return true +} + +int keepCompactReturnInC_PR71848() { + bool foo = false; + return( foo ); +// CHECK-MESSAGES: :[[@LINE-1]]:9: warning: implicit conversion 'bool' -> 'int' [readability-implicit-bool-conversion] +// CHECK-FIXES: return(int)( foo ); +} diff --git a/clang-tools-extra/unittests/CMakeLists.txt b/clang-tools-extra/unittests/CMakeLists.txt index 086a68e638307..77311540e719f 100644 --- a/clang-tools-extra/unittests/CMakeLists.txt +++ b/clang-tools-extra/unittests/CMakeLists.txt @@ -1,5 +1,5 @@ add_custom_target(ExtraToolsUnitTests) -set_target_properties(ExtraToolsUnitTests PROPERTIES FOLDER "Extra Tools Unit Tests") +set_target_properties(ExtraToolsUnitTests PROPERTIES FOLDER "Clang Tools Extra/Tests") function(add_extra_unittest test_dirname) add_unittest(ExtraToolsUnitTests ${test_dirname} ${ARGN}) diff --git a/clang/CMakeLists.txt b/clang/CMakeLists.txt index 354d70b95e899..d45623b27ec55 100644 --- a/clang/CMakeLists.txt +++ b/clang/CMakeLists.txt @@ -1,4 +1,5 @@ cmake_minimum_required(VERSION 3.20.0) +set(LLVM_SUBPROJECT_TITLE "Clang") if(NOT DEFINED LLVM_COMMON_CMAKE_UTILS) set(LLVM_COMMON_CMAKE_UTILS ${CMAKE_CURRENT_SOURCE_DIR}/../cmake) @@ -351,10 +352,7 @@ if (LLVM_COMPILER_IS_GCC_COMPATIBLE) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic -Wno-long-long") endif () - check_cxx_compiler_flag("-Werror -Wnested-anon-types" CXX_SUPPORTS_NO_NESTED_ANON_TYPES_FLAG) - if( CXX_SUPPORTS_NO_NESTED_ANON_TYPES_FLAG ) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-nested-anon-types" ) - endif() + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-nested-anon-types" ) endif () # Determine HOST_LINK_VERSION on Darwin. @@ -399,7 +397,7 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY) # Installing the headers needs to depend on generating any public # tablegen'd headers. add_custom_target(clang-headers DEPENDS clang-tablegen-targets) - set_target_properties(clang-headers PROPERTIES FOLDER "Misc") + set_target_properties(clang-headers PROPERTIES FOLDER "Clang/Resources") if(NOT LLVM_ENABLE_IDE) add_llvm_install_targets(install-clang-headers DEPENDS clang-headers @@ -407,6 +405,7 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY) endif() add_custom_target(bash-autocomplete DEPENDS utils/bash-autocomplete.sh) + set_target_properties(bash-autocomplete PROPERTIES FOLDER "Clang/Misc") install(FILES utils/bash-autocomplete.sh DESTINATION "${CMAKE_INSTALL_DATADIR}/clang" COMPONENT bash-autocomplete) @@ -487,7 +486,7 @@ add_custom_target(clang-tablegen-targets omp_gen ClangDriverOptions ${CLANG_TABLEGEN_TARGETS}) -set_target_properties(clang-tablegen-targets PROPERTIES FOLDER "Misc") +set_target_properties(clang-tablegen-targets PROPERTIES FOLDER "Clang/Tablegenning/Targets") list(APPEND LLVM_COMMON_DEPENDS clang-tablegen-targets) # Force target to be built as soon as possible. Clang modules builds depend @@ -552,7 +551,7 @@ endif() # Custom target to install all clang libraries. add_custom_target(clang-libraries) -set_target_properties(clang-libraries PROPERTIES FOLDER "Misc") +set_target_properties(clang-libraries PROPERTIES FOLDER "Clang/Install") if(NOT LLVM_ENABLE_IDE) add_llvm_install_targets(install-clang-libraries diff --git a/clang/bindings/python/tests/CMakeLists.txt b/clang/bindings/python/tests/CMakeLists.txt index c4cd2539e9d6c..2543cf739463d 100644 --- a/clang/bindings/python/tests/CMakeLists.txt +++ b/clang/bindings/python/tests/CMakeLists.txt @@ -11,7 +11,7 @@ add_custom_target(check-clang-python WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/..) set(RUN_PYTHON_TESTS TRUE) -set_target_properties(check-clang-python PROPERTIES FOLDER "Clang tests") +set_target_properties(check-clang-python PROPERTIES FOLDER "Clang/Tests") # Tests require libclang.so which is only built with LLVM_ENABLE_PIC=ON if(NOT LLVM_ENABLE_PIC) diff --git a/clang/cmake/caches/CrossWinToARMLinux.cmake b/clang/cmake/caches/CrossWinToARMLinux.cmake index 736a54ece550c..62e87c6c62f85 100644 --- a/clang/cmake/caches/CrossWinToARMLinux.cmake +++ b/clang/cmake/caches/CrossWinToARMLinux.cmake @@ -89,6 +89,13 @@ endif() message(STATUS "Toolchain target to build: ${LLVM_TARGETS_TO_BUILD}") +# Allow to override libc++ ABI version. Use 2 by default. +if (NOT DEFINED LIBCXX_ABI_VERSION) + set(LIBCXX_ABI_VERSION 2) +endif() + +message(STATUS "Toolchain's Libc++ ABI version: ${LIBCXX_ABI_VERSION}") + if (NOT DEFINED CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE "Release" CACHE STRING "") endif() @@ -109,8 +116,15 @@ set(CLANG_DEFAULT_OBJCOPY "llvm-objcopy" CACHE STRING "") set(CLANG_DEFAULT_RTLIB "compiler-rt" CACHE STRING "") set(CLANG_DEFAULT_UNWINDLIB "libunwind" CACHE STRING "") -if(WIN32) - set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded" CACHE STRING "") +if (NOT DEFINED CMAKE_MSVC_RUNTIME_LIBRARY AND WIN32) + #Note: Always specify MT DLL for the LLDB build configurations on Windows host. + if (CMAKE_BUILD_TYPE STREQUAL "Debug") + set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreadedDebugDLL" CACHE STRING "") + else() + set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreadedDLL" CACHE STRING "") + endif() + # Grab all ucrt/vcruntime related DLLs into the binary installation folder. + set(CMAKE_INSTALL_UCRT_LIBRARIES ON CACHE BOOL "") endif() # Set up RPATH for the target runtime/builtin libraries. @@ -127,6 +141,15 @@ set(BUILTINS_${TOOLCHAIN_TARGET_TRIPLE}_CMAKE_INSTALL_RPATH set(BUILTINS_${TOOLCHAIN_TARGET_TRIPLE}_CMAKE_BUILD_WITH_INSTALL_RPATH ON CACHE BOOL "") set(BUILTINS_${TOOLCHAIN_TARGET_TRIPLE}_LLVM_CMAKE_DIR "${LLVM_PROJECT_DIR}/llvm/cmake/modules" CACHE PATH "") +if (DEFINED TOOLCHAIN_TARGET_COMPILER_FLAGS) + foreach(lang C;CXX;ASM) + set(BUILTINS_${TOOLCHAIN_TARGET_TRIPLE}_CMAKE_${lang}_FLAGS "${TOOLCHAIN_TARGET_COMPILER_FLAGS}" CACHE STRING "") + endforeach() +endif() +foreach(type SHARED;MODULE;EXE) + set(BUILTINS_${TOOLCHAIN_TARGET_TRIPLE}_CMAKE_${type}_LINKER_FLAGS "-fuse-ld=lld" CACHE STRING "") +endforeach() + set(LLVM_RUNTIME_TARGETS "${TOOLCHAIN_TARGET_TRIPLE}" CACHE STRING "") set(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR ON CACHE BOOL "") @@ -137,6 +160,15 @@ set(RUNTIMES_${TOOLCHAIN_TARGET_TRIPLE}_CMAKE_SYSROOT set(RUNTIMES_${TOOLCHAIN_TARGET_TRIPLE}_CMAKE_INSTALL_RPATH "${RUNTIMES_INSTALL_RPATH}" CACHE STRING "") set(RUNTIMES_${TOOLCHAIN_TARGET_TRIPLE}_CMAKE_BUILD_WITH_INSTALL_RPATH ON CACHE BOOL "") +if (DEFINED TOOLCHAIN_TARGET_COMPILER_FLAGS) + foreach(lang C;CXX;ASM) + set(RUNTIMES_${TOOLCHAIN_TARGET_TRIPLE}_CMAKE_${lang}_FLAGS "${TOOLCHAIN_TARGET_COMPILER_FLAGS}" CACHE STRING "") + endforeach() +endif() +foreach(type SHARED;MODULE;EXE) + set(RUNTIMES_${TOOLCHAIN_TARGET_TRIPLE}_CMAKE_${type}_LINKER_FLAGS "-fuse-ld=lld" CACHE STRING "") +endforeach() + set(RUNTIMES_${TOOLCHAIN_TARGET_TRIPLE}_COMPILER_RT_BUILD_BUILTINS ON CACHE BOOL "") set(RUNTIMES_${TOOLCHAIN_TARGET_TRIPLE}_COMPILER_RT_BUILD_SANITIZERS OFF CACHE BOOL "") set(RUNTIMES_${TOOLCHAIN_TARGET_TRIPLE}_COMPILER_RT_BUILD_XRAY OFF CACHE BOOL "") @@ -164,7 +196,7 @@ set(RUNTIMES_${TOOLCHAIN_TARGET_TRIPLE}_LIBCXXABI_ENABLE_SHARED set(RUNTIMES_${TOOLCHAIN_TARGET_TRIPLE}_LIBCXX_USE_COMPILER_RT ON CACHE BOOL "") set(RUNTIMES_${TOOLCHAIN_TARGET_TRIPLE}_LIBCXX_ENABLE_SHARED OFF CACHE BOOL "") -set(RUNTIMES_${TOOLCHAIN_TARGET_TRIPLE}_LIBCXX_ABI_VERSION 2 CACHE STRING "") +set(RUNTIMES_${TOOLCHAIN_TARGET_TRIPLE}_LIBCXX_ABI_VERSION ${LIBCXX_ABI_VERSION} CACHE STRING "") set(RUNTIMES_${TOOLCHAIN_TARGET_TRIPLE}_LIBCXX_CXX_ABI "libcxxabi" CACHE STRING "") #!!! set(RUNTIMES_${TOOLCHAIN_TARGET_TRIPLE}_LIBCXX_ENABLE_NEW_DELETE_DEFINITIONS ON CACHE BOOL "") diff --git a/clang/cmake/caches/Fuchsia-stage2.cmake b/clang/cmake/caches/Fuchsia-stage2.cmake index d5546e20873b3..66e764968e85c 100644 --- a/clang/cmake/caches/Fuchsia-stage2.cmake +++ b/clang/cmake/caches/Fuchsia-stage2.cmake @@ -19,7 +19,6 @@ set(LLVM_ENABLE_LLD ON CACHE BOOL "") set(LLVM_ENABLE_LTO ON CACHE BOOL "") set(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR ON CACHE BOOL "") set(LLVM_ENABLE_PLUGINS OFF CACHE BOOL "") -set(LLVM_ENABLE_TERMINFO OFF CACHE BOOL "") set(LLVM_ENABLE_UNWIND_TABLES OFF CACHE BOOL "") set(LLVM_ENABLE_Z3_SOLVER OFF CACHE BOOL "") set(LLVM_ENABLE_ZLIB ON CACHE BOOL "") diff --git a/clang/cmake/caches/Fuchsia.cmake b/clang/cmake/caches/Fuchsia.cmake index 30a3b9116a461..4d3af3ad3f403 100644 --- a/clang/cmake/caches/Fuchsia.cmake +++ b/clang/cmake/caches/Fuchsia.cmake @@ -12,7 +12,6 @@ set(LLVM_ENABLE_DIA_SDK OFF CACHE BOOL "") set(LLVM_ENABLE_LIBEDIT OFF CACHE BOOL "") set(LLVM_ENABLE_LIBXML2 OFF CACHE BOOL "") set(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR ON CACHE BOOL "") -set(LLVM_ENABLE_TERMINFO OFF CACHE BOOL "") set(LLVM_ENABLE_UNWIND_TABLES OFF CACHE BOOL "") set(LLVM_ENABLE_Z3_SOLVER OFF CACHE BOOL "") set(LLVM_ENABLE_ZLIB OFF CACHE BOOL "") @@ -34,7 +33,6 @@ set(_FUCHSIA_BOOTSTRAP_PASSTHROUGH LibXml2_ROOT LLVM_ENABLE_CURL LLVM_ENABLE_HTTPLIB - LLVM_ENABLE_TERMINFO LLVM_ENABLE_LIBEDIT CURL_ROOT OpenSSL_ROOT @@ -47,11 +45,6 @@ set(_FUCHSIA_BOOTSTRAP_PASSTHROUGH CURSES_LIBRARIES PANEL_LIBRARIES - # Deprecated - Terminfo_ROOT - - Terminfo_LIBRARIES - # Deprecated LibEdit_ROOT diff --git a/clang/cmake/caches/VectorEngine.cmake b/clang/cmake/caches/VectorEngine.cmake index 2f968a21cc407..b429fb0997d7a 100644 --- a/clang/cmake/caches/VectorEngine.cmake +++ b/clang/cmake/caches/VectorEngine.cmake @@ -13,9 +13,7 @@ # ninja # -# Disable TERMINFO, ZLIB, and ZSTD for VE since there is no pre-compiled -# libraries. -set(LLVM_ENABLE_TERMINFO OFF CACHE BOOL "") +# Disable ZLIB, and ZSTD for VE since there is no pre-compiled libraries. set(LLVM_ENABLE_ZLIB OFF CACHE BOOL "") set(LLVM_ENABLE_ZSTD OFF CACHE BOOL "") diff --git a/clang/cmake/modules/AddClang.cmake b/clang/cmake/modules/AddClang.cmake index 75b0080f67156..a5ef639187d9d 100644 --- a/clang/cmake/modules/AddClang.cmake +++ b/clang/cmake/modules/AddClang.cmake @@ -26,7 +26,6 @@ function(clang_tablegen) if(CTG_TARGET) add_public_tablegen_target(${CTG_TARGET}) - set_target_properties( ${CTG_TARGET} PROPERTIES FOLDER "Clang tablegenning") set_property(GLOBAL APPEND PROPERTY CLANG_TABLEGEN_TARGETS ${CTG_TARGET}) endif() endfunction(clang_tablegen) @@ -138,13 +137,11 @@ macro(add_clang_library name) endif() endforeach() - set_target_properties(${name} PROPERTIES FOLDER "Clang libraries") set_clang_windows_version_resource_properties(${name}) endmacro(add_clang_library) macro(add_clang_executable name) add_llvm_executable( ${name} ${ARGN} ) - set_target_properties(${name} PROPERTIES FOLDER "Clang executables") set_clang_windows_version_resource_properties(${name}) endmacro(add_clang_executable) diff --git a/clang/docs/CMakeLists.txt b/clang/docs/CMakeLists.txt index 4163dd2d90ad5..51e9db29f887f 100644 --- a/clang/docs/CMakeLists.txt +++ b/clang/docs/CMakeLists.txt @@ -78,6 +78,7 @@ if (LLVM_ENABLE_DOXYGEN) COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/doxygen.cfg WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMENT "Generating clang doxygen documentation." VERBATIM) + set_target_properties(doxygen-clang PROPERTIES FOLDER "Clang/Docs") if (LLVM_BUILD_DOCS) add_dependencies(doxygen doxygen-clang) diff --git a/clang/docs/ClangFormatStyleOptions.rst b/clang/docs/ClangFormatStyleOptions.rst index 6d092219877f9..1a7d0e6a05e31 100644 --- a/clang/docs/ClangFormatStyleOptions.rst +++ b/clang/docs/ClangFormatStyleOptions.rst @@ -1421,13 +1421,21 @@ the configuration (without a prefix: ``Auto``). .. code-block:: c++ - true: #define A \ int aaaa; \ int b; \ int dddddddddd; - false: + * ``ENAS_LeftWithLastLine`` (in configuration: ``LeftWithLastLine``) + Align escaped newlines as far left as possible, using the last line of + the preprocessor directive as the reference if it's the longest. + + .. code-block:: c++ + + #define A \ + int aaaa; \ + int b; \ + int dddddddddd; * ``ENAS_Right`` (in configuration: ``Right``) Align escaped newlines in the right-most column. diff --git a/clang/docs/InternalsManual.rst b/clang/docs/InternalsManual.rst index b3e2b870ae5f9..3d21e37784b36 100644 --- a/clang/docs/InternalsManual.rst +++ b/clang/docs/InternalsManual.rst @@ -123,6 +123,44 @@ severe that error recovery won't be able to recover sensibly from them (thus spewing a ton of bogus errors). One example of this class of error are failure to ``#include`` a file. +Diagnostic Wording +^^^^^^^^^^^^^^^^^^ +The wording used for a diagnostic is critical because it is the only way for a +user to know how to correct their code. Use the following suggestions when +wording a diagnostic. + +* Diagnostics in Clang do not start with a capital letter and do not end with + punctuation. + + * This does not apply to proper nouns like ``Clang`` or ``OpenMP``, to + acronyms like ``GCC`` or ``ARC``, or to language standards like ``C23`` + or ``C++17``. + * A trailing question mark is allowed. e.g., ``unknown identifier %0; did + you mean %1?``. + +* Appropriately capitalize proper nouns like ``Clang``, ``OpenCL``, ``GCC``, + ``Objective-C``, etc and language standard versions like ``C11`` or ``C++11``. +* The wording should be succinct. If necessary, use a semicolon to combine + sentence fragments instead of using complete sentences. e.g., prefer wording + like ``'%0' is deprecated; it will be removed in a future release of Clang`` + over wording like ``'%0' is deprecated. It will be removed in a future release + of Clang``. +* The wording should be actionable and avoid using standards terms or grammar + productions that a new user would not be familiar with. e.g., prefer wording + like ``missing semicolon`` over wording like ``syntax error`` (which is not + actionable) or ``expected unqualified-id`` (which uses standards terminology). +* The wording should clearly explain what is wrong with the code rather than + restating what the code does. e.g., prefer wording like ``type %0 requires a + value in the range %1 to %2`` over wording like ``%0 is invalid``. +* The wording should have enough contextual information to help the user + identify the issue in a complex expression. e.g., prefer wording like + ``both sides of the %0 binary operator are identical`` over wording like + ``identical operands to binary operator``. +* Use single quotes to denote syntactic constructs or command line arguments + named in a diagnostic message. e.g., prefer wording like ``'this' pointer + cannot be null in well-defined C++ code`` over wording like ``this pointer + cannot be null in well-defined C++ code``. + The Format String ^^^^^^^^^^^^^^^^^ diff --git a/clang/docs/LanguageExtensions.rst b/clang/docs/LanguageExtensions.rst index 440008e927325..b1b26f7970dda 100644 --- a/clang/docs/LanguageExtensions.rst +++ b/clang/docs/LanguageExtensions.rst @@ -4424,6 +4424,7 @@ immediately after the name being declared. For example, this applies the GNU ``unused`` attribute to ``a`` and ``f``, and also applies the GNU ``noreturn`` attribute to ``f``. +Examples: .. code-block:: c++ [[gnu::unused]] int a, f [[gnu::noreturn]] (); @@ -4433,6 +4434,42 @@ Target-Specific Extensions Clang supports some language features conditionally on some targets. +AMDGPU Language Extensions +-------------------------- + +__builtin_amdgcn_fence +^^^^^^^^^^^^^^^^^^^^^^ + +``__builtin_amdgcn_fence`` emits a fence. + +* ``unsigned`` atomic ordering, e.g. ``__ATOMIC_ACQUIRE`` +* ``const char *`` synchronization scope, e.g. ``workgroup`` +* Zero or more ``const char *`` address spaces names. + +The address spaces arguments must be one of the following string literals: + +* ``"local"`` +* ``"global"`` + +If one or more address space name are provided, the code generator will attempt +to emit potentially faster instructions that order access to at least those +address spaces. +Emitting such instructions may not always be possible and the compiler is free +to fence more aggressively. + +If no address spaces names are provided, all address spaces are fenced. + +.. code-block:: c++ + + // Fence all address spaces. + __builtin_amdgcn_fence(__ATOMIC_SEQ_CST, "workgroup"); + __builtin_amdgcn_fence(__ATOMIC_ACQUIRE, "agent"); + + // Fence only requested address spaces. + __builtin_amdgcn_fence(__ATOMIC_SEQ_CST, "workgroup", "local") + __builtin_amdgcn_fence(__ATOMIC_SEQ_CST, "workgroup", "local", "global") + + ARM/AArch64 Language Extensions ------------------------------- @@ -5623,4 +5660,4 @@ Compiling different TUs depending on these flags (including use of ``std::hardware_constructive_interference`` or ``std::hardware_destructive_interference``) with different compilers, macro definitions, or architecture flags will lead to ODR violations and should be -avoided. \ No newline at end of file +avoided. diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst index 0c4a343b70009..894f6b0443174 100644 --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -334,13 +334,18 @@ New Compiler Flags - ``-fexperimental-late-parse-attributes`` enables an experimental feature to allow late parsing certain attributes in specific contexts where they would - not normally be late parsed. + not normally be late parsed. Currently this allows late parsing the + `counted_by` attribute in C. See `Attribute Changes in Clang`_. - ``-fseparate-named-sections`` uses separate unique sections for global symbols in named special sections (i.e. symbols annotated with ``__attribute__((section(...)))``. This enables linker GC to collect unused symbols without having to use a per-symbol section. +- ``-fms-define-stdc`` and its clang-cl counterpart ``/Zc:__STDC__``. + Matches MSVC behaviour by defining ``__STDC__`` to ``1`` when + MSVC compatibility mode is used. It has no effect for C++ code. + Deprecated Compiler Flags ------------------------- @@ -423,6 +428,24 @@ Attribute Changes in Clang - The ``clspv_libclc_builtin`` attribute has been added to allow clspv (`OpenCL-C to Vulkan SPIR-V compiler `_) to identify functions coming from libclc (`OpenCL-C builtin library `_). +- The ``counted_by`` attribute is now allowed on pointers that are members of a + struct in C. + +- The ``counted_by`` attribute can now be late parsed in C when + ``-fexperimental-late-parse-attributes`` is passed but only when attribute is + used in the declaration attribute position. This allows using the + attribute on existing code where it previously impossible to do so without + re-ordering struct field declarations would break ABI as shown below. + + .. code-block:: c + + struct BufferTy { + /* Refering to `count` requires late parsing */ + char* buffer __counted_by(count); + /* Swapping `buffer` and `count` to avoid late parsing would break ABI */ + size_t count; + }; + Improvements to Clang's diagnostics ----------------------------------- @@ -518,6 +541,9 @@ Improvements to Clang's diagnostics - Clang emits a ``-Wparentheses`` warning for expressions with consecutive comparisons like ``x < y < z``. Fixes #GH20456. +- Clang no longer emits a "declared here" note for a builtin function that has no declaration in source. + Fixes #GH93369. + Improvements to Clang's time-trace ---------------------------------- @@ -609,6 +635,8 @@ Bug Fixes in This Version Bug Fixes to Compiler Builtins ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +- Fix crash when atomic builtins are called with pointer to zero-size struct (#GH90330) + Bug Fixes to Attribute Support ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -711,7 +739,6 @@ Bug Fixes to C++ Support from being explicitly specialized for a given implicit instantiation of the class template. - Fixed a crash when ``this`` is used in a dependent class scope function template specialization that instantiates to a static member function. - - Fix crash when inheriting from a cv-qualified type. Fixes #GH35603 - Fix a crash when the using enum declaration uses an anonymous enumeration. Fixes (#GH86790). - Handled an edge case in ``getFullyPackExpandedSize`` so that we now avoid a false-positive diagnostic. (#GH84220) @@ -769,6 +796,17 @@ Bug Fixes to C++ Support - Fixed a crash when trying to emit captures in a lambda call operator with an explicit object parameter that is called on a derived type of the lambda. Fixes (#GH87210), (GH89541). +- Clang no longer tries to check if an expression is immediate-escalating in an unevaluated context. + Fixes (#GH91308). +- Fix a crash caused by a regression in the handling of ``source_location`` + in dependent contexts. Fixes (#GH92680). +- Fixed a crash when diagnosing failed conversions involving template parameter + packs. (#GH93076) +- Fixed a regression introduced in Clang 18 causing a static function overloading a non-static function + with the same parameters not to be diagnosed. (Fixes #GH93456). +- Clang now diagnoses unexpanded parameter packs in attributes. (Fixes #GH93269). +- Clang now allows ``@$``` in raw string literals. Fixes (#GH93130). +- Fix an assertion failure when checking invalid ``this`` usage in the wrong context. (Fixes #GH91536). Bug Fixes to AST Handling ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -782,12 +820,14 @@ Miscellaneous Bug Fixes - Fixed an infinite recursion in ASTImporter, on return type declared inside body of C++11 lambda without trailing return (#GH68775). - Fixed declaration name source location of instantiated function definitions (GH71161). +- Improve diagnostic output to print an expression instead of 'no argument` when comparing Values as template arguments. Miscellaneous Clang Crashes Fixed ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - Do not attempt to dump the layout of dependent types or invalid declarations when ``-fdump-record-layouts-complete`` is passed. Fixes #GH83684. +- Unhandled StructuralValues in the template differ (#GH93068). OpenACC Specific Changes ------------------------ @@ -801,6 +841,8 @@ AMDGPU Support X86 Support ^^^^^^^^^^^ +- Remove knl/knm specific ISA supports: AVX512PF, AVX512ER, PREFETCHWT1 + Arm and AArch64 Support ^^^^^^^^^^^^^^^^^^^^^^^ @@ -853,6 +895,10 @@ Windows Support including STL headers will no longer slow down compile times since ``intrin.h`` is not included from MSVC STL. +- When the target triple is `*-windows-msvc` strict aliasing is now disabled by default + to ensure compatibility with msvc. Previously strict aliasing was only disabled if the + driver mode was cl. + LoongArch Support ^^^^^^^^^^^^^^^^^ @@ -923,9 +969,10 @@ clang-format ``BreakTemplateDeclarations``. - ``AlwaysBreakAfterReturnType`` is deprecated and renamed to ``BreakAfterReturnType``. -- Handles Java ``switch`` expressions. +- Handles Java switch expressions. - Adds ``AllowShortCaseExpressionOnASingleLine`` option. - Adds ``AlignCaseArrows`` suboption to ``AlignConsecutiveShortCaseStatements``. +- Adds ``LeftWithLastLine`` suboption to ``AlignEscapedNewlines``. libclang -------- diff --git a/clang/docs/analyzer/checkers.rst b/clang/docs/analyzer/checkers.rst index b4bd9dac1cbc2..3a31708a1e9de 100644 --- a/clang/docs/analyzer/checkers.rst +++ b/clang/docs/analyzer/checkers.rst @@ -2833,6 +2833,41 @@ Warn on mmap() calls that are both writable and executable. // code } +.. _alpha-security-putenv-stack-array: + +alpha.security.PutenvStackArray (C) +""""""""""""""""""""""""""""""""""" +Finds calls to the ``putenv`` function which pass a pointer to a stack-allocated +(automatic) array as the argument. Function ``putenv`` does not copy the passed +string, only a pointer to the data is stored and this data can be read even by +other threads. Content of a stack-allocated array is likely to be overwritten +after returning from the parent function. + +The problem can be solved by using a static array variable or dynamically +allocated memory. Even better is to avoid using ``putenv`` (it has other +problems related to memory leaks) and use ``setenv`` instead. + +The check corresponds to CERT rule +`POS34-C. Do not call putenv() with a pointer to an automatic variable as the argument +`_. + +.. code-block:: c + + int f() { + char env[] = "NAME=value"; + return putenv(env); // putenv function should not be called with stack-allocated string + } + +There is one case where the checker can report a false positive. This is when +the stack-allocated array is used at `putenv` in a function or code branch that +does not return (calls `fork` or `exec` like function). + +Another special case is if the `putenv` is called from function `main`. Here +the stack is deallocated at the end of the program and it should be no problem +to use the stack-allocated string (a multi-threaded program may require more +attention). The checker does not warn for cases when stack space of `main` is +used at the `putenv` call. + .. _alpha-security-ReturnPtrRange: alpha.security.ReturnPtrRange (C) @@ -2859,55 +2894,6 @@ alpha.security.cert SEI CERT checkers which tries to find errors based on their `C coding rules `_. -.. _alpha-security-cert-pos-checkers: - -alpha.security.cert.pos -^^^^^^^^^^^^^^^^^^^^^^^ - -SEI CERT checkers of `POSIX C coding rules `_. - -.. _alpha-security-cert-pos-34c: - -alpha.security.cert.pos.34c -""""""""""""""""""""""""""" -Finds calls to the ``putenv`` function which pass a pointer to an automatic variable as the argument. - -.. code-block:: c - - int func(const char *var) { - char env[1024]; - int retval = snprintf(env, sizeof(env),"TEST=%s", var); - if (retval < 0 || (size_t)retval >= sizeof(env)) { - /* Handle error */ - } - - return putenv(env); // putenv function should not be called with auto variables - } - -Limitations: - - - Technically, one can pass automatic variables to ``putenv``, - but one needs to ensure that the given environment key stays - alive until it's removed or overwritten. - Since the analyzer cannot keep track of which envvars get overwritten - and when, it needs to be slightly more aggressive and warn for such - cases too, leading in some cases to false-positive reports like this: - - .. code-block:: c - - void baz() { - char env[] = "NAME=value"; - putenv(env); // false-positive warning: putenv function should not be called... - // More code... - putenv((char *)"NAME=anothervalue"); - // This putenv call overwrites the previous entry, thus that can no longer dangle. - } // 'env' array becomes dead only here. - -alpha.security.cert.env -^^^^^^^^^^^^^^^^^^^^^^^ - -SEI CERT checkers of `Environment C coding rules `_. - alpha.security.taint ^^^^^^^^^^^^^^^^^^^^ diff --git a/clang/include/clang/AST/RecursiveASTVisitor.h b/clang/include/clang/AST/RecursiveASTVisitor.h index 089cd08d55dbb..bb68a379cd5d7 100644 --- a/clang/include/clang/AST/RecursiveASTVisitor.h +++ b/clang/include/clang/AST/RecursiveASTVisitor.h @@ -30,6 +30,7 @@ #include "clang/AST/ExprOpenMP.h" #include "clang/AST/LambdaCapture.h" #include "clang/AST/NestedNameSpecifier.h" +#include "clang/AST/OpenACCClause.h" #include "clang/AST/OpenMPClause.h" #include "clang/AST/Stmt.h" #include "clang/AST/StmtCXX.h" @@ -510,6 +511,7 @@ template class RecursiveASTVisitor { bool TraverseOpenACCAssociatedStmtConstruct(OpenACCAssociatedStmtConstruct *S); bool VisitOpenACCClauseList(ArrayRef); + bool VisitOpenACCClause(const OpenACCClause *); }; template @@ -3982,9 +3984,26 @@ bool RecursiveASTVisitor::TraverseOpenACCAssociatedStmtConstruct( return true; } +template +bool RecursiveASTVisitor::VisitOpenACCClause(const OpenACCClause *C) { + for (const Stmt *Child : C->children()) + TRY_TO(TraverseStmt(const_cast(Child))); + return true; +} + template bool RecursiveASTVisitor::VisitOpenACCClauseList( - ArrayRef) { + ArrayRef Clauses) { + + for (const auto *C : Clauses) + TRY_TO(VisitOpenACCClause(C)); +// if (const auto *WithCond = dyn_cast(C); +// WithCond && WIthCond->hasConditionExpr()) { +// TRY_TO(TraverseStmt(WithCond->getConditionExpr()); +// } else if (const auto * +// } +// OpenACCClauseWithCondition::getConditionExpr/hasConditionExpr +//OpenACCClauseWithExprs::children (might be null?) // TODO OpenACC: When we have Clauses with expressions, we should visit them // here. return true; diff --git a/clang/include/clang/AST/Type.h b/clang/include/clang/AST/Type.h index a8d755a5ecd1e..20fb957237df8 100644 --- a/clang/include/clang/AST/Type.h +++ b/clang/include/clang/AST/Type.h @@ -2515,6 +2515,7 @@ class alignas(TypeAlignment) Type : public ExtQualsTypeCommonBase { bool isRecordType() const; bool isClassType() const; bool isStructureType() const; + bool isStructureTypeWithFlexibleArrayMember() const; bool isObjCBoxableRecordType() const; bool isInterfaceType() const; bool isStructureOrClassType() const; diff --git a/clang/include/clang/Basic/Attr.td b/clang/include/clang/Basic/Attr.td index 1132a9654f0cc..25c5f3e9addd7 100644 --- a/clang/include/clang/Basic/Attr.td +++ b/clang/include/clang/Basic/Attr.td @@ -2973,9 +2973,12 @@ def Convergent : InheritableAttr { def NoInline : DeclOrStmtAttr { let Spellings = [CustomKeyword<"__noinline__">, GCC<"noinline">, CXX11<"clang", "noinline">, C23<"clang", "noinline">, + CXX11<"msvc", "noinline">, C23<"msvc", "noinline">, Declspec<"noinline">]; - let Accessors = [Accessor<"isClangNoInline", [CXX11<"clang", "noinline">, - C23<"clang", "noinline">]>]; + let Accessors = [Accessor<"isStmtNoInline", [CXX11<"clang", "noinline">, + C23<"clang", "noinline">, + CXX11<"msvc", "noinline">, + C23<"msvc", "noinline">]>]; let Documentation = [NoInlineDocs]; let Subjects = SubjectList<[Function, Stmt], WarnDiag, "functions and statements">; @@ -3205,7 +3208,8 @@ def TypeNullUnspecified : TypeAttr { def CountedBy : DeclOrTypeAttr { let Spellings = [Clang<"counted_by">]; let Subjects = SubjectList<[Field], ErrorDiag>; - let Args = [ExprArgument<"Count">, IntArgument<"NestedLevel">]; + let Args = [ExprArgument<"Count">, IntArgument<"NestedLevel", 1>]; + let LateParsed = LateAttrParseExperimentalExt; let ParseArgumentsAsUnevaluated = 1; let Documentation = [CountedByDocs]; let LangOpts = [COnly]; diff --git a/clang/include/clang/Basic/BuiltinsAArch64.def b/clang/include/clang/Basic/BuiltinsAArch64.def index cf8711c6eaee3..5f53c98167dfb 100644 --- a/clang/include/clang/Basic/BuiltinsAArch64.def +++ b/clang/include/clang/Basic/BuiltinsAArch64.def @@ -290,7 +290,7 @@ TARGET_HEADER_BUILTIN(_CountLeadingZeros64, "UiULLi", "nh", INTRIN_H, ALL_MS_LAN TARGET_HEADER_BUILTIN(_CountOneBits, "UiUNi", "nh", INTRIN_H, ALL_MS_LANGUAGES, "") TARGET_HEADER_BUILTIN(_CountOneBits64, "UiULLi", "nh", INTRIN_H, ALL_MS_LANGUAGES, "") -TARGET_HEADER_BUILTIN(__prefetch, "vv*", "nh", INTRIN_H, ALL_MS_LANGUAGES, "") +TARGET_HEADER_BUILTIN(__prefetch, "vvC*", "nh", INTRIN_H, ALL_MS_LANGUAGES, "") #undef BUILTIN #undef LANGBUILTIN diff --git a/clang/include/clang/Basic/BuiltinsAMDGPU.def b/clang/include/clang/Basic/BuiltinsAMDGPU.def index a05f540720fd3..630ac1dd8a314 100644 --- a/clang/include/clang/Basic/BuiltinsAMDGPU.def +++ b/clang/include/clang/Basic/BuiltinsAMDGPU.def @@ -68,7 +68,7 @@ BUILTIN(__builtin_amdgcn_sched_group_barrier, "vIiIiIi", "n") BUILTIN(__builtin_amdgcn_iglp_opt, "vIi", "n") BUILTIN(__builtin_amdgcn_s_dcache_inv, "v", "n") BUILTIN(__builtin_amdgcn_buffer_wbinvl1, "v", "n") -BUILTIN(__builtin_amdgcn_fence, "vUicC*", "n") +BUILTIN(__builtin_amdgcn_fence, "vUicC*.", "n") BUILTIN(__builtin_amdgcn_groupstaticsize, "Ui", "n") BUILTIN(__builtin_amdgcn_wavefrontsize, "Ui", "nc") diff --git a/clang/include/clang/Basic/BuiltinsWebAssembly.def b/clang/include/clang/Basic/BuiltinsWebAssembly.def index 8645cff1e8679..fd8c1b480d6da 100644 --- a/clang/include/clang/Basic/BuiltinsWebAssembly.def +++ b/clang/include/clang/Basic/BuiltinsWebAssembly.def @@ -193,6 +193,8 @@ TARGET_BUILTIN(__builtin_wasm_relaxed_dot_bf16x8_add_f32_f32x4, "V4fV8UsV8UsV4f" // Half-Precision (fp16) TARGET_BUILTIN(__builtin_wasm_loadf16_f32, "fh*", "nU", "half-precision") TARGET_BUILTIN(__builtin_wasm_storef16_f32, "vfh*", "n", "half-precision") +TARGET_BUILTIN(__builtin_wasm_splat_f16x8, "V8hf", "nc", "half-precision") +TARGET_BUILTIN(__builtin_wasm_extract_lane_f16x8, "fV8hi", "nc", "half-precision") // Reference Types builtins // Some builtins are custom type-checked - see 't' as part of the third argument, diff --git a/clang/include/clang/Basic/BuiltinsX86.def b/clang/include/clang/Basic/BuiltinsX86.def index eafcc219c1096..7074479786b97 100644 --- a/clang/include/clang/Basic/BuiltinsX86.def +++ b/clang/include/clang/Basic/BuiltinsX86.def @@ -832,23 +832,11 @@ TARGET_BUILTIN(__builtin_ia32_rsqrt14ss_mask, "V4fV4fV4fV4fUc", "ncV:128:", "avx TARGET_BUILTIN(__builtin_ia32_rsqrt14pd512_mask, "V8dV8dV8dUc", "ncV:512:", "avx512f,evex512") TARGET_BUILTIN(__builtin_ia32_rsqrt14ps512_mask, "V16fV16fV16fUs", "ncV:512:", "avx512f,evex512") -TARGET_BUILTIN(__builtin_ia32_rsqrt28sd_round_mask, "V2dV2dV2dV2dUcIi", "ncV:128:", "avx512er") -TARGET_BUILTIN(__builtin_ia32_rsqrt28ss_round_mask, "V4fV4fV4fV4fUcIi", "ncV:128:", "avx512er") -TARGET_BUILTIN(__builtin_ia32_rsqrt28pd_mask, "V8dV8dV8dUcIi", "ncV:512:", "avx512er,evex512") -TARGET_BUILTIN(__builtin_ia32_rsqrt28ps_mask, "V16fV16fV16fUsIi", "ncV:512:", "avx512er,evex512") - TARGET_BUILTIN(__builtin_ia32_rcp14sd_mask, "V2dV2dV2dV2dUc", "ncV:128:", "avx512f") TARGET_BUILTIN(__builtin_ia32_rcp14ss_mask, "V4fV4fV4fV4fUc", "ncV:128:", "avx512f") TARGET_BUILTIN(__builtin_ia32_rcp14pd512_mask, "V8dV8dV8dUc", "ncV:512:", "avx512f,evex512") TARGET_BUILTIN(__builtin_ia32_rcp14ps512_mask, "V16fV16fV16fUs", "ncV:512:", "avx512f,evex512") -TARGET_BUILTIN(__builtin_ia32_rcp28sd_round_mask, "V2dV2dV2dV2dUcIi", "ncV:128:", "avx512er") -TARGET_BUILTIN(__builtin_ia32_rcp28ss_round_mask, "V4fV4fV4fV4fUcIi", "ncV:128:", "avx512er") -TARGET_BUILTIN(__builtin_ia32_rcp28pd_mask, "V8dV8dV8dUcIi", "ncV:512:", "avx512er,evex512") -TARGET_BUILTIN(__builtin_ia32_rcp28ps_mask, "V16fV16fV16fUsIi", "ncV:512:", "avx512er,evex512") -TARGET_BUILTIN(__builtin_ia32_exp2pd_mask, "V8dV8dV8dUcIi", "ncV:512:", "avx512er,evex512") -TARGET_BUILTIN(__builtin_ia32_exp2ps_mask, "V16fV16fV16fUsIi", "ncV:512:", "avx512er,evex512") - TARGET_BUILTIN(__builtin_ia32_cvttps2dq512_mask, "V16iV16fV16iUsIi", "ncV:512:", "avx512f,evex512") TARGET_BUILTIN(__builtin_ia32_cvttps2udq512_mask, "V16iV16fV16iUsIi", "ncV:512:", "avx512f,evex512") TARGET_BUILTIN(__builtin_ia32_cvttpd2dq512_mask, "V8iV8dV8iUcIi", "ncV:512:", "avx512f,evex512") @@ -960,15 +948,6 @@ TARGET_BUILTIN(__builtin_ia32_scattersiv16si, "vv*UsV16iV16iIi", "nV:512:", "avx TARGET_BUILTIN(__builtin_ia32_scatterdiv8di, "vv*UcV8OiV8OiIi", "nV:512:", "avx512f,evex512") TARGET_BUILTIN(__builtin_ia32_scatterdiv16si, "vv*UcV8OiV8iIi", "nV:512:", "avx512f,evex512") -TARGET_BUILTIN(__builtin_ia32_gatherpfdpd, "vUcV8ivC*IiIi", "nV:512:", "avx512pf,evex512") -TARGET_BUILTIN(__builtin_ia32_gatherpfdps, "vUsV16ivC*IiIi", "nV:512:", "avx512pf,evex512") -TARGET_BUILTIN(__builtin_ia32_gatherpfqpd, "vUcV8OivC*IiIi", "nV:512:", "avx512pf,evex512") -TARGET_BUILTIN(__builtin_ia32_gatherpfqps, "vUcV8OivC*IiIi", "nV:512:", "avx512pf,evex512") -TARGET_BUILTIN(__builtin_ia32_scatterpfdpd, "vUcV8iv*IiIi", "nV:512:", "avx512pf,evex512") -TARGET_BUILTIN(__builtin_ia32_scatterpfdps, "vUsV16iv*IiIi", "nV:512:", "avx512pf,evex512") -TARGET_BUILTIN(__builtin_ia32_scatterpfqpd, "vUcV8Oiv*IiIi", "nV:512:", "avx512pf,evex512") -TARGET_BUILTIN(__builtin_ia32_scatterpfqps, "vUcV8Oiv*IiIi", "nV:512:", "avx512pf,evex512") - TARGET_BUILTIN(__builtin_ia32_knotqi, "UcUc", "nc", "avx512dq") TARGET_BUILTIN(__builtin_ia32_knothi, "UsUs", "nc", "avx512f") TARGET_BUILTIN(__builtin_ia32_knotsi, "UiUi", "nc", "avx512bw") diff --git a/clang/include/clang/Basic/CharInfo.h b/clang/include/clang/Basic/CharInfo.h index d807955311828..4d90528f7992e 100644 --- a/clang/include/clang/Basic/CharInfo.h +++ b/clang/include/clang/Basic/CharInfo.h @@ -28,8 +28,7 @@ namespace charinfo { CHAR_LOWER = 0x0040, // a-z CHAR_UNDER = 0x0080, // _ CHAR_PERIOD = 0x0100, // . - CHAR_RAWDEL = 0x0200, // {}[]#<>%:;?*+-/^&|~!=,"' - CHAR_PUNCT = 0x0400 // `$@() + CHAR_PUNCT = 0x0200, // {}[]#<>%:;?*+-/^&|~!=,"'`$@() }; enum { @@ -152,7 +151,8 @@ LLVM_READONLY inline bool isHexDigit(unsigned char c) { /// Note that '_' is both a punctuation character and an identifier character! LLVM_READONLY inline bool isPunctuation(unsigned char c) { using namespace charinfo; - return (InfoTable[c] & (CHAR_UNDER|CHAR_PERIOD|CHAR_RAWDEL|CHAR_PUNCT)) != 0; + return (InfoTable[c] & + (CHAR_UNDER | CHAR_PERIOD | CHAR_PUNCT | CHAR_PUNCT)) != 0; } /// Return true if this character is an ASCII printable character; that is, a @@ -160,8 +160,8 @@ LLVM_READONLY inline bool isPunctuation(unsigned char c) { /// terminal. LLVM_READONLY inline bool isPrintable(unsigned char c) { using namespace charinfo; - return (InfoTable[c] & (CHAR_UPPER|CHAR_LOWER|CHAR_PERIOD|CHAR_PUNCT| - CHAR_DIGIT|CHAR_UNDER|CHAR_RAWDEL|CHAR_SPACE)) != 0; + return (InfoTable[c] & (CHAR_UPPER | CHAR_LOWER | CHAR_PERIOD | CHAR_PUNCT | + CHAR_DIGIT | CHAR_UNDER | CHAR_SPACE)) != 0; } /// Return true if this is the body character of a C preprocessing number, @@ -175,8 +175,9 @@ LLVM_READONLY inline bool isPreprocessingNumberBody(unsigned char c) { /// Return true if this is the body character of a C++ raw string delimiter. LLVM_READONLY inline bool isRawStringDelimBody(unsigned char c) { using namespace charinfo; - return (InfoTable[c] & (CHAR_UPPER|CHAR_LOWER|CHAR_PERIOD| - CHAR_DIGIT|CHAR_UNDER|CHAR_RAWDEL)) != 0; + return (InfoTable[c] & (CHAR_UPPER | CHAR_LOWER | CHAR_PERIOD | CHAR_DIGIT | + CHAR_UNDER | CHAR_PUNCT)) != 0 && + c != '(' && c != ')'; } enum class EscapeChar { diff --git a/clang/include/clang/Basic/DiagnosticCommonKinds.td b/clang/include/clang/Basic/DiagnosticCommonKinds.td index fd64cc737fc9d..31edda4c442a8 100644 --- a/clang/include/clang/Basic/DiagnosticCommonKinds.td +++ b/clang/include/clang/Basic/DiagnosticCommonKinds.td @@ -364,9 +364,6 @@ def warn_invalid_feature_combination : Warning< def warn_target_unrecognized_env : Warning< "mismatch between architecture and environment in target triple '%0'; did you mean '%1'?">, InGroup; -def warn_knl_knm_isa_support_removed : Warning< - "KNL, KNM related Intel Xeon Phi CPU's specific ISA's supports will be removed in LLVM 19.">, - InGroup>; def err_target_unsupported_abi_with_fpu : Error< "'%0' ABI is not supported with FPU">; diff --git a/clang/include/clang/Basic/DiagnosticDriverKinds.td b/clang/include/clang/Basic/DiagnosticDriverKinds.td index 339bad7b01c38..203394297a77a 100644 --- a/clang/include/clang/Basic/DiagnosticDriverKinds.td +++ b/clang/include/clang/Basic/DiagnosticDriverKinds.td @@ -58,7 +58,7 @@ def warn_drv_avr_stdlib_not_linked: Warning< def err_drv_cuda_bad_gpu_arch : Error<"unsupported CUDA gpu architecture: %0">; def err_drv_offload_bad_gpu_arch : Error<"unsupported %0 gpu architecture: %1">; def err_drv_offload_missing_gpu_arch : Error< - "Must pass in an explicit %0 gpu architecture to '%1'">; + "must pass in an explicit %0 gpu architecture to '%1'">; def err_drv_no_cuda_installation : Error< "cannot find CUDA installation; provide its path via '--cuda-path', or pass " "'-nocudainc' to build without CUDA includes">; @@ -94,8 +94,8 @@ def err_drv_no_hipspv_device_lib : Error< "'--hip-path' or '--hip-device-lib-path', or pass '-nogpulib' to build " "without HIP device library">; def err_drv_hipspv_no_hip_path : Error< - "'--hip-path' must be specified when offloading to " - "SPIR-V%select{| unless %1 is given}0.">; + "'--hip-path' must be specified when offloading to SPIR-V unless '-nogpuinc' " + "is given">; // TODO: Remove when COV6 is fully supported by ROCm. def warn_drv_amdgpu_cov6: Warning< @@ -148,13 +148,13 @@ def warn_drv_unsupported_option_for_flang : Warning< "the argument '%0' is not supported for option '%1'. Mapping to '%1%2'">, InGroup; def warn_drv_unsupported_diag_option_for_flang : Warning< - "The warning option '-%0' is not supported">, + "the warning option '-%0' is not supported">, InGroup; def warn_drv_unsupported_option_for_processor : Warning< "ignoring '%0' option as it is not currently supported for processor '%1'">, InGroup; def warn_drv_unsupported_openmp_library : Warning< - "The library '%0=%1' is not supported, openmp is not be enabled">, + "the library '%0=%1' is not supported, OpenMP will not be enabled">, InGroup; def err_drv_invalid_thread_model_for_target : Error< @@ -210,7 +210,7 @@ def err_drv_Xsycl_target_missing_triple : Error< def err_drv_invalid_Xsycl_frontend_with_args : Error< "invalid -Xsycl-target-frontend argument: '%0', options requiring arguments are unsupported">; def err_drv_bad_fpga_device_count : Error< - "More than one FPGA specific device binary found in input objects">; + "more than one FPGA specific device binary found in input objects">; def warn_drv_mismatch_fpga_archive : Warning< "FPGA archive '%0' does not contain matching emulation/hardware expectancy">, InGroup; @@ -374,7 +374,7 @@ def err_drv_no_neon_modifier : Error<"[no]neon is not accepted as modifier, plea def err_drv_invalid_omp_target : Error<"OpenMP target is invalid: '%0'">; def err_drv_invalid_sycl_target : Error<"SYCL target is invalid: '%0'">; def err_drv_incompatible_omp_arch : Error<"OpenMP target architecture '%0' pointer size is incompatible with host '%1'">; -def err_drv_option_conflict : Error<"The option %0 conflicts with %1">; +def err_drv_option_conflict : Error<"the option %0 conflicts with %1">; def err_drv_omp_host_ir_file_not_found : Error< "provided host compiler IR file '%0' is required to generate code for OpenMP " "target regions but cannot be found">; @@ -388,7 +388,7 @@ def err_drv_expecting_fsycl_with_sycl_opt : Error< def err_drv_fsycl_with_c_type : Error< "'%0' must not be used in conjunction with '-fsycl', which expects C++ source">; def err_drv_fsycl_with_pch : Error< - "Precompiled header generation is not supported with '-fsycl'">; + "precompiled header generation is not supported with '-fsycl'">; def err_drv_fsycl_unsupported_with_opt : Error<"'%0' is not supported with '-fsycl'">; def warn_drv_opt_requires_opt @@ -408,7 +408,7 @@ def err_drv_no_rdc_sycl_target_missing : Error< def err_drv_fsycl_wrong_optimization_options : Error< "-fsycl-optimize-non-user-code option can be used only in conjunction with %0">; def warn_drv_fsycl_add_default_spec_consts_image_flag_in_non_AOT : Warning< - "-fsycl-add-default-spec-consts-image flag has an effect only in Ahead of Time Compilation mode (AOT).">, + "-fsycl-add-default-spec-consts-image flag has an effect only in Ahead of Time Compilation mode (AOT)">, InGroup; def warn_drv_ftarget_register_alloc_mode_pvc : Warning< "using '%0' to set GRF mode on PVC hardware is deprecated; use '-ftarget-register-alloc-mode=pvc:%1'">, @@ -417,7 +417,7 @@ def err_drv_multiple_target_with_forced_target : Error< "multiple target usage with '%0' is not supported with '%1'">; def err_drv_failed_to_deduce_target_from_arch : Error< "failed to deduce triple for target architecture '%0'; specify the triple " - "using '-fopenmp-targets' and '-Xopenmp-target' instead.">; + "using '-fopenmp-targets' and '-Xopenmp-target' instead">; def err_drv_omp_offload_target_missingbcruntime : Error< "no library '%0' found in the default clang lib directory or in LIBRARY_PATH" "; use '--libomptarget-%1-bc-path' to specify %1 bitcode library">; @@ -588,14 +588,6 @@ def err_analyzer_checker_incompatible_analyzer_option : Error< def err_analyzer_not_built_with_z3 : Error< "analyzer constraint manager 'z3' is only available if LLVM was built with " "-DLLVM_ENABLE_Z3_SOLVER=ON">; -def warn_analyzer_deprecated_option : Warning< - "analyzer option '%0' is deprecated. This flag will be removed in %1, and " - "passing this option will be an error.">, - InGroup; -def warn_analyzer_deprecated_option_with_alternative : Warning< - "analyzer option '%0' is deprecated. This flag will be removed in %1, and " - "passing this option will be an error. Use '%2' instead.">, - InGroup; def warn_drv_needs_hvx : Warning< "%0 requires HVX, use -mhvx/-mhvx= to enable it">, @@ -628,10 +620,12 @@ def err_drv_extract_api_wrong_kind : Error< "in api extraction; use '-x %2' to override">; def err_drv_missing_symbol_graph_dir: Error< - "Must provide a symbol graph output directory using --symbol-graph-dir=">; + "must provide a symbol graph output directory using " + "'--symbol-graph-dir='">; def err_drv_unexpected_symbol_graph_output : Error< - "Unexpected output symbol graph '%1'; please provide --symbol-graph-dir= instead">; + "unexpected output symbol graph '%1'; please provide " + "'--symbol-graph-dir=' instead">; def warn_slash_u_filename : Warning<"'/U%0' treated as the '/U' option">, InGroup>; @@ -842,19 +836,19 @@ def err_drv_hlsl_16bit_types_unsupported: Error< "'%0' option requires target HLSL Version >= 2018%select{| and shader model >= 6.2}1, but HLSL Version is '%2'%select{| and shader model is '%3'}1">; def err_drv_hlsl_bad_shader_unsupported : Error< "%select{shader model|Vulkan environment|shader stage}0 '%1' in target '%2' is invalid for HLSL code generation">; -def warn_drv_dxc_missing_dxv : Warning<"dxv not found. " - "Resulting DXIL will not be validated or signed for use in release environments.">, - InGroup; +def warn_drv_dxc_missing_dxv : Warning< + "dxv not found; resulting DXIL will not be validated or signed for use in " + "release environment">, InGroup; def err_drv_invalid_range_dxil_validator_version : Error< - "invalid validator version : %0\n" - "Validator version must be less than or equal to current internal version.">; + "invalid validator version : %0; validator version must be less than or " + "equal to current internal version">; def err_drv_invalid_format_dxil_validator_version : Error< - "invalid validator version : %0\n" - "Format of validator version is \".\" (ex:\"1.4\").">; + "invalid validator version : %0; format of validator version is " + "\".\" (ex:\"1.4\")">; def err_drv_invalid_empty_dxil_validator_version : Error< - "invalid validator version : %0\n" - "If validator major version is 0, minor version must also be 0.">; + "invalid validator version : %0; if validator major version is 0, minor " + "version must also be 0">; def warn_drv_sarif_format_unstable : Warning< "diagnostic formatting in SARIF mode is currently unstable">, @@ -868,12 +862,10 @@ def warn_drv_loongarch_conflicting_implied_val : Warning< InGroup; def err_drv_loongarch_invalid_mfpu_EQ : Error< "invalid argument '%0' to -mfpu=; must be one of: 64, 32, none, 0 (alias for none)">; -def err_drv_loongarch_wrong_fpu_width_for_lsx : Error< - "wrong fpu width; LSX depends on 64-bit FPU.">; -def err_drv_loongarch_wrong_fpu_width_for_lasx : Error< - "wrong fpu width; LASX depends on 64-bit FPU.">; +def err_drv_loongarch_wrong_fpu_width : Error< + "wrong fpu width; %select{LSX|LASX}0 depends on 64-bit FPU">; def err_drv_loongarch_invalid_simd_option_combination : Error< - "invalid option combination; LASX depends on LSX.">; + "invalid option combination; LASX depends on LSX">; def err_drv_expand_response_file : Error< "failed to expand response file: %0">; @@ -885,9 +877,9 @@ def note_drv_available_multilibs : Note< "available multilibs are:%0">; def warn_android_unversioned_fallback : Warning< - "Using unversioned Android target directory %0 for target %1. Unversioned" - " directories will not be used in Clang 19. Provide a versioned directory" - " for the target version or lower instead.">, + "using unversioned Android target directory %0 for target %1; unversioned " + "directories will not be used in Clang 19 -- provide a versioned directory " + "for the target version or lower instead">, InGroup>; def err_drv_triple_version_invalid : Error< diff --git a/clang/include/clang/Basic/DiagnosticFrontendKinds.td b/clang/include/clang/Basic/DiagnosticFrontendKinds.td index 0d23b12a5e178..d53b8b6638ebe 100644 --- a/clang/include/clang/Basic/DiagnosticFrontendKinds.td +++ b/clang/include/clang/Basic/DiagnosticFrontendKinds.td @@ -71,14 +71,14 @@ def remark_fe_backend_optimization_remark_analysis : Remark<"%0">, BackendInfo, InGroup; def remark_fe_backend_optimization_remark_analysis_fpcommute : Remark<"%0; " "allow reordering by specifying '#pragma clang loop vectorize(enable)' " - "before the loop or by providing the compiler option '-ffast-math'.">, + "before the loop or by providing the compiler option '-ffast-math'">, BackendInfo, InGroup; def remark_fe_backend_optimization_remark_analysis_aliasing : Remark<"%0; " "allow reordering by specifying '#pragma clang loop vectorize(enable)' " - "before the loop. If the arrays will always be independent specify " + "before the loop; if the arrays will always be independent, specify " "'#pragma clang loop vectorize(assume_safety)' before the loop or provide " - "the '__restrict__' qualifier with the independent array arguments. " - "Erroneous results will occur if these options are incorrectly applied!">, + "the '__restrict__' qualifier with the independent array arguments -- " + "erroneous results will occur if these options are incorrectly applied">, BackendInfo, InGroup; def warn_fe_backend_optimization_failure : Warning<"%0">, BackendInfo, @@ -152,8 +152,8 @@ def warn_fe_serialized_diag_merge_failure : Warning< def warn_fe_serialized_diag_failure : Warning< "unable to open file %0 for serializing diagnostics (%1)">, InGroup; -def warn_fe_serialized_diag_failure_during_finalisation : Warning< - "Received warning after diagnostic serialization teardown was underway: %0">, +def warn_fe_serialized_diag_failure_during_finalization : Warning< + "received warning after diagnostic serialization teardown was underway: %0">, InGroup; def err_verify_missing_line : Error< @@ -345,7 +345,7 @@ def warn_atomic_op_oversized : Warning< InGroup; def warn_sync_op_misaligned : Warning< - "__sync builtin operation MUST have natural alignment (consider using __atomic).">, + "__sync builtin operation must have natural alignment (consider using __atomic)">, InGroup; def warn_alias_with_section : Warning< @@ -367,17 +367,16 @@ def warn_profile_data_unprofiled : Warning< "no profile data available for file \"%0\"">, InGroup; def warn_profile_data_misexpect : Warning< - "Potential performance regression from use of __builtin_expect(): " - "Annotation was correct on %0 of profiled executions.">, - BackendInfo, - InGroup; + "potential performance regression from use of __builtin_expect(): " + "annotation was correct on %0 of profiled executions">, + BackendInfo, InGroup; } // end of instrumentation issue category def err_extract_api_ignores_file_not_found : Error<"file '%0' specified by '--extract-api-ignores=' not found">, DefaultFatal; def warn_missing_symbol_graph_dir : Warning< - "Missing symbol graph output directory, defaulting to working directory">, + "missing symbol graph output directory, defaulting to working directory">, InGroup; def err_ast_action_on_llvm_ir : Error< diff --git a/clang/include/clang/Basic/DiagnosticGroups.td b/clang/include/clang/Basic/DiagnosticGroups.td index 03a79b3f1c68a..6591552fbb544 100644 --- a/clang/include/clang/Basic/DiagnosticGroups.td +++ b/clang/include/clang/Basic/DiagnosticGroups.td @@ -15,8 +15,6 @@ def Implicit : DiagGroup<"implicit", [ ImplicitInt ]>; -def DeprecatedStaticAnalyzerFlag : DiagGroup<"deprecated-static-analyzer-flag">; - // Empty DiagGroups are recognized by clang but ignored. def ODR : DiagGroup<"odr">; def : DiagGroup<"abi">; @@ -1472,6 +1470,10 @@ def FunctionMultiVersioning def NoDeref : DiagGroup<"noderef">; +// -fbounds-safety and bounds annotation related warnings +def BoundsSafetyCountedByEltTyUnknownSize : + DiagGroup<"bounds-safety-counted-by-elt-type-unknown-size">; + // A group for cross translation unit static analysis related warnings. def CrossTU : DiagGroup<"ctu">; diff --git a/clang/include/clang/Basic/DiagnosticInstallAPIKinds.td b/clang/include/clang/Basic/DiagnosticInstallAPIKinds.td index 944b2a38b6e96..cdf27247602f2 100644 --- a/clang/include/clang/Basic/DiagnosticInstallAPIKinds.td +++ b/clang/include/clang/Basic/DiagnosticInstallAPIKinds.td @@ -59,8 +59,8 @@ def err_platform_mismatch : Error<"platform does not match: '%0' (provided) vs ' def err_install_name_mismatch : Error<"install_name does not match: '%0' (provided) vs '%1' (found)">; def err_current_version_mismatch : Error<"current_version does not match: '%0' (provided) vs '%1' (found)">; def err_compatibility_version_mismatch : Error<"compatibility_version does not match: '%0' (provided) vs '%1' (found)">; -def err_appextension_safe_mismatch : Error<"ApplicationExtensionSafe flag does not match: '%0' (provided) vs '%1' (found)">; -def err_shared_cache_eligiblity_mismatch : Error<"NotForDyldSharedCache flag does not match: '%0' (provided) vs '%1' (found)">; +def err_appextension_safe_mismatch : Error<"the ApplicationExtensionSafe flag does not match: '%0' (provided) vs '%1' (found)">; +def err_shared_cache_eligiblity_mismatch : Error<"the NotForDyldSharedCache flag does not match: '%0' (provided) vs '%1' (found)">; def err_no_twolevel_namespace : Error<"flat namespace libraries are not supported">; def err_parent_umbrella_missing: Error<"parent umbrella missing from %0: '%1'">; def err_parent_umbrella_mismatch : Error<"parent umbrella does not match: '%0' (provided) vs '%1' (found)">; diff --git a/clang/include/clang/Basic/DiagnosticLexKinds.td b/clang/include/clang/Basic/DiagnosticLexKinds.td index ad6bacfb118d4..25fbfe83fa2bc 100644 --- a/clang/include/clang/Basic/DiagnosticLexKinds.td +++ b/clang/include/clang/Basic/DiagnosticLexKinds.td @@ -111,6 +111,14 @@ def warn_cxx98_compat_raw_string_literal : Warning< "raw string literals are incompatible with C++98">, InGroup, DefaultIgnore; +def warn_cxx26_compat_raw_string_literal_character_set : Warning< + " '%0' in a raw string literal delimiter is incompatible " + "with standards before C++2c">, + InGroup, DefaultIgnore; +def ext_cxx26_raw_string_literal_character_set : Extension< + " '%0' in a raw string literal delimiter is a C++2c extension">, + InGroup, DefaultIgnore; + def warn_multichar_character_literal : Warning< "multi-character character constant">, InGroup; def warn_four_char_character_literal : Warning< @@ -991,5 +999,5 @@ def err_pp_unclosed_pragma_unsafe_buffer_usage : Error<"'#pragma unsafe_buffer_usage' was not ended">; def err_pp_pragma_unsafe_buffer_usage_syntax : -Error<"Expected 'begin' or 'end'">; +Error<"expected 'begin' or 'end'">; } diff --git a/clang/include/clang/Basic/DiagnosticParseKinds.td b/clang/include/clang/Basic/DiagnosticParseKinds.td index d8e89125fae1e..f8328be5890dd 100644 --- a/clang/include/clang/Basic/DiagnosticParseKinds.td +++ b/clang/include/clang/Basic/DiagnosticParseKinds.td @@ -1117,7 +1117,7 @@ def err_availability_expected_environment : Error< // objc_bridge_related attribute def err_objcbridge_related_expected_related_class : Error< - "expected a related ObjectiveC class name, e.g., 'NSColor'">; + "expected a related Objective-C class name, e.g., 'NSColor'">; def err_objcbridge_related_selector_name : Error< "expected a class method selector with single argument, e.g., 'colorWithCGColor:'">; diff --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td b/clang/include/clang/Basic/DiagnosticSemaKinds.td index ca20b27d88859..6f32de54436be 100644 --- a/clang/include/clang/Basic/DiagnosticSemaKinds.td +++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td @@ -822,7 +822,7 @@ def note_include_header_or_declare : Note< def note_previous_builtin_declaration : Note<"%0 is a builtin with type %1">; def warn_implicit_decl_no_jmp_buf : Warning<"declaration of built-in function '%0' requires the declaration" - " of the 'jmp_buf' type, commonly provided in the header .">, + " of the 'jmp_buf' type, commonly provided in the header ">, InGroup>; def warn_implicit_decl_requires_sysheader : Warning< "declaration of built-in function '%1' requires inclusion of the header <%0>">, @@ -923,7 +923,7 @@ def note_strncat_wrong_size : Note< "the terminating null byte">; def warn_assume_side_effects : Warning< - "the argument to %0 has side effects that will be discarded">, + "assumption is ignored because it contains (potential) side-effects">, InGroup>; def warn_omp_assume_attribute_string_unknown : Warning< "unknown assumption string '%0'; attribute is potentially ignored">, @@ -3271,7 +3271,7 @@ def err_attribute_bad_sve_vector_size : Error< "'-msve-vector-bits' ('%1')">; def err_attribute_arm_feature_sve_bits_unsupported : Error< "%0 is only supported when '-msve-vector-bits=' is specified with a " - "value of 128, 256, 512, 1024 or 2048.">; + "value of 128, 256, 512, 1024 or 2048">; def warn_attribute_arm_sm_incompat_builtin : Warning< "builtin call has undefined behaviour when called from a %0 function">, InGroup>; @@ -4611,7 +4611,7 @@ def err_objc_attr_typedef_not_void_pointer : Error< def err_objc_cf_bridged_not_interface : Error< "CF object of type %0 is bridged to %1, which is not an Objective-C class">; def err_objc_ns_bridged_invalid_cfobject : Error< - "ObjectiveC object of type %0 is bridged to %1, which is not valid CF object">; + "Objective-C object of type %0 is bridged to %1, which is not valid CF object">; def warn_objc_invalid_bridge : Warning< "%0 bridges to %1, not %2">, InGroup; def warn_objc_invalid_bridge_to_cf : Warning< @@ -6629,8 +6629,10 @@ def warn_superclass_variable_sized_type_not_at_end : Warning< def err_flexible_array_count_not_in_same_struct : Error< "'counted_by' field %0 isn't within the same struct as the flexible array">; -def err_counted_by_attr_not_on_flexible_array_member : Error< - "'counted_by' only applies to C99 flexible array members">; +def err_counted_by_attr_not_on_ptr_or_flexible_array_member : Error< + "'counted_by' only applies to pointers or C99 flexible array members">; +def err_counted_by_attr_on_array_not_flexible_array_member : Error< + "'counted_by' on arrays only applies to C99 flexible array members">; def err_counted_by_attr_refer_to_itself : Error< "'counted_by' cannot refer to the flexible array member %0">; def err_counted_by_must_be_in_structure : Error< @@ -6645,6 +6647,23 @@ def err_counted_by_attr_refer_to_union : Error< "'counted_by' argument cannot refer to a union member">; def note_flexible_array_counted_by_attr_field : Note< "field %0 declared here">; +def err_counted_by_attr_pointee_unknown_size : Error< + "'counted_by' %select{cannot|should not}3 be applied to %select{" + "a pointer with pointee|" // pointer + "an array with element}0" // array + " of unknown size because %1 is %select{" + "an incomplete type|" // CountedByInvalidPointeeTypeKind::INCOMPLETE + "a sizeless type|" // CountedByInvalidPointeeTypeKind::SIZELESS + "a function type|" // CountedByInvalidPointeeTypeKind::FUNCTION + // CountedByInvalidPointeeTypeKind::FLEXIBLE_ARRAY_MEMBER + "a struct type with a flexible array member" + "%select{|. This will be an error in a future compiler version}3" + "" + "}2">; + +def warn_counted_by_attr_elt_type_unknown_size : + Warning, + InGroup; let CategoryName = "ARC Semantic Issue" in { @@ -8098,8 +8117,8 @@ def warn_deprecated_volatile_structured_binding : Warning< InGroup; def warn_deprecated_altivec_src_compat : Warning< - "Current handling of vector bool and vector pixel types in this context are " - "deprecated. The default behaviour will soon change to that implied by the " + "current handling of vector bool and vector pixel types in this context are " + "deprecated; the default behaviour will soon change to that implied by the " "'-altivec-compat=xl' option">, InGroup>; @@ -8305,7 +8324,7 @@ let CategoryName = "Lambda Issue" in { "implicit capture of 'this' is not allowed for kernel functions. " "Either ensure the object is allocated in the memory available " "on the device (e.g., shared USM memory) and capture it explicitly " - "or consider capturing the current object by copy ([*this]).">; + "or consider capturing the current object by copy ([*this])">; def err_lambda_member_access : Error< "invalid attempt to access member of lambda">; @@ -8944,8 +8963,10 @@ def err_builtin_fn_use : Error<"builtin functions must be directly called">; def warn_call_wrong_number_of_arguments : Warning< "too %select{few|many}0 arguments in call to %1">; + def err_atomic_builtin_must_be_pointer : Error< - "address argument to atomic builtin must be a pointer (%0 invalid)">; + "address argument to atomic builtin must be a pointer %select{|to a non-zero-sized object }1(%0 invalid)">; + def err_atomic_builtin_must_be_pointer_intptr : Error< "address argument to atomic builtin must be a pointer to integer or pointer" " (%0 invalid)">; @@ -9069,8 +9090,8 @@ def err_va_arg_in_device : Error< def err_alias_not_supported_on_nvptx : Error<"CUDA older than 10.0 does not support .alias">; def err_cuda_unattributed_constexpr_cannot_overload_device : Error< "constexpr function %0 without __host__ or __device__ attributes cannot " - "overload __device__ function with same signature. Add a __host__ " - "attribute, or build with -fno-cuda-host-device-constexpr.">; + "overload __device__ function with the same signature; add a __host__ " + "attribute, or build with -fno-cuda-host-device-constexpr">; def note_cuda_conflicting_device_function_declared_here : Note< "conflicting __device__ function declared here">; def err_cuda_device_exceptions : Error< @@ -9078,9 +9099,9 @@ def err_cuda_device_exceptions : Error< "%select{__device__|__global__|__host__|__host__ __device__}1 function">; def err_dynamic_var_init : Error< "dynamic initialization is not supported for " - "__device__, __constant__, __shared__, and __managed__ variables.">; + "__device__, __constant__, __shared__, and __managed__ variables">; def err_shared_var_init : Error< - "initialization is not supported for __shared__ variables.">; + "initialization is not supported for __shared__ variables">; def err_cuda_vla : Error< "cannot use variable-length arrays in " "%select{__device__|__global__|__host__|__host__ __device__}0 functions">; @@ -10464,12 +10485,12 @@ def err_shufflevector_argument_too_large : Error< "index for __builtin_shufflevector must be less than the total number " "of vector elements">; def err_shufflevector_minus_one_is_undefined_behavior_constexpr : Error< - "index for __builtin_shufflevector not within the bounds of the input vectors; index of -1 found at position %0 not permitted in a constexpr context.">; + "index for __builtin_shufflevector not within the bounds of the input vectors; index of -1 found at position %0 is not permitted in a constexpr context">; def err_convertvector_non_vector : Error< "first argument to __builtin_convertvector must be a vector">; def err_convertvector_constexpr_unsupported_vector_cast : Error< - "unsupported vector cast from %0 to %1 in a constant expression.">; + "unsupported vector cast from %0 to %1 in a constant expression">; def err_builtin_non_vector_type : Error< "%0 argument to %1 must be of vector type">; def err_convertvector_incompatible_vector : Error< @@ -10802,7 +10823,7 @@ def err_kernel_arg_address_space : Error< "pointer arguments to kernel functions must reside in '__global', " "'__constant' or '__local' address space">; def err_opencl_ext_vector_component_invalid_length : Error< - "vector component access has invalid length %0. Supported: 1,2,3,4,8,16.">; + "vector component access has invalid length %0; supported lengths are: 1,2,3,4,8,16">; def err_opencl_function_variable : Error< "%select{non-kernel function|function scope}0 variable cannot be declared in %1 address space">; def err_opencl_addrspace_scope : Error< @@ -11252,12 +11273,12 @@ def err_omp_atomic_compare : Error< "the statement for 'atomic compare' must be a compound statement of form '{x = expr ordop x ? expr : x;}', '{x = x ordop expr? expr : x;}'," " '{x = x == e ? d : x;}', '{x = e == x ? d : x;}', or 'if(expr ordop x) {x = expr;}', 'if(x ordop expr) {x = expr;}', 'if(x == e) {x = d;}'," " 'if(e == x) {x = d;}' where 'x' is an lvalue expression with scalar type, 'expr', 'e', and 'd' are expressions with scalar type," - " and 'ordop' is one of '<' or '>'.">; + " and 'ordop' is one of '<' or '>'">; def err_omp_atomic_compare_capture : Error< "the statement for 'atomic compare capture' must be a compound statement of form '{v = x; cond-up-stmt}', ''{cond-up-stmt v = x;}', '{if(x == e) {x = d;} else {v = x;}}'," " '{r = x == e; if(r) {x = d;}}', or '{r = x == e; if(r) {x = d;} else {v = x;}}', where 'cond-update-stmt' can have one of the following forms: 'if(expr ordop x) {x = expr;}'," " 'if(x ordop expr) {x = expr;}', 'if(x == e) {x = d;}', or 'if(e == x) {x = d;}' where 'x', 'r', and 'v' are lvalue expressions with scalar type, 'expr', 'e', and 'd' are expressions with scalar type," - " and 'ordop' is one of '<' or '>'.">; + " and 'ordop' is one of '<' or '>'">; def note_omp_atomic_compare: Note< "%select{expected compound statement|expected exactly one expression statement|expected assignment statement|expected conditional operator|expect result value to be at false expression|" "expect binary operator in conditional expression|expect '<', '>' or '==' as order operator|expect comparison in a form of 'x == e', 'e == x', 'x ordop expr', or 'expr ordop x'|" @@ -11423,7 +11444,7 @@ def err_omp_expected_int_param : Error< def err_omp_at_least_one_motion_clause_required : Error< "expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'">; def err_omp_cannot_update_with_internal_linkage : Error< - "the host cannot update a declare target variable that is not externally visible.">; + "the host cannot update a declare target variable that is not externally visible">; def err_omp_usedeviceptr_not_a_pointer : Error< "expected pointer or reference to pointer in 'use_device_ptr' clause">; def err_omp_argument_type_isdeviceptr : Error < @@ -11867,7 +11888,7 @@ def note_await_ready_no_bool_conversion : Note< "return type of 'await_ready' is required to be contextually convertible to 'bool'" >; def warn_coroutine_handle_address_invalid_return_type : Warning < - "return type of 'coroutine_handle<>::address should be 'void*' (have %0) in order to get capability with existing async C API.">, + "return type of 'coroutine_handle<>::address should be 'void*' (have %0) in order to get capability with existing async C API">, InGroup; def err_coroutine_promise_final_suspend_requires_nothrow : Error< "the expression 'co_await __promise.final_suspend()' is required to be non-throwing" @@ -11895,7 +11916,7 @@ def err_conflicting_aligned_options : Error < "conflicting option '-fcoro-aligned-allocation' and '-fno-aligned-allocation'" >; def err_coro_invalid_addr_of_label : Error< - "the GNU address of label extension is not allowed in coroutines." + "the GNU address of label extension is not allowed in coroutines" >; def err_coroutine_return_type : Error< "function returns a type %0 marked with [[clang::coro_return_type]] but is neither a coroutine nor a coroutine wrapper; " @@ -12677,4 +12698,8 @@ def err_acc_reduction_composite_type def err_acc_reduction_composite_member_type :Error< "OpenACC 'reduction' composite variable must not have non-scalar field">; def note_acc_reduction_composite_member_loc : Note<"invalid field is here">; + +// AMDGCN builtins diagnostics +def err_amdgcn_global_load_lds_size_invalid_value : Error<"invalid size value">; +def note_amdgcn_global_load_lds_size_valid_value : Note<"size must be 1, 2, or 4">; } // end of sema component. diff --git a/clang/include/clang/Basic/LangOptions.def b/clang/include/clang/Basic/LangOptions.def index 7cb131639b0cf..ee5af40abe232 100644 --- a/clang/include/clang/Basic/LangOptions.def +++ b/clang/include/clang/Basic/LangOptions.def @@ -324,6 +324,7 @@ LANGOPT(HIPStdParInterposeAlloc, 1, 0, "Replace allocations / deallocations with LANGOPT(OpenACC , 1, 0, "OpenACC Enabled") +LANGOPT(MSVCEnableStdcMacro , 1, 0, "Define __STDC__ with '-fms-compatibility'") LANGOPT(SizedDeallocation , 1, 0, "sized deallocation") LANGOPT(AlignedAllocation , 1, 0, "aligned allocation") LANGOPT(AlignedAllocationUnavailable, 1, 0, "aligned allocation functions are unavailable") diff --git a/clang/include/clang/Basic/arm_sve.td b/clang/include/clang/Basic/arm_sve.td index a9ea71cd07774..03570f94de666 100644 --- a/clang/include/clang/Basic/arm_sve.td +++ b/clang/include/clang/Basic/arm_sve.td @@ -2186,9 +2186,6 @@ let TargetGuard = "sme2" in { def SVSQRSHRUN_X4 : SInst<"svqrshrun[_n]_{0}[_{d}_x4]", "b4i", "il", MergeNone, "aarch64_sve_sqrshrun_x4", [IsStreaming], [ImmCheck<1, ImmCheckShiftRight, 0>]>; - def REINTERPRET_SVBOOL_TO_SVCOUNT : Inst<"svreinterpret[_c]", "}P", "Pc", MergeNone, "", [IsStreamingCompatible], []>; - def REINTERPRET_SVCOUNT_TO_SVBOOL : Inst<"svreinterpret[_b]", "P}", "Pc", MergeNone, "", [IsStreamingCompatible], []>; - // SQDMULH def SVSQDMULH_SINGLE_X2 : SInst<"svqdmulh[_single_{d}_x2]", "22d", "csil", MergeNone, "aarch64_sve_sqdmulh_single_vgx2", [IsStreaming], []>; def SVSQDMULH_SINGLE_X4 : SInst<"svqdmulh[_single_{d}_x4]", "44d", "csil", MergeNone, "aarch64_sve_sqdmulh_single_vgx4", [IsStreaming], []>; @@ -2197,6 +2194,9 @@ let TargetGuard = "sme2" in { } let TargetGuard = "sve2p1|sme2" in { + def REINTERPRET_SVBOOL_TO_SVCOUNT : Inst<"svreinterpret[_c]", "}P", "Pc", MergeNone, "", [IsStreamingCompatible], []>; + def REINTERPRET_SVCOUNT_TO_SVBOOL : Inst<"svreinterpret[_b]", "P}", "Pc", MergeNone, "", [IsStreamingCompatible], []>; + // SQRSHRN / UQRSHRN def SVQRSHRN_X2 : SInst<"svqrshrn[_n]_{0}[_{d}_x2]", "h2i", "i", MergeNone, "aarch64_sve_sqrshrn_x2", [IsStreamingCompatible], [ImmCheck<1, ImmCheck1_16>]>; def SVUQRSHRN_X2 : SInst<"svqrshrn[_n]_{0}[_{d}_x2]", "e2i", "Ui", MergeNone, "aarch64_sve_uqrshrn_x2", [IsStreamingCompatible], [ImmCheck<1, ImmCheck1_16>]>; diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td index b327746448f88..e0c0c5a0899ad 100644 --- a/clang/include/clang/Driver/Options.td +++ b/clang/include/clang/Driver/Options.td @@ -3060,6 +3060,10 @@ def fms_compatibility : Flag<["-"], "fms-compatibility">, Group, Visibility<[ClangOption, CC1Option, CLOption]>, HelpText<"Enable full Microsoft Visual C++ compatibility">, MarshallingInfoFlag>; +def fms_define_stdc : Flag<["-"], "fms-define-stdc">, Group, + Visibility<[ClangOption, CC1Option, CLOption]>, + HelpText<"Define '__STDC__' to '1' in MSVC Compatibility mode">, + MarshallingInfoFlag>; def fms_extensions : Flag<["-"], "fms-extensions">, Group, Visibility<[ClangOption, CC1Option, CLOption]>, HelpText<"Accept some non-standard constructs supported by the Microsoft compiler">, @@ -6405,14 +6409,10 @@ def mavx512cd : Flag<["-"], "mavx512cd">, Group; def mno_avx512cd : Flag<["-"], "mno-avx512cd">, Group; def mavx512dq : Flag<["-"], "mavx512dq">, Group; def mno_avx512dq : Flag<["-"], "mno-avx512dq">, Group; -def mavx512er : Flag<["-"], "mavx512er">, Group; -def mno_avx512er : Flag<["-"], "mno-avx512er">, Group; def mavx512fp16 : Flag<["-"], "mavx512fp16">, Group; def mno_avx512fp16 : Flag<["-"], "mno-avx512fp16">, Group; def mavx512ifma : Flag<["-"], "mavx512ifma">, Group; def mno_avx512ifma : Flag<["-"], "mno-avx512ifma">, Group; -def mavx512pf : Flag<["-"], "mavx512pf">, Group; -def mno_avx512pf : Flag<["-"], "mno-avx512pf">, Group; def mavx512vbmi : Flag<["-"], "mavx512vbmi">, Group; def mno_avx512vbmi : Flag<["-"], "mno-avx512vbmi">, Group; def mavx512vbmi2 : Flag<["-"], "mavx512vbmi2">, Group; @@ -6503,8 +6503,6 @@ def mpopcnt : Flag<["-"], "mpopcnt">, Group; def mno_popcnt : Flag<["-"], "mno-popcnt">, Group; def mprefetchi : Flag<["-"], "mprefetchi">, Group; def mno_prefetchi : Flag<["-"], "mno-prefetchi">, Group; -def mprefetchwt1 : Flag<["-"], "mprefetchwt1">, Group; -def mno_prefetchwt1 : Flag<["-"], "mno-prefetchwt1">, Group; def mprfchw : Flag<["-"], "mprfchw">, Group; def mno_prfchw : Flag<["-"], "mno-prfchw">, Group; def mptwrite : Flag<["-"], "mptwrite">, Group; @@ -8721,6 +8719,9 @@ def _SLASH_vd : CLJoined<"vd">, HelpText<"Control vtordisp placement">, Alias; def _SLASH_X : CLFlag<"X">, HelpText<"Do not add %INCLUDE% to include search path">, Alias; +def _SLASH_Zc___STDC__ : CLFlag<"Zc:__STDC__">, + HelpText<"Define __STDC__">, + Alias; def _SLASH_Zc_sizedDealloc : CLFlag<"Zc:sizedDealloc">, HelpText<"Enable C++14 sized global deallocation functions">, Alias; diff --git a/clang/include/clang/Format/Format.h b/clang/include/clang/Format/Format.h index 274b45d1bc586..eb6647038403d 100644 --- a/clang/include/clang/Format/Format.h +++ b/clang/include/clang/Format/Format.h @@ -480,15 +480,21 @@ struct FormatStyle { ENAS_DontAlign, /// Align escaped newlines as far left as possible. /// \code - /// true: /// #define A \ /// int aaaa; \ /// int b; \ /// int dddddddddd; - /// - /// false: /// \endcode ENAS_Left, + /// Align escaped newlines as far left as possible, using the last line of + /// the preprocessor directive as the reference if it's the longest. + /// \code + /// #define A \ + /// int aaaa; \ + /// int b; \ + /// int dddddddddd; + /// \endcode + ENAS_LeftWithLastLine, /// Align escaped newlines in the right-most column. /// \code /// #define A \ diff --git a/clang/include/clang/Interpreter/Interpreter.h b/clang/include/clang/Interpreter/Interpreter.h index 970e0245417b5..1234608bb5864 100644 --- a/clang/include/clang/Interpreter/Interpreter.h +++ b/clang/include/clang/Interpreter/Interpreter.h @@ -110,9 +110,9 @@ class Interpreter { RuntimeInterfaceBuilder::TransformExprFunction *AddPrintValueCall = nullptr; protected: - // Derived classes can make use an extended interface of the Interpreter. - // That's useful for testing and out-of-tree clients. - Interpreter(std::unique_ptr CI, llvm::Error &Err); + // Derived classes can use an extended interface of the Interpreter. + Interpreter(std::unique_ptr CI, llvm::Error &Err, + std::unique_ptr JITBuilder = nullptr); // Create the internal IncrementalExecutor, or re-create it after calling // ResetExecutor(). @@ -128,13 +128,6 @@ class Interpreter { // custom runtime. virtual std::unique_ptr FindRuntimeInterface(); - // Lazily construct thev ORCv2 JITBuilder. This called when the internal - // IncrementalExecutor is created. The default implementation populates an - // in-process JIT with debugging support. Override this to configure the JIT - // engine used for execution. - virtual llvm::Expected> - CreateJITBuilder(CompilerInstance &CI); - public: virtual ~Interpreter(); @@ -189,6 +182,8 @@ class Interpreter { llvm::DenseMap Dtors; llvm::SmallVector ValuePrintingInfo; + + std::unique_ptr JITBuilder; }; } // namespace clang diff --git a/clang/include/clang/Parse/Parser.h b/clang/include/clang/Parse/Parser.h index 18a0f1078bed9..25bf4f5a6b66b 100644 --- a/clang/include/clang/Parse/Parser.h +++ b/clang/include/clang/Parse/Parser.h @@ -1646,8 +1646,12 @@ class Parser : public CodeCompletionHandler { void ParseLexedAttributes(ParsingClass &Class); void ParseLexedAttributeList(LateParsedAttrList &LAs, Decl *D, bool EnterScope, bool OnDefinition); + void ParseLexedCAttributeList(LateParsedAttrList &LA, bool EnterScope, + ParsedAttributes *OutAttrs = nullptr); void ParseLexedAttribute(LateParsedAttribute &LA, bool EnterScope, bool OnDefinition); + void ParseLexedCAttribute(LateParsedAttribute &LA, bool EnterScope, + ParsedAttributes *OutAttrs = nullptr); void ParseLexedMethodDeclarations(ParsingClass &Class); void ParseLexedMethodDeclaration(LateParsedMethodDeclaration &LM); void ParseLexedMethodDefs(ParsingClass &Class); @@ -2535,7 +2539,8 @@ class Parser : public CodeCompletionHandler { void ParseStructDeclaration( ParsingDeclSpec &DS, - llvm::function_ref FieldsCallback); + llvm::function_ref FieldsCallback, + LateParsedAttrList *LateFieldAttrs = nullptr); DeclGroupPtrTy ParseTopLevelStmtDecl(); @@ -3114,6 +3119,8 @@ class Parser : public CodeCompletionHandler { SourceLocation ScopeLoc, ParsedAttr::Form Form); + void DistributeCLateParsedAttrs(Decl *Dcl, LateParsedAttrList *LateAttrs); + void ParseBoundsAttribute(IdentifierInfo &AttrName, SourceLocation AttrNameLoc, ParsedAttributes &Attrs, IdentifierInfo *ScopeName, SourceLocation ScopeLoc, diff --git a/clang/include/clang/Sema/Sema.h b/clang/include/clang/Sema/Sema.h index 1f64a7184cd65..d251c250e6390 100644 --- a/clang/include/clang/Sema/Sema.h +++ b/clang/include/clang/Sema/Sema.h @@ -5281,6 +5281,13 @@ class Sema final : public SemaBase { Context == ExpressionEvaluationContext::UnevaluatedList; } + bool isPotentiallyEvaluated() const { + return Context == ExpressionEvaluationContext::PotentiallyEvaluated || + Context == + ExpressionEvaluationContext::PotentiallyEvaluatedIfUsed || + Context == ExpressionEvaluationContext::ConstantEvaluated; + } + bool isConstantEvaluated() const { return Context == ExpressionEvaluationContext::ConstantEvaluated || Context == ExpressionEvaluationContext::ImmediateFunctionContext; @@ -5315,6 +5322,16 @@ class Sema final : public SemaBase { return ExprEvalContexts.back(); }; + ExpressionEvaluationContextRecord &parentEvaluationContext() { + assert(ExprEvalContexts.size() >= 2 && + "Must be in an expression evaluation context"); + return ExprEvalContexts[ExprEvalContexts.size() - 2]; + }; + + const ExpressionEvaluationContextRecord &parentEvaluationContext() const { + return const_cast(this)->parentEvaluationContext(); + }; + bool isBoundsAttrContext() const { return ExprEvalContexts.back().ExprContext == ExpressionEvaluationContextRecord::ExpressionKind:: @@ -6445,10 +6462,9 @@ class Sema final : public SemaBase { /// flag from previous context. void keepInLifetimeExtendingContext() { if (ExprEvalContexts.size() > 2 && - ExprEvalContexts[ExprEvalContexts.size() - 2] - .InLifetimeExtendingContext) { + parentEvaluationContext().InLifetimeExtendingContext) { auto &LastRecord = ExprEvalContexts.back(); - auto &PrevRecord = ExprEvalContexts[ExprEvalContexts.size() - 2]; + auto &PrevRecord = parentEvaluationContext(); LastRecord.InLifetimeExtendingContext = PrevRecord.InLifetimeExtendingContext; } @@ -11583,7 +11599,8 @@ class Sema final : public SemaBase { QualType BuildMatrixType(QualType T, Expr *NumRows, Expr *NumColumns, SourceLocation AttrLoc); - QualType BuildCountAttributedArrayType(QualType WrappedTy, Expr *CountExpr); + QualType BuildCountAttributedArrayOrPointerType(QualType WrappedTy, + Expr *CountExpr); QualType BuildAddressSpaceAttr(QualType &T, LangAS ASIdx, Expr *AddrSpace, SourceLocation AttrLoc); diff --git a/clang/include/clang/Serialization/ASTReader.h b/clang/include/clang/Serialization/ASTReader.h index 1bb5fa27a2419..4ece4593f0738 100644 --- a/clang/include/clang/Serialization/ASTReader.h +++ b/clang/include/clang/Serialization/ASTReader.h @@ -601,11 +601,11 @@ class ASTReader /// An array of lexical contents of a declaration context, as a sequence of /// Decl::Kind, DeclID pairs. - using unalighed_decl_id_t = + using unaligned_decl_id_t = llvm::support::detail::packed_endian_specific_integral< serialization::DeclID, llvm::endianness::native, llvm::support::unaligned>; - using LexicalContents = ArrayRef; + using LexicalContents = ArrayRef; /// Map from a DeclContext to its lexical contents. llvm::DenseMap> @@ -2246,7 +2246,7 @@ class ASTReader auto [Loc, ModuleFileIndex] = ReadUntranslatedSourceLocation(Raw, Seq); ModuleFile *OwningModuleFile = - ModuleFileIndex == 0 ? &MF : MF.DependentModules[ModuleFileIndex - 1]; + ModuleFileIndex == 0 ? &MF : MF.TransitiveImports[ModuleFileIndex - 1]; assert(!SourceMgr.isLoadedSourceLocation(Loc) && "Run out source location space"); diff --git a/clang/include/clang/Serialization/ModuleFile.h b/clang/include/clang/Serialization/ModuleFile.h index 7d8cbe3d40f56..992d26a8b88c1 100644 --- a/clang/include/clang/Serialization/ModuleFile.h +++ b/clang/include/clang/Serialization/ModuleFile.h @@ -513,11 +513,11 @@ class ModuleFile { /// List of modules which this modules dependent on. Different /// from `Imports`, this includes indirectly imported modules too. - /// The order of DependentModules is significant. It should keep + /// The order of TransitiveImports is significant. It should keep /// the same order with that module file manager when we write /// the current module file. The value of the member will be initialized /// in `ASTReader::ReadModuleOffsetMap`. - llvm::SmallVector DependentModules; + llvm::SmallVector TransitiveImports; /// Determine whether this module was directly imported at /// any point during translation. diff --git a/clang/include/clang/StaticAnalyzer/Checkers/Checkers.td b/clang/include/clang/StaticAnalyzer/Checkers/Checkers.td index d0ba1ce548403..40f443047bd4b 100644 --- a/clang/include/clang/StaticAnalyzer/Checkers/Checkers.td +++ b/clang/include/clang/StaticAnalyzer/Checkers/Checkers.td @@ -1035,15 +1035,6 @@ let ParentPackage = ENV in { } // end "security.cert.env" -let ParentPackage = POSAlpha in { - - def PutenvWithAuto : Checker<"34c">, - HelpText<"Finds calls to the 'putenv' function which pass a pointer to " - "an automatic variable as the argument.">, - Documentation; - -} // end "alpha.cert.pos" - let ParentPackage = SecurityAlpha in { def ArrayBoundChecker : Checker<"ArrayBound">, @@ -1054,10 +1045,6 @@ def ArrayBoundCheckerV2 : Checker<"ArrayBoundV2">, HelpText<"Warn about buffer overflows (newer checker)">, Documentation; -def ReturnPointerRangeChecker : Checker<"ReturnPtrRange">, - HelpText<"Check for an out-of-bound pointer being returned to callers">, - Documentation; - def MallocOverflowSecurityChecker : Checker<"MallocOverflow">, HelpText<"Check for overflows in the arguments to malloc()">, Documentation; @@ -1078,6 +1065,15 @@ def MmapWriteExecChecker : Checker<"MmapWriteExec">, ]>, Documentation; +def PutenvStackArray : Checker<"PutenvStackArray">, + HelpText<"Finds calls to the function 'putenv' which pass a pointer to " + "an automatic (stack-allocated) array as the argument.">, + Documentation; + +def ReturnPointerRangeChecker : Checker<"ReturnPtrRange">, + HelpText<"Check for an out-of-bound pointer being returned to callers">, + Documentation; + } // end "alpha.security" //===----------------------------------------------------------------------===// diff --git a/clang/lib/AST/APValue.cpp b/clang/lib/AST/APValue.cpp index 8c77b563657d9..d8e33ff421c06 100644 --- a/clang/lib/AST/APValue.cpp +++ b/clang/lib/AST/APValue.cpp @@ -90,7 +90,7 @@ QualType APValue::LValueBase::getType() const { // For a materialized temporary, the type of the temporary we materialized // may not be the type of the expression. if (const MaterializeTemporaryExpr *MTE = - clang::dyn_cast(Base)) { + llvm::dyn_cast(Base)) { SmallVector CommaLHSs; SmallVector Adjustments; const Expr *Temp = MTE->getSubExpr(); diff --git a/clang/lib/AST/ASTDiagnostic.cpp b/clang/lib/AST/ASTDiagnostic.cpp index 91bc1b22acfc7..0680ff5e3a385 100644 --- a/clang/lib/AST/ASTDiagnostic.cpp +++ b/clang/lib/AST/ASTDiagnostic.cpp @@ -1215,46 +1215,19 @@ class TemplateDiff { bool &NeedAddressOf) { if (!Iter.isEnd()) { switch (Iter->getKind()) { - default: - llvm_unreachable("unknown ArgumentKind"); - case TemplateArgument::Integral: - Value = Iter->getAsIntegral(); - HasInt = true; - IntType = Iter->getIntegralType(); - return; - case TemplateArgument::Declaration: { - VD = Iter->getAsDecl(); - QualType ArgType = Iter->getParamTypeForDecl(); - QualType VDType = VD->getType(); - if (ArgType->isPointerType() && - Context.hasSameType(ArgType->getPointeeType(), VDType)) - NeedAddressOf = true; - return; - } - case TemplateArgument::NullPtr: - IsNullPtr = true; - return; - case TemplateArgument::Expression: - E = Iter->getAsExpr(); - } - } else if (!Default->isParameterPack()) { - E = Default->getDefaultArgument().getArgument().getAsExpr(); - } - - if (!Iter.hasDesugaredTA()) return; - - const TemplateArgument& TA = Iter.getDesugaredTA(); - switch (TA.getKind()) { - default: - llvm_unreachable("unknown ArgumentKind"); + case TemplateArgument::StructuralValue: + // FIXME: Diffing of structural values is not implemented. + // There is no possible fallback in this case, this will show up + // as '(no argument)'. + return; case TemplateArgument::Integral: - Value = TA.getAsIntegral(); + Value = Iter->getAsIntegral(); HasInt = true; - IntType = TA.getIntegralType(); + IntType = Iter->getIntegralType(); return; case TemplateArgument::Declaration: { - VD = TA.getAsDecl(); - QualType ArgType = TA.getParamTypeForDecl(); + VD = Iter->getAsDecl(); + QualType ArgType = Iter->getParamTypeForDecl(); QualType VDType = VD->getType(); if (ArgType->isPointerType() && Context.hasSameType(ArgType->getPointeeType(), VDType)) @@ -1265,13 +1238,62 @@ class TemplateDiff { IsNullPtr = true; return; case TemplateArgument::Expression: - // TODO: Sometimes, the desugared template argument Expr differs from - // the sugared template argument Expr. It may be useful in the future - // but for now, it is just discarded. - if (!E) - E = TA.getAsExpr(); - return; + E = Iter->getAsExpr(); + break; + case TemplateArgument::Null: + case TemplateArgument::Type: + case TemplateArgument::Template: + case TemplateArgument::TemplateExpansion: + llvm_unreachable("TemplateArgument kind is not expected for NTTP"); + case TemplateArgument::Pack: + llvm_unreachable("TemplateArgument kind should be handled elsewhere"); + } + } else if (!Default->isParameterPack()) { + E = Default->getDefaultArgument().getArgument().getAsExpr(); + } + + if (!Iter.hasDesugaredTA()) + return; + + const TemplateArgument &TA = Iter.getDesugaredTA(); + switch (TA.getKind()) { + case TemplateArgument::StructuralValue: + // FIXME: Diffing of structural values is not implemented. + // Just fall back to the expression. + return; + case TemplateArgument::Integral: + Value = TA.getAsIntegral(); + HasInt = true; + IntType = TA.getIntegralType(); + return; + case TemplateArgument::Declaration: { + VD = TA.getAsDecl(); + QualType ArgType = TA.getParamTypeForDecl(); + QualType VDType = VD->getType(); + if (ArgType->isPointerType() && + Context.hasSameType(ArgType->getPointeeType(), VDType)) + NeedAddressOf = true; + return; } + case TemplateArgument::NullPtr: + IsNullPtr = true; + return; + case TemplateArgument::Expression: + // TODO: Sometimes, the desugared template argument Expr differs from + // the sugared template argument Expr. It may be useful in the future + // but for now, it is just discarded. + if (!E) + E = TA.getAsExpr(); + return; + case TemplateArgument::Null: + case TemplateArgument::Type: + case TemplateArgument::Template: + case TemplateArgument::TemplateExpansion: + llvm_unreachable("TemplateArgument kind is not expected for NTTP"); + case TemplateArgument::Pack: + llvm_unreachable("TemplateArgument kind should be handled elsewhere"); + } + llvm_unreachable("Unexpected TemplateArgument kind"); } /// DiffNonTypes - Handles any template parameters not handled by DiffTypes @@ -1914,6 +1936,11 @@ class TemplateDiff { return; } + if (E) { + PrintExpr(E); + return; + } + OS << "(no argument)"; } diff --git a/clang/lib/AST/Interp/ByteCodeExprGen.cpp b/clang/lib/AST/Interp/ByteCodeExprGen.cpp index e64d3a94b5091..3eb7e7544df71 100644 --- a/clang/lib/AST/Interp/ByteCodeExprGen.cpp +++ b/clang/lib/AST/Interp/ByteCodeExprGen.cpp @@ -1080,24 +1080,38 @@ bool ByteCodeExprGen::visitInitList(ArrayRef Inits, }; if (R->isUnion()) { - assert(Inits.size() == 1); - const Expr *Init = Inits[0]; - const FieldDecl *FToInit = nullptr; - if (const auto *ILE = dyn_cast(E)) - FToInit = ILE->getInitializedFieldInUnion(); - else - FToInit = cast(E)->getInitializedFieldInUnion(); - - if (!this->emitDupPtr(E)) - return false; - - const Record::Field *FieldToInit = R->getField(FToInit); - if (std::optional T = classify(Init)) { - if (!initPrimitiveField(FieldToInit, Init, *T)) - return false; + if (Inits.size() == 0) { + // Zero-initialize the first union field. + if (R->getNumFields() == 0) + return this->emitFinishInit(E); + const Record::Field *FieldToInit = R->getField(0u); + QualType FieldType = FieldToInit->Desc->getType(); + if (std::optional T = classify(FieldType)) { + if (!this->visitZeroInitializer(*T, FieldType, E)) + return false; + if (!this->emitInitField(*T, FieldToInit->Offset, E)) + return false; + } + // FIXME: Non-primitive case? } else { - if (!initCompositeField(FieldToInit, Init)) + const Expr *Init = Inits[0]; + const FieldDecl *FToInit = nullptr; + if (const auto *ILE = dyn_cast(E)) + FToInit = ILE->getInitializedFieldInUnion(); + else + FToInit = cast(E)->getInitializedFieldInUnion(); + + if (!this->emitDupPtr(E)) return false; + + const Record::Field *FieldToInit = R->getField(FToInit); + if (std::optional T = classify(Init)) { + if (!initPrimitiveField(FieldToInit, Init, *T)) + return false; + } else { + if (!initCompositeField(FieldToInit, Init)) + return false; + } } return this->emitFinishInit(E); } @@ -1623,6 +1637,12 @@ bool ByteCodeExprGen::VisitStringLiteral(const StringLiteral *E) { return true; } +template +bool ByteCodeExprGen::VisitObjCStringLiteral( + const ObjCStringLiteral *E) { + return this->delegate(E->getString()); +} + template bool ByteCodeExprGen::VisitSYCLUniqueStableNameExpr( const SYCLUniqueStableNameExpr *E) { @@ -2629,6 +2649,14 @@ bool ByteCodeExprGen::VisitShuffleVectorExpr( return true; } +template +bool ByteCodeExprGen::VisitObjCBoxedExpr(const ObjCBoxedExpr *E) { + if (!E->isExpressibleAsConstantInitializer()) + return this->emitInvalid(E); + + return this->delegate(E->getSubExpr()); +} + template bool ByteCodeExprGen::discard(const Expr *E) { OptionScope Scope(this, /*NewDiscardResult=*/true, /*NewInitializing=*/false); @@ -2644,6 +2672,9 @@ bool ByteCodeExprGen::delegate(const Expr *E) { } template bool ByteCodeExprGen::visit(const Expr *E) { + if (E->getType().isNull()) + return false; + if (E->getType()->isVoidType()) return this->discard(E); @@ -3310,7 +3341,8 @@ bool ByteCodeExprGen::VisitCallExpr(const CallExpr *E) { // write the result into. if (IsVirtual && !HasQualifier) { uint32_t VarArgSize = 0; - unsigned NumParams = Func->getNumWrittenParams(); + unsigned NumParams = + Func->getNumWrittenParams() + isa(E); for (unsigned I = NumParams, N = E->getNumArgs(); I != N; ++I) VarArgSize += align(primSize(classify(E->getArg(I)).value_or(PT_Ptr))); @@ -3744,13 +3776,13 @@ bool ByteCodeExprGen::VisitDeclRefExpr(const DeclRefExpr *E) { return this->emitGetPtrLocal(Offset, E); } else if (auto GlobalIndex = P.getGlobal(D)) { if (IsReference) - return this->emitGetGlobalPtr(*GlobalIndex, E); + return this->emitGetGlobal(classifyPrim(E), *GlobalIndex, E); return this->emitGetPtrGlobal(*GlobalIndex, E); } else if (const auto *PVD = dyn_cast(D)) { if (auto It = this->Params.find(PVD); It != this->Params.end()) { if (IsReference || !It->second.IsPtr) - return this->emitGetParamPtr(It->second.Offset, E); + return this->emitGetParam(classifyPrim(E), It->second.Offset, E); return this->emitGetPtrParam(It->second.Offset, E); } @@ -3781,7 +3813,8 @@ bool ByteCodeExprGen::VisitDeclRefExpr(const DeclRefExpr *E) { } } else { if (const auto *VD = dyn_cast(D); - VD && VD->getAnyInitializer() && VD->getType().isConstQualified()) { + VD && VD->getAnyInitializer() && VD->getType().isConstQualified() && + !VD->isWeak()) { if (!this->visitVarDecl(VD)) return false; // Retry. @@ -3792,6 +3825,8 @@ bool ByteCodeExprGen::VisitDeclRefExpr(const DeclRefExpr *E) { if (std::optional I = P.getOrCreateDummy(D)) { if (!this->emitGetPtrGlobal(*I, E)) return false; + if (E->getType()->isVoidType()) + return true; // Convert the dummy pointer to another pointer type if we have to. if (PrimType PT = classifyPrim(E); PT != PT_Ptr) { if (!this->emitDecayPtr(PT_Ptr, PT, E)) diff --git a/clang/lib/AST/Interp/ByteCodeExprGen.h b/clang/lib/AST/Interp/ByteCodeExprGen.h index a2e283c866332..44c495240289f 100644 --- a/clang/lib/AST/Interp/ByteCodeExprGen.h +++ b/clang/lib/AST/Interp/ByteCodeExprGen.h @@ -90,6 +90,7 @@ class ByteCodeExprGen : public ConstStmtVisitor, bool>, bool VisitOpaqueValueExpr(const OpaqueValueExpr *E); bool VisitAbstractConditionalOperator(const AbstractConditionalOperator *E); bool VisitStringLiteral(const StringLiteral *E); + bool VisitObjCStringLiteral(const ObjCStringLiteral *E); bool VisitSYCLUniqueStableNameExpr(const SYCLUniqueStableNameExpr *E); bool VisitCharacterLiteral(const CharacterLiteral *E); bool VisitCompoundAssignOperator(const CompoundAssignOperator *E); @@ -126,6 +127,7 @@ class ByteCodeExprGen : public ConstStmtVisitor, bool>, bool VisitAddrLabelExpr(const AddrLabelExpr *E); bool VisitConvertVectorExpr(const ConvertVectorExpr *E); bool VisitShuffleVectorExpr(const ShuffleVectorExpr *E); + bool VisitObjCBoxedExpr(const ObjCBoxedExpr *E); protected: bool visitExpr(const Expr *E) override; diff --git a/clang/lib/AST/Interp/ByteCodeStmtGen.cpp b/clang/lib/AST/Interp/ByteCodeStmtGen.cpp index ff92bc117f9ef..6ee7898f228de 100644 --- a/clang/lib/AST/Interp/ByteCodeStmtGen.cpp +++ b/clang/lib/AST/Interp/ByteCodeStmtGen.cpp @@ -687,26 +687,29 @@ bool ByteCodeStmtGen::visitDefaultStmt(const DefaultStmt *S) { template bool ByteCodeStmtGen::visitAttributedStmt(const AttributedStmt *S) { - for (const Attr *A : S->getAttrs()) { - auto *AA = dyn_cast(A); - if (!AA) - continue; + if (this->Ctx.getLangOpts().CXXAssumptions && + !this->Ctx.getLangOpts().MSVCCompat) { + for (const Attr *A : S->getAttrs()) { + auto *AA = dyn_cast(A); + if (!AA) + continue; - assert(isa(S->getSubStmt())); + assert(isa(S->getSubStmt())); - const Expr *Assumption = AA->getAssumption(); - if (Assumption->isValueDependent()) - return false; + const Expr *Assumption = AA->getAssumption(); + if (Assumption->isValueDependent()) + return false; - if (Assumption->HasSideEffects(this->Ctx.getASTContext())) - continue; + if (Assumption->HasSideEffects(this->Ctx.getASTContext())) + continue; - // Evaluate assumption. - if (!this->visitBool(Assumption)) - return false; + // Evaluate assumption. + if (!this->visitBool(Assumption)) + return false; - if (!this->emitAssume(Assumption)) - return false; + if (!this->emitAssume(Assumption)) + return false; + } } // Ignore other attributes. diff --git a/clang/lib/AST/Interp/Context.cpp b/clang/lib/AST/Interp/Context.cpp index d51a57e5e92ea..4ecfa0f9bfd75 100644 --- a/clang/lib/AST/Interp/Context.cpp +++ b/clang/lib/AST/Interp/Context.cpp @@ -164,7 +164,8 @@ std::optional Context::classify(QualType T) const { T->isFunctionType() || T->isSpecificBuiltinType(BuiltinType::BoundMember)) return PT_FnPtr; - if (T->isReferenceType() || T->isPointerType()) + if (T->isReferenceType() || T->isPointerType() || + T->isObjCObjectPointerType()) return PT_Ptr; if (const auto *AT = T->getAs()) diff --git a/clang/lib/AST/Interp/Interp.cpp b/clang/lib/AST/Interp/Interp.cpp index cac678352e2ce..145fa65791da2 100644 --- a/clang/lib/AST/Interp/Interp.cpp +++ b/clang/lib/AST/Interp/Interp.cpp @@ -18,6 +18,7 @@ #include "clang/AST/ASTContext.h" #include "clang/AST/ASTDiagnostic.h" #include "clang/AST/CXXInheritance.h" +#include "clang/AST/DeclObjC.h" #include "clang/AST/Expr.h" #include "clang/AST/ExprCXX.h" #include "llvm/ADT/APSInt.h" @@ -101,6 +102,11 @@ static void diagnoseNonConstVariable(InterpState &S, CodePtr OpPC, return; } + // Rather random, but this is to match the diagnostic output of the current + // interpreter. + if (isa(VD)) + return; + if (VD->getType()->isIntegralOrEnumerationType()) { S.FFDiag(Loc, diag::note_constexpr_ltor_non_const_int, 1) << VD; S.Note(VD->getLocation(), diag::note_declared_at); @@ -451,7 +457,7 @@ bool CheckLoad(InterpState &S, CodePtr OpPC, const Pointer &Ptr) { if (!CheckConstant(S, OpPC, Ptr)) return false; - if (!CheckDummy(S, OpPC, Ptr)) + if (!CheckDummy(S, OpPC, Ptr, AK_Read)) return false; if (!CheckExtern(S, OpPC, Ptr)) return false; @@ -471,7 +477,7 @@ bool CheckLoad(InterpState &S, CodePtr OpPC, const Pointer &Ptr) { bool CheckStore(InterpState &S, CodePtr OpPC, const Pointer &Ptr) { if (!CheckLive(S, OpPC, Ptr, AK_Assign)) return false; - if (!CheckDummy(S, OpPC, Ptr)) + if (!CheckDummy(S, OpPC, Ptr, AK_Assign)) return false; if (!CheckExtern(S, OpPC, Ptr)) return false; @@ -654,7 +660,8 @@ bool CheckDeclRef(InterpState &S, CodePtr OpPC, const DeclRefExpr *DR) { return diagnoseUnknownDecl(S, OpPC, D); } -bool CheckDummy(InterpState &S, CodePtr OpPC, const Pointer &Ptr) { +bool CheckDummy(InterpState &S, CodePtr OpPC, const Pointer &Ptr, + AccessKinds AK) { if (!Ptr.isDummy()) return true; @@ -663,7 +670,15 @@ bool CheckDummy(InterpState &S, CodePtr OpPC, const Pointer &Ptr) { if (!D) return false; - return diagnoseUnknownDecl(S, OpPC, D); + if (AK == AK_Read || AK == AK_Increment || AK == AK_Decrement) + return diagnoseUnknownDecl(S, OpPC, D); + + assert(AK == AK_Assign); + if (S.getLangOpts().CPlusPlus11) { + const SourceInfo &E = S.Current->getSource(OpPC); + S.FFDiag(E, diag::note_constexpr_modify_global); + } + return false; } bool CheckNonNullArgs(InterpState &S, CodePtr OpPC, const Function *F, diff --git a/clang/lib/AST/Interp/Interp.h b/clang/lib/AST/Interp/Interp.h index 8430a7de24dff..eca1792e64718 100644 --- a/clang/lib/AST/Interp/Interp.h +++ b/clang/lib/AST/Interp/Interp.h @@ -56,7 +56,8 @@ bool CheckLive(InterpState &S, CodePtr OpPC, const Pointer &Ptr, AccessKinds AK); /// Checks if a pointer is a dummy pointer. -bool CheckDummy(InterpState &S, CodePtr OpPC, const Pointer &Ptr); +bool CheckDummy(InterpState &S, CodePtr OpPC, const Pointer &Ptr, + AccessKinds AK); /// Checks if a pointer is null. bool CheckNull(InterpState &S, CodePtr OpPC, const Pointer &Ptr, @@ -588,7 +589,7 @@ bool IncDecHelper(InterpState &S, CodePtr OpPC, const Pointer &Ptr) { template ::T> bool Inc(InterpState &S, CodePtr OpPC) { const Pointer &Ptr = S.Stk.pop(); - if (!CheckDummy(S, OpPC, Ptr)) + if (!CheckDummy(S, OpPC, Ptr, AK_Increment)) return false; if (!CheckInitialized(S, OpPC, Ptr, AK_Increment)) return false; @@ -602,7 +603,7 @@ bool Inc(InterpState &S, CodePtr OpPC) { template ::T> bool IncPop(InterpState &S, CodePtr OpPC) { const Pointer &Ptr = S.Stk.pop(); - if (!CheckDummy(S, OpPC, Ptr)) + if (!CheckDummy(S, OpPC, Ptr, AK_Increment)) return false; if (!CheckInitialized(S, OpPC, Ptr, AK_Increment)) return false; @@ -617,7 +618,7 @@ bool IncPop(InterpState &S, CodePtr OpPC) { template ::T> bool Dec(InterpState &S, CodePtr OpPC) { const Pointer &Ptr = S.Stk.pop(); - if (!CheckDummy(S, OpPC, Ptr)) + if (!CheckDummy(S, OpPC, Ptr, AK_Decrement)) return false; if (!CheckInitialized(S, OpPC, Ptr, AK_Decrement)) return false; @@ -631,7 +632,7 @@ bool Dec(InterpState &S, CodePtr OpPC) { template ::T> bool DecPop(InterpState &S, CodePtr OpPC) { const Pointer &Ptr = S.Stk.pop(); - if (!CheckDummy(S, OpPC, Ptr)) + if (!CheckDummy(S, OpPC, Ptr, AK_Decrement)) return false; if (!CheckInitialized(S, OpPC, Ptr, AK_Decrement)) return false; @@ -1335,17 +1336,19 @@ inline bool GetPtrThisBase(InterpState &S, CodePtr OpPC, uint32_t Off) { inline bool FinishInitPop(InterpState &S, CodePtr OpPC) { const Pointer &Ptr = S.Stk.pop(); - if (Ptr.canBeInitialized()) + if (Ptr.canBeInitialized()) { Ptr.initialize(); - Ptr.activate(); + Ptr.activate(); + } return true; } inline bool FinishInit(InterpState &S, CodePtr OpPC) { const Pointer &Ptr = S.Stk.peek(); - if (Ptr.canBeInitialized()) + if (Ptr.canBeInitialized()) { Ptr.initialize(); - Ptr.activate(); + Ptr.activate(); + } return true; } @@ -1371,9 +1374,6 @@ inline bool GetPtrVirtBasePop(InterpState &S, CodePtr OpPC, const Pointer &Ptr = S.Stk.pop(); if (!CheckNull(S, OpPC, Ptr, CSK_Base)) return false; - if (Ptr.isDummy()) // FIXME: Once we have type info for dummy pointers, this - // needs to go. - return false; return VirtBaseHelper(S, OpPC, D, Ptr); } diff --git a/clang/lib/AST/Interp/InterpBuiltin.cpp b/clang/lib/AST/Interp/InterpBuiltin.cpp index 565c85bc2e0c2..00206d09c113d 100644 --- a/clang/lib/AST/Interp/InterpBuiltin.cpp +++ b/clang/lib/AST/Interp/InterpBuiltin.cpp @@ -214,7 +214,7 @@ static bool interp__builtin_strlen(InterpState &S, CodePtr OpPC, if (!CheckLive(S, OpPC, StrPtr, AK_Read)) return false; - if (!CheckDummy(S, OpPC, StrPtr)) + if (!CheckDummy(S, OpPC, StrPtr, AK_Read)) return false; assert(StrPtr.getFieldDesc()->isPrimitiveArray()); diff --git a/clang/lib/AST/Interp/PrimType.h b/clang/lib/AST/Interp/PrimType.h index 05a094d0c5b1f..604fb5dfde1e4 100644 --- a/clang/lib/AST/Interp/PrimType.h +++ b/clang/lib/AST/Interp/PrimType.h @@ -30,20 +30,20 @@ template class Integral; /// Enumeration of the primitive types of the VM. enum PrimType : unsigned { - PT_Sint8, - PT_Uint8, - PT_Sint16, - PT_Uint16, - PT_Sint32, - PT_Uint32, - PT_Sint64, - PT_Uint64, - PT_IntAP, - PT_IntAPS, - PT_Bool, - PT_Float, - PT_Ptr, - PT_FnPtr, + PT_Sint8 = 0, + PT_Uint8 = 1, + PT_Sint16 = 2, + PT_Uint16 = 3, + PT_Sint32 = 4, + PT_Uint32 = 5, + PT_Sint64 = 6, + PT_Uint64 = 7, + PT_IntAP = 8, + PT_IntAPS = 9, + PT_Bool = 10, + PT_Float = 11, + PT_Ptr = 12, + PT_FnPtr = 13, }; inline constexpr bool isPtrType(PrimType T) { diff --git a/clang/lib/AST/Interp/Record.cpp b/clang/lib/AST/Interp/Record.cpp index 6a0a28bc9124b..8ded765fc1c41 100644 --- a/clang/lib/AST/Interp/Record.cpp +++ b/clang/lib/AST/Interp/Record.cpp @@ -16,7 +16,7 @@ Record::Record(const RecordDecl *Decl, BaseList &&SrcBases, FieldList &&SrcFields, VirtualBaseList &&SrcVirtualBases, unsigned VirtualSize, unsigned BaseSize) : Decl(Decl), Bases(std::move(SrcBases)), Fields(std::move(SrcFields)), - BaseSize(BaseSize), VirtualSize(VirtualSize) { + BaseSize(BaseSize), VirtualSize(VirtualSize), IsUnion(Decl->isUnion()) { for (Base &V : SrcVirtualBases) VirtualBases.push_back({ V.Decl, V.Offset + BaseSize, V.Desc, V.R }); diff --git a/clang/lib/AST/Interp/Record.h b/clang/lib/AST/Interp/Record.h index cf0480b3f62fa..83e15b125f77a 100644 --- a/clang/lib/AST/Interp/Record.h +++ b/clang/lib/AST/Interp/Record.h @@ -53,7 +53,7 @@ class Record final { /// Returns the name of the underlying declaration. const std::string getName() const; /// Checks if the record is a union. - bool isUnion() const { return getDecl()->isUnion(); } + bool isUnion() const { return IsUnion; } /// Returns the size of the record. unsigned getSize() const { return BaseSize; } /// Returns the full size of the record, including records. @@ -132,6 +132,8 @@ class Record final { unsigned BaseSize; /// Size of all virtual bases. unsigned VirtualSize; + /// If this record is a union. + bool IsUnion; }; } // namespace interp diff --git a/clang/lib/AST/ParentMap.cpp b/clang/lib/AST/ParentMap.cpp index 3d6a1cc84c7b1..534793b837bbb 100644 --- a/clang/lib/AST/ParentMap.cpp +++ b/clang/lib/AST/ParentMap.cpp @@ -97,6 +97,22 @@ static void BuildParentMap(MapTy& M, Stmt* S, BuildParentMap(M, SubStmt, OVMode); } break; + case Stmt::CXXDefaultArgExprClass: + if (auto *Arg = dyn_cast(S)) { + if (Arg->hasRewrittenInit()) { + M[Arg->getExpr()] = S; + BuildParentMap(M, Arg->getExpr(), OVMode); + } + } + break; + case Stmt::CXXDefaultInitExprClass: + if (auto *Init = dyn_cast(S)) { + if (Init->hasRewrittenInit()) { + M[Init->getExpr()] = S; + BuildParentMap(M, Init->getExpr(), OVMode); + } + } + break; default: for (Stmt *SubStmt : S->children()) { if (SubStmt) { diff --git a/clang/lib/AST/TemplateBase.cpp b/clang/lib/AST/TemplateBase.cpp index 3310d7dc24c59..a7ee973b7f7d0 100644 --- a/clang/lib/AST/TemplateBase.cpp +++ b/clang/lib/AST/TemplateBase.cpp @@ -538,9 +538,19 @@ void TemplateArgument::print(const PrintingPolicy &Policy, raw_ostream &Out, Out << "nullptr"; break; - case Template: - getAsTemplate().print(Out, Policy, TemplateName::Qualified::Fully); + case Template: { + TemplateName TN = getAsTemplate(); + if (const auto *TD = TN.getAsTemplateDecl(); + TD && TD->getDeclName().isEmpty()) { + assert(isa(TD) && + "Unexpected anonymous template"); + const auto *TTP = cast(TD); + Out << "template-parameter-" << TTP->getDepth() << "-" << TTP->getIndex(); + } else { + TN.print(Out, Policy, TemplateName::Qualified::Fully); + } break; + } case TemplateExpansion: getAsTemplateOrTemplatePattern().print(Out, Policy); diff --git a/clang/lib/AST/Type.cpp b/clang/lib/AST/Type.cpp index 0361f218b9b86..e08eb4299ca49 100644 --- a/clang/lib/AST/Type.cpp +++ b/clang/lib/AST/Type.cpp @@ -632,6 +632,16 @@ bool Type::isStructureType() const { return false; } +bool Type::isStructureTypeWithFlexibleArrayMember() const { + const auto *RT = getAs(); + if (!RT) + return false; + const auto *Decl = RT->getDecl(); + if (!Decl->isStruct()) + return false; + return Decl->hasFlexibleArrayMember(); +} + bool Type::isObjCBoxableRecordType() const { if (const auto *RT = getAs()) return RT->getDecl()->hasAttr(); diff --git a/clang/lib/Analysis/CFG.cpp b/clang/lib/Analysis/CFG.cpp index 64e6155de090c..02317257c2740 100644 --- a/clang/lib/Analysis/CFG.cpp +++ b/clang/lib/Analysis/CFG.cpp @@ -556,6 +556,10 @@ class CFGBuilder { private: // Visitors to walk an AST and construct the CFG. + CFGBlock *VisitCXXDefaultArgExpr(CXXDefaultArgExpr *Default, + AddStmtChoice asc); + CFGBlock *VisitCXXDefaultInitExpr(CXXDefaultInitExpr *Default, + AddStmtChoice asc); CFGBlock *VisitInitListExpr(InitListExpr *ILE, AddStmtChoice asc); CFGBlock *VisitAddrLabelExpr(AddrLabelExpr *A, AddStmtChoice asc); CFGBlock *VisitAttributedStmt(AttributedStmt *A, AddStmtChoice asc); @@ -2254,16 +2258,10 @@ CFGBlock *CFGBuilder::Visit(Stmt * S, AddStmtChoice asc, asc, ExternallyDestructed); case Stmt::CXXDefaultArgExprClass: + return VisitCXXDefaultArgExpr(cast(S), asc); + case Stmt::CXXDefaultInitExprClass: - // FIXME: The expression inside a CXXDefaultArgExpr is owned by the - // called function's declaration, not by the caller. If we simply add - // this expression to the CFG, we could end up with the same Expr - // appearing multiple times (PR13385). - // - // It's likewise possible for multiple CXXDefaultInitExprs for the same - // expression to be used in the same function (through aggregate - // initialization). - return VisitStmt(S, asc); + return VisitCXXDefaultInitExpr(cast(S), asc); case Stmt::CXXBindTemporaryExprClass: return VisitCXXBindTemporaryExpr(cast(S), asc); @@ -2433,6 +2431,40 @@ CFGBlock *CFGBuilder::VisitChildren(Stmt *S) { return B; } +CFGBlock *CFGBuilder::VisitCXXDefaultArgExpr(CXXDefaultArgExpr *Arg, + AddStmtChoice asc) { + if (Arg->hasRewrittenInit()) { + if (asc.alwaysAdd(*this, Arg)) { + autoCreateBlock(); + appendStmt(Block, Arg); + } + return VisitStmt(Arg->getExpr(), asc); + } + + // We can't add the default argument if it's not rewritten because the + // expression inside a CXXDefaultArgExpr is owned by the called function's + // declaration, not by the caller, we could end up with the same expression + // appearing multiple times. + return VisitStmt(Arg, asc); +} + +CFGBlock *CFGBuilder::VisitCXXDefaultInitExpr(CXXDefaultInitExpr *Init, + AddStmtChoice asc) { + if (Init->hasRewrittenInit()) { + if (asc.alwaysAdd(*this, Init)) { + autoCreateBlock(); + appendStmt(Block, Init); + } + return VisitStmt(Init->getExpr(), asc); + } + + // We can't add the default initializer if it's not rewritten because multiple + // CXXDefaultInitExprs for the same sub-expression to be used in the same + // function (through aggregate initialization). we could end up with the same + // expression appearing multiple times. + return VisitStmt(Init, asc); +} + CFGBlock *CFGBuilder::VisitInitListExpr(InitListExpr *ILE, AddStmtChoice asc) { if (asc.alwaysAdd(*this, ILE)) { autoCreateBlock(); diff --git a/clang/lib/Analysis/FlowSensitive/CMakeLists.txt b/clang/lib/Analysis/FlowSensitive/CMakeLists.txt index f89d4e57e5819..05cdaa7e27823 100644 --- a/clang/lib/Analysis/FlowSensitive/CMakeLists.txt +++ b/clang/lib/Analysis/FlowSensitive/CMakeLists.txt @@ -37,3 +37,4 @@ add_custom_command(OUTPUT HTMLLogger.inc DEPENDS ${CLANG_SOURCE_DIR}/utils/bundle_resources.py HTMLLogger.html HTMLLogger.css HTMLLogger.js VERBATIM) add_custom_target(clangAnalysisFlowSensitiveResources DEPENDS HTMLLogger.inc) +set_target_properties(clangAnalysisFlowSensitiveResources PROPERTIES FOLDER "Clang/Misc") diff --git a/clang/lib/Analysis/MacroExpansionContext.cpp b/clang/lib/Analysis/MacroExpansionContext.cpp index 564e359668a51..b212b7f245792 100644 --- a/clang/lib/Analysis/MacroExpansionContext.cpp +++ b/clang/lib/Analysis/MacroExpansionContext.cpp @@ -12,7 +12,7 @@ #define DEBUG_TYPE "macro-expansion-context" -static void dumpTokenInto(const clang::Preprocessor &PP, clang::raw_ostream &OS, +static void dumpTokenInto(const clang::Preprocessor &PP, llvm::raw_ostream &OS, clang::Token Tok); namespace clang { diff --git a/clang/lib/Basic/CharInfo.cpp b/clang/lib/Basic/CharInfo.cpp index d02054c9718f5..26d693b8e9b94 100644 --- a/clang/lib/Basic/CharInfo.cpp +++ b/clang/lib/Basic/CharInfo.cpp @@ -31,20 +31,20 @@ const uint16_t clang::charinfo::InfoTable[256] = { 0 , 0 , 0 , 0 , //32 SP 33 ! 34 " 35 # //36 $ 37 % 38 & 39 ' - CHAR_SPACE , CHAR_RAWDEL , CHAR_RAWDEL , CHAR_RAWDEL , - CHAR_PUNCT , CHAR_RAWDEL , CHAR_RAWDEL , CHAR_RAWDEL , + CHAR_SPACE , CHAR_PUNCT , CHAR_PUNCT , CHAR_PUNCT , + CHAR_PUNCT , CHAR_PUNCT , CHAR_PUNCT , CHAR_PUNCT , //40 ( 41 ) 42 * 43 + //44 , 45 - 46 . 47 / - CHAR_PUNCT , CHAR_PUNCT , CHAR_RAWDEL , CHAR_RAWDEL , - CHAR_RAWDEL , CHAR_RAWDEL , CHAR_PERIOD , CHAR_RAWDEL , + CHAR_PUNCT , CHAR_PUNCT , CHAR_PUNCT , CHAR_PUNCT , + CHAR_PUNCT , CHAR_PUNCT , CHAR_PERIOD , CHAR_PUNCT , //48 0 49 1 50 2 51 3 //52 4 53 5 54 6 55 7 CHAR_DIGIT , CHAR_DIGIT , CHAR_DIGIT , CHAR_DIGIT , CHAR_DIGIT , CHAR_DIGIT , CHAR_DIGIT , CHAR_DIGIT , //56 8 57 9 58 : 59 ; //60 < 61 = 62 > 63 ? - CHAR_DIGIT , CHAR_DIGIT , CHAR_RAWDEL , CHAR_RAWDEL , - CHAR_RAWDEL , CHAR_RAWDEL , CHAR_RAWDEL , CHAR_RAWDEL , + CHAR_DIGIT , CHAR_DIGIT , CHAR_PUNCT , CHAR_PUNCT , + CHAR_PUNCT , CHAR_PUNCT , CHAR_PUNCT , CHAR_PUNCT , //64 @ 65 A 66 B 67 C //68 D 69 E 70 F 71 G CHAR_PUNCT , CHAR_XUPPER , CHAR_XUPPER , CHAR_XUPPER , @@ -59,8 +59,8 @@ const uint16_t clang::charinfo::InfoTable[256] = { CHAR_UPPER , CHAR_UPPER , CHAR_UPPER , CHAR_UPPER , //88 X 89 Y 90 Z 91 [ //92 \ 93 ] 94 ^ 95 _ - CHAR_UPPER , CHAR_UPPER , CHAR_UPPER , CHAR_RAWDEL , - CHAR_PUNCT , CHAR_RAWDEL , CHAR_RAWDEL , CHAR_UNDER , + CHAR_UPPER , CHAR_UPPER , CHAR_UPPER , CHAR_PUNCT , + CHAR_PUNCT , CHAR_PUNCT , CHAR_PUNCT , CHAR_UNDER , //96 ` 97 a 98 b 99 c //100 d 101 e 102 f 103 g CHAR_PUNCT , CHAR_XLOWER , CHAR_XLOWER , CHAR_XLOWER , @@ -75,6 +75,6 @@ const uint16_t clang::charinfo::InfoTable[256] = { CHAR_LOWER , CHAR_LOWER , CHAR_LOWER , CHAR_LOWER , //120 x 121 y 122 z 123 { //124 | 125 } 126 ~ 127 DEL - CHAR_LOWER , CHAR_LOWER , CHAR_LOWER , CHAR_RAWDEL , - CHAR_RAWDEL , CHAR_RAWDEL , CHAR_RAWDEL , 0 + CHAR_LOWER , CHAR_LOWER , CHAR_LOWER , CHAR_PUNCT , + CHAR_PUNCT , CHAR_PUNCT , CHAR_PUNCT , 0 }; diff --git a/clang/lib/Basic/Targets/WebAssembly.h b/clang/lib/Basic/Targets/WebAssembly.h index 4db97867df607..e4a449d1ff304 100644 --- a/clang/lib/Basic/Targets/WebAssembly.h +++ b/clang/lib/Basic/Targets/WebAssembly.h @@ -90,6 +90,9 @@ class LLVM_LIBRARY_VISIBILITY WebAssemblyTargetInfo : public TargetInfo { StringRef getABI() const override; bool setABI(const std::string &Name) override; + bool useFP16ConversionIntrinsics() const override { + return !HasHalfPrecision; + } protected: void getTargetDefines(const LangOptions &Opts, diff --git a/clang/lib/Basic/Targets/X86.cpp b/clang/lib/Basic/Targets/X86.cpp index b823eaf6ce336..3a30cff917bb4 100644 --- a/clang/lib/Basic/Targets/X86.cpp +++ b/clang/lib/Basic/Targets/X86.cpp @@ -310,15 +310,9 @@ bool X86TargetInfo::handleTargetFeatures(std::vector &Features, HasAVX512VNNI = true; } else if (Feature == "+avx512bf16") { HasAVX512BF16 = true; - } else if (Feature == "+avx512er") { - HasAVX512ER = true; - Diags.Report(diag::warn_knl_knm_isa_support_removed); } else if (Feature == "+avx512fp16") { HasAVX512FP16 = true; HasLegalHalfType = true; - } else if (Feature == "+avx512pf") { - HasAVX512PF = true; - Diags.Report(diag::warn_knl_knm_isa_support_removed); } else if (Feature == "+avx512dq") { HasAVX512DQ = true; } else if (Feature == "+avx512bitalg") { @@ -375,9 +369,6 @@ bool X86TargetInfo::handleTargetFeatures(std::vector &Features, HasWBNOINVD = true; } else if (Feature == "+prefetchi") { HasPREFETCHI = true; - } else if (Feature == "+prefetchwt1") { - HasPREFETCHWT1 = true; - Diags.Report(diag::warn_knl_knm_isa_support_removed); } else if (Feature == "+clzero") { HasCLZERO = true; } else if (Feature == "+cldemote") { @@ -840,12 +831,8 @@ void X86TargetInfo::getTargetDefines(const LangOptions &Opts, Builder.defineMacro("__AVX512VNNI__"); if (HasAVX512BF16) Builder.defineMacro("__AVX512BF16__"); - if (HasAVX512ER) - Builder.defineMacro("__AVX512ER__"); if (HasAVX512FP16) Builder.defineMacro("__AVX512FP16__"); - if (HasAVX512PF) - Builder.defineMacro("__AVX512PF__"); if (HasAVX512DQ) Builder.defineMacro("__AVX512DQ__"); if (HasAVX512BITALG) @@ -897,8 +884,6 @@ void X86TargetInfo::getTargetDefines(const LangOptions &Opts, Builder.defineMacro("__SM4__"); if (HasPREFETCHI) Builder.defineMacro("__PREFETCHI__"); - if (HasPREFETCHWT1) - Builder.defineMacro("__PREFETCHWT1__"); if (HasCLZERO) Builder.defineMacro("__CLZERO__"); if (HasKL) @@ -1084,9 +1069,7 @@ bool X86TargetInfo::isValidFeatureName(StringRef Name) const { .Case("avx512vpopcntdq", true) .Case("avx512vnni", true) .Case("avx512bf16", true) - .Case("avx512er", true) .Case("avx512fp16", true) - .Case("avx512pf", true) .Case("avx512dq", true) .Case("avx512bitalg", true) .Case("avx512bw", true) @@ -1134,7 +1117,6 @@ bool X86TargetInfo::isValidFeatureName(StringRef Name) const { .Case("pku", true) .Case("popcnt", true) .Case("prefetchi", true) - .Case("prefetchwt1", true) .Case("prfchw", true) .Case("ptwrite", true) .Case("raoint", true) @@ -1201,9 +1183,7 @@ bool X86TargetInfo::hasFeature(StringRef Feature) const { .Case("avx512vpopcntdq", HasAVX512VPOPCNTDQ) .Case("avx512vnni", HasAVX512VNNI) .Case("avx512bf16", HasAVX512BF16) - .Case("avx512er", HasAVX512ER) .Case("avx512fp16", HasAVX512FP16) - .Case("avx512pf", HasAVX512PF) .Case("avx512dq", HasAVX512DQ) .Case("avx512bitalg", HasAVX512BITALG) .Case("avx512bw", HasAVX512BW) @@ -1253,7 +1233,6 @@ bool X86TargetInfo::hasFeature(StringRef Feature) const { .Case("pku", HasPKU) .Case("popcnt", HasPOPCNT) .Case("prefetchi", HasPREFETCHI) - .Case("prefetchwt1", HasPREFETCHWT1) .Case("prfchw", HasPRFCHW) .Case("ptwrite", HasPTWRITE) .Case("raoint", HasRAOINT) diff --git a/clang/lib/Basic/Targets/X86.h b/clang/lib/Basic/Targets/X86.h index 6a0a6cb84203d..0633b7e0da96a 100644 --- a/clang/lib/Basic/Targets/X86.h +++ b/clang/lib/Basic/Targets/X86.h @@ -103,8 +103,6 @@ class LLVM_LIBRARY_VISIBILITY X86TargetInfo : public TargetInfo { bool HasAVX512VNNI = false; bool HasAVX512FP16 = false; bool HasAVX512BF16 = false; - bool HasAVX512ER = false; - bool HasAVX512PF = false; bool HasAVX512DQ = false; bool HasAVX512BITALG = false; bool HasAVX512BW = false; @@ -136,7 +134,6 @@ class LLVM_LIBRARY_VISIBILITY X86TargetInfo : public TargetInfo { bool HasCLWB = false; bool HasMOVBE = false; bool HasPREFETCHI = false; - bool HasPREFETCHWT1 = false; bool HasRDPID = false; bool HasRDPRU = false; bool HasRetpolineExternalThunk = false; diff --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp index add4f0bb93ac1..521b7d10cd761 100644 --- a/clang/lib/CodeGen/CGBuiltin.cpp +++ b/clang/lib/CodeGen/CGBuiltin.cpp @@ -58,6 +58,7 @@ #include "llvm/IR/IntrinsicsX86.h" #include "llvm/IR/MDBuilder.h" #include "llvm/IR/MatrixBuilder.h" +#include "llvm/IR/MemoryModelRelaxationAnnotations.h" #include "llvm/Support/ConvertUTF.h" #include "llvm/Support/MathExtras.h" #include "llvm/Support/ScopedPrinter.h" @@ -18428,6 +18429,29 @@ Value *CodeGenFunction::EmitHLSLBuiltinExpr(unsigned BuiltinID, return nullptr; } +void CodeGenFunction::AddAMDGPUFenceAddressSpaceMMRA(llvm::Instruction *Inst, + const CallExpr *E) { + constexpr const char *Tag = "amdgpu-as"; + + LLVMContext &Ctx = Inst->getContext(); + SmallVector MMRAs; + for (unsigned K = 2; K < E->getNumArgs(); ++K) { + llvm::Value *V = EmitScalarExpr(E->getArg(K)); + StringRef AS; + if (llvm::getConstantStringInfo(V, AS)) { + MMRAs.push_back({Tag, AS}); + // TODO: Delete the resulting unused constant? + continue; + } + CGM.Error(E->getExprLoc(), + "expected an address space name as a string literal"); + } + + llvm::sort(MMRAs); + MMRAs.erase(llvm::unique(MMRAs), MMRAs.end()); + Inst->setMetadata(LLVMContext::MD_mmra, MMRAMetadata::getMD(Ctx, MMRAs)); +} + Value *CodeGenFunction::EmitAMDGPUBuiltinExpr(unsigned BuiltinID, const CallExpr *E) { llvm::AtomicOrdering AO = llvm::AtomicOrdering::SequentiallyConsistent; @@ -19098,7 +19122,10 @@ Value *CodeGenFunction::EmitAMDGPUBuiltinExpr(unsigned BuiltinID, case AMDGPU::BI__builtin_amdgcn_fence: { ProcessOrderScopeAMDGCN(EmitScalarExpr(E->getArg(0)), EmitScalarExpr(E->getArg(1)), AO, SSID); - return Builder.CreateFence(AO, SSID); + FenceInst *Fence = Builder.CreateFence(AO, SSID); + if (E->getNumArgs() > 2) + AddAMDGPUFenceAddressSpaceMMRA(Fence, E); + return Fence; } case AMDGPU::BI__builtin_amdgcn_atomic_inc32: case AMDGPU::BI__builtin_amdgcn_atomic_inc64: @@ -23332,6 +23359,17 @@ Value *CodeGenFunction::EmitWebAssemblyBuiltinExpr(unsigned BuiltinID, Function *Callee = CGM.getIntrinsic(Intrinsic::wasm_storef16_f32); return Builder.CreateCall(Callee, {Val, Addr}); } + case WebAssembly::BI__builtin_wasm_splat_f16x8: { + Value *Val = EmitScalarExpr(E->getArg(0)); + Function *Callee = CGM.getIntrinsic(Intrinsic::wasm_splat_f16x8); + return Builder.CreateCall(Callee, {Val}); + } + case WebAssembly::BI__builtin_wasm_extract_lane_f16x8: { + Value *Vector = EmitScalarExpr(E->getArg(0)); + Value *Index = EmitScalarExpr(E->getArg(1)); + Function *Callee = CGM.getIntrinsic(Intrinsic::wasm_extract_lane_f16x8); + return Builder.CreateCall(Callee, {Vector, Index}); + } case WebAssembly::BI__builtin_wasm_table_get: { assert(E->getArg(0)->getType()->isArrayType()); Value *Table = EmitArrayToPointerDecay(E->getArg(0)).emitRawPointer(*this); diff --git a/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp index 0ae3a6ea6e01d..946f4315d89cd 100644 --- a/clang/lib/CodeGen/CGExpr.cpp +++ b/clang/lib/CodeGen/CGExpr.cpp @@ -318,8 +318,8 @@ pushTemporaryCleanup(CodeGenFunction &CGF, const MaterializeTemporaryExpr *M, CleanupKind CleanupKind; if (Lifetime == Qualifiers::OCL_Strong) { const ValueDecl *VD = M->getExtendingDecl(); - bool Precise = - VD && isa(VD) && VD->hasAttr(); + bool Precise = isa_and_nonnull(VD) && + VD->hasAttr(); CleanupKind = CGF.getARCCleanupKind(); Destroy = Precise ? &CodeGenFunction::destroyARCStrongPrecise : &CodeGenFunction::destroyARCStrongImprecise; diff --git a/clang/lib/CodeGen/CodeGenFunction.h b/clang/lib/CodeGen/CodeGenFunction.h index 6d5e8863707fa..89a773c8f5565 100644 --- a/clang/lib/CodeGen/CodeGenFunction.h +++ b/clang/lib/CodeGen/CodeGenFunction.h @@ -4657,6 +4657,9 @@ class CodeGenFunction : public CodeGenTypeCache { llvm::Value *EmitHexagonBuiltinExpr(unsigned BuiltinID, const CallExpr *E); llvm::Value *EmitRISCVBuiltinExpr(unsigned BuiltinID, const CallExpr *E, ReturnValueSlot ReturnValue); + + void AddAMDGPUFenceAddressSpaceMMRA(llvm::Instruction *Inst, + const CallExpr *E); void ProcessOrderScopeAMDGCN(llvm::Value *Order, llvm::Value *Scope, llvm::AtomicOrdering &AO, llvm::SyncScope::ID &SSID); diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index e854bfff02ab0..ba02161f9c829 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -4589,7 +4589,7 @@ llvm::GlobalValue::LinkageTypes getMultiversionLinkage(CodeGenModule &CGM, } static FunctionDecl *createDefaultTargetVersionFrom(const FunctionDecl *FD) { - DeclContext *DeclCtx = FD->getASTContext().getTranslationUnitDecl(); + auto *DeclCtx = const_cast(FD->getDeclContext()); TypeSourceInfo *TInfo = FD->getTypeSourceInfo(); StorageClass SC = FD->getStorageClass(); DeclarationName Name = FD->getNameInfo().getName(); diff --git a/clang/lib/CodeGen/CoverageMappingGen.cpp b/clang/lib/CodeGen/CoverageMappingGen.cpp index 993d7cc7e21fa..6ce2d32dd292e 100644 --- a/clang/lib/CodeGen/CoverageMappingGen.cpp +++ b/clang/lib/CodeGen/CoverageMappingGen.cpp @@ -294,10 +294,36 @@ class CoverageMappingBuilder { return SM.getLocForEndOfFile(SM.getFileID(Loc)); } - /// Find out where the current file is included or macro is expanded. - SourceLocation getIncludeOrExpansionLoc(SourceLocation Loc) { - return Loc.isMacroID() ? SM.getImmediateExpansionRange(Loc).getBegin() - : SM.getIncludeLoc(SM.getFileID(Loc)); + /// Find out where a macro is expanded. If the immediate result is a + /// , keep looking until the result isn't. Return a pair of + /// \c SourceLocation. The first object is always the begin sloc of found + /// result. The second should be checked by the caller: if it has value, it's + /// the end sloc of the found result. Otherwise the while loop didn't get + /// executed, which means the location wasn't changed and the caller has to + /// learn the end sloc from somewhere else. + std::pair> + getNonScratchExpansionLoc(SourceLocation Loc) { + std::optional EndLoc = std::nullopt; + while (Loc.isMacroID() && + SM.isWrittenInScratchSpace(SM.getSpellingLoc(Loc))) { + auto ExpansionRange = SM.getImmediateExpansionRange(Loc); + Loc = ExpansionRange.getBegin(); + EndLoc = ExpansionRange.getEnd(); + } + return std::make_pair(Loc, EndLoc); + } + + /// Find out where the current file is included or macro is expanded. If + /// \c AcceptScratch is set to false, keep looking for expansions until the + /// found sloc is not a . + SourceLocation getIncludeOrExpansionLoc(SourceLocation Loc, + bool AcceptScratch = true) { + if (!Loc.isMacroID()) + return SM.getIncludeLoc(SM.getFileID(Loc)); + Loc = SM.getImmediateExpansionRange(Loc).getBegin(); + if (AcceptScratch) + return Loc; + return getNonScratchExpansionLoc(Loc).first; } /// Return true if \c Loc is a location in a built-in macro. @@ -344,6 +370,15 @@ class CoverageMappingBuilder { for (auto &Region : SourceRegions) { SourceLocation Loc = Region.getBeginLoc(); + // Replace Region with its definition if it is in . + auto NonScratchExpansionLoc = getNonScratchExpansionLoc(Loc); + auto EndLoc = NonScratchExpansionLoc.second; + if (EndLoc.has_value()) { + Loc = NonScratchExpansionLoc.first; + Region.setStartLoc(Loc); + Region.setEndLoc(EndLoc.value()); + } + // Replace Loc with FileLoc if it is expanded with system headers. if (!SystemHeadersCoverage && SM.isInSystemMacro(Loc)) { auto BeginLoc = SM.getSpellingLoc(Loc); @@ -538,7 +573,7 @@ class CoverageMappingBuilder { SourceRegionFilter Filter; for (const auto &FM : FileIDMapping) { SourceLocation ExpandedLoc = FM.second.second; - SourceLocation ParentLoc = getIncludeOrExpansionLoc(ExpandedLoc); + SourceLocation ParentLoc = getIncludeOrExpansionLoc(ExpandedLoc, false); if (ParentLoc.isInvalid()) continue; @@ -2236,7 +2271,8 @@ struct CounterCoverageMappingBuilder } void VisitOpaqueValueExpr(const OpaqueValueExpr* OVE) { - Visit(OVE->getSourceExpr()); + if (OVE->isUnique()) + Visit(OVE->getSourceExpr()); } }; diff --git a/clang/lib/CodeGen/ItaniumCXXABI.cpp b/clang/lib/CodeGen/ItaniumCXXABI.cpp index 207b12806546c..fa853a785a893 100644 --- a/clang/lib/CodeGen/ItaniumCXXABI.cpp +++ b/clang/lib/CodeGen/ItaniumCXXABI.cpp @@ -1799,6 +1799,37 @@ void ItaniumCXXABI::EmitDestructorCall(CodeGenFunction &CGF, ThisTy, VTT, VTTTy, nullptr); } +// Check if any non-inline method has the specified attribute. +template +static bool CXXRecordNonInlineHasAttr(const CXXRecordDecl *RD) { + for (const auto *D : RD->noload_decls()) { + if (const auto *FD = dyn_cast(D)) { + if (FD->isInlined() || FD->doesThisDeclarationHaveABody() || + FD->isPureVirtual()) + continue; + if (D->hasAttr()) + return true; + } + } + + return false; +} + +static void setVTableSelectiveDLLImportExport(CodeGenModule &CGM, + llvm::GlobalVariable *VTable, + const CXXRecordDecl *RD) { + if (VTable->getDLLStorageClass() != + llvm::GlobalVariable::DefaultStorageClass || + RD->hasAttr() || RD->hasAttr()) + return; + + if (CGM.getVTables().isVTableExternal(RD)) { + if (CXXRecordNonInlineHasAttr(RD)) + VTable->setDLLStorageClass(llvm::GlobalValue::DLLImportStorageClass); + } else if (CXXRecordNonInlineHasAttr(RD)) + VTable->setDLLStorageClass(llvm::GlobalValue::DLLExportStorageClass); +} + void ItaniumCXXABI::emitVTableDefinitions(CodeGenVTables &CGVT, const CXXRecordDecl *RD) { llvm::GlobalVariable *VTable = getAddrOfVTable(RD, CharUnits()); @@ -1824,6 +1855,9 @@ void ItaniumCXXABI::emitVTableDefinitions(CodeGenVTables &CGVT, if (CGM.supportsCOMDAT() && VTable->isWeakForLinker()) VTable->setComdat(CGM.getModule().getOrInsertComdat(VTable->getName())); + if (CGM.getTarget().hasPS4DLLImportExport()) + setVTableSelectiveDLLImportExport(CGM, VTable, RD); + // Set the right visibility. CGM.setGVProperties(VTable, RD); @@ -1911,29 +1945,6 @@ ItaniumCXXABI::getVTableAddressPoint(BaseSubobject Base, VTable->getValueType(), VTable, Indices, /*InBounds=*/true, InRange); } -// Check whether all the non-inline virtual methods for the class have the -// specified attribute. -template -static bool CXXRecordAllNonInlineVirtualsHaveAttr(const CXXRecordDecl *RD) { - bool FoundNonInlineVirtualMethodWithAttr = false; - for (const auto *D : RD->noload_decls()) { - if (const auto *FD = dyn_cast(D)) { - if (!FD->isVirtualAsWritten() || FD->isInlineSpecified() || - FD->doesThisDeclarationHaveABody()) - continue; - if (!D->hasAttr()) - return false; - FoundNonInlineVirtualMethodWithAttr = true; - } - } - - // We didn't find any non-inline virtual methods missing the attribute. We - // will return true when we found at least one non-inline virtual with the - // attribute. (This lets our caller know that the attribute needs to be - // propagated up to the vtable.) - return FoundNonInlineVirtualMethodWithAttr; -} - llvm::Value *ItaniumCXXABI::getVTableAddressPointInStructorWithVTT( CodeGenFunction &CGF, const CXXRecordDecl *VTableClass, BaseSubobject Base, const CXXRecordDecl *NearestVBase) { @@ -1987,26 +1998,10 @@ llvm::GlobalVariable *ItaniumCXXABI::getAddrOfVTable(const CXXRecordDecl *RD, getContext().toCharUnitsFromBits(PAlign).getAsAlign()); VTable->setUnnamedAddr(llvm::GlobalValue::UnnamedAddr::Global); - // In MS C++ if you have a class with virtual functions in which you are using - // selective member import/export, then all virtual functions must be exported - // unless they are inline, otherwise a link error will result. To match this - // behavior, for such classes, we dllimport the vtable if it is defined - // externally and all the non-inline virtual methods are marked dllimport, and - // we dllexport the vtable if it is defined in this TU and all the non-inline - // virtual methods are marked dllexport. - if (CGM.getTarget().hasPS4DLLImportExport()) { - if ((!RD->hasAttr()) && (!RD->hasAttr())) { - if (CGM.getVTables().isVTableExternal(RD)) { - if (CXXRecordAllNonInlineVirtualsHaveAttr(RD)) - VTable->setDLLStorageClass(llvm::GlobalValue::DLLImportStorageClass); - } else { - if (CXXRecordAllNonInlineVirtualsHaveAttr(RD)) - VTable->setDLLStorageClass(llvm::GlobalValue::DLLExportStorageClass); - } - } - } - CGM.setGVProperties(VTable, RD); + if (CGM.getTarget().hasPS4DLLImportExport()) + setVTableSelectiveDLLImportExport(CGM, VTable, RD); + CGM.setGVProperties(VTable, RD); return VTable; } @@ -3290,7 +3285,7 @@ ItaniumRTTIBuilder::GetAddrOfExternalRTTIDescriptor(QualType Ty) { // Import the typeinfo symbol when all non-inline virtual methods are // imported. if (CGM.getTarget().hasPS4DLLImportExport()) { - if (RD && CXXRecordAllNonInlineVirtualsHaveAttr(RD)) { + if (RD && CXXRecordNonInlineHasAttr(RD)) { GV->setDLLStorageClass(llvm::GlobalVariable::DLLImportStorageClass); CGM.setDSOLocal(GV); } @@ -3948,13 +3943,13 @@ llvm::Constant *ItaniumRTTIBuilder::BuildTypeInfo( // Export the typeinfo in the same circumstances as the vtable is exported. auto GVDLLStorageClass = DLLStorageClass; - if (CGM.getTarget().hasPS4DLLImportExport()) { + if (CGM.getTarget().hasPS4DLLImportExport() && + GVDLLStorageClass != llvm::GlobalVariable::DLLExportStorageClass) { if (const RecordType *RecordTy = dyn_cast(Ty)) { const CXXRecordDecl *RD = cast(RecordTy->getDecl()); if (RD->hasAttr() || - CXXRecordAllNonInlineVirtualsHaveAttr(RD)) { + CXXRecordNonInlineHasAttr(RD)) GVDLLStorageClass = llvm::GlobalVariable::DLLExportStorageClass; - } } } @@ -3994,9 +3989,7 @@ llvm::Constant *ItaniumRTTIBuilder::BuildTypeInfo( CGM.setDSOLocal(GV); TypeName->setDLLStorageClass(DLLStorageClass); - GV->setDLLStorageClass(CGM.getTarget().hasPS4DLLImportExport() - ? GVDLLStorageClass - : DLLStorageClass); + GV->setDLLStorageClass(GVDLLStorageClass); TypeName->setPartition(CGM.getCodeGenOpts().SymbolPartition); GV->setPartition(CGM.getCodeGenOpts().SymbolPartition); diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp index 10c35323c5115..7ad00c96c5662 100644 --- a/clang/lib/Driver/Driver.cpp +++ b/clang/lib/Driver/Driver.cpp @@ -3138,22 +3138,13 @@ void Driver::BuildInputs(const ToolChain &TC, DerivedArgList &Args, Diag(clang::diag::note_drv_t_option_is_global); } - // CUDA/HIP and their preprocessor expansions can be accepted by CL mode. // Warn -x after last input file has no effect - auto LastXArg = Args.getLastArgValue(options::OPT_x); - const llvm::StringSet<> ValidXArgs = {"cuda", "hip", "cui", "hipi"}; - if (!IsCLMode() || ValidXArgs.contains(LastXArg)) { + { Arg *LastXArg = Args.getLastArgNoClaim(options::OPT_x); Arg *LastInputArg = Args.getLastArgNoClaim(options::OPT_INPUT); if (LastXArg && LastInputArg && LastInputArg->getIndex() < LastXArg->getIndex()) Diag(clang::diag::warn_drv_unused_x) << LastXArg->getValue(); - } else { - // In CL mode suggest /TC or /TP since -x doesn't make sense if passed via - // /clang:. - if (auto *A = Args.getLastArg(options::OPT_x)) - Diag(diag::err_drv_unsupported_opt_with_suggestion) - << A->getAsString(Args) << "/TC' or '/TP"; } for (Arg *A : Args) { diff --git a/clang/lib/Driver/ToolChains/Arch/LoongArch.cpp b/clang/lib/Driver/ToolChains/Arch/LoongArch.cpp index d23f9b36efb9a..9ea4cc3f7cb95 100644 --- a/clang/lib/Driver/ToolChains/Arch/LoongArch.cpp +++ b/clang/lib/Driver/ToolChains/Arch/LoongArch.cpp @@ -181,7 +181,7 @@ void loongarch::getLoongArchTargetFeatures(const Driver &D, // -m*-float and -mfpu=none/0/32 conflict with -mlsx. if (A->getOption().matches(options::OPT_mlsx)) { if (llvm::find(Features, "-d") != Features.end()) - D.Diag(diag::err_drv_loongarch_wrong_fpu_width_for_lsx); + D.Diag(diag::err_drv_loongarch_wrong_fpu_width) << /*LSX*/ 0; else /*-mlsx*/ Features.push_back("+lsx"); } else /*-mno-lsx*/ { @@ -196,7 +196,7 @@ void loongarch::getLoongArchTargetFeatures(const Driver &D, // -mno-lsx conflicts with -mlasx. if (A->getOption().matches(options::OPT_mlasx)) { if (llvm::find(Features, "-d") != Features.end()) - D.Diag(diag::err_drv_loongarch_wrong_fpu_width_for_lasx); + D.Diag(diag::err_drv_loongarch_wrong_fpu_width) << /*LASX*/ 1; else if (llvm::find(Features, "-lsx") != Features.end()) D.Diag(diag::err_drv_loongarch_invalid_simd_option_combination); else { /*-mlasx*/ diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index 7a76b6baa6cfd..e1f4a6d96b07c 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -1103,7 +1103,7 @@ void Clang::AddPreprocessingOptions(Compilation &C, const JobAction &JA, // If user provided -o, that is the dependency target, except // when we are only generating a dependency file. - Arg *OutputOpt = Args.getLastArg(options::OPT_o); + Arg *OutputOpt = Args.getLastArg(options::OPT_o, options::OPT__SLASH_Fo); if (OutputOpt && Output.getType() != types::TY_Dependencies) { DepTarget = OutputOpt->getValue(); } else { @@ -6425,11 +6425,10 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, // enabled. This alias option is being used to simplify the hasFlag logic. OptSpecifier StrictAliasingAliasOption = OFastEnabled ? options::OPT_Ofast : options::OPT_fstrict_aliasing; - // We turn strict aliasing off by default if we're in CL mode, since MSVC + // We turn strict aliasing off by default if we're Windows MSVC since MSVC // doesn't do any TBAA. - bool TBAAOnByDefault = !D.IsCLMode(); if (!Args.hasFlag(options::OPT_fstrict_aliasing, StrictAliasingAliasOption, - options::OPT_fno_strict_aliasing, TBAAOnByDefault)) + options::OPT_fno_strict_aliasing, !IsWindowsMSVC)) CmdArgs.push_back("-relaxed-aliasing"); if (!Args.hasFlag(options::OPT_fstruct_path_tbaa, options::OPT_fno_struct_path_tbaa, true)) @@ -7839,8 +7838,12 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, options::OPT_fms_compatibility, options::OPT_fno_ms_compatibility, (IsWindowsMSVC && Args.hasFlag(options::OPT_fms_extensions, options::OPT_fno_ms_extensions, true))); - if (IsMSVCCompat) + if (IsMSVCCompat) { CmdArgs.push_back("-fms-compatibility"); + if (!types::isCXX(Input.getType()) && + Args.hasArg(options::OPT_fms_define_stdc)) + CmdArgs.push_back("-fms-define-stdc"); + } if (Triple.isWindowsMSVCEnvironment() && !D.IsCLMode() && Args.hasArg(options::OPT_fms_runtime_lib_EQ)) @@ -8080,13 +8083,8 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, // -fsized-deallocation is on by default in C++14 onwards and otherwise off // by default. - if (Arg *A = Args.getLastArg(options::OPT_fsized_deallocation, - options::OPT_fno_sized_deallocation)) { - if (A->getOption().matches(options::OPT_fno_sized_deallocation)) - CmdArgs.push_back("-fno-sized-deallocation"); - else - CmdArgs.push_back("-fsized-deallocation"); - } + Args.addLastArg(CmdArgs, options::OPT_fsized_deallocation, + options::OPT_fno_sized_deallocation); // -faligned-allocation is on by default in C++17 onwards and otherwise off // by default. diff --git a/clang/lib/Driver/ToolChains/HIPSPV.cpp b/clang/lib/Driver/ToolChains/HIPSPV.cpp index a26a481ab1bfa..dec536420f987 100644 --- a/clang/lib/Driver/ToolChains/HIPSPV.cpp +++ b/clang/lib/Driver/ToolChains/HIPSPV.cpp @@ -193,7 +193,7 @@ void HIPSPVToolChain::AddHIPIncludeArgs(const ArgList &DriverArgs, StringRef hipPath = DriverArgs.getLastArgValue(options::OPT_hip_path_EQ); if (hipPath.empty()) { - getDriver().Diag(diag::err_drv_hipspv_no_hip_path) << 1 << "'-nogpuinc'"; + getDriver().Diag(diag::err_drv_hipspv_no_hip_path); return; } SmallString<128> P(hipPath); diff --git a/clang/lib/ExtractAPI/DeclarationFragments.cpp b/clang/lib/ExtractAPI/DeclarationFragments.cpp index 904b9315f26ef..8c7c0f8a14726 100644 --- a/clang/lib/ExtractAPI/DeclarationFragments.cpp +++ b/clang/lib/ExtractAPI/DeclarationFragments.cpp @@ -1084,12 +1084,22 @@ DeclarationFragmentsBuilder::getFragmentsForTemplateArguments( if (StringRef(ArgumentFragment.begin()->Spelling) .starts_with("type-parameter")) { - std::string ProperArgName = TemplateArgumentLocs.value()[i] - .getTypeSourceInfo() - ->getType() - .getAsString(); - ArgumentFragment.begin()->Spelling.swap(ProperArgName); + if (TemplateArgumentLocs.has_value() && + TemplateArgumentLocs->size() > i) { + std::string ProperArgName = TemplateArgumentLocs.value()[i] + .getTypeSourceInfo() + ->getType() + .getAsString(); + ArgumentFragment.begin()->Spelling.swap(ProperArgName); + } else { + auto &Spelling = ArgumentFragment.begin()->Spelling; + Spelling.clear(); + raw_string_ostream OutStream(Spelling); + CTA.print(Context.getPrintingPolicy(), OutStream, false); + OutStream.flush(); + } } + Fragments.append(std::move(ArgumentFragment)); break; } @@ -1212,9 +1222,9 @@ DeclarationFragmentsBuilder::getFragmentsForClassTemplateSpecialization( cast(Decl))) .pop_back() // there is an extra semicolon now .append("<", DeclarationFragments::FragmentKind::Text) - .append( - getFragmentsForTemplateArguments(Decl->getTemplateArgs().asArray(), - Decl->getASTContext(), std::nullopt)) + .append(getFragmentsForTemplateArguments( + Decl->getTemplateArgs().asArray(), Decl->getASTContext(), + Decl->getTemplateArgsAsWritten()->arguments())) .append(">", DeclarationFragments::FragmentKind::Text) .appendSemicolon(); } @@ -1255,9 +1265,9 @@ DeclarationFragmentsBuilder::getFragmentsForVarTemplateSpecialization( .append(DeclarationFragmentsBuilder::getFragmentsForVarTemplate(Decl)) .pop_back() // there is an extra semicolon now .append("<", DeclarationFragments::FragmentKind::Text) - .append( - getFragmentsForTemplateArguments(Decl->getTemplateArgs().asArray(), - Decl->getASTContext(), std::nullopt)) + .append(getFragmentsForTemplateArguments( + Decl->getTemplateArgs().asArray(), Decl->getASTContext(), + Decl->getTemplateArgsAsWritten()->arguments())) .append(">", DeclarationFragments::FragmentKind::Text) .appendSemicolon(); } diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp index 9cba0c2614eef..c015e03fa15e7 100644 --- a/clang/lib/Format/Format.cpp +++ b/clang/lib/Format/Format.cpp @@ -308,6 +308,7 @@ struct ScalarEnumerationTraits { FormatStyle::EscapedNewlineAlignmentStyle &Value) { IO.enumCase(Value, "DontAlign", FormatStyle::ENAS_DontAlign); IO.enumCase(Value, "Left", FormatStyle::ENAS_Left); + IO.enumCase(Value, "LeftWithLastLine", FormatStyle::ENAS_LeftWithLastLine); IO.enumCase(Value, "Right", FormatStyle::ENAS_Right); // For backward compatibility. diff --git a/clang/lib/Format/WhitespaceManager.cpp b/clang/lib/Format/WhitespaceManager.cpp index ed06d6098a9f2..50531aee9d597 100644 --- a/clang/lib/Format/WhitespaceManager.cpp +++ b/clang/lib/Format/WhitespaceManager.cpp @@ -1245,22 +1245,29 @@ void WhitespaceManager::alignTrailingComments(unsigned Start, unsigned End, } void WhitespaceManager::alignEscapedNewlines() { - if (Style.AlignEscapedNewlines == FormatStyle::ENAS_DontAlign) + const auto Align = Style.AlignEscapedNewlines; + if (Align == FormatStyle::ENAS_DontAlign) return; - bool AlignLeft = Style.AlignEscapedNewlines == FormatStyle::ENAS_Left; - unsigned MaxEndOfLine = AlignLeft ? 0 : Style.ColumnLimit; + const bool WithLastLine = Align == FormatStyle::ENAS_LeftWithLastLine; + const bool AlignLeft = Align == FormatStyle::ENAS_Left || WithLastLine; + const auto MaxColumn = Style.ColumnLimit; + unsigned MaxEndOfLine = AlignLeft ? 0 : MaxColumn; unsigned StartOfMacro = 0; for (unsigned i = 1, e = Changes.size(); i < e; ++i) { Change &C = Changes[i]; - if (C.NewlinesBefore > 0) { - if (C.ContinuesPPDirective) { - MaxEndOfLine = std::max(C.PreviousEndOfTokenColumn + 2, MaxEndOfLine); - } else { - alignEscapedNewlines(StartOfMacro + 1, i, MaxEndOfLine); - MaxEndOfLine = AlignLeft ? 0 : Style.ColumnLimit; - StartOfMacro = i; - } + if (C.NewlinesBefore == 0 && (!WithLastLine || C.Tok->isNot(tok::eof))) + continue; + const bool InPPDirective = C.ContinuesPPDirective; + const auto BackslashColumn = C.PreviousEndOfTokenColumn + 2; + if (InPPDirective || + (WithLastLine && (MaxColumn == 0 || BackslashColumn <= MaxColumn))) { + MaxEndOfLine = std::max(BackslashColumn, MaxEndOfLine); + } + if (!InPPDirective) { + alignEscapedNewlines(StartOfMacro + 1, i, MaxEndOfLine); + MaxEndOfLine = AlignLeft ? 0 : MaxColumn; + StartOfMacro = i; } } alignEscapedNewlines(StartOfMacro + 1, Changes.size(), MaxEndOfLine); diff --git a/clang/lib/Frontend/InitPreprocessor.cpp b/clang/lib/Frontend/InitPreprocessor.cpp index ec09392d6d563..66c09f64e6f28 100644 --- a/clang/lib/Frontend/InitPreprocessor.cpp +++ b/clang/lib/Frontend/InitPreprocessor.cpp @@ -432,7 +432,8 @@ static void InitializeStandardPredefinedMacros(const TargetInfo &TI, // [C++] Whether __STDC__ is predefined and if so, what its value is, // are implementation-defined. // (Removed in C++20.) - if (!LangOpts.MSVCCompat && !LangOpts.TraditionalCPP) + if ((!LangOpts.MSVCCompat || LangOpts.MSVCEnableStdcMacro) && + !LangOpts.TraditionalCPP) Builder.defineMacro("__STDC__"); // -- __STDC_HOSTED__ // The integer literal 1 if the implementation is a hosted diff --git a/clang/lib/Frontend/SerializedDiagnosticPrinter.cpp b/clang/lib/Frontend/SerializedDiagnosticPrinter.cpp index b76728acb9077..0887b5a504f05 100644 --- a/clang/lib/Frontend/SerializedDiagnosticPrinter.cpp +++ b/clang/lib/Frontend/SerializedDiagnosticPrinter.cpp @@ -574,7 +574,7 @@ void SDiagsWriter::HandleDiagnostic(DiagnosticsEngine::Level DiagLevel, SmallString<256> diagnostic; Info.FormatDiagnostic(diagnostic); getMetaDiags()->Report( - diag::warn_fe_serialized_diag_failure_during_finalisation) + diag::warn_fe_serialized_diag_failure_during_finalization) << diagnostic; return; } diff --git a/clang/lib/Headers/CMakeLists.txt b/clang/lib/Headers/CMakeLists.txt index 5f02c71f6ca51..d3090e488306f 100644 --- a/clang/lib/Headers/CMakeLists.txt +++ b/clang/lib/Headers/CMakeLists.txt @@ -153,12 +153,10 @@ set(x86_files avx512bwintrin.h avx512cdintrin.h avx512dqintrin.h - avx512erintrin.h avx512fintrin.h avx512fp16intrin.h avx512ifmaintrin.h avx512ifmavlintrin.h - avx512pfintrin.h avx512vbmi2intrin.h avx512vbmiintrin.h avx512vbmivlintrin.h @@ -445,14 +443,14 @@ endforeach( f ) function(add_header_target target_name file_list) add_library(${target_name} INTERFACE ${file_list}) set_target_properties(${target_name} PROPERTIES - FOLDER "Misc" + FOLDER "Clang/Resources" RUNTIME_OUTPUT_DIRECTORY "${output_dir}") endfunction() # The catch-all clang-resource-headers target add_library(clang-resource-headers INTERFACE ${out_files}) set_target_properties("clang-resource-headers" PROPERTIES - FOLDER "Misc" + FOLDER "Clang/Resources" RUNTIME_OUTPUT_DIRECTORY "${output_dir}") add_dependencies("clang-resource-headers" "core-resource-headers" diff --git a/clang/lib/Headers/avx512erintrin.h b/clang/lib/Headers/avx512erintrin.h deleted file mode 100644 index 1c5a2d2d208ff..0000000000000 --- a/clang/lib/Headers/avx512erintrin.h +++ /dev/null @@ -1,271 +0,0 @@ -/*===---- avx512erintrin.h - AVX512ER intrinsics ---------------------------=== - * - * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. - * See https://llvm.org/LICENSE.txt for license information. - * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - * - *===-----------------------------------------------------------------------=== - */ -#ifndef __IMMINTRIN_H -#error "Never use directly; include instead." -#endif - -#ifndef __AVX512ERINTRIN_H -#define __AVX512ERINTRIN_H - -/* exp2a23 */ -#define _mm512_exp2a23_round_pd(A, R) \ - ((__m512d)__builtin_ia32_exp2pd_mask((__v8df)(__m512d)(A), \ - (__v8df)_mm512_setzero_pd(), \ - (__mmask8)-1, (int)(R))) - -#define _mm512_mask_exp2a23_round_pd(S, M, A, R) \ - ((__m512d)__builtin_ia32_exp2pd_mask((__v8df)(__m512d)(A), \ - (__v8df)(__m512d)(S), (__mmask8)(M), \ - (int)(R))) - -#define _mm512_maskz_exp2a23_round_pd(M, A, R) \ - ((__m512d)__builtin_ia32_exp2pd_mask((__v8df)(__m512d)(A), \ - (__v8df)_mm512_setzero_pd(), \ - (__mmask8)(M), (int)(R))) - -#define _mm512_exp2a23_pd(A) \ - _mm512_exp2a23_round_pd((A), _MM_FROUND_CUR_DIRECTION) - -#define _mm512_mask_exp2a23_pd(S, M, A) \ - _mm512_mask_exp2a23_round_pd((S), (M), (A), _MM_FROUND_CUR_DIRECTION) - -#define _mm512_maskz_exp2a23_pd(M, A) \ - _mm512_maskz_exp2a23_round_pd((M), (A), _MM_FROUND_CUR_DIRECTION) - -#define _mm512_exp2a23_round_ps(A, R) \ - ((__m512)__builtin_ia32_exp2ps_mask((__v16sf)(__m512)(A), \ - (__v16sf)_mm512_setzero_ps(), \ - (__mmask16)-1, (int)(R))) - -#define _mm512_mask_exp2a23_round_ps(S, M, A, R) \ - ((__m512)__builtin_ia32_exp2ps_mask((__v16sf)(__m512)(A), \ - (__v16sf)(__m512)(S), (__mmask16)(M), \ - (int)(R))) - -#define _mm512_maskz_exp2a23_round_ps(M, A, R) \ - ((__m512)__builtin_ia32_exp2ps_mask((__v16sf)(__m512)(A), \ - (__v16sf)_mm512_setzero_ps(), \ - (__mmask16)(M), (int)(R))) - -#define _mm512_exp2a23_ps(A) \ - _mm512_exp2a23_round_ps((A), _MM_FROUND_CUR_DIRECTION) - -#define _mm512_mask_exp2a23_ps(S, M, A) \ - _mm512_mask_exp2a23_round_ps((S), (M), (A), _MM_FROUND_CUR_DIRECTION) - -#define _mm512_maskz_exp2a23_ps(M, A) \ - _mm512_maskz_exp2a23_round_ps((M), (A), _MM_FROUND_CUR_DIRECTION) - -/* rsqrt28 */ -#define _mm512_rsqrt28_round_pd(A, R) \ - ((__m512d)__builtin_ia32_rsqrt28pd_mask((__v8df)(__m512d)(A), \ - (__v8df)_mm512_setzero_pd(), \ - (__mmask8)-1, (int)(R))) - -#define _mm512_mask_rsqrt28_round_pd(S, M, A, R) \ - ((__m512d)__builtin_ia32_rsqrt28pd_mask((__v8df)(__m512d)(A), \ - (__v8df)(__m512d)(S), (__mmask8)(M), \ - (int)(R))) - -#define _mm512_maskz_rsqrt28_round_pd(M, A, R) \ - ((__m512d)__builtin_ia32_rsqrt28pd_mask((__v8df)(__m512d)(A), \ - (__v8df)_mm512_setzero_pd(), \ - (__mmask8)(M), (int)(R))) - -#define _mm512_rsqrt28_pd(A) \ - _mm512_rsqrt28_round_pd((A), _MM_FROUND_CUR_DIRECTION) - -#define _mm512_mask_rsqrt28_pd(S, M, A) \ - _mm512_mask_rsqrt28_round_pd((S), (M), (A), _MM_FROUND_CUR_DIRECTION) - -#define _mm512_maskz_rsqrt28_pd(M, A) \ - _mm512_maskz_rsqrt28_round_pd((M), (A), _MM_FROUND_CUR_DIRECTION) - -#define _mm512_rsqrt28_round_ps(A, R) \ - ((__m512)__builtin_ia32_rsqrt28ps_mask((__v16sf)(__m512)(A), \ - (__v16sf)_mm512_setzero_ps(), \ - (__mmask16)-1, (int)(R))) - -#define _mm512_mask_rsqrt28_round_ps(S, M, A, R) \ - ((__m512)__builtin_ia32_rsqrt28ps_mask((__v16sf)(__m512)(A), \ - (__v16sf)(__m512)(S), (__mmask16)(M), \ - (int)(R))) - -#define _mm512_maskz_rsqrt28_round_ps(M, A, R) \ - ((__m512)__builtin_ia32_rsqrt28ps_mask((__v16sf)(__m512)(A), \ - (__v16sf)_mm512_setzero_ps(), \ - (__mmask16)(M), (int)(R))) - -#define _mm512_rsqrt28_ps(A) \ - _mm512_rsqrt28_round_ps((A), _MM_FROUND_CUR_DIRECTION) - -#define _mm512_mask_rsqrt28_ps(S, M, A) \ - _mm512_mask_rsqrt28_round_ps((S), (M), A, _MM_FROUND_CUR_DIRECTION) - -#define _mm512_maskz_rsqrt28_ps(M, A) \ - _mm512_maskz_rsqrt28_round_ps((M), (A), _MM_FROUND_CUR_DIRECTION) - -#define _mm_rsqrt28_round_ss(A, B, R) \ - ((__m128)__builtin_ia32_rsqrt28ss_round_mask((__v4sf)(__m128)(A), \ - (__v4sf)(__m128)(B), \ - (__v4sf)_mm_setzero_ps(), \ - (__mmask8)-1, (int)(R))) - -#define _mm_mask_rsqrt28_round_ss(S, M, A, B, R) \ - ((__m128)__builtin_ia32_rsqrt28ss_round_mask((__v4sf)(__m128)(A), \ - (__v4sf)(__m128)(B), \ - (__v4sf)(__m128)(S), \ - (__mmask8)(M), (int)(R))) - -#define _mm_maskz_rsqrt28_round_ss(M, A, B, R) \ - ((__m128)__builtin_ia32_rsqrt28ss_round_mask((__v4sf)(__m128)(A), \ - (__v4sf)(__m128)(B), \ - (__v4sf)_mm_setzero_ps(), \ - (__mmask8)(M), (int)(R))) - -#define _mm_rsqrt28_ss(A, B) \ - _mm_rsqrt28_round_ss((A), (B), _MM_FROUND_CUR_DIRECTION) - -#define _mm_mask_rsqrt28_ss(S, M, A, B) \ - _mm_mask_rsqrt28_round_ss((S), (M), (A), (B), _MM_FROUND_CUR_DIRECTION) - -#define _mm_maskz_rsqrt28_ss(M, A, B) \ - _mm_maskz_rsqrt28_round_ss((M), (A), (B), _MM_FROUND_CUR_DIRECTION) - -#define _mm_rsqrt28_round_sd(A, B, R) \ - ((__m128d)__builtin_ia32_rsqrt28sd_round_mask((__v2df)(__m128d)(A), \ - (__v2df)(__m128d)(B), \ - (__v2df)_mm_setzero_pd(), \ - (__mmask8)-1, (int)(R))) - -#define _mm_mask_rsqrt28_round_sd(S, M, A, B, R) \ - ((__m128d)__builtin_ia32_rsqrt28sd_round_mask((__v2df)(__m128d)(A), \ - (__v2df)(__m128d)(B), \ - (__v2df)(__m128d)(S), \ - (__mmask8)(M), (int)(R))) - -#define _mm_maskz_rsqrt28_round_sd(M, A, B, R) \ - ((__m128d)__builtin_ia32_rsqrt28sd_round_mask((__v2df)(__m128d)(A), \ - (__v2df)(__m128d)(B), \ - (__v2df)_mm_setzero_pd(), \ - (__mmask8)(M), (int)(R))) - -#define _mm_rsqrt28_sd(A, B) \ - _mm_rsqrt28_round_sd((A), (B), _MM_FROUND_CUR_DIRECTION) - -#define _mm_mask_rsqrt28_sd(S, M, A, B) \ - _mm_mask_rsqrt28_round_sd((S), (M), (A), (B), _MM_FROUND_CUR_DIRECTION) - -#define _mm_maskz_rsqrt28_sd(M, A, B) \ - _mm_maskz_rsqrt28_round_sd((M), (A), (B), _MM_FROUND_CUR_DIRECTION) - -/* rcp28 */ -#define _mm512_rcp28_round_pd(A, R) \ - ((__m512d)__builtin_ia32_rcp28pd_mask((__v8df)(__m512d)(A), \ - (__v8df)_mm512_setzero_pd(), \ - (__mmask8)-1, (int)(R))) - -#define _mm512_mask_rcp28_round_pd(S, M, A, R) \ - ((__m512d)__builtin_ia32_rcp28pd_mask((__v8df)(__m512d)(A), \ - (__v8df)(__m512d)(S), (__mmask8)(M), \ - (int)(R))) - -#define _mm512_maskz_rcp28_round_pd(M, A, R) \ - ((__m512d)__builtin_ia32_rcp28pd_mask((__v8df)(__m512d)(A), \ - (__v8df)_mm512_setzero_pd(), \ - (__mmask8)(M), (int)(R))) - -#define _mm512_rcp28_pd(A) \ - _mm512_rcp28_round_pd((A), _MM_FROUND_CUR_DIRECTION) - -#define _mm512_mask_rcp28_pd(S, M, A) \ - _mm512_mask_rcp28_round_pd((S), (M), (A), _MM_FROUND_CUR_DIRECTION) - -#define _mm512_maskz_rcp28_pd(M, A) \ - _mm512_maskz_rcp28_round_pd((M), (A), _MM_FROUND_CUR_DIRECTION) - -#define _mm512_rcp28_round_ps(A, R) \ - ((__m512)__builtin_ia32_rcp28ps_mask((__v16sf)(__m512)(A), \ - (__v16sf)_mm512_setzero_ps(), \ - (__mmask16)-1, (int)(R))) - -#define _mm512_mask_rcp28_round_ps(S, M, A, R) \ - ((__m512)__builtin_ia32_rcp28ps_mask((__v16sf)(__m512)(A), \ - (__v16sf)(__m512)(S), (__mmask16)(M), \ - (int)(R))) - -#define _mm512_maskz_rcp28_round_ps(M, A, R) \ - ((__m512)__builtin_ia32_rcp28ps_mask((__v16sf)(__m512)(A), \ - (__v16sf)_mm512_setzero_ps(), \ - (__mmask16)(M), (int)(R))) - -#define _mm512_rcp28_ps(A) \ - _mm512_rcp28_round_ps((A), _MM_FROUND_CUR_DIRECTION) - -#define _mm512_mask_rcp28_ps(S, M, A) \ - _mm512_mask_rcp28_round_ps((S), (M), (A), _MM_FROUND_CUR_DIRECTION) - -#define _mm512_maskz_rcp28_ps(M, A) \ - _mm512_maskz_rcp28_round_ps((M), (A), _MM_FROUND_CUR_DIRECTION) - -#define _mm_rcp28_round_ss(A, B, R) \ - ((__m128)__builtin_ia32_rcp28ss_round_mask((__v4sf)(__m128)(A), \ - (__v4sf)(__m128)(B), \ - (__v4sf)_mm_setzero_ps(), \ - (__mmask8)-1, (int)(R))) - -#define _mm_mask_rcp28_round_ss(S, M, A, B, R) \ - ((__m128)__builtin_ia32_rcp28ss_round_mask((__v4sf)(__m128)(A), \ - (__v4sf)(__m128)(B), \ - (__v4sf)(__m128)(S), \ - (__mmask8)(M), (int)(R))) - -#define _mm_maskz_rcp28_round_ss(M, A, B, R) \ - ((__m128)__builtin_ia32_rcp28ss_round_mask((__v4sf)(__m128)(A), \ - (__v4sf)(__m128)(B), \ - (__v4sf)_mm_setzero_ps(), \ - (__mmask8)(M), (int)(R))) - -#define _mm_rcp28_ss(A, B) \ - _mm_rcp28_round_ss((A), (B), _MM_FROUND_CUR_DIRECTION) - -#define _mm_mask_rcp28_ss(S, M, A, B) \ - _mm_mask_rcp28_round_ss((S), (M), (A), (B), _MM_FROUND_CUR_DIRECTION) - -#define _mm_maskz_rcp28_ss(M, A, B) \ - _mm_maskz_rcp28_round_ss((M), (A), (B), _MM_FROUND_CUR_DIRECTION) - -#define _mm_rcp28_round_sd(A, B, R) \ - ((__m128d)__builtin_ia32_rcp28sd_round_mask((__v2df)(__m128d)(A), \ - (__v2df)(__m128d)(B), \ - (__v2df)_mm_setzero_pd(), \ - (__mmask8)-1, (int)(R))) - -#define _mm_mask_rcp28_round_sd(S, M, A, B, R) \ - ((__m128d)__builtin_ia32_rcp28sd_round_mask((__v2df)(__m128d)(A), \ - (__v2df)(__m128d)(B), \ - (__v2df)(__m128d)(S), \ - (__mmask8)(M), (int)(R))) - -#define _mm_maskz_rcp28_round_sd(M, A, B, R) \ - ((__m128d)__builtin_ia32_rcp28sd_round_mask((__v2df)(__m128d)(A), \ - (__v2df)(__m128d)(B), \ - (__v2df)_mm_setzero_pd(), \ - (__mmask8)(M), (int)(R))) - -#define _mm_rcp28_sd(A, B) \ - _mm_rcp28_round_sd((A), (B), _MM_FROUND_CUR_DIRECTION) - -#define _mm_mask_rcp28_sd(S, M, A, B) \ - _mm_mask_rcp28_round_sd((S), (M), (A), (B), _MM_FROUND_CUR_DIRECTION) - -#define _mm_maskz_rcp28_sd(M, A, B) \ - _mm_maskz_rcp28_round_sd((M), (A), (B), _MM_FROUND_CUR_DIRECTION) - -#endif /* __AVX512ERINTRIN_H */ diff --git a/clang/lib/Headers/avx512pfintrin.h b/clang/lib/Headers/avx512pfintrin.h deleted file mode 100644 index f853be021a2dd..0000000000000 --- a/clang/lib/Headers/avx512pfintrin.h +++ /dev/null @@ -1,92 +0,0 @@ -/*===------------- avx512pfintrin.h - PF intrinsics ------------------------=== - * - * - * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. - * See https://llvm.org/LICENSE.txt for license information. - * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - * - *===-----------------------------------------------------------------------=== - */ -#ifndef __IMMINTRIN_H -#error "Never use directly; include instead." -#endif - -#ifndef __AVX512PFINTRIN_H -#define __AVX512PFINTRIN_H - -#define _mm512_mask_prefetch_i32gather_pd(index, mask, addr, scale, hint) \ - __builtin_ia32_gatherpfdpd((__mmask8)(mask), (__v8si)(__m256i)(index), \ - (void const *)(addr), (int)(scale), \ - (int)(hint)) - -#define _mm512_prefetch_i32gather_pd(index, addr, scale, hint) \ - __builtin_ia32_gatherpfdpd((__mmask8) -1, (__v8si)(__m256i)(index), \ - (void const *)(addr), (int)(scale), \ - (int)(hint)) - -#define _mm512_mask_prefetch_i32gather_ps(index, mask, addr, scale, hint) \ - __builtin_ia32_gatherpfdps((__mmask16)(mask), \ - (__v16si)(__m512i)(index), (void const *)(addr), \ - (int)(scale), (int)(hint)) - -#define _mm512_prefetch_i32gather_ps(index, addr, scale, hint) \ - __builtin_ia32_gatherpfdps((__mmask16) -1, \ - (__v16si)(__m512i)(index), (void const *)(addr), \ - (int)(scale), (int)(hint)) - -#define _mm512_mask_prefetch_i64gather_pd(index, mask, addr, scale, hint) \ - __builtin_ia32_gatherpfqpd((__mmask8)(mask), (__v8di)(__m512i)(index), \ - (void const *)(addr), (int)(scale), \ - (int)(hint)) - -#define _mm512_prefetch_i64gather_pd(index, addr, scale, hint) \ - __builtin_ia32_gatherpfqpd((__mmask8) -1, (__v8di)(__m512i)(index), \ - (void const *)(addr), (int)(scale), \ - (int)(hint)) - -#define _mm512_mask_prefetch_i64gather_ps(index, mask, addr, scale, hint) \ - __builtin_ia32_gatherpfqps((__mmask8)(mask), (__v8di)(__m512i)(index), \ - (void const *)(addr), (int)(scale), (int)(hint)) - -#define _mm512_prefetch_i64gather_ps(index, addr, scale, hint) \ - __builtin_ia32_gatherpfqps((__mmask8) -1, (__v8di)(__m512i)(index), \ - (void const *)(addr), (int)(scale), (int)(hint)) - -#define _mm512_prefetch_i32scatter_pd(addr, index, scale, hint) \ - __builtin_ia32_scatterpfdpd((__mmask8)-1, (__v8si)(__m256i)(index), \ - (void *)(addr), (int)(scale), \ - (int)(hint)) - -#define _mm512_mask_prefetch_i32scatter_pd(addr, mask, index, scale, hint) \ - __builtin_ia32_scatterpfdpd((__mmask8)(mask), (__v8si)(__m256i)(index), \ - (void *)(addr), (int)(scale), \ - (int)(hint)) - -#define _mm512_prefetch_i32scatter_ps(addr, index, scale, hint) \ - __builtin_ia32_scatterpfdps((__mmask16)-1, (__v16si)(__m512i)(index), \ - (void *)(addr), (int)(scale), (int)(hint)) - -#define _mm512_mask_prefetch_i32scatter_ps(addr, mask, index, scale, hint) \ - __builtin_ia32_scatterpfdps((__mmask16)(mask), \ - (__v16si)(__m512i)(index), (void *)(addr), \ - (int)(scale), (int)(hint)) - -#define _mm512_prefetch_i64scatter_pd(addr, index, scale, hint) \ - __builtin_ia32_scatterpfqpd((__mmask8)-1, (__v8di)(__m512i)(index), \ - (void *)(addr), (int)(scale), \ - (int)(hint)) - -#define _mm512_mask_prefetch_i64scatter_pd(addr, mask, index, scale, hint) \ - __builtin_ia32_scatterpfqpd((__mmask8)(mask), (__v8di)(__m512i)(index), \ - (void *)(addr), (int)(scale), \ - (int)(hint)) - -#define _mm512_prefetch_i64scatter_ps(addr, index, scale, hint) \ - __builtin_ia32_scatterpfqps((__mmask8)-1, (__v8di)(__m512i)(index), \ - (void *)(addr), (int)(scale), (int)(hint)) - -#define _mm512_mask_prefetch_i64scatter_ps(addr, mask, index, scale, hint) \ - __builtin_ia32_scatterpfqps((__mmask8)(mask), (__v8di)(__m512i)(index), \ - (void *)(addr), (int)(scale), (int)(hint)) - -#endif diff --git a/clang/lib/Headers/immintrin.h b/clang/lib/Headers/immintrin.h index 508696d3725b9..cd6cf09b90cad 100644 --- a/clang/lib/Headers/immintrin.h +++ b/clang/lib/Headers/immintrin.h @@ -151,10 +151,6 @@ #include #endif -#if !defined(__SCE__) || __has_feature(modules) || defined(__AVX512ER__) -#include -#endif - #if !defined(__SCE__) || __has_feature(modules) || defined(__AVX512IFMA__) #include #endif @@ -186,10 +182,6 @@ #include #endif -#if !defined(__SCE__) || __has_feature(modules) || defined(__AVX512PF__) -#include -#endif - #if !defined(__SCE__) || __has_feature(modules) || defined(__AVX512FP16__) #include #endif diff --git a/clang/lib/Headers/intrin.h b/clang/lib/Headers/intrin.h index 7eb6dceaabfae..5ceb986a1f652 100644 --- a/clang/lib/Headers/intrin.h +++ b/clang/lib/Headers/intrin.h @@ -378,7 +378,7 @@ unsigned int _CountLeadingSigns64(__int64); unsigned int _CountOneBits(unsigned long); unsigned int _CountOneBits64(unsigned __int64); -void __cdecl __prefetch(void *); +void __cdecl __prefetch(const void *); #endif /*----------------------------------------------------------------------------*\ diff --git a/clang/lib/Headers/module.modulemap b/clang/lib/Headers/module.modulemap index 4abfd1d98a635..9ffc249c8d1a2 100644 --- a/clang/lib/Headers/module.modulemap +++ b/clang/lib/Headers/module.modulemap @@ -44,7 +44,6 @@ module _Builtin_intrinsics [system] [extern_c] { textual header "avxintrin.h" textual header "avx2intrin.h" textual header "avx512fintrin.h" - textual header "avx512erintrin.h" textual header "fmaintrin.h" header "x86intrin.h" diff --git a/clang/lib/Interpreter/Interpreter.cpp b/clang/lib/Interpreter/Interpreter.cpp index b20e6efcebfd1..683f87e8c8c79 100644 --- a/clang/lib/Interpreter/Interpreter.cpp +++ b/clang/lib/Interpreter/Interpreter.cpp @@ -229,12 +229,32 @@ IncrementalCompilerBuilder::CreateCudaHost() { } Interpreter::Interpreter(std::unique_ptr CI, - llvm::Error &Err) { - llvm::ErrorAsOutParameter EAO(&Err); + llvm::Error &ErrOut, + std::unique_ptr JITBuilder) + : JITBuilder(std::move(JITBuilder)) { + llvm::ErrorAsOutParameter EAO(&ErrOut); auto LLVMCtx = std::make_unique(); TSCtx = std::make_unique(std::move(LLVMCtx)); - IncrParser = std::make_unique(*this, std::move(CI), - *TSCtx->getContext(), Err); + IncrParser = std::make_unique( + *this, std::move(CI), *TSCtx->getContext(), ErrOut); + if (ErrOut) + return; + + // Not all frontends support code-generation, e.g. ast-dump actions don't + if (IncrParser->getCodeGen()) { + if (llvm::Error Err = CreateExecutor()) { + ErrOut = joinErrors(std::move(ErrOut), std::move(Err)); + return; + } + + // Process the PTUs that came from initialization. For example -include will + // give us a header that's processed at initialization of the preprocessor. + for (PartialTranslationUnit &PTU : IncrParser->getPTUs()) + if (llvm::Error Err = Execute(PTU)) { + ErrOut = joinErrors(std::move(ErrOut), std::move(Err)); + return; + } + } } Interpreter::~Interpreter() { @@ -382,25 +402,29 @@ createJITTargetMachineBuilder(const std::string &TT) { return llvm::orc::JITTargetMachineBuilder(llvm::Triple(TT)); } -llvm::Expected> -Interpreter::CreateJITBuilder(CompilerInstance &CI) { - auto JTMB = createJITTargetMachineBuilder(CI.getTargetOpts().Triple); - if (!JTMB) - return JTMB.takeError(); - return IncrementalExecutor::createDefaultJITBuilder(std::move(*JTMB)); -} - llvm::Error Interpreter::CreateExecutor() { if (IncrExecutor) return llvm::make_error("Operation failed. " "Execution engine exists", std::error_code()); - llvm::Expected> JB = - CreateJITBuilder(*getCompilerInstance()); - if (!JB) - return JB.takeError(); + if (!IncrParser->getCodeGen()) + return llvm::make_error("Operation failed. " + "No code generator available", + std::error_code()); + if (!JITBuilder) { + const std::string &TT = getCompilerInstance()->getTargetOpts().Triple; + auto JTMB = createJITTargetMachineBuilder(TT); + if (!JTMB) + return JTMB.takeError(); + auto JB = IncrementalExecutor::createDefaultJITBuilder(std::move(*JTMB)); + if (!JB) + return JB.takeError(); + JITBuilder = std::move(*JB); + } + llvm::Error Err = llvm::Error::success(); - auto Executor = std::make_unique(*TSCtx, **JB, Err); + auto Executor = + std::make_unique(*TSCtx, *JITBuilder, Err); if (!Err) IncrExecutor = std::move(Executor); diff --git a/clang/lib/Lex/Lexer.cpp b/clang/lib/Lex/Lexer.cpp index c98645993abe0..c7543a48c0b50 100644 --- a/clang/lib/Lex/Lexer.cpp +++ b/clang/lib/Lex/Lexer.cpp @@ -2261,8 +2261,17 @@ bool Lexer::LexRawStringLiteral(Token &Result, const char *CurPtr, unsigned PrefixLen = 0; - while (PrefixLen != 16 && isRawStringDelimBody(CurPtr[PrefixLen])) + while (PrefixLen != 16 && isRawStringDelimBody(CurPtr[PrefixLen])) { ++PrefixLen; + if (!isLexingRawMode() && + llvm::is_contained({'$', '@', '`'}, CurPtr[PrefixLen])) { + const char *Pos = &CurPtr[PrefixLen]; + Diag(Pos, LangOpts.CPlusPlus26 + ? diag::warn_cxx26_compat_raw_string_literal_character_set + : diag::ext_cxx26_raw_string_literal_character_set) + << StringRef(Pos, 1); + } + } // If the last character was not a '(', then we didn't lex a valid delimiter. if (CurPtr[PrefixLen] != '(') { diff --git a/clang/lib/Parse/ParseDecl.cpp b/clang/lib/Parse/ParseDecl.cpp index 1514b499fadcd..1f69a4cf93e25 100644 --- a/clang/lib/Parse/ParseDecl.cpp +++ b/clang/lib/Parse/ParseDecl.cpp @@ -467,6 +467,11 @@ bool Parser::ParseAttributeArgumentList( break; } + if (Actions.DiagnoseUnexpandedParameterPack(Expr.get())) { + SawError = true; + break; + } + Exprs.push_back(Expr.get()); if (Tok.isNot(tok::comma)) @@ -3313,6 +3318,19 @@ void Parser::ParseAlignmentSpecifier(ParsedAttributes &Attrs, } } +void Parser::DistributeCLateParsedAttrs(Decl *Dcl, + LateParsedAttrList *LateAttrs) { + if (!LateAttrs) + return; + + if (Dcl) { + for (auto *LateAttr : *LateAttrs) { + if (LateAttr->Decls.empty()) + LateAttr->addDecl(Dcl); + } + } +} + /// Bounds attributes (e.g., counted_by): /// AttrName '(' expression ')' void Parser::ParseBoundsAttribute(IdentifierInfo &AttrName, @@ -4850,13 +4868,14 @@ static void DiagnoseCountAttributedTypeInUnnamedAnon(ParsingDeclSpec &DS, /// void Parser::ParseStructDeclaration( ParsingDeclSpec &DS, - llvm::function_ref FieldsCallback) { + llvm::function_ref FieldsCallback, + LateParsedAttrList *LateFieldAttrs) { if (Tok.is(tok::kw___extension__)) { // __extension__ silences extension warnings in the subexpression. ExtensionRAIIObject O(Diags); // Use RAII to do this. ConsumeToken(); - return ParseStructDeclaration(DS, FieldsCallback); + return ParseStructDeclaration(DS, FieldsCallback, LateFieldAttrs); } // Parse leading attributes. @@ -4921,10 +4940,12 @@ void Parser::ParseStructDeclaration( } // If attributes exist after the declarator, parse them. - MaybeParseGNUAttributes(DeclaratorInfo.D); + MaybeParseGNUAttributes(DeclaratorInfo.D, LateFieldAttrs); // We're done with this declarator; invoke the callback. - FieldsCallback(DeclaratorInfo); + Decl *Field = FieldsCallback(DeclaratorInfo); + if (Field) + DistributeCLateParsedAttrs(Field, LateFieldAttrs); // If we don't have a comma, it is either the end of the list (a ';') // or an error, bail out. @@ -4935,6 +4956,73 @@ void Parser::ParseStructDeclaration( } } +// TODO: All callers of this function should be moved to +// `Parser::ParseLexedAttributeList`. +void Parser::ParseLexedCAttributeList(LateParsedAttrList &LAs, bool EnterScope, + ParsedAttributes *OutAttrs) { + assert(LAs.parseSoon() && + "Attribute list should be marked for immediate parsing."); + for (auto *LA : LAs) { + ParseLexedCAttribute(*LA, EnterScope, OutAttrs); + delete LA; + } + LAs.clear(); +} + +/// Finish parsing an attribute for which parsing was delayed. +/// This will be called at the end of parsing a class declaration +/// for each LateParsedAttribute. We consume the saved tokens and +/// create an attribute with the arguments filled in. We add this +/// to the Attribute list for the decl. +void Parser::ParseLexedCAttribute(LateParsedAttribute &LA, bool EnterScope, + ParsedAttributes *OutAttrs) { + // Create a fake EOF so that attribute parsing won't go off the end of the + // attribute. + Token AttrEnd; + AttrEnd.startToken(); + AttrEnd.setKind(tok::eof); + AttrEnd.setLocation(Tok.getLocation()); + AttrEnd.setEofData(LA.Toks.data()); + LA.Toks.push_back(AttrEnd); + + // Append the current token at the end of the new token stream so that it + // doesn't get lost. + LA.Toks.push_back(Tok); + PP.EnterTokenStream(LA.Toks, /*DisableMacroExpansion=*/true, + /*IsReinject=*/true); + // Drop the current token and bring the first cached one. It's the same token + // as when we entered this function. + ConsumeAnyToken(/*ConsumeCodeCompletionTok=*/true); + + // TODO: Use `EnterScope` + (void)EnterScope; + + ParsedAttributes Attrs(AttrFactory); + + assert(LA.Decls.size() <= 1 && + "late field attribute expects to have at most one declaration."); + + // Dispatch based on the attribute and parse it + ParseGNUAttributeArgs(&LA.AttrName, LA.AttrNameLoc, Attrs, nullptr, nullptr, + SourceLocation(), ParsedAttr::Form::GNU(), nullptr); + + for (auto *D : LA.Decls) + Actions.ActOnFinishDelayedAttribute(getCurScope(), D, Attrs); + + // Due to a parsing error, we either went over the cached tokens or + // there are still cached tokens left, so we skip the leftover tokens. + while (Tok.isNot(tok::eof)) + ConsumeAnyToken(); + + // Consume the fake EOF token if it's there + if (Tok.is(tok::eof) && Tok.getEofData() == AttrEnd.getEofData()) + ConsumeAnyToken(); + + if (OutAttrs) { + OutAttrs->takeAllFrom(Attrs); + } +} + /// ParseStructUnionBody /// struct-contents: /// struct-declaration-list @@ -4958,6 +5046,11 @@ void Parser::ParseStructUnionBody(SourceLocation RecordLoc, ParseScope StructScope(this, Scope::ClassScope|Scope::DeclScope); Actions.ActOnTagStartDefinition(getCurScope(), TagDecl); + // `LateAttrParseExperimentalExtOnly=true` requests that only attributes + // marked with `LateAttrParseExperimentalExt` are late parsed. + LateParsedAttrList LateFieldAttrs(/*PSoon=*/true, + /*LateAttrParseExperimentalExtOnly=*/true); + // While we still have something to read, read the declarations in the struct. while (!tryParseMisplacedModuleImport() && Tok.isNot(tok::r_brace) && Tok.isNot(tok::eof)) { @@ -5008,18 +5101,19 @@ void Parser::ParseStructUnionBody(SourceLocation RecordLoc, } if (!Tok.is(tok::at)) { - auto CFieldCallback = [&](ParsingFieldDeclarator &FD) { + auto CFieldCallback = [&](ParsingFieldDeclarator &FD) -> Decl * { // Install the declarator into the current TagDecl. Decl *Field = Actions.ActOnField(getCurScope(), TagDecl, FD.D.getDeclSpec().getSourceRange().getBegin(), FD.D, FD.BitfieldSize); FD.complete(Field); + return Field; }; // Parse all the comma separated declarators. ParsingDeclSpec DS(*this); - ParseStructDeclaration(DS, CFieldCallback); + ParseStructDeclaration(DS, CFieldCallback, &LateFieldAttrs); } else { // Handle @defs ConsumeToken(); if (!Tok.isObjCAtKeyword(tok::objc_defs)) { @@ -5060,7 +5154,10 @@ void Parser::ParseStructUnionBody(SourceLocation RecordLoc, ParsedAttributes attrs(AttrFactory); // If attributes exist after struct contents, parse them. - MaybeParseGNUAttributes(attrs); + MaybeParseGNUAttributes(attrs, &LateFieldAttrs); + + // Late parse field attributes if necessary. + ParseLexedCAttributeList(LateFieldAttrs, /*EnterScope=*/false); SmallVector FieldDecls(TagDecl->fields()); diff --git a/clang/lib/Parse/ParseObjc.cpp b/clang/lib/Parse/ParseObjc.cpp index 89f4acbd25e49..6a2088a73c55b 100644 --- a/clang/lib/Parse/ParseObjc.cpp +++ b/clang/lib/Parse/ParseObjc.cpp @@ -780,16 +780,16 @@ void Parser::ParseObjCInterfaceDeclList(tok::ObjCKeywordKind contextKey, } bool addedToDeclSpec = false; - auto ObjCPropertyCallback = [&](ParsingFieldDeclarator &FD) { + auto ObjCPropertyCallback = [&](ParsingFieldDeclarator &FD) -> Decl * { if (FD.D.getIdentifier() == nullptr) { Diag(AtLoc, diag::err_objc_property_requires_field_name) << FD.D.getSourceRange(); - return; + return nullptr; } if (FD.BitfieldSize) { Diag(AtLoc, diag::err_objc_property_bitfield) << FD.D.getSourceRange(); - return; + return nullptr; } // Map a nullability property attribute to a context-sensitive keyword @@ -818,6 +818,7 @@ void Parser::ParseObjCInterfaceDeclList(tok::ObjCKeywordKind contextKey, MethodImplKind); FD.complete(Property); + return Property; }; // Parse all the comma separated declarators. @@ -2013,7 +2014,7 @@ void Parser::ParseObjCClassInstanceVariables(ObjCContainerDecl *interfaceDecl, continue; } - auto ObjCIvarCallback = [&](ParsingFieldDeclarator &FD) { + auto ObjCIvarCallback = [&](ParsingFieldDeclarator &FD) -> Decl * { assert(getObjCDeclContext() == interfaceDecl && "Ivar should have interfaceDecl as its decl context"); // Install the declarator into the interface decl. @@ -2024,6 +2025,7 @@ void Parser::ParseObjCClassInstanceVariables(ObjCContainerDecl *interfaceDecl, if (Field) AllIvarDecls.push_back(Field); FD.complete(Field); + return Field; }; // Parse all the comma separated declarators. diff --git a/clang/lib/Sema/SemaAvailability.cpp b/clang/lib/Sema/SemaAvailability.cpp index 06b4696af3790..6b38cfd3eb543 100644 --- a/clang/lib/Sema/SemaAvailability.cpp +++ b/clang/lib/Sema/SemaAvailability.cpp @@ -988,11 +988,6 @@ void Sema::DiagnoseUnguardedAvailabilityViolations(Decl *D) { Stmt *Body = nullptr; if (auto *FD = D->getAsFunction()) { - // FIXME: We only examine the pattern decl for availability violations now, - // but we should also examine instantiated templates. - if (FD->isTemplateInstantiation()) - return; - Body = FD->getBody(); if (auto *CD = dyn_cast(FD)) diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp index e1a5ceac4f634..959b9fd85f7bc 100644 --- a/clang/lib/Sema/SemaChecking.cpp +++ b/clang/lib/Sema/SemaChecking.cpp @@ -3882,7 +3882,7 @@ bool Sema::CheckARMBuiltinExclusiveCall(unsigned BuiltinID, CallExpr *TheCall, const PointerType *pointerType = PointerArg->getType()->getAs(); if (!pointerType) { Diag(DRE->getBeginLoc(), diag::err_atomic_builtin_must_be_pointer) - << PointerArg->getType() << PointerArg->getSourceRange(); + << PointerArg->getType() << 0 << PointerArg->getSourceRange(); return true; } @@ -3916,7 +3916,7 @@ bool Sema::CheckARMBuiltinExclusiveCall(unsigned BuiltinID, CallExpr *TheCall, if (!ValType->isIntegerType() && !ValType->isAnyPointerType() && !ValType->isBlockPointerType() && !ValType->isFloatingType()) { Diag(DRE->getBeginLoc(), diag::err_atomic_builtin_must_be_pointer_intfltptr) - << PointerArg->getType() << PointerArg->getSourceRange(); + << PointerArg->getType() << 0 << PointerArg->getSourceRange(); return true; } @@ -5754,6 +5754,28 @@ bool Sema::CheckAMDGCNBuiltinFunctionCall(unsigned BuiltinID, // position of memory order and scope arguments in the builtin unsigned OrderIndex, ScopeIndex; switch (BuiltinID) { + case AMDGPU::BI__builtin_amdgcn_global_load_lds: { + constexpr const int SizeIdx = 2; + llvm::APSInt Size; + Expr *ArgExpr = TheCall->getArg(SizeIdx); + ExprResult R = VerifyIntegerConstantExpression(ArgExpr, &Size); + if (R.isInvalid()) + return true; + switch (Size.getSExtValue()) { + case 1: + case 2: + case 4: + return false; + default: + Diag(ArgExpr->getExprLoc(), + diag::err_amdgcn_global_load_lds_size_invalid_value) + << ArgExpr->getSourceRange(); + Diag(ArgExpr->getExprLoc(), + diag::note_amdgcn_global_load_lds_size_valid_value) + << ArgExpr->getSourceRange(); + return true; + } + } case AMDGPU::BI__builtin_amdgcn_get_fpenv: case AMDGPU::BI__builtin_amdgcn_set_fpenv: return false; @@ -7164,7 +7186,7 @@ ExprResult Sema::BuildAtomicExpr(SourceRange CallRange, SourceRange ExprRange, const PointerType *pointerType = Ptr->getType()->getAs(); if (!pointerType) { Diag(ExprRange.getBegin(), diag::err_atomic_builtin_must_be_pointer) - << Ptr->getType() << Ptr->getSourceRange(); + << Ptr->getType() << 0 << Ptr->getSourceRange(); return ExprError(); } @@ -7193,6 +7215,13 @@ ExprResult Sema::BuildAtomicExpr(SourceRange CallRange, SourceRange ExprRange, } } + // Pointer to object of size zero is not allowed. + if (Context.getTypeInfoInChars(AtomTy).Width.isZero()) { + Diag(ExprRange.getBegin(), diag::err_atomic_builtin_must_be_pointer) + << Ptr->getType() << 1 << Ptr->getSourceRange(); + return ExprError(); + } + // For an arithmetic operation, the implied arithmetic must be well-formed. if (Form == Arithmetic) { // GCC does not enforce these rules for GNU atomics, but we do to help catch @@ -7584,7 +7613,7 @@ ExprResult Sema::BuiltinAtomicOverloaded(ExprResult TheCallResult) { const PointerType *pointerType = FirstArg->getType()->getAs(); if (!pointerType) { Diag(DRE->getBeginLoc(), diag::err_atomic_builtin_must_be_pointer) - << FirstArg->getType() << FirstArg->getSourceRange(); + << FirstArg->getType() << 0 << FirstArg->getSourceRange(); return ExprError(); } @@ -7592,7 +7621,7 @@ ExprResult Sema::BuiltinAtomicOverloaded(ExprResult TheCallResult) { if (!ValType->isIntegerType() && !ValType->isAnyPointerType() && !ValType->isBlockPointerType()) { Diag(DRE->getBeginLoc(), diag::err_atomic_builtin_must_be_pointer_intptr) - << FirstArg->getType() << FirstArg->getSourceRange(); + << FirstArg->getType() << 0 << FirstArg->getSourceRange(); return ExprError(); } diff --git a/clang/lib/Sema/SemaCodeComplete.cpp b/clang/lib/Sema/SemaCodeComplete.cpp index ad3ca4cc94ca6..cd1c5f9391ccd 100644 --- a/clang/lib/Sema/SemaCodeComplete.cpp +++ b/clang/lib/Sema/SemaCodeComplete.cpp @@ -5692,8 +5692,15 @@ QualType getApproximateType(const Expr *E) { } } if (const auto *UO = llvm::dyn_cast(E)) { - if (UO->getOpcode() == UnaryOperatorKind::UO_Deref) - return UO->getSubExpr()->getType()->getPointeeType(); + if (UO->getOpcode() == UnaryOperatorKind::UO_Deref) { + // We recurse into the subexpression because it could be of dependent + // type. + if (auto Pointee = getApproximateType(UO->getSubExpr())->getPointeeType(); + !Pointee.isNull()) + return Pointee; + // Our caller expects a non-null result, even though the SubType is + // supposed to have a pointee. Fall through to Unresolved anyway. + } } return Unresolved; } diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index a7fa168fd817f..a9fa63a5e3fa9 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -11967,8 +11967,8 @@ static bool CheckMultiVersionFunction(Sema &S, FunctionDecl *NewFD, return false; if (!OldDecl || !OldDecl->getAsFunction() || - OldDecl->getDeclContext()->getRedeclContext() != - NewFD->getDeclContext()->getRedeclContext()) { + !OldDecl->getDeclContext()->getRedeclContext()->Equals( + NewFD->getDeclContext()->getRedeclContext())) { // If there's no previous declaration, AND this isn't attempting to cause // multiversioning, this isn't an error condition. if (MVKind == MultiVersionKind::None) diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp index 2f67508bf191e..f012fb97cea93 100644 --- a/clang/lib/Sema/SemaDeclAttr.cpp +++ b/clang/lib/Sema/SemaDeclAttr.cpp @@ -11611,31 +11611,95 @@ static const RecordDecl *GetEnclosingNamedOrTopAnonRecord(const FieldDecl *FD) { return RD; } -static bool -CheckCountExpr(Sema &S, FieldDecl *FD, Expr *E, - llvm::SmallVectorImpl &Decls) { +enum class CountedByInvalidPointeeTypeKind { + INCOMPLETE, + SIZELESS, + FUNCTION, + FLEXIBLE_ARRAY_MEMBER, + VALID, +}; + +static bool CheckCountedByAttrOnField( + Sema &S, FieldDecl *FD, Expr *E, + llvm::SmallVectorImpl &Decls) { + // Check the context the attribute is used in + if (FD->getParent()->isUnion()) { S.Diag(FD->getBeginLoc(), diag::err_counted_by_attr_in_union) << FD->getSourceRange(); return true; } - if (!E->getType()->isIntegerType() || E->getType()->isBooleanType()) { - S.Diag(E->getBeginLoc(), diag::err_counted_by_attr_argument_not_integer) - << E->getSourceRange(); + const auto FieldTy = FD->getType(); + if (!FieldTy->isArrayType() && !FieldTy->isPointerType()) { + S.Diag(FD->getBeginLoc(), + diag::err_counted_by_attr_not_on_ptr_or_flexible_array_member) + << FD->getLocation(); return true; } LangOptions::StrictFlexArraysLevelKind StrictFlexArraysLevel = LangOptions::StrictFlexArraysLevelKind::IncompleteOnly; - - if (!Decl::isFlexibleArrayMemberLike(S.getASTContext(), FD, FD->getType(), + if (FieldTy->isArrayType() && + !Decl::isFlexibleArrayMemberLike(S.getASTContext(), FD, FieldTy, StrictFlexArraysLevel, true)) { - // The "counted_by" attribute must be on a flexible array member. - SourceRange SR = FD->getLocation(); - S.Diag(SR.getBegin(), - diag::err_counted_by_attr_not_on_flexible_array_member) - << SR; + S.Diag(FD->getBeginLoc(), + diag::err_counted_by_attr_on_array_not_flexible_array_member) + << FD->getLocation(); + return true; + } + + CountedByInvalidPointeeTypeKind InvalidTypeKind = + CountedByInvalidPointeeTypeKind::VALID; + QualType PointeeTy; + int SelectPtrOrArr = 0; + if (FieldTy->isPointerType()) { + PointeeTy = FieldTy->getPointeeType(); + SelectPtrOrArr = 0; + } else { + assert(FieldTy->isArrayType()); + const ArrayType *AT = S.getASTContext().getAsArrayType(FieldTy); + PointeeTy = AT->getElementType(); + SelectPtrOrArr = 1; + } + // Note: The `Decl::isFlexibleArrayMemberLike` check earlier on means + // only `PointeeTy->isStructureTypeWithFlexibleArrayMember()` is reachable + // when `FieldTy->isArrayType()`. + bool ShouldWarn = false; + if (PointeeTy->isIncompleteType()) { + InvalidTypeKind = CountedByInvalidPointeeTypeKind::INCOMPLETE; + } else if (PointeeTy->isSizelessType()) { + InvalidTypeKind = CountedByInvalidPointeeTypeKind::SIZELESS; + } else if (PointeeTy->isFunctionType()) { + InvalidTypeKind = CountedByInvalidPointeeTypeKind::FUNCTION; + } else if (PointeeTy->isStructureTypeWithFlexibleArrayMember()) { + if (FieldTy->isArrayType()) { + // This is a workaround for the Linux kernel that has already adopted + // `counted_by` on a FAM where the pointee is a struct with a FAM. This + // should be an error because computing the bounds of the array cannot be + // done correctly without manually traversing every struct object in the + // array at runtime. To allow the code to be built this error is + // downgraded to a warning. + ShouldWarn = true; + } + InvalidTypeKind = CountedByInvalidPointeeTypeKind::FLEXIBLE_ARRAY_MEMBER; + } + + if (InvalidTypeKind != CountedByInvalidPointeeTypeKind::VALID) { + unsigned DiagID = ShouldWarn + ? diag::warn_counted_by_attr_elt_type_unknown_size + : diag::err_counted_by_attr_pointee_unknown_size; + S.Diag(FD->getBeginLoc(), DiagID) + << SelectPtrOrArr << PointeeTy << (int)InvalidTypeKind + << (ShouldWarn ? 1 : 0) << FD->getSourceRange(); + return true; + } + + // Check the expression + + if (!E->getType()->isIntegerType() || E->getType()->isBooleanType()) { + S.Diag(E->getBeginLoc(), diag::err_counted_by_attr_argument_not_integer) + << E->getSourceRange(); return true; } @@ -11698,10 +11762,11 @@ static void handleCountedByAttrField(Sema &S, Decl *D, const ParsedAttr &AL) { return; llvm::SmallVector Decls; - if (CheckCountExpr(S, FD, CountExpr, Decls)) + if (CheckCountedByAttrOnField(S, FD, CountExpr, Decls)) return; - QualType CAT = S.BuildCountAttributedArrayType(FD->getType(), CountExpr); + QualType CAT = + S.BuildCountAttributedArrayOrPointerType(FD->getType(), CountExpr); FD->setType(CAT); } diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index 1cad6d93bbb8d..74b840178c000 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -5574,6 +5574,15 @@ struct EnsureImmediateInvocationInDefaultArgs // cause it to incorrectly point it to the outermost class // in the case of nested struct initialization. ExprResult TransformCXXThisExpr(CXXThisExpr *E) { return E; } + + // Rewrite to source location to refer to the context in which they are used. + ExprResult TransformSourceLocExpr(SourceLocExpr *E) { + if (E->getParentContext() == SemaRef.CurContext) + return E; + return getDerived().RebuildSourceLocExpr(E->getIdentKind(), E->getType(), + E->getBeginLoc(), E->getEndLoc(), + SemaRef.CurContext); + } }; ExprResult Sema::BuildCXXDefaultArgExpr(SourceLocation CallLoc, @@ -5667,6 +5676,7 @@ ExprResult Sema::BuildCXXDefaultInitExpr(SourceLocation Loc, FieldDecl *Field) { InitializationContext.emplace(Loc, Field, CurContext); Expr *Init = nullptr; + bool HasRewrittenInit = false; bool NestedDefaultChecking = isCheckingDefaultArgumentOrInitializer(); bool InLifetimeExtendingContext = isInLifetimeExtendingContext(); @@ -5716,6 +5726,7 @@ ExprResult Sema::BuildCXXDefaultInitExpr(SourceLocation Loc, FieldDecl *Field) { isa_and_present(Field->getInClassInitializer()); if (V.HasImmediateCalls || InLifetimeExtendingContext || ContainsAnyTemporaries) { + HasRewrittenInit = true; ExprEvalContexts.back().DelayedDefaultInitializationContext = {Loc, Field, CurContext}; ExprEvalContexts.back().IsCurrentlyCheckingDefaultArgumentOrInitializer = @@ -5759,7 +5770,7 @@ ExprResult Sema::BuildCXXDefaultInitExpr(SourceLocation Loc, FieldDecl *Field) { return CXXDefaultInitExpr::Create(Context, InitializationContext->Loc, Field, InitializationContext->Context, - Init); + HasRewrittenInit ? Init : nullptr); } // DR1351: @@ -17294,8 +17305,7 @@ ExprResult Sema::TransformToPotentiallyEvaluated(Expr *E) { TypeSourceInfo *Sema::TransformToPotentiallyEvaluated(TypeSourceInfo *TInfo) { assert(isUnevaluatedContext() && "Should only transform unevaluated expressions"); - ExprEvalContexts.back().Context = - ExprEvalContexts[ExprEvalContexts.size() - 2].Context; + ExprEvalContexts.back().Context = parentEvaluationContext().Context; if (isUnevaluatedContext()) return TInfo; return TransformToPE(*this).TransformType(TInfo); @@ -17312,14 +17322,13 @@ Sema::PushExpressionEvaluationContext( // discarded statements or immediate context are themselves // a discarded statement or an immediate context, respectively. ExprEvalContexts.back().InDiscardedStatement = - ExprEvalContexts[ExprEvalContexts.size() - 2] - .isDiscardedStatementContext(); + parentEvaluationContext().isDiscardedStatementContext(); // C++23 [expr.const]/p15 // An expression or conversion is in an immediate function context if [...] // it is a subexpression of a manifestly constant-evaluated expression or // conversion. - const auto &Prev = ExprEvalContexts[ExprEvalContexts.size() - 2]; + const auto &Prev = parentEvaluationContext(); ExprEvalContexts.back().InImmediateFunctionContext = Prev.isImmediateFunctionContext() || Prev.isConstantEvaluated(); @@ -17764,7 +17773,7 @@ void Sema::PopExpressionEvaluationContext() { // Append the collected materialized temporaries into previous context before // exit if the previous also is a lifetime extending context. - auto &PrevRecord = ExprEvalContexts[ExprEvalContexts.size() - 2]; + auto &PrevRecord = parentEvaluationContext(); if (getLangOpts().CPlusPlus23 && Rec.InLifetimeExtendingContext && PrevRecord.InLifetimeExtendingContext && !Rec.ForRangeLifetimeExtendTemps.empty()) { diff --git a/clang/lib/Sema/SemaExprCXX.cpp b/clang/lib/Sema/SemaExprCXX.cpp index ffcc28e57b40a..5fcba0c53e393 100644 --- a/clang/lib/Sema/SemaExprCXX.cpp +++ b/clang/lib/Sema/SemaExprCXX.cpp @@ -1449,10 +1449,10 @@ bool Sema::CheckCXXThisType(SourceLocation Loc, QualType Type) { // category are defined within such member functions as they are within // an implicit object member function). DeclContext *DC = getFunctionLevelDeclContext(); - if (const auto *Method = dyn_cast(DC); - Method && Method->isExplicitObjectMemberFunction()) { + const auto *Method = dyn_cast(DC); + if (Method && Method->isExplicitObjectMemberFunction()) { Diag(Loc, diag::err_invalid_this_use) << 1; - } else if (isLambdaCallWithExplicitObjectParameter(CurContext)) { + } else if (Method && isLambdaCallWithExplicitObjectParameter(CurContext)) { Diag(Loc, diag::err_invalid_this_use) << 1; } else { Diag(Loc, diag::err_invalid_this_use) << 0; diff --git a/clang/lib/Sema/SemaLookup.cpp b/clang/lib/Sema/SemaLookup.cpp index 7f6abd19f31b9..bf970937410c7 100644 --- a/clang/lib/Sema/SemaLookup.cpp +++ b/clang/lib/Sema/SemaLookup.cpp @@ -5948,6 +5948,16 @@ void Sema::diagnoseTypo(const TypoCorrection &Correction, NamedDecl *ChosenDecl = Correction.isKeyword() ? nullptr : Correction.getFoundDecl(); + + // For builtin functions which aren't declared anywhere in source, + // don't emit the "declared here" note. + if (const auto *FD = dyn_cast_if_present(ChosenDecl); + FD && FD->getBuiltinID() && + PrevNote.getDiagID() == diag::note_previous_decl && + Correction.getCorrectionRange().getBegin() == FD->getBeginLoc()) { + ChosenDecl = nullptr; + } + if (PrevNote.getDiagID() && ChosenDecl) Diag(ChosenDecl->getLocation(), PrevNote) << CorrectedQuotedStr << (ErrorRecovery ? FixItHint() : FixTypo); diff --git a/clang/lib/Sema/SemaOverload.cpp b/clang/lib/Sema/SemaOverload.cpp index 6ed95a2e6f26d..81d9db404c897 100644 --- a/clang/lib/Sema/SemaOverload.cpp +++ b/clang/lib/Sema/SemaOverload.cpp @@ -13,6 +13,7 @@ #include "clang/AST/ASTContext.h" #include "clang/AST/ASTLambda.h" #include "clang/AST/CXXInheritance.h" +#include "clang/AST/Decl.h" #include "clang/AST/DeclCXX.h" #include "clang/AST/DeclObjC.h" #include "clang/AST/DependenceFlags.h" @@ -1482,7 +1483,7 @@ static bool IsOverloadOrOverrideImpl(Sema &SemaRef, FunctionDecl *New, } if (OldMethod && NewMethod && !OldMethod->isStatic() && - !OldMethod->isStatic()) { + !NewMethod->isStatic()) { bool HaveCorrespondingObjectParameters = [&](const CXXMethodDecl *Old, const CXXMethodDecl *New) { auto NewObjectType = New->getFunctionObjectParameterReferenceType(); @@ -11328,8 +11329,16 @@ static void DiagnoseBadConversion(Sema &S, OverloadCandidate *Cand, Expr *FromExpr = Conv.Bad.FromExpr; QualType FromTy = Conv.Bad.getFromType(); QualType ToTy = Conv.Bad.getToType(); - SourceRange ToParamRange = - !isObjectArgument ? Fn->getParamDecl(I)->getSourceRange() : SourceRange(); + SourceRange ToParamRange; + + // FIXME: In presence of parameter packs we can't determine parameter range + // reliably, as we don't have access to instantiation. + bool HasParamPack = + llvm::any_of(Fn->parameters().take_front(I), [](const ParmVarDecl *Parm) { + return Parm->isParameterPack(); + }); + if (!isObjectArgument && !HasParamPack) + ToParamRange = Fn->getParamDecl(I)->getSourceRange(); if (FromTy == S.Context.OverloadTy) { assert(FromExpr && "overload set argument came from implicit argument?"); @@ -14381,7 +14390,7 @@ Sema::CreateOverloadedUnaryOp(SourceLocation OpLoc, UnaryOperatorKind Opc, if (Fn.isInvalid()) return ExprError(); return CXXOperatorCallExpr::Create(Context, Op, Fn.get(), ArgsArray, - Context.DependentTy, VK, OpLoc, + Context.DependentTy, VK_PRValue, OpLoc, CurFPFeatureOverrides()); } diff --git a/clang/lib/Sema/SemaStmtAttr.cpp b/clang/lib/Sema/SemaStmtAttr.cpp index 46511e49f2265..a7a7347cfcbab 100644 --- a/clang/lib/Sema/SemaStmtAttr.cpp +++ b/clang/lib/Sema/SemaStmtAttr.cpp @@ -700,7 +700,7 @@ bool Sema::CheckAlwaysInlineAttr(const Stmt *OrigSt, const Stmt *CurSt, static Attr *handleNoInlineAttr(Sema &S, Stmt *St, const ParsedAttr &A, SourceRange Range) { NoInlineAttr NIA(S.Context, A); - if (!NIA.isClangNoInline()) { + if (!NIA.isStmtNoInline()) { S.Diag(St->getBeginLoc(), diag::warn_function_attribute_ignored_in_stmt) << "[[clang::noinline]]"; return nullptr; @@ -1263,10 +1263,8 @@ ExprResult Sema::ActOnCXXAssumeAttr(Stmt *St, const ParsedAttr &A, } if (!getLangOpts().CPlusPlus23 && - A.getSyntax() == AttributeCommonInfo::AS_CXX11) { - llvm::dbgs() << "Syntax: " << int(A.getSyntax()) << "\n"; + A.getSyntax() == AttributeCommonInfo::AS_CXX11) Diag(A.getLoc(), diag::ext_cxx23_attr) << A << Range; - } return Assumption; } diff --git a/clang/lib/Sema/SemaTemplate.cpp b/clang/lib/Sema/SemaTemplate.cpp index 268f079980a6c..39e9dbed0c3e0 100644 --- a/clang/lib/Sema/SemaTemplate.cpp +++ b/clang/lib/Sema/SemaTemplate.cpp @@ -1807,8 +1807,6 @@ static void SetNestedNameSpecifier(Sema &S, TagDecl *T, // Returns the template parameter list with all default template argument // information. static TemplateParameterList *GetTemplateParameterList(TemplateDecl *TD) { - if (TD->isImplicit()) - return TD->getTemplateParameters(); // Make sure we get the template parameter list from the most // recent declaration, since that is the only one that is guaranteed to // have all the default template argument information. @@ -1829,8 +1827,7 @@ static TemplateParameterList *GetTemplateParameterList(TemplateDecl *TD) { // template friend struct C; // }; // template struct S; - while ((D->isImplicit() || - D->getFriendObjectKind() != Decl::FriendObjectKind::FOK_None) && + while (D->getFriendObjectKind() != Decl::FriendObjectKind::FOK_None && D->getPreviousDecl()) D = D->getPreviousDecl(); return cast(D)->getTemplateParameters(); diff --git a/clang/lib/Sema/SemaTemplateDeduction.cpp b/clang/lib/Sema/SemaTemplateDeduction.cpp index 76f47e9cb2560..f9ec34163e656 100644 --- a/clang/lib/Sema/SemaTemplateDeduction.cpp +++ b/clang/lib/Sema/SemaTemplateDeduction.cpp @@ -527,8 +527,8 @@ static NamedDecl *getTemplateParameterWithDefault(Sema &S, NamedDecl *A, R->setDefaultArgument( S.Context, S.getTrivialTemplateArgumentLoc(Default, QualType(), SourceLocation())); - if (T->hasTypeConstraint()) { - auto *C = T->getTypeConstraint(); + if (R->hasTypeConstraint()) { + auto *C = R->getTypeConstraint(); R->setTypeConstraint(C->getConceptReference(), C->getImmediatelyDeclaredConstraint()); } @@ -583,53 +583,37 @@ DeduceTemplateArguments(Sema &S, TemplateParameterList *TemplateParams, return TemplateDeductionResult::Success; auto NewDeduced = DeducedTemplateArgument(Arg); - // Provisional resolution for CWG2398: If Arg names a template - // specialization, then we deduce a synthesized template template parameter - // based on A, but using the TS's arguments as defaults. - if (DefaultArguments.size() != 0) { + // Provisional resolution for CWG2398: If Arg is also a template template + // param, and it names a template specialization, then we deduce a + // synthesized template template parameter based on A, but using the TS's + // arguments as defaults. + if (auto *TempArg = dyn_cast_or_null( + Arg.getAsTemplateDecl())) { assert(Arg.getKind() == TemplateName::Template); - TemplateDecl *TempArg = Arg.getAsTemplateDecl(); + assert(!TempArg->isExpandedParameterPack()); + TemplateParameterList *As = TempArg->getTemplateParameters(); - assert(DefaultArguments.size() <= As->size()); - - SmallVector Params(As->size()); - for (unsigned I = 0; I < DefaultArguments.size(); ++I) - Params[I] = getTemplateParameterWithDefault(S, As->getParam(I), - DefaultArguments[I]); - for (unsigned I = DefaultArguments.size(); I < As->size(); ++I) - Params[I] = As->getParam(I); - // FIXME: We could unique these, and also the parameters, but we don't - // expect programs to contain a large enough amount of these deductions - // for that to be worthwhile. - auto *TPL = TemplateParameterList::Create( - S.Context, SourceLocation(), SourceLocation(), Params, - SourceLocation(), As->getRequiresClause()); - - TemplateDecl *TD; - switch (TempArg->getKind()) { - case Decl::TemplateTemplateParm: { - auto *A = cast(TempArg); - assert(!A->isExpandedParameterPack()); - TD = TemplateTemplateParmDecl::Create( - S.Context, A->getDeclContext(), SourceLocation(), A->getDepth(), - A->getPosition(), A->isParameterPack(), A->getIdentifier(), - A->wasDeclaredWithTypename(), TPL); - break; - } - case Decl::ClassTemplate: { - auto *A = cast(TempArg); - auto *CT = ClassTemplateDecl::Create(S.Context, A->getDeclContext(), - SourceLocation(), A->getDeclName(), - TPL, A->getTemplatedDecl()); - CT->setPreviousDecl(A); - TD = CT; - break; - } - default: - llvm_unreachable("Unexpected Template Kind"); + if (DefaultArguments.size() != 0) { + assert(DefaultArguments.size() <= As->size()); + SmallVector Params(As->size()); + for (unsigned I = 0; I < DefaultArguments.size(); ++I) + Params[I] = getTemplateParameterWithDefault(S, As->getParam(I), + DefaultArguments[I]); + for (unsigned I = DefaultArguments.size(); I < As->size(); ++I) + Params[I] = As->getParam(I); + // FIXME: We could unique these, and also the parameters, but we don't + // expect programs to contain a large enough amount of these deductions + // for that to be worthwhile. + auto *TPL = TemplateParameterList::Create( + S.Context, SourceLocation(), SourceLocation(), Params, + SourceLocation(), As->getRequiresClause()); + NewDeduced = DeducedTemplateArgument( + TemplateName(TemplateTemplateParmDecl::Create( + S.Context, TempArg->getDeclContext(), SourceLocation(), + TempArg->getDepth(), TempArg->getPosition(), + TempArg->isParameterPack(), TempArg->getIdentifier(), + TempArg->wasDeclaredWithTypename(), TPL))); } - TD->setImplicit(true); - NewDeduced = DeducedTemplateArgument(TemplateName(TD)); } DeducedTemplateArgument Result = checkDeducedTemplateArguments(S.Context, @@ -4788,8 +4772,13 @@ TemplateDeductionResult Sema::DeduceTemplateArguments( DeduceReturnType(Specialization, Info.getLocation(), false)) return TemplateDeductionResult::MiscellaneousDeductionFailure; + // [C++26][expr.const]/p17 + // An expression or conversion is immediate-escalating if it is not initially + // in an immediate function context and it is [...] + // a potentially-evaluated id-expression that denotes an immediate function. if (IsAddressOfFunction && getLangOpts().CPlusPlus20 && Specialization->isImmediateEscalating() && + parentEvaluationContext().isPotentiallyEvaluated() && CheckIfFunctionSpecializationIsImmediate(Specialization, Info.getLocation())) return TemplateDeductionResult::MiscellaneousDeductionFailure; diff --git a/clang/lib/Sema/SemaTemplateVariadic.cpp b/clang/lib/Sema/SemaTemplateVariadic.cpp index 0b20604665068..7a44b978aacdb 100644 --- a/clang/lib/Sema/SemaTemplateVariadic.cpp +++ b/clang/lib/Sema/SemaTemplateVariadic.cpp @@ -66,6 +66,9 @@ namespace { bool shouldWalkTypesOfTypeLocs() const { return false; } + // We need this so we can find e.g. attributes on lambdas. + bool shouldVisitImplicitCode() const { return true; } + //------------------------------------------------------------------------ // Recording occurrences of (unexpanded) parameter packs. //------------------------------------------------------------------------ diff --git a/clang/lib/Sema/SemaType.cpp b/clang/lib/Sema/SemaType.cpp index e39022eb7250b..3af6d56a2467b 100644 --- a/clang/lib/Sema/SemaType.cpp +++ b/clang/lib/Sema/SemaType.cpp @@ -9437,9 +9437,9 @@ BuildTypeCoupledDecls(Expr *E, Decls.push_back(TypeCoupledDeclRefInfo(CountDecl, /*IsDref*/ false)); } -QualType Sema::BuildCountAttributedArrayType(QualType WrappedTy, - Expr *CountExpr) { - assert(WrappedTy->isIncompleteArrayType()); +QualType Sema::BuildCountAttributedArrayOrPointerType(QualType WrappedTy, + Expr *CountExpr) { + assert(WrappedTy->isIncompleteArrayType() || WrappedTy->isPointerType()); llvm::SmallVector Decls; BuildTypeCoupledDecls(CountExpr, Decls); diff --git a/clang/lib/Sema/SemaX86.cpp b/clang/lib/Sema/SemaX86.cpp index da735a8e73183..ffac1afc5d782 100644 --- a/clang/lib/Sema/SemaX86.cpp +++ b/clang/lib/Sema/SemaX86.cpp @@ -70,15 +70,9 @@ bool SemaX86::CheckBuiltinRoundingOrSAE(unsigned BuiltinID, CallExpr *TheCall) { case X86::BI__builtin_ia32_vcvttph2udq512_mask: case X86::BI__builtin_ia32_vcvttph2qq512_mask: case X86::BI__builtin_ia32_vcvttph2uqq512_mask: - case X86::BI__builtin_ia32_exp2pd_mask: - case X86::BI__builtin_ia32_exp2ps_mask: case X86::BI__builtin_ia32_getexppd512_mask: case X86::BI__builtin_ia32_getexpps512_mask: case X86::BI__builtin_ia32_getexpph512_mask: - case X86::BI__builtin_ia32_rcp28pd_mask: - case X86::BI__builtin_ia32_rcp28ps_mask: - case X86::BI__builtin_ia32_rsqrt28pd_mask: - case X86::BI__builtin_ia32_rsqrt28ps_mask: case X86::BI__builtin_ia32_vcomisd: case X86::BI__builtin_ia32_vcomiss: case X86::BI__builtin_ia32_vcomish: @@ -105,16 +99,12 @@ bool SemaX86::CheckBuiltinRoundingOrSAE(unsigned BuiltinID, CallExpr *TheCall) { case X86::BI__builtin_ia32_minsd_round_mask: case X86::BI__builtin_ia32_minss_round_mask: case X86::BI__builtin_ia32_minsh_round_mask: - case X86::BI__builtin_ia32_rcp28sd_round_mask: - case X86::BI__builtin_ia32_rcp28ss_round_mask: case X86::BI__builtin_ia32_reducepd512_mask: case X86::BI__builtin_ia32_reduceps512_mask: case X86::BI__builtin_ia32_reduceph512_mask: case X86::BI__builtin_ia32_rndscalepd_mask: case X86::BI__builtin_ia32_rndscaleps_mask: case X86::BI__builtin_ia32_rndscaleph_mask: - case X86::BI__builtin_ia32_rsqrt28sd_round_mask: - case X86::BI__builtin_ia32_rsqrt28ss_round_mask: ArgNum = 4; break; case X86::BI__builtin_ia32_fixupimmpd512_mask: @@ -324,16 +314,6 @@ bool SemaX86::CheckBuiltinGatherScatterScale(unsigned BuiltinID, switch (BuiltinID) { default: return false; - case X86::BI__builtin_ia32_gatherpfdpd: - case X86::BI__builtin_ia32_gatherpfdps: - case X86::BI__builtin_ia32_gatherpfqpd: - case X86::BI__builtin_ia32_gatherpfqps: - case X86::BI__builtin_ia32_scatterpfdpd: - case X86::BI__builtin_ia32_scatterpfdps: - case X86::BI__builtin_ia32_scatterpfqpd: - case X86::BI__builtin_ia32_scatterpfqps: - ArgNum = 3; - break; case X86::BI__builtin_ia32_gatherd_pd: case X86::BI__builtin_ia32_gatherd_pd256: case X86::BI__builtin_ia32_gatherq_pd: @@ -869,18 +849,6 @@ bool SemaX86::CheckBuiltinFunctionCall(const TargetInfo &TI, unsigned BuiltinID, l = 0; u = 255; break; - case X86::BI__builtin_ia32_gatherpfdpd: - case X86::BI__builtin_ia32_gatherpfdps: - case X86::BI__builtin_ia32_gatherpfqpd: - case X86::BI__builtin_ia32_gatherpfqps: - case X86::BI__builtin_ia32_scatterpfdpd: - case X86::BI__builtin_ia32_scatterpfdps: - case X86::BI__builtin_ia32_scatterpfqpd: - case X86::BI__builtin_ia32_scatterpfqps: - i = 4; - l = 2; - u = 3; - break; case X86::BI__builtin_ia32_reducesd_mask: case X86::BI__builtin_ia32_reducess_mask: case X86::BI__builtin_ia32_rndscalesd_round_mask: diff --git a/clang/lib/Sema/TreeTransform.h b/clang/lib/Sema/TreeTransform.h index 380396cfc71e8..87db73441045b 100644 --- a/clang/lib/Sema/TreeTransform.h +++ b/clang/lib/Sema/TreeTransform.h @@ -7365,7 +7365,7 @@ QualType TreeTransform::TransformCountAttributedType( if (getDerived().AlwaysRebuild() || InnerTy != OldTy->desugar() || OldCount != NewCount) { // Currently, CountAttributedType can only wrap incomplete array types. - Result = SemaRef.BuildCountAttributedArrayType(InnerTy, NewCount); + Result = SemaRef.BuildCountAttributedArrayOrPointerType(InnerTy, NewCount); } TLB.push(Result); diff --git a/clang/lib/Serialization/ASTReader.cpp b/clang/lib/Serialization/ASTReader.cpp index 27c18cf80d1d4..27964609ed363 100644 --- a/clang/lib/Serialization/ASTReader.cpp +++ b/clang/lib/Serialization/ASTReader.cpp @@ -1264,7 +1264,7 @@ bool ASTReader::ReadLexicalDeclContextStorage(ModuleFile &M, if (!Lex.first) { Lex = std::make_pair( &M, llvm::ArrayRef( - reinterpret_cast(Blob.data()), + reinterpret_cast(Blob.data()), Blob.size() / sizeof(DeclID))); } DC->setHasExternalLexicalStorage(true); @@ -3401,7 +3401,7 @@ llvm::Error ASTReader::ReadASTBlock(ModuleFile &F, case TU_UPDATE_LEXICAL: { DeclContext *TU = ContextObj->getTranslationUnitDecl(); LexicalContents Contents( - reinterpret_cast(Blob.data()), + reinterpret_cast(Blob.data()), static_cast(Blob.size() / sizeof(DeclID))); TULexicalDecls.push_back(std::make_pair(&F, Contents)); TU->setHasExternalLexicalStorage(true); @@ -4059,7 +4059,7 @@ void ASTReader::ReadModuleOffsetMap(ModuleFile &F) const { RemapBuilder DeclRemap(F.DeclRemap); RemapBuilder TypeRemap(F.TypeRemap); - auto &ImportedModuleVector = F.DependentModules; + auto &ImportedModuleVector = F.TransitiveImports; assert(ImportedModuleVector.empty()); while (Data < DataEnd) { diff --git a/clang/lib/Serialization/ASTWriter.cpp b/clang/lib/Serialization/ASTWriter.cpp index 00b0e48083217..dd548fabfd955 100644 --- a/clang/lib/Serialization/ASTWriter.cpp +++ b/clang/lib/Serialization/ASTWriter.cpp @@ -1049,6 +1049,7 @@ void ASTWriter::WriteBlockInfoBlock() { RECORD(DECL_UNRESOLVED_USING_VALUE); RECORD(DECL_UNRESOLVED_USING_TYPENAME); RECORD(DECL_LINKAGE_SPEC); + RECORD(DECL_EXPORT); RECORD(DECL_CXX_RECORD); RECORD(DECL_CXX_METHOD); RECORD(DECL_CXX_CONSTRUCTOR); @@ -5037,6 +5038,14 @@ void ASTWriter::PrepareWritingSpecialDecls(Sema &SemaRef) { continue; } + // If we're writing C++ named modules, don't emit declarations which are + // not from modules by default. They may be built in declarations (be + // handled above) or implcit declarations (see the implementation of + // `Sema::Initialize()` for example). + if (isWritingStdCXXNamedModules() && !D->getOwningModule() && + D->isImplicit()) + continue; + GetDeclRef(D); } @@ -6197,8 +6206,9 @@ bool ASTWriter::wasDeclEmitted(const Decl *D) const { return true; bool Emitted = DeclIDs.contains(D); - assert((Emitted || GeneratingReducedBMI) && - "The declaration can only be omitted in reduced BMI."); + assert((Emitted || (!D->getOwningModule() && isWritingStdCXXNamedModules()) || + GeneratingReducedBMI) && + "The declaration within modules can only be omitted in reduced BMI."); return Emitted; } diff --git a/clang/lib/StaticAnalyzer/Checkers/CMakeLists.txt b/clang/lib/StaticAnalyzer/Checkers/CMakeLists.txt index 45d3788f105dc..cd5a3bdd02e4a 100644 --- a/clang/lib/StaticAnalyzer/Checkers/CMakeLists.txt +++ b/clang/lib/StaticAnalyzer/Checkers/CMakeLists.txt @@ -96,7 +96,7 @@ add_clang_library(clangStaticAnalyzerCheckers PointerSortingChecker.cpp PointerSubChecker.cpp PthreadLockChecker.cpp - cert/PutenvWithAutoChecker.cpp + PutenvStackArrayChecker.cpp RetainCountChecker/RetainCountChecker.cpp RetainCountChecker/RetainCountDiagnostics.cpp ReturnPointerRangeChecker.cpp diff --git a/clang/lib/StaticAnalyzer/Checkers/cert/PutenvWithAutoChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/PutenvStackArrayChecker.cpp similarity index 62% rename from clang/lib/StaticAnalyzer/Checkers/cert/PutenvWithAutoChecker.cpp rename to clang/lib/StaticAnalyzer/Checkers/PutenvStackArrayChecker.cpp index a82f7caf16b29..bf81d57bf82fd 100644 --- a/clang/lib/StaticAnalyzer/Checkers/cert/PutenvWithAutoChecker.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/PutenvStackArrayChecker.cpp @@ -1,4 +1,4 @@ -//== PutenvWithAutoChecker.cpp --------------------------------- -*- C++ -*--=// +//== PutenvStackArrayChecker.cpp ------------------------------- -*- C++ -*--=// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -6,13 +6,13 @@ // //===----------------------------------------------------------------------===// // -// This file defines PutenvWithAutoChecker which finds calls of ``putenv`` -// function with automatic variable as the argument. +// This file defines PutenvStackArrayChecker which finds calls of ``putenv`` +// function with automatic array variable as the argument. // https://wiki.sei.cmu.edu/confluence/x/6NYxBQ // //===----------------------------------------------------------------------===// -#include "../AllocationState.h" +#include "AllocationState.h" #include "clang/StaticAnalyzer/Checkers/BuiltinCheckerRegistration.h" #include "clang/StaticAnalyzer/Core/BugReporter/BugType.h" #include "clang/StaticAnalyzer/Core/Checker.h" @@ -26,9 +26,9 @@ using namespace clang; using namespace ento; namespace { -class PutenvWithAutoChecker : public Checker { +class PutenvStackArrayChecker : public Checker { private: - BugType BT{this, "'putenv' function should not be called with auto variables", + BugType BT{this, "'putenv' called with stack-allocated string", categories::SecurityError}; const CallDescription Putenv{CDM::CLibrary, {"putenv"}, 1}; @@ -37,20 +37,25 @@ class PutenvWithAutoChecker : public Checker { }; } // namespace -void PutenvWithAutoChecker::checkPostCall(const CallEvent &Call, - CheckerContext &C) const { +void PutenvStackArrayChecker::checkPostCall(const CallEvent &Call, + CheckerContext &C) const { if (!Putenv.matches(Call)) return; SVal ArgV = Call.getArgSVal(0); const Expr *ArgExpr = Call.getArgExpr(0); - const MemSpaceRegion *MSR = ArgV.getAsRegion()->getMemorySpace(); - if (!isa(MSR)) + const auto *SSR = + dyn_cast(ArgV.getAsRegion()->getMemorySpace()); + if (!SSR) + return; + const auto *StackFrameFuncD = + dyn_cast_or_null(SSR->getStackFrame()->getDecl()); + if (StackFrameFuncD && StackFrameFuncD->isMain()) return; StringRef ErrorMsg = "The 'putenv' function should not be called with " - "arguments that have automatic storage"; + "arrays that have automatic storage"; ExplodedNode *N = C.generateErrorNode(); auto Report = std::make_unique(BT, ErrorMsg, N); @@ -60,8 +65,10 @@ void PutenvWithAutoChecker::checkPostCall(const CallEvent &Call, C.emitReport(std::move(Report)); } -void ento::registerPutenvWithAuto(CheckerManager &Mgr) { - Mgr.registerChecker(); +void ento::registerPutenvStackArray(CheckerManager &Mgr) { + Mgr.registerChecker(); } -bool ento::shouldRegisterPutenvWithAuto(const CheckerManager &) { return true; } +bool ento::shouldRegisterPutenvStackArray(const CheckerManager &) { + return true; +} diff --git a/clang/lib/StaticAnalyzer/Checkers/WebKit/PtrTypesSemantics.cpp b/clang/lib/StaticAnalyzer/Checkers/WebKit/PtrTypesSemantics.cpp index 5c797d5233089..49bbff1942167 100644 --- a/clang/lib/StaticAnalyzer/Checkers/WebKit/PtrTypesSemantics.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/WebKit/PtrTypesSemantics.cpp @@ -271,6 +271,43 @@ class TrivialFunctionAnalysisVisitor TrivialFunctionAnalysisVisitor(CacheTy &Cache) : Cache(Cache) {} + bool IsFunctionTrivial(const Decl *D) { + auto CacheIt = Cache.find(D); + if (CacheIt != Cache.end()) + return CacheIt->second; + + // Treat a recursive function call to be trivial until proven otherwise. + auto [RecursiveIt, IsNew] = RecursiveFn.insert(std::make_pair(D, true)); + if (!IsNew) + return RecursiveIt->second; + + bool Result = [&]() { + if (auto *CtorDecl = dyn_cast(D)) { + for (auto *CtorInit : CtorDecl->inits()) { + if (!Visit(CtorInit->getInit())) + return false; + } + } + const Stmt *Body = D->getBody(); + if (!Body) + return false; + return Visit(Body); + }(); + + if (!Result) { + // D and its mutually recursive callers are all non-trivial. + for (auto &It : RecursiveFn) + It.second = false; + } + RecursiveIt = RecursiveFn.find(D); + assert(RecursiveIt != RecursiveFn.end()); + Result = RecursiveIt->second; + RecursiveFn.erase(RecursiveIt); + Cache[D] = Result; + + return Result; + } + bool VisitStmt(const Stmt *S) { // All statements are non-trivial unless overriden later. // Don't even recurse into children by default. @@ -368,7 +405,7 @@ class TrivialFunctionAnalysisVisitor Name == "bitwise_cast" || Name.find("__builtin") == 0) return true; - return TrivialFunctionAnalysis::isTrivialImpl(Callee, Cache); + return IsFunctionTrivial(Callee); } bool @@ -403,7 +440,7 @@ class TrivialFunctionAnalysisVisitor return true; // Recursively descend into the callee to confirm that it's trivial as well. - return TrivialFunctionAnalysis::isTrivialImpl(Callee, Cache); + return IsFunctionTrivial(Callee); } bool VisitCXXOperatorCallExpr(const CXXOperatorCallExpr *OCE) { @@ -413,7 +450,7 @@ class TrivialFunctionAnalysisVisitor if (!Callee) return false; // Recursively descend into the callee to confirm that it's trivial as well. - return TrivialFunctionAnalysis::isTrivialImpl(Callee, Cache); + return IsFunctionTrivial(Callee); } bool VisitCXXDefaultArgExpr(const CXXDefaultArgExpr *E) { @@ -439,7 +476,7 @@ class TrivialFunctionAnalysisVisitor } // Recursively descend into the callee to confirm that it's trivial. - return TrivialFunctionAnalysis::isTrivialImpl(CE->getConstructor(), Cache); + return IsFunctionTrivial(CE->getConstructor()); } bool VisitCXXNewExpr(const CXXNewExpr *NE) { return VisitChildren(NE); } @@ -513,36 +550,13 @@ class TrivialFunctionAnalysisVisitor private: CacheTy &Cache; + CacheTy RecursiveFn; }; bool TrivialFunctionAnalysis::isTrivialImpl( const Decl *D, TrivialFunctionAnalysis::CacheTy &Cache) { - // If the function isn't in the cache, conservatively assume that - // it's not trivial until analysis completes. This makes every recursive - // function non-trivial. This also guarantees that each function - // will be scanned at most once. - auto [It, IsNew] = Cache.insert(std::make_pair(D, false)); - if (!IsNew) - return It->second; - TrivialFunctionAnalysisVisitor V(Cache); - - if (auto *CtorDecl = dyn_cast(D)) { - for (auto *CtorInit : CtorDecl->inits()) { - if (!V.Visit(CtorInit->getInit())) - return false; - } - } - - const Stmt *Body = D->getBody(); - if (!Body) - return false; - - bool Result = V.Visit(Body); - if (Result) - Cache[D] = true; - - return Result; + return V.IsFunctionTrivial(D); } bool TrivialFunctionAnalysis::isTrivialImpl( diff --git a/clang/lib/StaticAnalyzer/Checkers/WebKit/RefCntblBaseVirtualDtorChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/WebKit/RefCntblBaseVirtualDtorChecker.cpp index 7f4c3a7b787e8..9df108e28ecdb 100644 --- a/clang/lib/StaticAnalyzer/Checkers/WebKit/RefCntblBaseVirtualDtorChecker.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/WebKit/RefCntblBaseVirtualDtorChecker.cpp @@ -11,16 +11,116 @@ #include "PtrTypesSemantics.h" #include "clang/AST/CXXInheritance.h" #include "clang/AST/RecursiveASTVisitor.h" +#include "clang/AST/StmtVisitor.h" #include "clang/StaticAnalyzer/Checkers/BuiltinCheckerRegistration.h" #include "clang/StaticAnalyzer/Core/BugReporter/BugReporter.h" #include "clang/StaticAnalyzer/Core/BugReporter/BugType.h" #include "clang/StaticAnalyzer/Core/Checker.h" +#include "llvm/ADT/DenseSet.h" +#include "llvm/ADT/SetVector.h" #include using namespace clang; using namespace ento; namespace { + +class DerefFuncDeleteExprVisitor + : public ConstStmtVisitor { + // Returns true if any of child statements return true. + bool VisitChildren(const Stmt *S) { + for (const Stmt *Child : S->children()) { + if (Child && Visit(Child)) + return true; + } + return false; + } + + bool VisitBody(const Stmt *Body) { + if (!Body) + return false; + + auto [It, IsNew] = VisitedBody.insert(Body); + if (!IsNew) // This body is recursive + return false; + + return Visit(Body); + } + +public: + DerefFuncDeleteExprVisitor(const TemplateArgumentList &ArgList, + const CXXRecordDecl *ClassDecl) + : ArgList(&ArgList), ClassDecl(ClassDecl) {} + + DerefFuncDeleteExprVisitor(const CXXRecordDecl *ClassDecl) + : ClassDecl(ClassDecl) {} + + std::optional HasSpecializedDelete(CXXMethodDecl *Decl) { + if (auto *Body = Decl->getBody()) + return VisitBody(Body); + if (Decl->getTemplateInstantiationPattern()) + return std::nullopt; // Indeterminate. There was no concrete instance. + return false; + } + + bool VisitCallExpr(const CallExpr *CE) { + const Decl *D = CE->getCalleeDecl(); + if (D && D->hasBody()) + return VisitBody(D->getBody()); + return false; + } + + bool VisitCXXDeleteExpr(const CXXDeleteExpr *E) { + auto *Arg = E->getArgument(); + while (Arg) { + if (auto *Paren = dyn_cast(Arg)) + Arg = Paren->getSubExpr(); + else if (auto *Cast = dyn_cast(Arg)) { + Arg = Cast->getSubExpr(); + auto CastType = Cast->getType(); + if (auto *PtrType = dyn_cast(CastType)) { + auto PointeeType = PtrType->getPointeeType(); + while (auto *ET = dyn_cast(PointeeType)) { + if (ET->isSugared()) + PointeeType = ET->desugar(); + } + if (auto *ParmType = dyn_cast(PointeeType)) { + if (ArgList) { + auto ParmIndex = ParmType->getIndex(); + auto Type = ArgList->get(ParmIndex).getAsType(); + if (Type->getAsCXXRecordDecl() == ClassDecl) + return true; + } + } else if (auto *RD = dyn_cast(PointeeType)) { + if (RD->getDecl() == ClassDecl) + return true; + } else if (auto *ST = + dyn_cast(PointeeType)) { + auto Type = ST->getReplacementType(); + if (auto *RD = dyn_cast(Type)) { + if (RD->getDecl() == ClassDecl) + return true; + } + } + } + } else + break; + } + return false; + } + + bool VisitStmt(const Stmt *S) { return VisitChildren(S); } + + // Return false since the contents of lambda isn't necessarily executed. + // If it is executed, VisitCallExpr above will visit its body. + bool VisitLambdaExpr(const LambdaExpr *) { return false; } + +private: + const TemplateArgumentList *ArgList{nullptr}; + const CXXRecordDecl *ClassDecl; + llvm::DenseSet VisitedBody; +}; + class RefCntblBaseVirtualDtorChecker : public Checker> { private: @@ -51,63 +151,93 @@ class RefCntblBaseVirtualDtorChecker bool shouldVisitImplicitCode() const { return false; } bool VisitCXXRecordDecl(const CXXRecordDecl *RD) { - Checker->visitCXXRecordDecl(RD); + if (!RD->hasDefinition()) + return true; + + Decls.insert(RD); + + for (auto &Base : RD->bases()) { + const auto AccSpec = Base.getAccessSpecifier(); + if (AccSpec == AS_protected || AccSpec == AS_private || + (AccSpec == AS_none && RD->isClass())) + continue; + + QualType T = Base.getType(); + if (T.isNull()) + continue; + + const CXXRecordDecl *C = T->getAsCXXRecordDecl(); + if (!C) + continue; + + if (auto *CTSD = dyn_cast(C)) { + for (auto &Arg : CTSD->getTemplateArgs().asArray()) { + if (Arg.getKind() != TemplateArgument::Type) + continue; + auto TemplT = Arg.getAsType(); + if (TemplT.isNull()) + continue; + + bool IsCRTP = TemplT->getAsCXXRecordDecl() == RD; + if (!IsCRTP) + continue; + CRTPs.insert(C); + } + } + } + return true; } + + llvm::SetVector Decls; + llvm::DenseSet CRTPs; }; LocalVisitor visitor(this); visitor.TraverseDecl(const_cast(TUD)); + for (auto *RD : visitor.Decls) { + if (visitor.CRTPs.contains(RD)) + continue; + visitCXXRecordDecl(RD); + } } void visitCXXRecordDecl(const CXXRecordDecl *RD) const { if (shouldSkipDecl(RD)) return; - CXXBasePaths Paths; - Paths.setOrigin(RD); + for (auto &Base : RD->bases()) { + const auto AccSpec = Base.getAccessSpecifier(); + if (AccSpec == AS_protected || AccSpec == AS_private || + (AccSpec == AS_none && RD->isClass())) + continue; - const CXXBaseSpecifier *ProblematicBaseSpecifier = nullptr; - const CXXRecordDecl *ProblematicBaseClass = nullptr; + auto hasRefInBase = clang::hasPublicMethodInBase(&Base, "ref"); + auto hasDerefInBase = clang::hasPublicMethodInBase(&Base, "deref"); - const auto IsPublicBaseRefCntblWOVirtualDtor = - [RD, &ProblematicBaseSpecifier, - &ProblematicBaseClass](const CXXBaseSpecifier *Base, CXXBasePath &) { - const auto AccSpec = Base->getAccessSpecifier(); - if (AccSpec == AS_protected || AccSpec == AS_private || - (AccSpec == AS_none && RD->isClass())) - return false; + bool hasRef = hasRefInBase && *hasRefInBase != nullptr; + bool hasDeref = hasDerefInBase && *hasDerefInBase != nullptr; - auto hasRefInBase = clang::hasPublicMethodInBase(Base, "ref"); - auto hasDerefInBase = clang::hasPublicMethodInBase(Base, "deref"); + QualType T = Base.getType(); + if (T.isNull()) + continue; - bool hasRef = hasRefInBase && *hasRefInBase != nullptr; - bool hasDeref = hasDerefInBase && *hasDerefInBase != nullptr; + const CXXRecordDecl *C = T->getAsCXXRecordDecl(); + if (!C) + continue; - QualType T = Base->getType(); - if (T.isNull()) - return false; - - const CXXRecordDecl *C = T->getAsCXXRecordDecl(); - if (!C) - return false; - if (isRefCountedClass(C)) - return false; - - bool AnyInconclusiveBase = false; - const auto hasPublicRefInBase = - [&AnyInconclusiveBase](const CXXBaseSpecifier *Base, - CXXBasePath &) { - auto hasRefInBase = clang::hasPublicMethodInBase(Base, "ref"); - if (!hasRefInBase) { - AnyInconclusiveBase = true; - return false; - } - return (*hasRefInBase) != nullptr; - }; - const auto hasPublicDerefInBase = [&AnyInconclusiveBase]( - const CXXBaseSpecifier *Base, - CXXBasePath &) { + bool AnyInconclusiveBase = false; + const auto hasPublicRefInBase = + [&AnyInconclusiveBase](const CXXBaseSpecifier *Base, CXXBasePath &) { + auto hasRefInBase = clang::hasPublicMethodInBase(Base, "ref"); + if (!hasRefInBase) { + AnyInconclusiveBase = true; + return false; + } + return (*hasRefInBase) != nullptr; + }; + const auto hasPublicDerefInBase = + [&AnyInconclusiveBase](const CXXBaseSpecifier *Base, CXXBasePath &) { auto hasDerefInBase = clang::hasPublicMethodInBase(Base, "deref"); if (!hasDerefInBase) { AnyInconclusiveBase = true; @@ -115,28 +245,42 @@ class RefCntblBaseVirtualDtorChecker } return (*hasDerefInBase) != nullptr; }; - CXXBasePaths Paths; - Paths.setOrigin(C); - hasRef = hasRef || C->lookupInBases(hasPublicRefInBase, Paths, + CXXBasePaths Paths; + Paths.setOrigin(C); + hasRef = hasRef || C->lookupInBases(hasPublicRefInBase, Paths, + /*LookupInDependent =*/true); + hasDeref = hasDeref || C->lookupInBases(hasPublicDerefInBase, Paths, /*LookupInDependent =*/true); - hasDeref = hasDeref || C->lookupInBases(hasPublicDerefInBase, Paths, - /*LookupInDependent =*/true); - if (AnyInconclusiveBase || !hasRef || !hasDeref) - return false; - - const auto *Dtor = C->getDestructor(); - if (!Dtor || !Dtor->isVirtual()) { - ProblematicBaseSpecifier = Base; - ProblematicBaseClass = C; - return true; - } - - return false; - }; - - if (RD->lookupInBases(IsPublicBaseRefCntblWOVirtualDtor, Paths, - /*LookupInDependent =*/true)) { - reportBug(RD, ProblematicBaseSpecifier, ProblematicBaseClass); + if (AnyInconclusiveBase || !hasRef || !hasDeref) + continue; + + auto HasSpecializedDelete = isClassWithSpecializedDelete(C, RD); + if (!HasSpecializedDelete || *HasSpecializedDelete) + continue; + if (C->lookupInBases( + [&](const CXXBaseSpecifier *Base, CXXBasePath &) { + auto *T = Base->getType().getTypePtrOrNull(); + if (!T) + return false; + auto *R = T->getAsCXXRecordDecl(); + if (!R) + return false; + auto Result = isClassWithSpecializedDelete(R, RD); + if (!Result) + AnyInconclusiveBase = true; + return Result && *Result; + }, + Paths, /*LookupInDependent =*/true)) + continue; + if (AnyInconclusiveBase) + continue; + + const auto *Dtor = C->getDestructor(); + if (!Dtor || !Dtor->isVirtual()) { + auto *ProblematicBaseSpecifier = &Base; + auto *ProblematicBaseClass = C; + reportBug(RD, ProblematicBaseSpecifier, ProblematicBaseClass); + } } } @@ -182,6 +326,32 @@ class RefCntblBaseVirtualDtorChecker ClsName == "ThreadSafeRefCountedAndCanMakeThreadSafeWeakPtr"); } + static std::optional + isClassWithSpecializedDelete(const CXXRecordDecl *C, + const CXXRecordDecl *DerivedClass) { + if (auto *ClsTmplSpDecl = dyn_cast(C)) { + for (auto *MethodDecl : C->methods()) { + if (safeGetName(MethodDecl) == "deref") { + DerefFuncDeleteExprVisitor Visitor(ClsTmplSpDecl->getTemplateArgs(), + DerivedClass); + auto Result = Visitor.HasSpecializedDelete(MethodDecl); + if (!Result || *Result) + return Result; + } + } + return false; + } + for (auto *MethodDecl : C->methods()) { + if (safeGetName(MethodDecl) == "deref") { + DerefFuncDeleteExprVisitor Visitor(DerivedClass); + auto Result = Visitor.HasSpecializedDelete(MethodDecl); + if (!Result || *Result) + return Result; + } + } + return false; + } + void reportBug(const CXXRecordDecl *DerivedClass, const CXXBaseSpecifier *BaseSpec, const CXXRecordDecl *ProblematicBaseClass) const { diff --git a/clang/lib/StaticAnalyzer/Checkers/WebKit/UncountedLocalVarsChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/WebKit/UncountedLocalVarsChecker.cpp index 0d9710a5e2d83..274da0baf2ce5 100644 --- a/clang/lib/StaticAnalyzer/Checkers/WebKit/UncountedLocalVarsChecker.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/WebKit/UncountedLocalVarsChecker.cpp @@ -135,7 +135,19 @@ class UncountedLocalVarsChecker bool shouldVisitImplicitCode() const { return false; } bool VisitVarDecl(VarDecl *V) { - Checker->visitVarDecl(V); + auto *Init = V->getInit(); + if (Init && V->isLocalVarDecl()) + Checker->visitVarDecl(V, Init); + return true; + } + + bool VisitBinaryOperator(const BinaryOperator *BO) { + if (BO->isAssignmentOp()) { + if (auto *VarRef = dyn_cast(BO->getLHS())) { + if (auto *V = dyn_cast(VarRef->getDecl())) + Checker->visitVarDecl(V, BO->getRHS()); + } + } return true; } @@ -174,7 +186,7 @@ class UncountedLocalVarsChecker visitor.TraverseDecl(const_cast(TUD)); } - void visitVarDecl(const VarDecl *V) const { + void visitVarDecl(const VarDecl *V, const Expr *Value) const { if (shouldSkipVarDecl(V)) return; @@ -184,12 +196,8 @@ class UncountedLocalVarsChecker std::optional IsUncountedPtr = isUncountedPtr(ArgType); if (IsUncountedPtr && *IsUncountedPtr) { - const Expr *const InitExpr = V->getInit(); - if (!InitExpr) - return; // FIXME: later on we might warn on uninitialized vars too - if (tryToFindPtrOrigin( - InitExpr, /*StopAtFirstRefCountedObj=*/false, + Value, /*StopAtFirstRefCountedObj=*/false, [&](const clang::Expr *InitArgOrigin, bool IsSafe) { if (!InitArgOrigin) return true; @@ -232,34 +240,46 @@ class UncountedLocalVarsChecker })) return; - reportBug(V); + reportBug(V, Value); } } bool shouldSkipVarDecl(const VarDecl *V) const { assert(V); - if (!V->isLocalVarDecl()) - return true; - - if (BR->getSourceManager().isInSystemHeader(V->getLocation())) - return true; - - return false; + return BR->getSourceManager().isInSystemHeader(V->getLocation()); } - void reportBug(const VarDecl *V) const { + void reportBug(const VarDecl *V, const Expr *Value) const { assert(V); SmallString<100> Buf; llvm::raw_svector_ostream Os(Buf); - Os << "Local variable "; - printQuotedQualifiedName(Os, V); - Os << " is uncounted and unsafe."; - - PathDiagnosticLocation BSLoc(V->getLocation(), BR->getSourceManager()); - auto Report = std::make_unique(Bug, Os.str(), BSLoc); - Report->addRange(V->getSourceRange()); - BR->emitReport(std::move(Report)); + if (dyn_cast(V)) { + Os << "Assignment to an uncounted parameter "; + printQuotedQualifiedName(Os, V); + Os << " is unsafe."; + + PathDiagnosticLocation BSLoc(Value->getExprLoc(), BR->getSourceManager()); + auto Report = std::make_unique(Bug, Os.str(), BSLoc); + Report->addRange(Value->getSourceRange()); + BR->emitReport(std::move(Report)); + } else { + if (V->hasLocalStorage()) + Os << "Local variable "; + else if (V->isStaticLocal()) + Os << "Static local variable "; + else if (V->hasGlobalStorage()) + Os << "Global variable "; + else + Os << "Variable "; + printQuotedQualifiedName(Os, V); + Os << " is uncounted and unsafe."; + + PathDiagnosticLocation BSLoc(V->getLocation(), BR->getSourceManager()); + auto Report = std::make_unique(Bug, Os.str(), BSLoc); + Report->addRange(V->getSourceRange()); + BR->emitReport(std::move(Report)); + } } }; } // namespace diff --git a/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp b/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp index b8299fac002ea..eec0116581cb8 100644 --- a/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp +++ b/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp @@ -1975,33 +1975,45 @@ void ExprEngine::Visit(const Stmt *S, ExplodedNode *Pred, ExplodedNodeSet Tmp; StmtNodeBuilder Bldr2(PreVisit, Tmp, *currBldrCtx); - const Expr *ArgE; - if (const auto *DefE = dyn_cast(S)) + bool HasRewrittenInit = false; + const Expr *ArgE = nullptr; + if (const auto *DefE = dyn_cast(S)) { ArgE = DefE->getExpr(); - else if (const auto *DefE = dyn_cast(S)) + HasRewrittenInit = DefE->hasRewrittenInit(); + } else if (const auto *DefE = dyn_cast(S)) { ArgE = DefE->getExpr(); - else + HasRewrittenInit = DefE->hasRewrittenInit(); + } else llvm_unreachable("unknown constant wrapper kind"); - bool IsTemporary = false; - if (const auto *MTE = dyn_cast(ArgE)) { - ArgE = MTE->getSubExpr(); - IsTemporary = true; - } + if (HasRewrittenInit) { + for (auto *N : PreVisit) { + ProgramStateRef state = N->getState(); + const LocationContext *LCtx = N->getLocationContext(); + state = state->BindExpr(S, LCtx, state->getSVal(ArgE, LCtx)); + Bldr2.generateNode(S, N, state); + } + } else { + // If it's not rewritten, the contents of these expressions are not + // actually part of the current function, so we fall back to constant + // evaluation. + bool IsTemporary = false; + if (const auto *MTE = dyn_cast(ArgE)) { + ArgE = MTE->getSubExpr(); + IsTemporary = true; + } + + std::optional ConstantVal = svalBuilder.getConstantVal(ArgE); + const LocationContext *LCtx = Pred->getLocationContext(); + for (auto *I : PreVisit) { + ProgramStateRef State = I->getState(); + State = State->BindExpr(S, LCtx, ConstantVal.value_or(UnknownVal())); + if (IsTemporary) + State = createTemporaryRegionIfNeeded(State, LCtx, cast(S), + cast(S)); - std::optional ConstantVal = svalBuilder.getConstantVal(ArgE); - if (!ConstantVal) - ConstantVal = UnknownVal(); - - const LocationContext *LCtx = Pred->getLocationContext(); - for (const auto I : PreVisit) { - ProgramStateRef State = I->getState(); - State = State->BindExpr(S, LCtx, *ConstantVal); - if (IsTemporary) - State = createTemporaryRegionIfNeeded(State, LCtx, - cast(S), - cast(S)); - Bldr2.generateNode(S, I, State); + Bldr2.generateNode(S, I, State); + } } getCheckerManager().runCheckersForPostStmt(Dst, Tmp, S, *this); diff --git a/clang/test/AST/Interp/builtin-functions.cpp b/clang/test/AST/Interp/builtin-functions.cpp index fbe76aba73c90..0a17106449faf 100644 --- a/clang/test/AST/Interp/builtin-functions.cpp +++ b/clang/test/AST/Interp/builtin-functions.cpp @@ -900,7 +900,7 @@ namespace shufflevector { static_assert(vectorShuffle6[7] == 7, "");// ref-error {{not an integral constant expression}} constexpr vector4char vectorShuffleFail1 = __builtin_shufflevector( // both-error {{must be initialized by a constant expression}}\ - // ref-error {{index for __builtin_shufflevector not within the bounds of the input vectors; index of -1 found at position 0 not permitted in a constexpr context.}} + // ref-error {{index for __builtin_shufflevector not within the bounds of the input vectors; index of -1 found at position 0 is not permitted in a constexpr context}} vector4charConst1, vector4charConst2, -1, -1, -1, -1); } diff --git a/clang/test/AST/Interp/c.c b/clang/test/AST/Interp/c.c index 2a75457a4693f..f4c7bf16f2f95 100644 --- a/clang/test/AST/Interp/c.c +++ b/clang/test/AST/Interp/c.c @@ -278,3 +278,15 @@ void addrlabelexpr(void) { a0: ; static void *ps[] = { &&a0 }; // pedantic-warning {{use of GNU address-of-label extension}} } + +extern void cv2; +void *foo5 (void) +{ + return &cv2; // pedantic-warning{{address of an expression of type 'void'}} +} + +__attribute__((weak)) const unsigned int test10_bound = 10; +char test10_global[test10_bound]; // all-error {{variable length array declaration not allowed at file scope}} +void test10(void) { + char test10_local[test10_bound] = "help"; // all-error {{variable-sized object may not be initialized}} +} diff --git a/clang/test/AST/Interp/cxx03.cpp b/clang/test/AST/Interp/cxx03.cpp index b6aaf0840cfb3..70ae4134842b5 100644 --- a/clang/test/AST/Interp/cxx03.cpp +++ b/clang/test/AST/Interp/cxx03.cpp @@ -24,3 +24,8 @@ namespace NonLValueMemberExpr { const int &TT1::subobj_init = PODType().value; } + +void LambdaAccessingADummy() { + int d; + int a9[1] = {[d = 0] = 1}; // both-error {{is not an integral constant expression}} +} diff --git a/clang/test/AST/Interp/cxx98.cpp b/clang/test/AST/Interp/cxx98.cpp index be81735329db8..e68e4dbc8d74b 100644 --- a/clang/test/AST/Interp/cxx98.cpp +++ b/clang/test/AST/Interp/cxx98.cpp @@ -50,3 +50,7 @@ _Static_assert(c0_test == 0, ""); int a = 0; // both-note {{declared here}} _Static_assert(a == 0, ""); // both-error {{static assertion expression is not an integral constant expression}} \ // both-note {{read of non-const variable 'a' is not allowed in a constant expression}} + +struct SelfReference { SelfReference &r; }; +extern SelfReference self_reference_1; +SelfReference self_reference_2 = {self_reference_1}; diff --git a/clang/test/AST/Interp/eval-order.cpp b/clang/test/AST/Interp/eval-order.cpp index 695a43c9d235b..aaf2b74510bbf 100644 --- a/clang/test/AST/Interp/eval-order.cpp +++ b/clang/test/AST/Interp/eval-order.cpp @@ -1,8 +1,7 @@ -// RUN: %clang_cc1 -std=c++1z -verify %s -fcxx-exceptions -triple=x86_64-linux-gnu -// RUN: %clang_cc1 -std=c++1z -verify %s -fcxx-exceptions -triple=x86_64-linux-gnu -fexperimental-new-constant-interpreter +// RUN: %clang_cc1 -std=c++1z -verify=ref,both %s -fcxx-exceptions -triple=x86_64-linux-gnu +// RUN: %clang_cc1 -std=c++1z -verify=expected,both %s -fcxx-exceptions -triple=x86_64-linux-gnu -fexperimental-new-constant-interpreter // ref-no-diagnostics -// expected-no-diagnostics /// Check that assignment operators evaluate their operands right-to-left. /// Copied from test/SemaCXX/constant-expression-cxx1z.cpp @@ -46,7 +45,7 @@ namespace EvalOrder { } template constexpr T &&b(T &&v) { if (!done_a) - throw "wrong"; + throw "wrong"; // expected-note 7{{not valid}} done_b = true; return (T &&)v; } @@ -76,21 +75,30 @@ namespace EvalOrder { // SEQ(A(&ud)->*B(&UserDefined::n)); FIXME // Rule 4: a(b1, b2, b3) - // SEQ(A(f)(B(1), B(2), B(3))); FIXME + SEQ(A(f)(B(1), B(2), B(3))); // expected-error {{not an integral constant expression}} FIXME \ + // expected-note 2{{in call to}} // Rule 5: b = a, b @= a - // SEQ(B(lvalue().get()) = A(0)); FIXME - // SEQ(B(lvalue().get()) = A(ud)); FIXME + SEQ(B(lvalue().get()) = A(0)); // expected-error {{not an integral constant expression}} FIXME \ + // expected-note 2{{in call to}} + SEQ(B(lvalue().get()) = A(ud)); // expected-error {{not an integral constant expression}} FIXME \ + // expected-note 2{{in call to}} SEQ(B(lvalue().get()) += A(0)); - // SEQ(B(lvalue().get()) += A(ud)); FIXME - // SEQ(B(lvalue().get()) += A(nm)); FIXME + SEQ(B(lvalue().get()) += A(ud)); // expected-error {{not an integral constant expression}} FIXME \ + // expected-note 2{{in call to}} + + SEQ(B(lvalue().get()) += A(nm)); // expected-error {{not an integral constant expression}} FIXME \ + // expected-note 2{{in call to}} + // Rule 6: a[b] constexpr int arr[3] = {}; SEQ(A(arr)[B(0)]); SEQ(A(+arr)[B(0)]); - // SEQ(A(0)[B(arr)]); FIXME - // SEQ(A(0)[B(+arr)]); FIXME + SEQ(A(0)[B(arr)]); // expected-error {{not an integral constant expression}} FIXME \ + // expected-note 2{{in call to}} + SEQ(A(0)[B(+arr)]); // expected-error {{not an integral constant expression}} FIXME \ + // expected-note 2{{in call to}} SEQ(A(ud)[B(0)]); // Rule 7: a << b diff --git a/clang/test/AST/Interp/functions.cpp b/clang/test/AST/Interp/functions.cpp index e95ade8ef51b7..10c62a43ef33b 100644 --- a/clang/test/AST/Interp/functions.cpp +++ b/clang/test/AST/Interp/functions.cpp @@ -623,3 +623,9 @@ namespace FuncPtrParam { *a; // both-warning {{expression result unused}} } } + +namespace { + void f() noexcept; + void (&r)() = f; + void (&cond3)() = r; +} diff --git a/clang/test/AST/Interp/objc.mm b/clang/test/AST/Interp/objc.mm new file mode 100644 index 0000000000000..6402c8ae098fd --- /dev/null +++ b/clang/test/AST/Interp/objc.mm @@ -0,0 +1,13 @@ +// RUN: %clang_cc1 -fexperimental-new-constant-interpreter -verify=expected,both %s +// RUN: %clang_cc1 -verify=ref,both %s + +@interface A { + int a; + static_assert(a, ""); // both-error {{static assertion expression is not an integral constant expression}} +} +@end + +@interface NSString +@end +constexpr NSString *t0 = @"abc"; +constexpr NSString *t1 = @("abc"); diff --git a/clang/test/AST/Interp/records.cpp b/clang/test/AST/Interp/records.cpp index 3a5ecd291a568..0a89c81bafd57 100644 --- a/clang/test/AST/Interp/records.cpp +++ b/clang/test/AST/Interp/records.cpp @@ -1335,8 +1335,6 @@ namespace UnnamedBitFields { static_assert(a.c == 'a', ""); } -/// FIXME: This still doesn't work in the new interpreter because -/// we lack type information for dummy pointers. namespace VirtualBases { /// This used to crash. namespace One { @@ -1346,7 +1344,7 @@ namespace VirtualBases { }; class B : public virtual A { public: - int getX() { return x; } // ref-note {{declared here}} + int getX() { return x; } // both-note {{declared here}} }; class DV : virtual public B{}; @@ -1354,7 +1352,7 @@ namespace VirtualBases { void foo() { DV b; int a[b.getX()]; // both-warning {{variable length arrays}} \ - // ref-note {{non-constexpr function 'getX' cannot be used}} + // both-note {{non-constexpr function 'getX' cannot be used}} } } @@ -1469,3 +1467,16 @@ namespace IgnoredCtorWithZeroInit { return (S(), true); } } + +#if __cplusplus >= 202002L +namespace VirtOperator { + /// This used to crash because it's a virtual CXXOperatorCallExpr. + struct B { + virtual constexpr bool operator==(const B&) const { return true; } + }; + struct D : B { + constexpr bool operator==(const B&) const override{ return false; } // both-note {{operator}} + }; + constexpr bool cmp_base_derived = D() == D(); // both-warning {{ambiguous}} +} +#endif diff --git a/clang/test/AST/Interp/unions.cpp b/clang/test/AST/Interp/unions.cpp index bc5604c2b2d04..293a1981a52f0 100644 --- a/clang/test/AST/Interp/unions.cpp +++ b/clang/test/AST/Interp/unions.cpp @@ -30,3 +30,38 @@ constexpr A ab = {.d = 1.0}; static_assert(ab.d == 1.0, ""); static_assert(ab.a == 1, ""); // both-error {{not an integral constant expression}} \ // both-note {{read of member 'a' of union with active member 'd'}} + + +namespace Empty { + union E {}; + constexpr E e{}; +} + +namespace SimpleStore { + union A { + int a; + int b; + }; + constexpr int foo() { + A a{.b = 4}; + a.b = 10; + return a.b; + } + static_assert(foo() == 10, ""); + + constexpr int empty() { + A a{}; /// Just test that this works. + return 10; + } + static_assert(empty() == 10, ""); +} + +namespace ZeroInit { + struct S { int m; }; + union Z { + float f; + }; + + constexpr Z z{}; + static_assert(z.f == 0.0, ""); +} diff --git a/clang/test/AST/attr-counted-by-late-parsed-struct-ptrs.c b/clang/test/AST/attr-counted-by-late-parsed-struct-ptrs.c new file mode 100644 index 0000000000000..a585a45eeff03 --- /dev/null +++ b/clang/test/AST/attr-counted-by-late-parsed-struct-ptrs.c @@ -0,0 +1,45 @@ +// RUN: %clang_cc1 -fexperimental-late-parse-attributes %s -ast-dump | FileCheck %s + +#define __counted_by(f) __attribute__((counted_by(f))) + +struct size_known { + int field; +}; + +//============================================================================== +// __counted_by on struct member pointer in decl attribute position +//============================================================================== + +struct on_member_pointer_complete_ty { + struct size_known *buf __counted_by(count); + int count; +}; +// CHECK-LABEL: struct on_member_pointer_complete_ty definition +// CHECK-NEXT: |-FieldDecl {{.*}} buf 'struct size_known * __counted_by(count)':'struct size_known *' +// CHECK-NEXT: `-FieldDecl {{.*}} referenced count 'int' + +struct on_pointer_anon_count { + struct size_known *buf __counted_by(count); + struct { + int count; + }; +}; + +// CHECK-LABEL: struct on_pointer_anon_count definition +// CHECK-NEXT: |-FieldDecl {{.*}} buf 'struct size_known * __counted_by(count)':'struct size_known *' +// CHECK-NEXT: |-RecordDecl {{.*}} struct definition +// CHECK-NEXT: | `-FieldDecl {{.*}} count 'int' +// CHECK-NEXT: |-FieldDecl {{.*}} implicit 'struct on_pointer_anon_count::(anonymous at {{.*}})' +// CHECK-NEXT: `-IndirectFieldDecl {{.*}} implicit referenced count 'int' +// CHECK-NEXT: |-Field {{.*}} '' 'struct on_pointer_anon_count::(anonymous at {{.*}})' +// CHECK-NEXT: `-Field {{.*}} 'count' 'int' + +//============================================================================== +// __counted_by on struct member pointer in type attribute position +//============================================================================== +// TODO: Correctly parse counted_by as a type attribute. Currently it is parsed +// as a declaration attribute and is **not** late parsed resulting in the `count` +// field being unavailable. +// +// See `clang/test/Sema/attr-counted-by-late-parsed-struct-ptrs.c` for test +// cases. diff --git a/clang/test/AST/attr-counted-by-struct-ptrs.c b/clang/test/AST/attr-counted-by-struct-ptrs.c new file mode 100644 index 0000000000000..79a453d239cd5 --- /dev/null +++ b/clang/test/AST/attr-counted-by-struct-ptrs.c @@ -0,0 +1,117 @@ +// RUN: %clang_cc1 %s -ast-dump | FileCheck %s + +#define __counted_by(f) __attribute__((counted_by(f))) + +struct size_unknown; +struct size_known { + int field; +}; + +//============================================================================== +// __counted_by on struct member pointer in decl attribute position +//============================================================================== + +// CHECK-LABEL: RecordDecl {{.+}} struct on_member_pointer_complete_ty definition +// CHECK-NEXT: |-FieldDecl {{.+}} referenced count 'int' +// CHECK-NEXT: `-FieldDecl {{.+}} buf 'struct size_known * __counted_by(count)':'struct size_known *' +struct on_member_pointer_complete_ty { + int count; + struct size_known * buf __counted_by(count); +}; + +// CHECK-LABEL: RecordDecl {{.+}} struct on_pointer_anon_buf definition +// CHECK-NEXT: |-FieldDecl {{.+}} referenced count 'int' +// CHECK-NEXT: |-RecordDecl {{.+}} struct definition +// CHECK-NEXT: | `-FieldDecl {{.+}} buf 'struct size_known * __counted_by(count)':'struct size_known *' +// CHECK-NEXT: |-FieldDecl {{.+}} implicit 'struct on_pointer_anon_buf::(anonymous at [[ANON_STRUCT_PATH:.+]])' +// CHECK-NEXT: `-IndirectFieldDecl {{.+}} implicit buf 'struct size_known * __counted_by(count)':'struct size_known *' +// CHECK-NEXT: |-Field {{.+}} '' 'struct on_pointer_anon_buf::(anonymous at [[ANON_STRUCT_PATH]])' +// CHECK-NEXT: `-Field {{.+}} 'buf' 'struct size_known * __counted_by(count)':'struct size_known *' +struct on_pointer_anon_buf { + int count; + struct { + struct size_known *buf __counted_by(count); + }; +}; + +struct on_pointer_anon_count { + struct { + int count; + }; + struct size_known *buf __counted_by(count); +}; + +//============================================================================== +// __counted_by on struct member pointer in type attribute position +//============================================================================== +// TODO: Correctly parse counted_by as a type attribute. Currently it is parsed +// as a declaration attribute + +// CHECK-LABEL: RecordDecl {{.+}} struct on_member_pointer_complete_ty_ty_pos definition +// CHECK-NEXT: |-FieldDecl {{.+}} referenced count 'int' +// CHECK-NEXT: `-FieldDecl {{.+}} buf 'struct size_known * __counted_by(count)':'struct size_known *' +struct on_member_pointer_complete_ty_ty_pos { + int count; + struct size_known *__counted_by(count) buf; +}; + +// TODO: This should be forbidden but isn't due to counted_by being treated as a +// declaration attribute. The attribute ends up on the outer most pointer +// (allowed by sema) even though syntactically its supposed to be on the inner +// pointer (would not allowed by sema due to pointee being a function type). +// CHECK-LABEL: RecordDecl {{.+}} struct on_member_pointer_fn_ptr_ty_ty_pos_inner definition +// CHECK-NEXT: |-FieldDecl {{.+}} referenced count 'int' +// CHECK-NEXT: `-FieldDecl {{.+}} fn_ptr 'void (** __counted_by(count))(void)':'void (**)(void)' +struct on_member_pointer_fn_ptr_ty_ty_pos_inner { + int count; + void (* __counted_by(count) * fn_ptr)(void); +}; + +// FIXME: The generated AST here is wrong. The attribute should be on the inner +// pointer. +// CHECK-LABEL: RecordDecl {{.+}} struct on_nested_pointer_inner definition +// CHECK-NEXT: |-FieldDecl {{.+}} referenced count 'int' +// CHECK-NEXT: `-FieldDecl {{.+}} buf 'struct size_known ** __counted_by(count)':'struct size_known **' +struct on_nested_pointer_inner { + int count; + // TODO: This should be disallowed because in the `-fbounds-safety` model + // `__counted_by` can only be nested when used in function parameters. + struct size_known *__counted_by(count) *buf; +}; + +// CHECK-LABEL: RecordDecl {{.+}} struct on_nested_pointer_outer definition +// CHECK-NEXT: |-FieldDecl {{.+}} referenced count 'int' +// CHECK-NEXT: `-FieldDecl {{.+}} buf 'struct size_known ** __counted_by(count)':'struct size_known **' +struct on_nested_pointer_outer { + int count; + struct size_known **__counted_by(count) buf; +}; + +// CHECK-LABEL: RecordDecl {{.+}} struct on_pointer_anon_buf_ty_pos definition +// CHECK-NEXT: |-FieldDecl {{.+}} referenced count 'int' +// CHECK-NEXT: |-RecordDecl {{.+}} struct definition +// CHECK-NEXT: | `-FieldDecl {{.+}} buf 'struct size_known * __counted_by(count)':'struct size_known *' +// CHECK-NEXT: |-FieldDecl {{.+}} implicit 'struct on_pointer_anon_buf_ty_pos::(anonymous at [[ANON_STRUCT_PATH2:.+]])' +// CHECK-NEXT: `-IndirectFieldDecl {{.+}} implicit buf 'struct size_known * __counted_by(count)':'struct size_known *' +// CHECK-NEXT: |-Field {{.+}} '' 'struct on_pointer_anon_buf_ty_pos::(anonymous at [[ANON_STRUCT_PATH2]])' +// CHECK-NEXT: `-Field {{.+}} 'buf' 'struct size_known * __counted_by(count)':'struct size_known *' +struct on_pointer_anon_buf_ty_pos { + int count; + struct { + struct size_known * __counted_by(count) buf; + }; +}; + +// CHECK-LABEL: RecordDecl {{.+}} struct on_pointer_anon_count_ty_pos definition +// CHECK-NEXT: |-RecordDecl {{.+}} struct definition +// CHECK-NEXT: | `-FieldDecl {{.+}} count 'int' +// CHECK-NEXT: |-FieldDecl {{.+}} implicit 'struct on_pointer_anon_count_ty_pos::(anonymous at [[ANON_STRUCT_PATH3:.+]])' +// CHECK-NEXT: |-IndirectFieldDecl {{.+}} implicit referenced count 'int' +// CHECK-NEXT: | |-Field {{.+}} '' 'struct on_pointer_anon_count_ty_pos::(anonymous at [[ANON_STRUCT_PATH3]])' +// CHECK-NEXT: | `-Field {{.+}} 'count' 'int' +struct on_pointer_anon_count_ty_pos { + struct { + int count; + }; + struct size_known *__counted_by(count) buf; +}; diff --git a/clang/test/Analysis/Checkers/WebKit/ref-cntbl-base-virtual-dtor-ref-deref-on-diff-classes.cpp b/clang/test/Analysis/Checkers/WebKit/ref-cntbl-base-virtual-dtor-ref-deref-on-diff-classes.cpp index aac58c0c1dda6..85108bccfee71 100644 --- a/clang/test/Analysis/Checkers/WebKit/ref-cntbl-base-virtual-dtor-ref-deref-on-diff-classes.cpp +++ b/clang/test/Analysis/Checkers/WebKit/ref-cntbl-base-virtual-dtor-ref-deref-on-diff-classes.cpp @@ -19,4 +19,5 @@ struct Derived : Base { }; void foo () { Derived d; + d.deref(); } diff --git a/clang/test/Analysis/Checkers/WebKit/ref-cntbl-base-virtual-dtor-templates.cpp b/clang/test/Analysis/Checkers/WebKit/ref-cntbl-base-virtual-dtor-templates.cpp index eeb62d5d89ec4..4fc1624d7a154 100644 --- a/clang/test/Analysis/Checkers/WebKit/ref-cntbl-base-virtual-dtor-templates.cpp +++ b/clang/test/Analysis/Checkers/WebKit/ref-cntbl-base-virtual-dtor-templates.cpp @@ -10,8 +10,7 @@ struct DerivedClassTmpl1 : T { }; // expected-warning@-1{{Struct 'RefCntblBase' is used as a base of struct 'DerivedClassTmpl1' but doesn't have virtual destructor}} DerivedClassTmpl1 a; - - +void foo(DerivedClassTmpl1& obj) { obj.deref(); } template struct DerivedClassTmpl2 : T { }; @@ -21,7 +20,6 @@ template int foo(T) { DerivedClassTmpl2 f; return 42; } int b = foo(RefCntblBase{}); - template struct DerivedClassTmpl3 : T { }; // expected-warning@-1{{Struct 'RefCntblBase' is used as a base of struct 'DerivedClassTmpl3' but doesn't have virtual destructor}} @@ -29,7 +27,6 @@ struct DerivedClassTmpl3 : T { }; typedef DerivedClassTmpl3 Foo; Foo c; - namespace WTF { class RefCountedBase { @@ -58,33 +55,344 @@ class RefCounted : public RefCountedBase { RefCounted() { } }; +template +class ExoticRefCounted : public RefCountedBase { +public: + void deref() const { + if (derefBase()) + delete (const_cast(static_cast(this))); + } +}; + +template +class BadBase : RefCountedBase { +public: + void deref() const { + if (derefBase()) + delete (const_cast(static_cast(this))); + } +}; + +template +class FancyDeref { +public: + void ref() const + { + ++refCount; + } + + void deref() const + { + --refCount; + if (refCount) + return; + auto deleteThis = [this] { + delete static_cast(this); + }; + deleteThis(); + } +private: + mutable unsigned refCount { 0 }; +}; + +namespace Detail { + + template + class CallableWrapperBase { + public: + virtual ~CallableWrapperBase() { } + virtual Out call(In...) = 0; + }; + + template class CallableWrapper; + + template + class CallableWrapper : public CallableWrapperBase { + public: + explicit CallableWrapper(CallableType&& callable) + : m_callable(WTFMove(callable)) { } + CallableWrapper(const CallableWrapper&) = delete; + CallableWrapper& operator=(const CallableWrapper&) = delete; + Out call(In... in) final { return m_callable(in...); } + private: + CallableType m_callable; + }; + +} // namespace Detail + +template class Function; + +template +class Function { +public: + using Impl = Detail::CallableWrapperBase; + + Function() = default; + + template + Function(CallableType&& callable) + : m_callableWrapper(new Detail::CallableWrapper>(callable)) { } + + template + Function(FunctionType f) + : m_callableWrapper(new Detail::CallableWrapper>(f)) { } + + ~Function() { + } + + Out operator()(In... in) const { + ASSERT(m_callableWrapper); + return m_callableWrapper->call(in...); + } + + explicit operator bool() const { return !!m_callableWrapper; } + +private: + Impl* m_callableWrapper; +}; + +void ensureOnMainThread(const Function&& function); + +enum class DestructionThread { Any, MainThread }; + +template +class FancyDeref2 { +public: + void ref() const + { + ++refCount; + } + + void deref() const + { + --refCount; + if (refCount) + return; + const_cast*>(this)->destroy(); + } + +private: + void destroy() { + delete static_cast(this); + } + mutable unsigned refCount { 0 }; +}; + +template +class DerivedFancyDeref2 : public FancyDeref2 { +}; + +template +class BadFancyDeref { +public: + void ref() const + { + ++refCount; + } + + void deref() const + { + --refCount; + if (refCount) + return; + auto deleteThis = [this] { + delete static_cast(this); + }; + delete this; + } +private: + mutable unsigned refCount { 0 }; +}; + template class ThreadSafeRefCounted { public: - void ref() const; - bool deref() const; + void ref() const { ++refCount; } + void deref() const { + if (!--refCount) + delete const_cast(static_cast(this)); + } +private: + mutable unsigned refCount { 0 }; }; template class ThreadSafeRefCountedAndCanMakeThreadSafeWeakPtr { public: - void ref() const; - bool deref() const; + void ref() const { ++refCount; } + void deref() const { + if (!--refCount) + delete const_cast(static_cast(this)); + } +private: + mutable unsigned refCount { 0 }; }; } // namespace WTF class DerivedClass4 : public WTF::RefCounted { }; +class DerivedClass4b : public WTF::ExoticRefCounted { }; + +class DerivedClass4cSub; +class DerivedClass4c : public WTF::BadBase { }; +// expected-warning@-1{{Class 'WTF::BadBase' is used as a base of class 'DerivedClass4c' but doesn't have virtual destructor}} +class DerivedClass4cSub : public DerivedClass4c { }; +void UseDerivedClass4c(DerivedClass4c &obj) { obj.deref(); } + +class DerivedClass4d : public WTF::RefCounted { +public: + virtual ~DerivedClass4d() { } +}; +class DerivedClass4dSub : public DerivedClass4d { }; + class DerivedClass5 : public DerivedClass4 { }; // expected-warning@-1{{Class 'DerivedClass4' is used as a base of class 'DerivedClass5' but doesn't have virtual destructor}} +void UseDerivedClass5(DerivedClass5 &obj) { obj.deref(); } class DerivedClass6 : public WTF::ThreadSafeRefCounted { }; +void UseDerivedClass6(DerivedClass6 &obj) { obj.deref(); } class DerivedClass7 : public DerivedClass6 { }; // expected-warning@-1{{Class 'DerivedClass6' is used as a base of class 'DerivedClass7' but doesn't have virtual destructor}} +void UseDerivedClass7(DerivedClass7 &obj) { obj.deref(); } class DerivedClass8 : public WTF::ThreadSafeRefCountedAndCanMakeThreadSafeWeakPtr { }; +void UseDerivedClass8(DerivedClass8 &obj) { obj.deref(); } class DerivedClass9 : public DerivedClass8 { }; // expected-warning@-1{{Class 'DerivedClass8' is used as a base of class 'DerivedClass9' but doesn't have virtual destructor}} +void UseDerivedClass9(DerivedClass9 &obj) { obj.deref(); } + +class DerivedClass10 : public WTF::FancyDeref { }; +void UseDerivedClass10(DerivedClass10 &obj) { obj.deref(); } + +class DerivedClass10b : public WTF::DerivedFancyDeref2 { }; +void UseDerivedClass10b(DerivedClass10b &obj) { obj.deref(); } + +class DerivedClass10c : public WTF::BadFancyDeref { }; +// expected-warning@-1{{Class 'WTF::BadFancyDeref' is used as a base of class 'DerivedClass10c' but doesn't have virtual destructor}} +void UseDerivedClass10c(DerivedClass10c &obj) { obj.deref(); } + +class BaseClass1 { +public: + void ref() const { ++refCount; } + void deref() const; +private: + enum class Type { Base, Derived } type { Type::Base }; + mutable unsigned refCount { 0 }; +}; + +class DerivedClass11 : public BaseClass1 { }; + +void BaseClass1::deref() const +{ + --refCount; + if (refCount) + return; + switch (type) { + case Type::Base: + delete const_cast(this); + break; + case Type::Derived: + delete const_cast(static_cast(this)); + break; + } +} + +void UseDerivedClass11(DerivedClass11& obj) { obj.deref(); } + +class BaseClass2; +static void deleteBase2(BaseClass2*); + +class BaseClass2 { +public: + void ref() const { ++refCount; } + void deref() const + { + if (!--refCount) + deleteBase2(const_cast(this)); + } + virtual bool isDerived() { return false; } +private: + mutable unsigned refCount { 0 }; +}; + +class DerivedClass12 : public BaseClass2 { + bool isDerived() final { return true; } +}; + +void UseDerivedClass11(DerivedClass12& obj) { obj.deref(); } + +void deleteBase2(BaseClass2* obj) { + if (obj->isDerived()) + delete static_cast(obj); + else + delete obj; +} + +class BaseClass3 { +public: + void ref() const { ++refCount; } + void deref() const + { + if (!--refCount) + const_cast(this)->destory(); + } + virtual bool isDerived() { return false; } + +private: + void destory(); + + mutable unsigned refCount { 0 }; +}; + +class DerivedClass13 : public BaseClass3 { + bool isDerived() final { return true; } +}; + +void UseDerivedClass11(DerivedClass13& obj) { obj.deref(); } + +void BaseClass3::destory() { + if (isDerived()) + delete static_cast(this); + else + delete this; +} + +class RecursiveBaseClass { +public: + void ref() const { + if (otherObject) + otherObject->ref(); + else + ++refCount; + } + void deref() const { + if (otherObject) + otherObject->deref(); + else { + --refCount; + if (refCount) + return; + delete this; + } + } +private: + RecursiveBaseClass* otherObject { nullptr }; + mutable unsigned refCount { 0 }; +}; + +class RecursiveDerivedClass : public RecursiveBaseClass { }; +// expected-warning@-1{{Class 'RecursiveBaseClass' is used as a base of class 'RecursiveDerivedClass' but doesn't have virtual destructor}} + +class DerivedClass14 : public WTF::RefCounted { +public: + virtual ~DerivedClass14() { } +}; + +void UseDerivedClass14(DerivedClass14& obj) { obj.deref(); } + +class DerivedClass15 : public DerivedClass14 { }; + +void UseDerivedClass15(DerivedClass15& obj) { obj.deref(); } diff --git a/clang/test/Analysis/Checkers/WebKit/uncounted-local-vars.cpp b/clang/test/Analysis/Checkers/WebKit/uncounted-local-vars.cpp index 632a82eb0d8d1..25776870dd3ae 100644 --- a/clang/test/Analysis/Checkers/WebKit/uncounted-local-vars.cpp +++ b/clang/test/Analysis/Checkers/WebKit/uncounted-local-vars.cpp @@ -216,3 +216,76 @@ void foo() { } } // namespace conditional_op + +namespace local_assignment_basic { + +RefCountable *provide_ref_cntbl(); + +void foo(RefCountable* a) { + RefCountable* b = a; + // expected-warning@-1{{Local variable 'b' is uncounted and unsafe [alpha.webkit.UncountedLocalVarsChecker]}} + if (b->trivial()) + b = provide_ref_cntbl(); +} + +void bar(RefCountable* a) { + RefCountable* b; + // expected-warning@-1{{Local variable 'b' is uncounted and unsafe [alpha.webkit.UncountedLocalVarsChecker]}} + b = provide_ref_cntbl(); +} + +void baz() { + RefPtr a = provide_ref_cntbl(); + { + RefCountable* b = a.get(); + // expected-warning@-1{{Local variable 'b' is uncounted and unsafe [alpha.webkit.UncountedLocalVarsChecker]}} + b = provide_ref_cntbl(); + } +} + +} // namespace local_assignment_basic + +namespace local_assignment_to_parameter { + +RefCountable *provide_ref_cntbl(); +void someFunction(); + +void foo(RefCountable* a) { + a = provide_ref_cntbl(); + // expected-warning@-1{{Assignment to an uncounted parameter 'a' is unsafe [alpha.webkit.UncountedLocalVarsChecker]}} + someFunction(); + a->method(); +} + +} // namespace local_assignment_to_parameter + +namespace local_assignment_to_static_local { + +RefCountable *provide_ref_cntbl(); +void someFunction(); + +void foo() { + static RefCountable* a = nullptr; + // expected-warning@-1{{Static local variable 'a' is uncounted and unsafe [alpha.webkit.UncountedLocalVarsChecker]}} + a = provide_ref_cntbl(); + someFunction(); + a->method(); +} + +} // namespace local_assignment_to_static_local + +namespace local_assignment_to_global { + +RefCountable *provide_ref_cntbl(); +void someFunction(); + +RefCountable* g_a = nullptr; +// expected-warning@-1{{Global variable 'local_assignment_to_global::g_a' is uncounted and unsafe [alpha.webkit.UncountedLocalVarsChecker]}} + +void foo() { + g_a = provide_ref_cntbl(); + someFunction(); + g_a->method(); +} + +} // namespace local_assignment_to_global diff --git a/clang/test/Analysis/Checkers/WebKit/uncounted-obj-arg.cpp b/clang/test/Analysis/Checkers/WebKit/uncounted-obj-arg.cpp index 96986631726fe..a98c6eb9c84d9 100644 --- a/clang/test/Analysis/Checkers/WebKit/uncounted-obj-arg.cpp +++ b/clang/test/Analysis/Checkers/WebKit/uncounted-obj-arg.cpp @@ -231,6 +231,18 @@ class RefCounted { void method(); void someFunction(); int otherFunction(); + unsigned recursiveTrivialFunction(int n) { return !n ? 1 : recursiveTrivialFunction(n - 1); } + unsigned recursiveComplexFunction(int n) { return !n ? otherFunction() : recursiveComplexFunction(n - 1); } + unsigned mutuallyRecursiveFunction1(int n) { return n < 0 ? 1 : (n % 2 ? mutuallyRecursiveFunction2(n - 2) : mutuallyRecursiveFunction1(n - 1)); } + unsigned mutuallyRecursiveFunction2(int n) { return n < 0 ? 1 : (n % 3 ? mutuallyRecursiveFunction2(n - 3) : mutuallyRecursiveFunction1(n - 2)); } + unsigned mutuallyRecursiveFunction3(int n) { return n < 0 ? 1 : (n % 5 ? mutuallyRecursiveFunction3(n - 5) : mutuallyRecursiveFunction4(n - 3)); } + unsigned mutuallyRecursiveFunction4(int n) { return n < 0 ? 1 : (n % 7 ? otherFunction() : mutuallyRecursiveFunction3(n - 3)); } + unsigned recursiveFunction5(unsigned n) { return n > 100 ? 2 : (n % 2 ? recursiveFunction5(n + 1) : recursiveFunction6(n + 2)); } + unsigned recursiveFunction6(unsigned n) { return n > 100 ? 3 : (n % 2 ? recursiveFunction6(n % 7) : recursiveFunction7(n % 5)); } + unsigned recursiveFunction7(unsigned n) { return n > 100 ? 5 : recursiveFunction7(n * 5); } + + void mutuallyRecursive8() { mutuallyRecursive9(); someFunction(); } + void mutuallyRecursive9() { mutuallyRecursive8(); } int trivial1() { return 123; } float trivial2() { return 0.3; } @@ -498,6 +510,24 @@ class UnrelatedClass { RefCounted::singleton().trivial18(); // no-warning RefCounted::singleton().someFunction(); // no-warning + getFieldTrivial().recursiveTrivialFunction(7); // no-warning + getFieldTrivial().recursiveComplexFunction(9); + // expected-warning@-1{{Call argument for 'this' parameter is uncounted and unsafe}} + getFieldTrivial().mutuallyRecursiveFunction1(11); // no-warning + getFieldTrivial().mutuallyRecursiveFunction2(13); // no-warning + getFieldTrivial().mutuallyRecursiveFunction3(17); + // expected-warning@-1{{Call argument for 'this' parameter is uncounted and unsafe}} + getFieldTrivial().mutuallyRecursiveFunction4(19); + // expected-warning@-1{{Call argument for 'this' parameter is uncounted and unsafe}} + getFieldTrivial().recursiveFunction5(23); // no-warning + getFieldTrivial().recursiveFunction6(29); // no-warning + getFieldTrivial().recursiveFunction7(31); // no-warning + + getFieldTrivial().mutuallyRecursive8(); + // expected-warning@-1{{Call argument for 'this' parameter is uncounted and unsafe}} + getFieldTrivial().mutuallyRecursive9(); + // expected-warning@-1{{Call argument for 'this' parameter is uncounted and unsafe}} + getFieldTrivial().someFunction(); // expected-warning@-1{{Call argument for 'this' parameter is uncounted and unsafe}} getFieldTrivial().nonTrivial1(); diff --git a/clang/test/Analysis/cert/pos34-c-fp-suppression.cpp b/clang/test/Analysis/cert/pos34-c-fp-suppression.cpp deleted file mode 100644 index d982fcb8a1baf..0000000000000 --- a/clang/test/Analysis/cert/pos34-c-fp-suppression.cpp +++ /dev/null @@ -1,51 +0,0 @@ -// RUN: %clang_analyze_cc1 \ -// RUN: -analyzer-checker=alpha.security.cert.pos.34c\ -// RUN: -verify %s - -#include "../Inputs/system-header-simulator.h" -void free(void *memblock); -void *malloc(size_t size); -int putenv(char *); -int rand(); - -namespace test_auto_var_used_good { - -extern char *ex; -int test_extern() { - return putenv(ex); // no-warning: extern storage class. -} - -void foo(void) { - char *buffer = (char *)"huttah!"; - if (rand() % 2 == 0) { - buffer = (char *)malloc(5); - strcpy(buffer, "woot"); - } - putenv(buffer); -} - -void bar(void) { - char *buffer = (char *)malloc(5); - strcpy(buffer, "woot"); - - if (rand() % 2 == 0) { - free(buffer); - buffer = (char *)"blah blah blah"; - } - putenv(buffer); -} - -void baz() { - char env[] = "NAME=value"; - // TODO: False Positive - putenv(env); - // expected-warning@-1 {{The 'putenv' function should not be called with arguments that have automatic storage}} - - /* - DO SOMETHING - */ - - putenv((char *)"NAME=anothervalue"); -} - -} // namespace test_auto_var_used_good diff --git a/clang/test/Analysis/cert/pos34-c.cpp b/clang/test/Analysis/cert/pos34-c.cpp deleted file mode 100644 index f2bd7b393d889..0000000000000 --- a/clang/test/Analysis/cert/pos34-c.cpp +++ /dev/null @@ -1,61 +0,0 @@ -// RUN: %clang_analyze_cc1 \ -// RUN: -analyzer-checker=alpha.security.cert.pos.34c\ -// RUN: -verify %s - -// Examples from the CERT rule's page. -// https://wiki.sei.cmu.edu/confluence/x/6NYxBQ - -#include "../Inputs/system-header-simulator.h" -void free(void *memblock); -void *malloc(size_t size); -int putenv(char *); -int snprintf(char *str, size_t size, const char *format, ...); - -namespace test_auto_var_used_bad { - -int volatile_memory1(const char *var) { - char env[1024]; - int retval = snprintf(env, sizeof(env), "TEST=%s", var); - if (retval < 0 || (size_t)retval >= sizeof(env)) { - /* Handle error */ - } - - return putenv(env); - // expected-warning@-1 {{The 'putenv' function should not be called with arguments that have automatic storage}} -} - -} // namespace test_auto_var_used_bad - -namespace test_auto_var_used_good { - -int test_static(const char *var) { - static char env[1024]; - - int retval = snprintf(env, sizeof(env), "TEST=%s", var); - if (retval < 0 || (size_t)retval >= sizeof(env)) { - /* Handle error */ - } - - return putenv(env); -} - -int test_heap_memory(const char *var) { - static char *oldenv; - const char *env_format = "TEST=%s"; - const size_t len = strlen(var) + strlen(env_format); - char *env = (char *)malloc(len); - if (env == NULL) { - return -1; - } - if (putenv(env) != 0) { // no-warning: env was dynamically allocated. - free(env); - return -1; - } - if (oldenv != NULL) { - free(oldenv); /* avoid memory leak */ - } - oldenv = env; - return 0; -} - -} // namespace test_auto_var_used_good diff --git a/clang/test/Analysis/cxx-uninitialized-object.cpp b/clang/test/Analysis/cxx-uninitialized-object.cpp index e3fa8ae8d7f29..aee0dae15fbfa 100644 --- a/clang/test/Analysis/cxx-uninitialized-object.cpp +++ b/clang/test/Analysis/cxx-uninitialized-object.cpp @@ -1114,27 +1114,27 @@ void fCXX11MemberInitTest1() { CXX11MemberInitTest1(); } +#ifdef PEDANTIC struct CXX11MemberInitTest2 { struct RecordType { - // TODO: we'd expect the note: {{uninitialized field 'this->rec.a'}} - int a; // no-note - // TODO: we'd expect the note: {{uninitialized field 'this->rec.b'}} - int b; // no-note + int a; // expected-note {{uninitialized field 'this->a'}} + int b; // expected-note {{uninitialized field 'this->b'}} RecordType(int) {} }; - RecordType rec = RecordType(int()); + RecordType rec = RecordType(int()); // expected-warning {{2 uninitialized fields}} int dontGetFilteredByNonPedanticMode = 0; CXX11MemberInitTest2() {} }; void fCXX11MemberInitTest2() { - // TODO: we'd expect the warning: {{2 uninitializeds field}} CXX11MemberInitTest2(); // no-warning } +#endif // PEDANTIC + //===----------------------------------------------------------------------===// // "Esoteric" primitive type tests. //===----------------------------------------------------------------------===// diff --git a/clang/test/Analysis/lifetime-extended-regions.cpp b/clang/test/Analysis/lifetime-extended-regions.cpp index 4458ad294af7c..524f4e0c400d1 100644 --- a/clang/test/Analysis/lifetime-extended-regions.cpp +++ b/clang/test/Analysis/lifetime-extended-regions.cpp @@ -121,11 +121,10 @@ void aggregateWithReferences() { clang_analyzer_dump(viaReference.rx); // expected-warning-re {{&lifetime_extended_object{int, viaReference, S{{[0-9]+}}} }} clang_analyzer_dump(viaReference.ry); // expected-warning-re {{&lifetime_extended_object{Composite, viaReference, S{{[0-9]+}}} }} - // FIXME: clang currently support extending lifetime of object bound to reference members of aggregates, - // that are created from default member initializer. But CFG and ExprEngine need to be updated to address this change. - // The following expect warning: {{&lifetime_extended_object{Composite, defaultInitExtended, S{{[0-9]+}}} }} + // The lifetime lifetime of object bound to reference members of aggregates, + // that are created from default member initializer was extended. RefAggregate defaultInitExtended{i}; - clang_analyzer_dump(defaultInitExtended.ry); // expected-warning {{Unknown }} + clang_analyzer_dump(defaultInitExtended.ry); // expected-warning-re {{&lifetime_extended_object{Composite, defaultInitExtended, S{{[0-9]+}}} }} } void lambda() { diff --git a/clang/test/Analysis/putenv-stack-array.c b/clang/test/Analysis/putenv-stack-array.c new file mode 100644 index 0000000000000..f28aed73031d3 --- /dev/null +++ b/clang/test/Analysis/putenv-stack-array.c @@ -0,0 +1,90 @@ +// RUN: %clang_analyze_cc1 \ +// RUN: -analyzer-checker=alpha.security.PutenvStackArray \ +// RUN: -verify %s + +#include "Inputs/system-header-simulator.h" +void free(void *); +void *malloc(size_t); +int putenv(char *); +int snprintf(char *, size_t, const char *, ...); + +int test_auto_var(const char *var) { + char env[1024]; + (void)snprintf(env, sizeof(env), "TEST=%s", var); + return putenv(env); // expected-warning{{The 'putenv' function should not be called with arrays that have automatic storage}} +} + +int test_static_var(const char *var) { + static char env[1024]; + (void)snprintf(env, sizeof(env), "TEST=%s", var); + return putenv(env); // no-warning: static array is used +} + +void test_heap_memory(const char *var) { + const char *env_format = "TEST=%s"; + const size_t len = strlen(var) + strlen(env_format); + char *env = (char *)malloc(len); + if (env == NULL) + return; + if (putenv(env) != 0) // no-warning: env was dynamically allocated. + free(env); +} + +typedef struct { + int A; + char Env[1024]; +} Mem; + +int test_auto_var_struct() { + Mem mem; + return putenv(mem.Env); // expected-warning{{The 'putenv' function should not be called with}} +} + +int test_auto_var_subarray() { + char env[1024]; + return putenv(env + 100); // expected-warning{{The 'putenv' function should not be called with}} +} + +int f_test_auto_var_call(char *env) { + return putenv(env); // expected-warning{{The 'putenv' function should not be called with}} +} + +int test_auto_var_call() { + char env[1024]; + return f_test_auto_var_call(env); +} + +int test_constant() { + char *env = "TEST"; + return putenv(env); // no-warning: data is not on the stack +} + +extern char *ext_env; +int test_extern() { + return putenv(ext_env); // no-warning: extern storage class. +} + +void test_auto_var_reset() { + char env[] = "NAME=value"; + putenv(env); // expected-warning{{The 'putenv' function should not be called with}} + // ... (do something) + // Even cases like this are likely a bug: + // It looks like that if one string was passed to putenv, + // it should not be deallocated at all, because when reading the + // environment variable a pointer into this string is returned. + // In this case, if another (or the same) thread reads variable "NAME" + // at this point and does not copy the returned string, the data may + // become invalid. + putenv((char *)"NAME=anothervalue"); +} + +void f_main(char *env) { + putenv(env); // no warning: string allocated in stack of 'main' +} + +int main(int argc, char **argv) { + char env[] = "NAME=value"; + putenv(env); // no warning: string allocated in stack of 'main' + f_main(env); + return 0; +} diff --git a/clang/test/CMakeLists.txt b/clang/test/CMakeLists.txt index 85031ddca08ae..9e6cc0555d4be 100644 --- a/clang/test/CMakeLists.txt +++ b/clang/test/CMakeLists.txt @@ -174,7 +174,7 @@ configure_file(AST/gen_ast_dump_json_test.py ${CLANG_BINARY_DIR}/bin/gen_ast_dump_json_test.py COPYONLY) add_custom_target(clang-test-depends DEPENDS ${CLANG_TEST_DEPS}) -set_target_properties(clang-test-depends PROPERTIES FOLDER "Clang tests") +set_target_properties(clang-test-depends PROPERTIES FOLDER "Clang/Tests") add_lit_testsuite(check-clang "Running the Clang regression tests" ${CMAKE_CURRENT_BINARY_DIR} @@ -183,7 +183,6 @@ add_lit_testsuite(check-clang "Running the Clang regression tests" DEPENDS ${CLANG_TEST_DEPS} ARGS ${CLANG_TEST_EXTRA_ARGS} ) -set_target_properties(check-clang PROPERTIES FOLDER "Clang tests") add_lit_testsuites(CLANG ${CMAKE_CURRENT_SOURCE_DIR} PARAMS ${CLANG_TEST_PARAMS} @@ -194,7 +193,7 @@ add_lit_testsuites(CLANG ${CMAKE_CURRENT_SOURCE_DIR} # Add a legacy target spelling: clang-test add_custom_target(clang-test) add_dependencies(clang-test check-clang) -set_target_properties(clang-test PROPERTIES FOLDER "Clang tests") +set_target_properties(clang-test PROPERTIES FOLDER "Clang/Tests") # FIXME: This logic can be removed once all buildbots have moved # debuginfo-test from clang/test to llvm/projects or monorepo. diff --git a/clang/test/CXX/temp/temp.decls/temp.alias/p2.cpp b/clang/test/CXX/temp/temp.decls/temp.alias/p2.cpp index bc39431253880..a5b39fe5c51f7 100644 --- a/clang/test/CXX/temp/temp.decls/temp.alias/p2.cpp +++ b/clang/test/CXX/temp/temp.decls/temp.alias/p2.cpp @@ -28,14 +28,13 @@ namespace StdExample { { /* ... */ } template class TT> - void f(TT); + void f(TT); // expected-note {{candidate template ignored}} template class TT> void g(TT>); int h() { - f(v); // OK: TT = vector, Alloc is used as the default argument for the - // second parameter. + f(v); // expected-error {{no matching function for call to 'f'}} g(v); // OK: TT = vector } diff --git a/clang/test/ClangScanDeps/response-file-clang-cl.c b/clang/test/ClangScanDeps/response-file-clang-cl.c new file mode 100644 index 0000000000000..b543231f4bb1b --- /dev/null +++ b/clang/test/ClangScanDeps/response-file-clang-cl.c @@ -0,0 +1,56 @@ +// Check that the scanner can adjust arguments by reading .rsp files in advance. + +// RUN: rm -rf %t +// RUN: split-file %s %t + +// First run the tests with a .cdb +// RUN: sed -e "s|DIR|%/t|g" %t/cdb.json.template > %t/cdb.json +// RUN: sed -e "s|DIR|%/t|g" %t/args_nested.template > %t/args_nested.rsp + +// RUN: cp %t/args_compilation.rsp %t/args.rsp +// RUN: clang-scan-deps --compilation-database %t/cdb.json > %t/deps.json +// RUN: cat %t/deps.json | sed 's:\\\\\?:/:g' | FileCheck -DPREFIX=%/t %s + +// RUN: cp %t/args_preprocess.rsp %t/args.rsp +// RUN: clang-scan-deps --compilation-database %t/cdb.json > %t/deps.json +// RUN: cat %t/deps.json | sed 's:\\\\\?:/:g' | FileCheck -DPREFIX=%/t %s + + +// Now run the tests again with a in-place compilation database +// RUN: cd %t + +// RUN: cp args_compilation.rsp args.rsp +// RUN: clang-scan-deps -o deps.json -- %clang_cl @args.rsp +// RUN: cat deps.json | sed 's:\\\\\?:/:g' | FileCheck -DPREFIX=%/t %s + +// RUN: cp args_preprocess.rsp args.rsp +// RUN: clang-scan-deps -o deps.json -- %clang_cl @args.rsp +// RUN: cat deps.json | sed 's:\\\\\?:/:g' | FileCheck -DPREFIX=%/t %s + +// Here we ensure that we got a qualified .obj with its full path, since that's what we're passing with /Fo +// CHECK: [[PREFIX]]/tu.obj: + +//--- cdb.json.template +[{ + "file": "DIR/tu.cpp", + "directory": "DIR", + "command": "clang-cl @DIR/args.rsp" +}] + +//--- args_compilation.rsp +@args_nested.rsp +/c + +//--- args_preprocess.rsp +@args_nested.rsp +/E + +//--- args_nested.template +/I include +tu.cpp +/FoDIR/tu.obj + +//--- include/header.h + +//--- tu.cpp +#include "header.h" diff --git a/clang/test/CodeCompletion/member-access.cpp b/clang/test/CodeCompletion/member-access.cpp index 9f8c21c0bca6d..912f269db6c1a 100644 --- a/clang/test/CodeCompletion/member-access.cpp +++ b/clang/test/CodeCompletion/member-access.cpp @@ -367,4 +367,20 @@ class A { // CHECK-DEREF-THIS: [#void#]function() } }; + +template +struct RepeatedField { + void Add(); +}; + +template +RepeatedField* MutableRepeatedField() {} + +template +void Foo() { + auto& C = *MutableRepeatedField(); + C. +} +// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:382:5 %s -o - | FileCheck -check-prefix=CHECK-DEREF-DEPENDENT %s +// CHECK-DEREF-DEPENDENT: [#void#]Add() } diff --git a/clang/test/CodeGen/SystemZ/sync-builtins-i128-8Al.c b/clang/test/CodeGen/SystemZ/sync-builtins-i128-8Al.c index 76c9c0ebed2bb..c678e9a9882f5 100644 --- a/clang/test/CodeGen/SystemZ/sync-builtins-i128-8Al.c +++ b/clang/test/CodeGen/SystemZ/sync-builtins-i128-8Al.c @@ -7,21 +7,21 @@ __int128 Ptr __attribute__((aligned(8))); __int128 f1() { -// CHECK: warning: __sync builtin operation MUST have natural alignment (consider using __atomic). [-Wsync-alignment] +// CHECK: warning: __sync builtin operation must have natural alignment (consider using __atomic) return __sync_fetch_and_add(&Ptr, 1); } __int128 f2() { -// CHECK: warning: __sync builtin operation MUST have natural alignment (consider using __atomic). [-Wsync-alignment] +// CHECK: warning: __sync builtin operation must have natural alignment (consider using __atomic) return __sync_sub_and_fetch(&Ptr, 1); } __int128 f3() { -// CHECK: warning: __sync builtin operation MUST have natural alignment (consider using __atomic). [-Wsync-alignment] +// CHECK: warning: __sync builtin operation must have natural alignment (consider using __atomic) return __sync_val_compare_and_swap(&Ptr, 0, 1); } void f4() { -// CHECK: warning: __sync builtin operation MUST have natural alignment (consider using __atomic). [-Wsync-alignment] +// CHECK: warning: __sync builtin operation must have natural alignment (consider using __atomic) __sync_lock_release(&Ptr); } diff --git a/clang/test/CodeGen/X86/avx512er-builtins.c b/clang/test/CodeGen/X86/avx512er-builtins.c deleted file mode 100644 index 11ec6aabec1e3..0000000000000 --- a/clang/test/CodeGen/X86/avx512er-builtins.c +++ /dev/null @@ -1,347 +0,0 @@ -// RUN: %clang_cc1 -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +avx512f -target-feature +avx512er -emit-llvm -o - -Wall | FileCheck %s - - -#include - -__m512d test_mm512_rsqrt28_round_pd(__m512d a) { - // CHECK-LABEL: @test_mm512_rsqrt28_round_pd - // CHECK: @llvm.x86.avx512.rsqrt28.pd - return _mm512_rsqrt28_round_pd(a, _MM_FROUND_NO_EXC); -} - -__m512d test_mm512_mask_rsqrt28_round_pd(__m512d s, __mmask8 m, __m512d a) { - // CHECK-LABEL: @test_mm512_mask_rsqrt28_round_pd - // CHECK: @llvm.x86.avx512.rsqrt28.pd - return _mm512_mask_rsqrt28_round_pd(s, m, a, _MM_FROUND_NO_EXC); -} - -__m512d test_mm512_maskz_rsqrt28_round_pd(__mmask8 m, __m512d a) { - // CHECK-LABEL: @test_mm512_maskz_rsqrt28_round_pd - // CHECK: @llvm.x86.avx512.rsqrt28.pd - return _mm512_maskz_rsqrt28_round_pd(m, a, _MM_FROUND_NO_EXC); -} - -__m512d test_mm512_rsqrt28_pd(__m512d a) { - // CHECK-LABEL: @test_mm512_rsqrt28_pd - // CHECK: @llvm.x86.avx512.rsqrt28.pd - return _mm512_rsqrt28_pd(a); -} - -__m512d test_mm512_mask_rsqrt28_pd(__m512d s, __mmask8 m, __m512d a) { - // CHECK-LABEL: @test_mm512_mask_rsqrt28_pd - // CHECK: @llvm.x86.avx512.rsqrt28.pd - return _mm512_mask_rsqrt28_pd(s, m, a); -} - -__m512d test_mm512_maskz_rsqrt28_pd(__mmask8 m, __m512d a) { - // CHECK-LABEL: @test_mm512_maskz_rsqrt28_pd - // CHECK: @llvm.x86.avx512.rsqrt28.pd - return _mm512_maskz_rsqrt28_pd(m, a); -} - -__m512 test_mm512_rsqrt28_round_ps(__m512 a) { - // CHECK-LABEL: @test_mm512_rsqrt28_round_ps - // CHECK: @llvm.x86.avx512.rsqrt28.ps - return _mm512_rsqrt28_round_ps(a, _MM_FROUND_NO_EXC); -} - -__m512 test_mm512_mask_rsqrt28_round_ps(__m512 s, __mmask16 m, __m512 a) { - // CHECK-LABEL: @test_mm512_mask_rsqrt28_round_ps - // CHECK: @llvm.x86.avx512.rsqrt28.ps - return _mm512_mask_rsqrt28_round_ps(s, m, a, _MM_FROUND_NO_EXC); -} - -__m512 test_mm512_maskz_rsqrt28_round_ps(__mmask16 m, __m512 a) { - // CHECK-LABEL: @test_mm512_maskz_rsqrt28_round_ps - // CHECK: @llvm.x86.avx512.rsqrt28.ps - return _mm512_maskz_rsqrt28_round_ps(m, a, _MM_FROUND_NO_EXC); -} - -__m512 test_mm512_rsqrt28_ps(__m512 a) { - // CHECK-LABEL: @test_mm512_rsqrt28_ps - // CHECK: @llvm.x86.avx512.rsqrt28.ps - return _mm512_rsqrt28_ps(a); -} - -__m512 test_mm512_mask_rsqrt28_ps(__m512 s, __mmask16 m, __m512 a) { - // CHECK-LABEL: @test_mm512_mask_rsqrt28_ps - // CHECK: @llvm.x86.avx512.rsqrt28.ps - return _mm512_mask_rsqrt28_ps(s, m, a); -} - -__m512 test_mm512_maskz_rsqrt28_ps(__mmask16 m, __m512 a) { - // CHECK-LABEL: @test_mm512_maskz_rsqrt28_ps - // CHECK: @llvm.x86.avx512.rsqrt28.ps - return _mm512_maskz_rsqrt28_ps(m, a); -} - -__m128 test_mm_rsqrt28_round_ss(__m128 a, __m128 b) { - // CHECK-LABEL: @test_mm_rsqrt28_round_ss - // CHECK: @llvm.x86.avx512.rsqrt28.ss - return _mm_rsqrt28_round_ss(a, b, _MM_FROUND_NO_EXC); -} - -__m128 test_mm_mask_rsqrt28_round_ss(__m128 s, __mmask16 m, __m128 a, __m128 b) { - // CHECK-LABEL: @test_mm_mask_rsqrt28_round_ss - // CHECK: @llvm.x86.avx512.rsqrt28.ss - return _mm_mask_rsqrt28_round_ss(s, m, a, b, _MM_FROUND_NO_EXC); -} - -__m128 test_mm_maskz_rsqrt28_round_ss(__mmask16 m, __m128 a, __m128 b) { - // CHECK-LABEL: @test_mm_maskz_rsqrt28_round_ss - // CHECK: @llvm.x86.avx512.rsqrt28.ss - return _mm_maskz_rsqrt28_round_ss(m, a, b, _MM_FROUND_NO_EXC); -} - -__m128 test_mm_rsqrt28_ss(__m128 a, __m128 b) { - // CHECK-LABEL: @test_mm_rsqrt28_ss - // CHECK: @llvm.x86.avx512.rsqrt28.ss - return _mm_rsqrt28_ss(a, b); -} - -__m128 test_mm_mask_rsqrt28_ss(__m128 s, __mmask16 m, __m128 a, __m128 b) { - // CHECK-LABEL: @test_mm_mask_rsqrt28_ss - // CHECK: @llvm.x86.avx512.rsqrt28.ss - return _mm_mask_rsqrt28_ss(s, m, a, b); -} - -__m128 test_mm_maskz_rsqrt28_ss(__mmask16 m, __m128 a, __m128 b) { - // CHECK-LABEL: @test_mm_maskz_rsqrt28_ss - // CHECK: @llvm.x86.avx512.rsqrt28.ss - return _mm_maskz_rsqrt28_ss(m, a, b); -} - -__m128d test_mm_rsqrt28_round_sd(__m128d a, __m128d b) { - // CHECK-LABEL: @test_mm_rsqrt28_round_sd - // CHECK: @llvm.x86.avx512.rsqrt28.sd - return _mm_rsqrt28_round_sd(a, b, _MM_FROUND_NO_EXC); -} - -__m128d test_mm_mask_rsqrt28_round_sd(__m128d s, __mmask8 m, __m128d a, __m128d b) { - // CHECK-LABEL: @test_mm_mask_rsqrt28_round_sd - // CHECK: @llvm.x86.avx512.rsqrt28.sd - return _mm_mask_rsqrt28_round_sd(s, m, a, b, _MM_FROUND_NO_EXC); -} - -__m128d test_mm_maskz_rsqrt28_round_sd(__mmask8 m, __m128d a, __m128d b) { - // CHECK-LABEL: @test_mm_maskz_rsqrt28_round_sd - // CHECK: @llvm.x86.avx512.rsqrt28.sd - return _mm_maskz_rsqrt28_round_sd(m, a, b, _MM_FROUND_NO_EXC); -} - -__m512d test_mm512_rcp28_round_pd(__m512d a) { - // CHECK-LABEL: @test_mm512_rcp28_round_pd - // CHECK: @llvm.x86.avx512.rcp28.pd - return _mm512_rcp28_round_pd(a, _MM_FROUND_NO_EXC); -} - -__m512d test_mm512_mask_rcp28_round_pd(__m512d s, __mmask8 m, __m512d a) { - // CHECK-LABEL: @test_mm512_mask_rcp28_round_pd - // CHECK: @llvm.x86.avx512.rcp28.pd - return _mm512_mask_rcp28_round_pd(s, m, a, _MM_FROUND_NO_EXC); -} - -__m512d test_mm512_maskz_rcp28_round_pd(__mmask8 m, __m512d a) { - // CHECK-LABEL: @test_mm512_maskz_rcp28_round_pd - // CHECK: @llvm.x86.avx512.rcp28.pd - return _mm512_maskz_rcp28_round_pd(m, a, _MM_FROUND_NO_EXC); -} - -__m512d test_mm512_rcp28_pd(__m512d a) { - // CHECK-LABEL: @test_mm512_rcp28_pd - // CHECK: @llvm.x86.avx512.rcp28.pd - return _mm512_rcp28_pd(a); -} - -__m512d test_mm512_mask_rcp28_pd(__m512d s, __mmask8 m, __m512d a) { - // CHECK-LABEL: @test_mm512_mask_rcp28_pd - // CHECK: @llvm.x86.avx512.rcp28.pd - return _mm512_mask_rcp28_pd(s, m, a); -} - -__m512d test_mm512_maskz_rcp28_pd(__mmask8 m, __m512d a) { - // CHECK-LABEL: @test_mm512_maskz_rcp28_pd - // CHECK: @llvm.x86.avx512.rcp28.pd - return _mm512_maskz_rcp28_pd(m, a); -} - -__m512 test_mm512_rcp28_round_ps(__m512 a) { - // CHECK-LABEL: @test_mm512_rcp28_round_ps - // CHECK: @llvm.x86.avx512.rcp28.ps - return _mm512_rcp28_round_ps(a, _MM_FROUND_NO_EXC); -} - -__m512 test_mm512_mask_rcp28_round_ps(__m512 s, __mmask16 m, __m512 a) { - // CHECK-LABEL: @test_mm512_mask_rcp28_round_ps - // CHECK: @llvm.x86.avx512.rcp28.ps - return _mm512_mask_rcp28_round_ps(s, m, a, _MM_FROUND_NO_EXC); -} - -__m512 test_mm512_maskz_rcp28_round_ps(__mmask16 m, __m512 a) { - // CHECK-LABEL: @test_mm512_maskz_rcp28_round_ps - // CHECK: @llvm.x86.avx512.rcp28.ps - return _mm512_maskz_rcp28_round_ps(m, a, _MM_FROUND_NO_EXC); -} - -__m512 test_mm512_rcp28_ps(__m512 a) { - // CHECK-LABEL: @test_mm512_rcp28_ps - // CHECK: @llvm.x86.avx512.rcp28.ps - return _mm512_rcp28_ps(a); -} - -__m512 test_mm512_mask_rcp28_ps(__m512 s, __mmask16 m, __m512 a) { - // CHECK-LABEL: @test_mm512_mask_rcp28_ps - // CHECK: @llvm.x86.avx512.rcp28.ps - return _mm512_mask_rcp28_ps(s, m, a); -} - -__m512 test_mm512_maskz_rcp28_ps(__mmask16 m, __m512 a) { - // CHECK-LABEL: @test_mm512_maskz_rcp28_ps - // CHECK: @llvm.x86.avx512.rcp28.ps - return _mm512_maskz_rcp28_ps(m, a); -} - -__m128 test_mm_rcp28_round_ss(__m128 a, __m128 b) { - // CHECK-LABEL: @test_mm_rcp28_round_ss - // CHECK: @llvm.x86.avx512.rcp28.ss - return _mm_rcp28_round_ss(a, b, _MM_FROUND_NO_EXC); -} - -__m128 test_mm_mask_rcp28_round_ss(__m128 s, __mmask16 m, __m128 a, __m128 b) { - // CHECK-LABEL: @test_mm_mask_rcp28_round_ss - // CHECK: @llvm.x86.avx512.rcp28.ss - return _mm_mask_rcp28_round_ss(s, m, a, b, _MM_FROUND_NO_EXC); -} - -__m128 test_mm_maskz_rcp28_round_ss(__mmask16 m, __m128 a, __m128 b) { - // CHECK-LABEL: @test_mm_maskz_rcp28_round_ss - // CHECK: @llvm.x86.avx512.rcp28.ss - return _mm_maskz_rcp28_round_ss(m, a, b, _MM_FROUND_NO_EXC); -} - -__m128 test_mm_rcp28_ss(__m128 a, __m128 b) { - // CHECK-LABEL: @test_mm_rcp28_ss - // CHECK: @llvm.x86.avx512.rcp28.ss - return _mm_rcp28_ss(a, b); -} - -__m128 test_mm_mask_rcp28_ss(__m128 s, __mmask16 m, __m128 a, __m128 b) { - // CHECK-LABEL: @test_mm_mask_rcp28_ss - // CHECK: @llvm.x86.avx512.rcp28.ss - return _mm_mask_rcp28_ss(s, m, a, b); -} - -__m128 test_mm_maskz_rcp28_ss(__mmask16 m, __m128 a, __m128 b) { - // CHECK-LABEL: @test_mm_maskz_rcp28_ss - // CHECK: @llvm.x86.avx512.rcp28.ss - return _mm_maskz_rcp28_ss(m, a, b); -} - -__m128d test_mm_rcp28_round_sd(__m128d a, __m128d b) { - // CHECK-LABEL: @test_mm_rcp28_round_sd - // CHECK: @llvm.x86.avx512.rcp28.sd - return _mm_rcp28_round_sd(a, b, _MM_FROUND_NO_EXC); -} - -__m128d test_mm_mask_rcp28_round_sd(__m128d s, __mmask8 m, __m128d a, __m128d b) { - // CHECK-LABEL: @test_mm_mask_rcp28_round_sd - // CHECK: @llvm.x86.avx512.rcp28.sd - return _mm_mask_rcp28_round_sd(s, m, a, b, _MM_FROUND_NO_EXC); -} - -__m128d test_mm_maskz_rcp28_round_sd(__mmask8 m, __m128d a, __m128d b) { - // CHECK-LABEL: @test_mm_maskz_rcp28_round_sd - // CHECK: @llvm.x86.avx512.rcp28.sd - return _mm_maskz_rcp28_round_sd(m, a, b, _MM_FROUND_NO_EXC); -} - -__m128d test_mm_rcp28_sd(__m128d a, __m128d b) { - // CHECK-LABEL: @test_mm_rcp28_sd - // CHECK: @llvm.x86.avx512.rcp28.sd - return _mm_rcp28_sd(a, b); -} - -__m128d test_mm_mask_rcp28_sd(__m128d s, __mmask8 m, __m128d a, __m128d b) { - // CHECK-LABEL: @test_mm_mask_rcp28_sd - // CHECK: @llvm.x86.avx512.rcp28.sd - return _mm_mask_rcp28_sd(s, m, a, b); -} - -__m128d test_mm_maskz_rcp28_sd(__mmask8 m, __m128d a, __m128d b) { - // CHECK-LABEL: @test_mm_maskz_rcp28_sd - // CHECK: @llvm.x86.avx512.rcp28.sd - return _mm_maskz_rcp28_sd(m, a, b); -} - -__m512d test_mm512_exp2a23_round_pd(__m512d a) { - // CHECK-LABEL: @test_mm512_exp2a23_round_pd - // CHECK: @llvm.x86.avx512.exp2.pd - return _mm512_exp2a23_round_pd(a, _MM_FROUND_NO_EXC); -} - -__m512d test_mm512_mask_exp2a23_round_pd(__m512d s, __mmask8 m, __m512d a) { - // CHECK-LABEL: @test_mm512_mask_exp2a23_round_pd - // CHECK: @llvm.x86.avx512.exp2.pd - return _mm512_mask_exp2a23_round_pd(s, m, a, _MM_FROUND_NO_EXC); -} - -__m512d test_mm512_maskz_exp2a23_round_pd(__mmask8 m, __m512d a) { - // CHECK-LABEL: @test_mm512_maskz_exp2a23_round_pd - // CHECK: @llvm.x86.avx512.exp2.pd - return _mm512_maskz_exp2a23_round_pd(m, a, _MM_FROUND_NO_EXC); -} - -__m512d test_mm512_exp2a23_pd(__m512d a) { - // CHECK-LABEL: @test_mm512_exp2a23_pd - // CHECK: @llvm.x86.avx512.exp2.pd - return _mm512_exp2a23_pd(a); -} - -__m512d test_mm512_mask_exp2a23_pd(__m512d s, __mmask8 m, __m512d a) { - // CHECK-LABEL: @test_mm512_mask_exp2a23_pd - // CHECK: @llvm.x86.avx512.exp2.pd - return _mm512_mask_exp2a23_pd(s, m, a); -} - -__m512d test_mm512_maskz_exp2a23_pd(__mmask8 m, __m512d a) { - // CHECK-LABEL: @test_mm512_maskz_exp2a23_pd - // CHECK: @llvm.x86.avx512.exp2.pd - return _mm512_maskz_exp2a23_pd(m, a); -} - -__m512 test_mm512_exp2a23_round_ps(__m512 a) { - // CHECK-LABEL: @test_mm512_exp2a23_round_ps - // CHECK: @llvm.x86.avx512.exp2.ps - return _mm512_exp2a23_round_ps(a, _MM_FROUND_NO_EXC); -} - -__m512 test_mm512_mask_exp2a23_round_ps(__m512 s, __mmask16 m, __m512 a) { - // CHECK-LABEL: @test_mm512_mask_exp2a23_round_ps - // CHECK: @llvm.x86.avx512.exp2.ps - return _mm512_mask_exp2a23_round_ps(s, m, a, _MM_FROUND_NO_EXC); -} - -__m512 test_mm512_maskz_exp2a23_round_ps(__mmask16 m, __m512 a) { - // CHECK-LABEL: @test_mm512_maskz_exp2a23_round_ps - // CHECK: @llvm.x86.avx512.exp2.ps - return _mm512_maskz_exp2a23_round_ps(m, a, _MM_FROUND_NO_EXC); -} - -__m512 test_mm512_exp2a23_ps(__m512 a) { - // CHECK-LABEL: @test_mm512_exp2a23_ps - // CHECK: @llvm.x86.avx512.exp2.ps - return _mm512_exp2a23_ps(a); -} - -__m512 test_mm512_mask_exp2a23_ps(__m512 s, __mmask16 m, __m512 a) { - // CHECK-LABEL: @test_mm512_mask_exp2a23_ps - // CHECK: @llvm.x86.avx512.exp2.ps - return _mm512_mask_exp2a23_ps(s, m, a); -} - -__m512 test_mm512_maskz_exp2a23_ps(__mmask16 m, __m512 a) { - // CHECK-LABEL: @test_mm512_maskz_exp2a23_ps - // CHECK: @llvm.x86.avx512.exp2.ps - return _mm512_maskz_exp2a23_ps(m, a); -} - diff --git a/clang/test/CodeGen/X86/avx512pf-builtins.c b/clang/test/CodeGen/X86/avx512pf-builtins.c deleted file mode 100644 index 3a117ed6a9460..0000000000000 --- a/clang/test/CodeGen/X86/avx512pf-builtins.c +++ /dev/null @@ -1,100 +0,0 @@ -// RUN: %clang_cc1 -flax-vector-conversions=none -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +avx512pf -emit-llvm -o - -Wall | FileCheck %s - - -#include - -void test_mm512_mask_prefetch_i32gather_pd(__m256i index, __mmask8 mask, void const *addr) { - // CHECK-LABEL: @test_mm512_mask_prefetch_i32gather_pd - // CHECK: @llvm.x86.avx512.gatherpf.dpd - return _mm512_mask_prefetch_i32gather_pd(index, mask, addr, 2, _MM_HINT_T0); -} - -void test_mm512_prefetch_i32gather_pd(__m256i index, void const *addr) { - // CHECK-LABEL: @test_mm512_prefetch_i32gather_pd - // CHECK: @llvm.x86.avx512.gatherpf.dpd - return _mm512_prefetch_i32gather_pd(index, addr, 2, _MM_HINT_T0); -} - -void test_mm512_mask_prefetch_i32gather_ps(__m512i index, __mmask16 mask, void const *addr) { - // CHECK-LABEL: @test_mm512_mask_prefetch_i32gather_ps - // CHECK: @llvm.x86.avx512.gatherpf.dps - return _mm512_mask_prefetch_i32gather_ps(index, mask, addr, 2, _MM_HINT_T0); -} - -void test_mm512_prefetch_i32gather_ps(__m512i index, void const *addr) { - // CHECK-LABEL: @test_mm512_prefetch_i32gather_ps - // CHECK: @llvm.x86.avx512.gatherpf.dps - return _mm512_prefetch_i32gather_ps(index, addr, 2, _MM_HINT_T0); -} - -void test_mm512_mask_prefetch_i64gather_pd(__m512i index, __mmask8 mask, void const *addr) { - // CHECK-LABEL: @test_mm512_mask_prefetch_i64gather_pd - // CHECK: @llvm.x86.avx512.gatherpf.qpd - return _mm512_mask_prefetch_i64gather_pd(index, mask, addr, 2, _MM_HINT_T0); -} - -void test_mm512_prefetch_i64gather_pd(__m512i index, void const *addr) { - // CHECK-LABEL: @test_mm512_prefetch_i64gather_pd - // CHECK: @llvm.x86.avx512.gatherpf.qpd - return _mm512_prefetch_i64gather_pd(index, addr, 2, _MM_HINT_T0); -} - -void test_mm512_mask_prefetch_i64gather_ps(__m512i index, __mmask8 mask, void const *addr) { - // CHECK-LABEL: @test_mm512_mask_prefetch_i64gather_ps - // CHECK: @llvm.x86.avx512.gatherpf.qps - return _mm512_mask_prefetch_i64gather_ps(index, mask, addr, 2, _MM_HINT_T0); -} - -void test_mm512_prefetch_i64gather_ps(__m512i index, void const *addr) { - // CHECK-LABEL: @test_mm512_prefetch_i64gather_ps - // CHECK: @llvm.x86.avx512.gatherpf.qps - return _mm512_prefetch_i64gather_ps(index, addr, 2, _MM_HINT_T0); -} - -void test_mm512_prefetch_i32scatter_pd(void *addr, __m256i index) { - // CHECK-LABEL: @test_mm512_prefetch_i32scatter_pd - // CHECK: @llvm.x86.avx512.scatterpf.dpd.512 - return _mm512_prefetch_i32scatter_pd(addr, index, 1, _MM_HINT_T1); -} - -void test_mm512_mask_prefetch_i32scatter_pd(void *addr, __mmask8 mask, __m256i index) { - // CHECK-LABEL: @test_mm512_mask_prefetch_i32scatter_pd - // CHECK: @llvm.x86.avx512.scatterpf.dpd.512 - return _mm512_mask_prefetch_i32scatter_pd(addr, mask, index, 1, _MM_HINT_T1); -} - -void test_mm512_prefetch_i32scatter_ps(void *addr, __m512i index) { - // CHECK-LABEL: @test_mm512_prefetch_i32scatter_ps - // CHECK: @llvm.x86.avx512.scatterpf.dps.512 - return _mm512_prefetch_i32scatter_ps(addr, index, 1, _MM_HINT_T1); -} - -void test_mm512_mask_prefetch_i32scatter_ps(void *addr, __mmask16 mask, __m512i index) { - // CHECK-LABEL: @test_mm512_mask_prefetch_i32scatter_ps - // CHECK: @llvm.x86.avx512.scatterpf.dps.512 - return _mm512_mask_prefetch_i32scatter_ps(addr, mask, index, 1, _MM_HINT_T1); -} - -void test_mm512_prefetch_i64scatter_pd(void *addr, __m512i index) { - // CHECK-LABEL: @test_mm512_prefetch_i64scatter_pd - // CHECK: @llvm.x86.avx512.scatterpf.qpd.512 - return _mm512_prefetch_i64scatter_pd(addr, index, 1, _MM_HINT_T1); -} - -void test_mm512_mask_prefetch_i64scatter_pd(void *addr, __mmask16 mask, __m512i index) { - // CHECK-LABEL: @test_mm512_mask_prefetch_i64scatter_pd - // CHECK: @llvm.x86.avx512.scatterpf.qpd.512 - return _mm512_mask_prefetch_i64scatter_pd(addr, mask, index, 1, _MM_HINT_T1); -} - -void test_mm512_prefetch_i64scatter_ps(void *addr, __m512i index) { - // CHECK-LABEL: @test_mm512_prefetch_i64scatter_ps - // CHECK: @llvm.x86.avx512.scatterpf.qps.512 - return _mm512_prefetch_i64scatter_ps(addr, index, 1, _MM_HINT_T1); -} - -void test_mm512_mask_prefetch_i64scatter_ps(void *addr, __mmask16 mask, __m512i index) { - // CHECK-LABEL: @test_mm512_mask_prefetch_i64scatter_ps - // CHECK: @llvm.x86.avx512.scatterpf.qps.512 - return _mm512_mask_prefetch_i64scatter_ps(addr, mask, index, 1, _MM_HINT_T1); -} diff --git a/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_reinterpret_svcount_svbool.c b/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_reinterpret_svcount_svbool.c index c442d2c0c4750..d894e98451b41 100644 --- a/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_reinterpret_svcount_svbool.c +++ b/clang/test/CodeGen/aarch64-sme2-intrinsics/acle_sme2_reinterpret_svcount_svbool.c @@ -2,12 +2,14 @@ // REQUIRES: aarch64-registered-target +// RUN: %clang_cc1 -triple aarch64 -target-feature +sve2p1 -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s +// RUN: %clang_cc1 -triple aarch64 -target-feature +sve2p1 -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK // RUN: %clang_cc1 -triple aarch64 -target-feature +sme2 -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s // RUN: %clang_cc1 -triple aarch64 -target-feature +sme2 -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK // RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64 -target-feature +sme2 -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s // RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64 -target-feature +sme2 -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -p mem2reg,instcombine,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK -#include +#include #if defined __ARM_FEATURE_SME #define MODE_ATTR __arm_streaming @@ -16,7 +18,7 @@ #endif #ifdef SVE_OVERLOADED_FORMS -// A simple used,unused... macro, long enough to represent any SVE builtin.§ +// A simple used,unused... macro, long enough to represent any SVE builtin. #define SVE_ACLE_FUNC(A1,A2_UNUSED,A3,A4_UNUSED) A1##A3 #else #define SVE_ACLE_FUNC(A1,A2,A3,A4) A1##A2##A3##A4 diff --git a/clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_reinterpret-bfloat.c b/clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_reinterpret-bfloat.c index bf2cd23e40802..41208bfb1f435 100644 --- a/clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_reinterpret-bfloat.c +++ b/clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_reinterpret-bfloat.c @@ -4,6 +4,10 @@ // RUN: %clang_cc1 -fclang-abi-compat=latest -DTUPLE=x2 -triple aarch64 -target-feature +sve -target-feature +bf16 -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -passes=mem2reg,tailcallelim | FileCheck %s -check-prefix=TUPLE2 // RUN: %clang_cc1 -fclang-abi-compat=latest -DTUPLE=x3 -triple aarch64 -target-feature +sve -target-feature +bf16 -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -passes=mem2reg,tailcallelim | FileCheck %s -check-prefix=TUPLE3 // RUN: %clang_cc1 -fclang-abi-compat=latest -DTUPLE=x4 -triple aarch64 -target-feature +sve -target-feature +bf16 -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -passes=mem2reg,tailcallelim | FileCheck %s -check-prefix=TUPLE4 +// RUN: %clang_cc1 -fclang-abi-compat=latest -triple aarch64 -target-feature +sme -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -passes=mem2reg,tailcallelim | FileCheck %s +// RUN: %clang_cc1 -fclang-abi-compat=latest -DTUPLE=x2 -triple aarch64 -target-feature +sme -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -passes=mem2reg,tailcallelim | FileCheck %s -check-prefix=TUPLE2 +// RUN: %clang_cc1 -fclang-abi-compat=latest -DTUPLE=x3 -triple aarch64 -target-feature +sme -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -passes=mem2reg,tailcallelim | FileCheck %s -check-prefix=TUPLE3 +// RUN: %clang_cc1 -fclang-abi-compat=latest -DTUPLE=x4 -triple aarch64 -target-feature +sme -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -passes=mem2reg,tailcallelim | FileCheck %s -check-prefix=TUPLE4 // RUN: %clang_cc1 -fclang-abi-compat=latest -triple aarch64 -target-feature +sve -target-feature +bf16 -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -passes=mem2reg,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK // RUN: %clang_cc1 -fclang-abi-compat=latest -DTUPLE=x2 -triple aarch64 -target-feature +sve -target-feature +bf16 -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -passes=mem2reg,tailcallelim | FileCheck %s -check-prefix=CPP-TUPLE2 // RUN: %clang_cc1 -fclang-abi-compat=latest -DTUPLE=x3 -triple aarch64 -target-feature +sve -target-feature +bf16 -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -passes=mem2reg,tailcallelim | FileCheck %s -check-prefix=CPP-TUPLE3 @@ -18,9 +22,16 @@ // RUN: %clang_cc1 -fclang-abi-compat=latest -DSVE_OVERLOADED_FORMS -DTUPLE=x4 -triple aarch64 -target-feature +sve -target-feature +bf16 -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -passes=mem2reg,tailcallelim | FileCheck %s -check-prefix=CPP-TUPLE4 // RUN: %clang_cc1 -fclang-abi-compat=latest -triple aarch64 -target-feature +sve -target-feature +bf16 -S -disable-O0-optnone -Werror -Wall -o /dev/null %s +// RUN: %clang_cc1 -fclang-abi-compat=latest -triple aarch64 -target-feature +sme -S -disable-O0-optnone -Werror -Wall -o /dev/null %s #include +#if defined __ARM_FEATURE_SME +#define MODE_ATTR __arm_streaming +#else +#define MODE_ATTR +#endif + #ifdef TUPLE #define TYPE_1(base,tuple) base ## tuple ## _t #define TYPE_0(base,tuple) TYPE_1(base,tuple) @@ -81,7 +92,7 @@ // CPP-TUPLE4-NEXT: [[TMP0:%.*]] = bitcast [[OP:%.*]] to // CPP-TUPLE4-NEXT: ret [[TMP0]] // -TYPE(svint8) test_svreinterpret_s8_bf16(TYPE(svbfloat16) op) { +TYPE(svint8) test_svreinterpret_s8_bf16(TYPE(svbfloat16) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_s8, _bf16)(op); } @@ -125,7 +136,7 @@ TYPE(svint8) test_svreinterpret_s8_bf16(TYPE(svbfloat16) op) { // CPP-TUPLE4-NEXT: [[TMP0:%.*]] = bitcast [[OP:%.*]] to // CPP-TUPLE4-NEXT: ret [[TMP0]] // -TYPE(svint16) test_svreinterpret_s16_bf16(TYPE(svbfloat16) op) { +TYPE(svint16) test_svreinterpret_s16_bf16(TYPE(svbfloat16) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_s16, _bf16)(op); } @@ -169,7 +180,7 @@ TYPE(svint16) test_svreinterpret_s16_bf16(TYPE(svbfloat16) op) { // CPP-TUPLE4-NEXT: [[TMP0:%.*]] = bitcast [[OP:%.*]] to // CPP-TUPLE4-NEXT: ret [[TMP0]] // -TYPE(svint32) test_svreinterpret_s32_bf16(TYPE(svbfloat16) op) { +TYPE(svint32) test_svreinterpret_s32_bf16(TYPE(svbfloat16) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_s32, _bf16)(op); } // CHECK-LABEL: @test_svreinterpret_s64_bf16( @@ -212,7 +223,7 @@ TYPE(svint32) test_svreinterpret_s32_bf16(TYPE(svbfloat16) op) { // CPP-TUPLE4-NEXT: [[TMP0:%.*]] = bitcast [[OP:%.*]] to // CPP-TUPLE4-NEXT: ret [[TMP0]] // -TYPE(svint64) test_svreinterpret_s64_bf16(TYPE(svbfloat16) op) { +TYPE(svint64) test_svreinterpret_s64_bf16(TYPE(svbfloat16) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_s64, _bf16)(op); } @@ -256,7 +267,7 @@ TYPE(svint64) test_svreinterpret_s64_bf16(TYPE(svbfloat16) op) { // CPP-TUPLE4-NEXT: [[TMP0:%.*]] = bitcast [[OP:%.*]] to // CPP-TUPLE4-NEXT: ret [[TMP0]] // -TYPE(svuint8) test_svreinterpret_u8_bf16(TYPE(svbfloat16) op) { +TYPE(svuint8) test_svreinterpret_u8_bf16(TYPE(svbfloat16) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_u8, _bf16)(op); } @@ -300,7 +311,7 @@ TYPE(svuint8) test_svreinterpret_u8_bf16(TYPE(svbfloat16) op) { // CPP-TUPLE4-NEXT: [[TMP0:%.*]] = bitcast [[OP:%.*]] to // CPP-TUPLE4-NEXT: ret [[TMP0]] // -TYPE(svuint16) test_svreinterpret_u16_bf16(TYPE(svbfloat16) op) { +TYPE(svuint16) test_svreinterpret_u16_bf16(TYPE(svbfloat16) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_u16, _bf16)(op); } @@ -344,7 +355,7 @@ TYPE(svuint16) test_svreinterpret_u16_bf16(TYPE(svbfloat16) op) { // CPP-TUPLE4-NEXT: [[TMP0:%.*]] = bitcast [[OP:%.*]] to // CPP-TUPLE4-NEXT: ret [[TMP0]] // -TYPE(svuint32) test_svreinterpret_u32_bf16(TYPE(svbfloat16) op) { +TYPE(svuint32) test_svreinterpret_u32_bf16(TYPE(svbfloat16) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_u32, _bf16)(op); } @@ -388,7 +399,7 @@ TYPE(svuint32) test_svreinterpret_u32_bf16(TYPE(svbfloat16) op) { // CPP-TUPLE4-NEXT: [[TMP0:%.*]] = bitcast [[OP:%.*]] to // CPP-TUPLE4-NEXT: ret [[TMP0]] // -TYPE(svuint64) test_svreinterpret_u64_bf16(TYPE(svbfloat16) op) { +TYPE(svuint64) test_svreinterpret_u64_bf16(TYPE(svbfloat16) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_u64, _bf16)(op); } @@ -432,7 +443,7 @@ TYPE(svuint64) test_svreinterpret_u64_bf16(TYPE(svbfloat16) op) { // CPP-TUPLE4-NEXT: [[TMP0:%.*]] = bitcast [[OP:%.*]] to // CPP-TUPLE4-NEXT: ret [[TMP0]] // -TYPE(svbfloat16) test_svreinterpret_bf16_s8(TYPE(svint8) op) { +TYPE(svbfloat16) test_svreinterpret_bf16_s8(TYPE(svint8) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_bf16, _s8)(op); } @@ -476,7 +487,7 @@ TYPE(svbfloat16) test_svreinterpret_bf16_s8(TYPE(svint8) op) { // CPP-TUPLE4-NEXT: [[TMP0:%.*]] = bitcast [[OP:%.*]] to // CPP-TUPLE4-NEXT: ret [[TMP0]] // -TYPE(svbfloat16) test_svreinterpret_bf16_s16(TYPE(svint16) op) { +TYPE(svbfloat16) test_svreinterpret_bf16_s16(TYPE(svint16) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_bf16, _s16)(op); } @@ -520,7 +531,7 @@ TYPE(svbfloat16) test_svreinterpret_bf16_s16(TYPE(svint16) op) { // CPP-TUPLE4-NEXT: [[TMP0:%.*]] = bitcast [[OP:%.*]] to // CPP-TUPLE4-NEXT: ret [[TMP0]] // -TYPE(svbfloat16) test_svreinterpret_bf16_s32(TYPE(svint32) op) { +TYPE(svbfloat16) test_svreinterpret_bf16_s32(TYPE(svint32) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_bf16, _s32)(op); } @@ -564,7 +575,7 @@ TYPE(svbfloat16) test_svreinterpret_bf16_s32(TYPE(svint32) op) { // CPP-TUPLE4-NEXT: [[TMP0:%.*]] = bitcast [[OP:%.*]] to // CPP-TUPLE4-NEXT: ret [[TMP0]] // -TYPE(svbfloat16) test_svreinterpret_bf16_s64(TYPE(svint64) op) { +TYPE(svbfloat16) test_svreinterpret_bf16_s64(TYPE(svint64) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_bf16, _s64)(op); } @@ -608,7 +619,7 @@ TYPE(svbfloat16) test_svreinterpret_bf16_s64(TYPE(svint64) op) { // CPP-TUPLE4-NEXT: [[TMP0:%.*]] = bitcast [[OP:%.*]] to // CPP-TUPLE4-NEXT: ret [[TMP0]] // -TYPE(svbfloat16) test_svreinterpret_bf16_u8(TYPE(svuint8) op) { +TYPE(svbfloat16) test_svreinterpret_bf16_u8(TYPE(svuint8) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_bf16, _u8)(op); } @@ -652,7 +663,7 @@ TYPE(svbfloat16) test_svreinterpret_bf16_u8(TYPE(svuint8) op) { // CPP-TUPLE4-NEXT: [[TMP0:%.*]] = bitcast [[OP:%.*]] to // CPP-TUPLE4-NEXT: ret [[TMP0]] // -TYPE(svbfloat16) test_svreinterpret_bf16_u16(TYPE(svuint16) op) { +TYPE(svbfloat16) test_svreinterpret_bf16_u16(TYPE(svuint16) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_bf16, _u16)(op); } @@ -696,7 +707,7 @@ TYPE(svbfloat16) test_svreinterpret_bf16_u16(TYPE(svuint16) op) { // CPP-TUPLE4-NEXT: [[TMP0:%.*]] = bitcast [[OP:%.*]] to // CPP-TUPLE4-NEXT: ret [[TMP0]] // -TYPE(svbfloat16) test_svreinterpret_bf16_u32(TYPE(svuint32) op) { +TYPE(svbfloat16) test_svreinterpret_bf16_u32(TYPE(svuint32) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_bf16, _u32)(op); } @@ -740,7 +751,7 @@ TYPE(svbfloat16) test_svreinterpret_bf16_u32(TYPE(svuint32) op) { // CPP-TUPLE4-NEXT: [[TMP0:%.*]] = bitcast [[OP:%.*]] to // CPP-TUPLE4-NEXT: ret [[TMP0]] // -TYPE(svbfloat16) test_svreinterpret_bf16_u64(TYPE(svuint64) op) { +TYPE(svbfloat16) test_svreinterpret_bf16_u64(TYPE(svuint64) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_bf16, _u64)(op); } @@ -776,7 +787,7 @@ TYPE(svbfloat16) test_svreinterpret_bf16_u64(TYPE(svuint64) op) { // CPP-TUPLE4-NEXT: entry: // CPP-TUPLE4-NEXT: ret [[OP:%.*]] // -TYPE(svbfloat16) test_svreinterpret_bf16_bf16(TYPE(svbfloat16) op) { +TYPE(svbfloat16) test_svreinterpret_bf16_bf16(TYPE(svbfloat16) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_bf16, _bf16)(op); } @@ -820,7 +831,7 @@ TYPE(svbfloat16) test_svreinterpret_bf16_bf16(TYPE(svbfloat16) op) { // CPP-TUPLE4-NEXT: [[TMP0:%.*]] = bitcast [[OP:%.*]] to // CPP-TUPLE4-NEXT: ret [[TMP0]] // -TYPE(svbfloat16) test_svreinterpret_bf16_f16(TYPE(svfloat16) op) { +TYPE(svbfloat16) test_svreinterpret_bf16_f16(TYPE(svfloat16) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_bf16, _f16)(op); } @@ -864,7 +875,7 @@ TYPE(svbfloat16) test_svreinterpret_bf16_f16(TYPE(svfloat16) op) { // CPP-TUPLE4-NEXT: [[TMP0:%.*]] = bitcast [[OP:%.*]] to // CPP-TUPLE4-NEXT: ret [[TMP0]] // -TYPE(svbfloat16) test_svreinterpret_bf16_f32(TYPE(svfloat32) op) { +TYPE(svbfloat16) test_svreinterpret_bf16_f32(TYPE(svfloat32) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_bf16, _f32)(op); } @@ -908,7 +919,7 @@ TYPE(svbfloat16) test_svreinterpret_bf16_f32(TYPE(svfloat32) op) { // CPP-TUPLE4-NEXT: [[TMP0:%.*]] = bitcast [[OP:%.*]] to // CPP-TUPLE4-NEXT: ret [[TMP0]] // -TYPE(svbfloat16) test_svreinterpret_bf16_f64(TYPE(svfloat64) op) { +TYPE(svbfloat16) test_svreinterpret_bf16_f64(TYPE(svfloat64) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_bf16, _f64)(op); } @@ -952,7 +963,7 @@ TYPE(svbfloat16) test_svreinterpret_bf16_f64(TYPE(svfloat64) op) { // CPP-TUPLE4-NEXT: [[TMP0:%.*]] = bitcast [[OP:%.*]] to // CPP-TUPLE4-NEXT: ret [[TMP0]] // -TYPE(svfloat32) test_svreinterpret_f32_bf16(TYPE(svbfloat16) op) { +TYPE(svfloat32) test_svreinterpret_f32_bf16(TYPE(svbfloat16) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_f32, _bf16)(op); } @@ -996,7 +1007,7 @@ TYPE(svfloat32) test_svreinterpret_f32_bf16(TYPE(svbfloat16) op) { // CPP-TUPLE4-NEXT: [[TMP0:%.*]] = bitcast [[OP:%.*]] to // CPP-TUPLE4-NEXT: ret [[TMP0]] // -TYPE(svfloat16) test_svreinterpret_f16_bf16(TYPE(svbfloat16) op) { +TYPE(svfloat16) test_svreinterpret_f16_bf16(TYPE(svbfloat16) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_f16, _bf16)(op); } @@ -1040,6 +1051,6 @@ TYPE(svfloat16) test_svreinterpret_f16_bf16(TYPE(svbfloat16) op) { // CPP-TUPLE4-NEXT: [[TMP0:%.*]] = bitcast [[OP:%.*]] to // CPP-TUPLE4-NEXT: ret [[TMP0]] // -TYPE(svfloat64) test_svreinterpret_f64_bf16(TYPE(svbfloat16) op) { +TYPE(svfloat64) test_svreinterpret_f64_bf16(TYPE(svbfloat16) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_f64, _bf16)(op); } diff --git a/clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_reinterpret.c b/clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_reinterpret.c index 3d9d5c3ce45ae..e61bbf3e03d7e 100644 --- a/clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_reinterpret.c +++ b/clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_reinterpret.c @@ -4,6 +4,10 @@ // RUN: %clang_cc1 -DTUPLE=x2 -triple aarch64 -target-feature +sve -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -passes=mem2reg,tailcallelim | FileCheck %s -check-prefix=TUPLE2 // RUN: %clang_cc1 -DTUPLE=x3 -triple aarch64 -target-feature +sve -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -passes=mem2reg,tailcallelim | FileCheck %s -check-prefix=TUPLE3 // RUN: %clang_cc1 -DTUPLE=x4 -triple aarch64 -target-feature +sve -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -passes=mem2reg,tailcallelim | FileCheck %s -check-prefix=TUPLE4 +// RUN: %clang_cc1 -triple aarch64 -target-feature +sme -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -passes=mem2reg,tailcallelim | FileCheck %s +// RUN: %clang_cc1 -DTUPLE=x2 -triple aarch64 -target-feature +sme -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -passes=mem2reg,tailcallelim | FileCheck %s -check-prefix=TUPLE2 +// RUN: %clang_cc1 -DTUPLE=x3 -triple aarch64 -target-feature +sme -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -passes=mem2reg,tailcallelim | FileCheck %s -check-prefix=TUPLE3 +// RUN: %clang_cc1 -DTUPLE=x4 -triple aarch64 -target-feature +sme -disable-O0-optnone -Werror -Wall -emit-llvm -o - %s | opt -S -passes=mem2reg,tailcallelim | FileCheck %s -check-prefix=TUPLE4 // RUN: %clang_cc1 -triple aarch64 -target-feature +sve -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -passes=mem2reg,tailcallelim | FileCheck %s -check-prefix=CPP-CHECK // RUN: %clang_cc1 -DTUPLE=x2 -triple aarch64 -target-feature +sve -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -passes=mem2reg,tailcallelim | FileCheck %s -check-prefix=CPP-TUPLE2 // RUN: %clang_cc1 -DTUPLE=x3 -triple aarch64 -target-feature +sve -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -passes=mem2reg,tailcallelim | FileCheck %s -check-prefix=CPP-TUPLE3 @@ -17,9 +21,16 @@ // RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -DTUPLE=x3 -triple aarch64 -target-feature +sve -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -passes=mem2reg,tailcallelim | FileCheck %s -check-prefix=CPP-TUPLE3 // RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -DTUPLE=x4 -triple aarch64 -target-feature +sve -disable-O0-optnone -Werror -Wall -emit-llvm -o - -x c++ %s | opt -S -passes=mem2reg,tailcallelim | FileCheck %s -check-prefix=CPP-TUPLE4 // RUN: %clang_cc1 -triple aarch64 -target-feature +sve -S -disable-O0-optnone -Werror -Wall -o /dev/null %s +// RUN: %clang_cc1 -triple aarch64 -target-feature +sme -S -disable-O0-optnone -Werror -Wall -o /dev/null %s #include +#if defined __ARM_FEATURE_SME +#define MODE_ATTR __arm_streaming +#else +#define MODE_ATTR +#endif + #ifdef TUPLE #define TYPE_1(base,tuple) base ## tuple ## _t #define TYPE_0(base,tuple) TYPE_1(base,tuple) @@ -72,7 +83,7 @@ // CPP-TUPLE4-NEXT: entry: // CPP-TUPLE4-NEXT: ret [[OP:%.*]] // -TYPE(svint8) test_svreinterpret_s8_s8(TYPE(svint8) op) +TYPE(svint8) test_svreinterpret_s8_s8(TYPE(svint8) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_s8,_s8)(op); } @@ -117,7 +128,7 @@ TYPE(svint8) test_svreinterpret_s8_s8(TYPE(svint8) op) // CPP-TUPLE4-NEXT: [[TMP0:%.*]] = bitcast [[OP:%.*]] to // CPP-TUPLE4-NEXT: ret [[TMP0]] // -TYPE(svint8) test_svreinterpret_s8_s16(TYPE(svint16) op) +TYPE(svint8) test_svreinterpret_s8_s16(TYPE(svint16) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_s8,_s16)(op); } @@ -162,7 +173,7 @@ TYPE(svint8) test_svreinterpret_s8_s16(TYPE(svint16) op) // CPP-TUPLE4-NEXT: [[TMP0:%.*]] = bitcast [[OP:%.*]] to // CPP-TUPLE4-NEXT: ret [[TMP0]] // -TYPE(svint8) test_svreinterpret_s8_s32(TYPE(svint32) op) +TYPE(svint8) test_svreinterpret_s8_s32(TYPE(svint32) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_s8,_s32)(op); } @@ -207,7 +218,7 @@ TYPE(svint8) test_svreinterpret_s8_s32(TYPE(svint32) op) // CPP-TUPLE4-NEXT: [[TMP0:%.*]] = bitcast [[OP:%.*]] to // CPP-TUPLE4-NEXT: ret [[TMP0]] // -TYPE(svint8) test_svreinterpret_s8_s64(TYPE(svint64) op) +TYPE(svint8) test_svreinterpret_s8_s64(TYPE(svint64) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_s8,_s64)(op); } @@ -244,7 +255,7 @@ TYPE(svint8) test_svreinterpret_s8_s64(TYPE(svint64) op) // CPP-TUPLE4-NEXT: entry: // CPP-TUPLE4-NEXT: ret [[OP:%.*]] // -TYPE(svint8) test_svreinterpret_s8_u8(TYPE(svuint8) op) +TYPE(svint8) test_svreinterpret_s8_u8(TYPE(svuint8) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_s8,_u8)(op); } @@ -289,7 +300,7 @@ TYPE(svint8) test_svreinterpret_s8_u8(TYPE(svuint8) op) // CPP-TUPLE4-NEXT: [[TMP0:%.*]] = bitcast [[OP:%.*]] to // CPP-TUPLE4-NEXT: ret [[TMP0]] // -TYPE(svint8) test_svreinterpret_s8_u16(TYPE(svuint16) op) +TYPE(svint8) test_svreinterpret_s8_u16(TYPE(svuint16) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_s8,_u16)(op); } @@ -335,7 +346,7 @@ TYPE(svint8) test_svreinterpret_s8_u16(TYPE(svuint16) op) // CPP-TUPLE4-NEXT: [[TMP0:%.*]] = bitcast [[OP:%.*]] to // CPP-TUPLE4-NEXT: ret [[TMP0]] // -TYPE(svint8) test_svreinterpret_s8_u32(TYPE(svuint32) op) +TYPE(svint8) test_svreinterpret_s8_u32(TYPE(svuint32) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_s8,_u32)(op); } @@ -381,7 +392,7 @@ TYPE(svint8) test_svreinterpret_s8_u32(TYPE(svuint32) op) // CPP-TUPLE4-NEXT: [[TMP0:%.*]] = bitcast [[OP:%.*]] to // CPP-TUPLE4-NEXT: ret [[TMP0]] // -TYPE(svint8) test_svreinterpret_s8_u64(TYPE(svuint64) op) +TYPE(svint8) test_svreinterpret_s8_u64(TYPE(svuint64) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_s8,_u64)(op); } @@ -426,7 +437,7 @@ TYPE(svint8) test_svreinterpret_s8_u64(TYPE(svuint64) op) // CPP-TUPLE4-NEXT: [[TMP0:%.*]] = bitcast [[OP:%.*]] to // CPP-TUPLE4-NEXT: ret [[TMP0]] // -TYPE(svint8) test_svreinterpret_s8_f16(TYPE(svfloat16) op) +TYPE(svint8) test_svreinterpret_s8_f16(TYPE(svfloat16) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_s8,_f16)(op); } @@ -471,7 +482,7 @@ TYPE(svint8) test_svreinterpret_s8_f16(TYPE(svfloat16) op) // CPP-TUPLE4-NEXT: [[TMP0:%.*]] = bitcast [[OP:%.*]] to // CPP-TUPLE4-NEXT: ret [[TMP0]] // -TYPE(svint8) test_svreinterpret_s8_f32(TYPE(svfloat32) op) +TYPE(svint8) test_svreinterpret_s8_f32(TYPE(svfloat32) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_s8,_f32)(op); } @@ -516,7 +527,7 @@ TYPE(svint8) test_svreinterpret_s8_f32(TYPE(svfloat32) op) // CPP-TUPLE4-NEXT: [[TMP0:%.*]] = bitcast [[OP:%.*]] to // CPP-TUPLE4-NEXT: ret [[TMP0]] // -TYPE(svint8) test_svreinterpret_s8_f64(TYPE(svfloat64) op) +TYPE(svint8) test_svreinterpret_s8_f64(TYPE(svfloat64) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_s8,_f64)(op); } @@ -561,7 +572,7 @@ TYPE(svint8) test_svreinterpret_s8_f64(TYPE(svfloat64) op) // CPP-TUPLE4-NEXT: [[TMP0:%.*]] = bitcast [[OP:%.*]] to // CPP-TUPLE4-NEXT: ret [[TMP0]] // -TYPE(svint16) test_svreinterpret_s16_s8(TYPE(svint8) op) +TYPE(svint16) test_svreinterpret_s16_s8(TYPE(svint8) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_s16,_s8)(op); } @@ -598,7 +609,7 @@ TYPE(svint16) test_svreinterpret_s16_s8(TYPE(svint8) op) // CPP-TUPLE4-NEXT: entry: // CPP-TUPLE4-NEXT: ret [[OP:%.*]] // -TYPE(svint16) test_svreinterpret_s16_s16(TYPE(svint16) op) +TYPE(svint16) test_svreinterpret_s16_s16(TYPE(svint16) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_s16,_s16)(op); } @@ -643,7 +654,7 @@ TYPE(svint16) test_svreinterpret_s16_s16(TYPE(svint16) op) // CPP-TUPLE4-NEXT: [[TMP0:%.*]] = bitcast [[OP:%.*]] to // CPP-TUPLE4-NEXT: ret [[TMP0]] // -TYPE(svint16) test_svreinterpret_s16_s32(TYPE(svint32) op) +TYPE(svint16) test_svreinterpret_s16_s32(TYPE(svint32) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_s16,_s32)(op); } @@ -688,7 +699,7 @@ TYPE(svint16) test_svreinterpret_s16_s32(TYPE(svint32) op) // CPP-TUPLE4-NEXT: [[TMP0:%.*]] = bitcast [[OP:%.*]] to // CPP-TUPLE4-NEXT: ret [[TMP0]] // -TYPE(svint16) test_svreinterpret_s16_s64(TYPE(svint64) op) +TYPE(svint16) test_svreinterpret_s16_s64(TYPE(svint64) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_s16,_s64)(op); } @@ -733,7 +744,7 @@ TYPE(svint16) test_svreinterpret_s16_s64(TYPE(svint64) op) // CPP-TUPLE4-NEXT: [[TMP0:%.*]] = bitcast [[OP:%.*]] to // CPP-TUPLE4-NEXT: ret [[TMP0]] // -TYPE(svint16) test_svreinterpret_s16_u8(TYPE(svuint8) op) +TYPE(svint16) test_svreinterpret_s16_u8(TYPE(svuint8) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_s16,_u8)(op); } @@ -770,7 +781,7 @@ TYPE(svint16) test_svreinterpret_s16_u8(TYPE(svuint8) op) // CPP-TUPLE4-NEXT: entry: // CPP-TUPLE4-NEXT: ret [[OP:%.*]] // -TYPE(svint16) test_svreinterpret_s16_u16(TYPE(svuint16) op) +TYPE(svint16) test_svreinterpret_s16_u16(TYPE(svuint16) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_s16,_u16)(op); } @@ -815,7 +826,7 @@ TYPE(svint16) test_svreinterpret_s16_u16(TYPE(svuint16) op) // CPP-TUPLE4-NEXT: [[TMP0:%.*]] = bitcast [[OP:%.*]] to // CPP-TUPLE4-NEXT: ret [[TMP0]] // -TYPE(svint16) test_svreinterpret_s16_u32(TYPE(svuint32) op) +TYPE(svint16) test_svreinterpret_s16_u32(TYPE(svuint32) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_s16,_u32)(op); } @@ -860,7 +871,7 @@ TYPE(svint16) test_svreinterpret_s16_u32(TYPE(svuint32) op) // CPP-TUPLE4-NEXT: [[TMP0:%.*]] = bitcast [[OP:%.*]] to // CPP-TUPLE4-NEXT: ret [[TMP0]] // -TYPE(svint16) test_svreinterpret_s16_u64(TYPE(svuint64) op) +TYPE(svint16) test_svreinterpret_s16_u64(TYPE(svuint64) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_s16,_u64)(op); } @@ -905,7 +916,7 @@ TYPE(svint16) test_svreinterpret_s16_u64(TYPE(svuint64) op) // CPP-TUPLE4-NEXT: [[TMP0:%.*]] = bitcast [[OP:%.*]] to // CPP-TUPLE4-NEXT: ret [[TMP0]] // -TYPE(svint16) test_svreinterpret_s16_f16(TYPE(svfloat16) op) +TYPE(svint16) test_svreinterpret_s16_f16(TYPE(svfloat16) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_s16,_f16)(op); } @@ -950,7 +961,7 @@ TYPE(svint16) test_svreinterpret_s16_f16(TYPE(svfloat16) op) // CPP-TUPLE4-NEXT: [[TMP0:%.*]] = bitcast [[OP:%.*]] to // CPP-TUPLE4-NEXT: ret [[TMP0]] // -TYPE(svint16) test_svreinterpret_s16_f32(TYPE(svfloat32) op) +TYPE(svint16) test_svreinterpret_s16_f32(TYPE(svfloat32) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_s16,_f32)(op); } @@ -995,7 +1006,7 @@ TYPE(svint16) test_svreinterpret_s16_f32(TYPE(svfloat32) op) // CPP-TUPLE4-NEXT: [[TMP0:%.*]] = bitcast [[OP:%.*]] to // CPP-TUPLE4-NEXT: ret [[TMP0]] // -TYPE(svint16) test_svreinterpret_s16_f64(TYPE(svfloat64) op) +TYPE(svint16) test_svreinterpret_s16_f64(TYPE(svfloat64) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_s16,_f64)(op); } @@ -1040,7 +1051,7 @@ TYPE(svint16) test_svreinterpret_s16_f64(TYPE(svfloat64) op) // CPP-TUPLE4-NEXT: [[TMP0:%.*]] = bitcast [[OP:%.*]] to // CPP-TUPLE4-NEXT: ret [[TMP0]] // -TYPE(svint32) test_svreinterpret_s32_s8(TYPE(svint8) op) +TYPE(svint32) test_svreinterpret_s32_s8(TYPE(svint8) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_s32,_s8)(op); } @@ -1085,7 +1096,7 @@ TYPE(svint32) test_svreinterpret_s32_s8(TYPE(svint8) op) // CPP-TUPLE4-NEXT: [[TMP0:%.*]] = bitcast [[OP:%.*]] to // CPP-TUPLE4-NEXT: ret [[TMP0]] // -TYPE(svint32) test_svreinterpret_s32_s16(TYPE(svint16) op) +TYPE(svint32) test_svreinterpret_s32_s16(TYPE(svint16) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_s32,_s16)(op); } @@ -1122,7 +1133,7 @@ TYPE(svint32) test_svreinterpret_s32_s16(TYPE(svint16) op) // CPP-TUPLE4-NEXT: entry: // CPP-TUPLE4-NEXT: ret [[OP:%.*]] // -TYPE(svint32) test_svreinterpret_s32_s32(TYPE(svint32) op) +TYPE(svint32) test_svreinterpret_s32_s32(TYPE(svint32) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_s32,_s32)(op); } @@ -1167,7 +1178,7 @@ TYPE(svint32) test_svreinterpret_s32_s32(TYPE(svint32) op) // CPP-TUPLE4-NEXT: [[TMP0:%.*]] = bitcast [[OP:%.*]] to // CPP-TUPLE4-NEXT: ret [[TMP0]] // -TYPE(svint32) test_svreinterpret_s32_s64(TYPE(svint64) op) +TYPE(svint32) test_svreinterpret_s32_s64(TYPE(svint64) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_s32,_s64)(op); } @@ -1212,7 +1223,7 @@ TYPE(svint32) test_svreinterpret_s32_s64(TYPE(svint64) op) // CPP-TUPLE4-NEXT: [[TMP0:%.*]] = bitcast [[OP:%.*]] to // CPP-TUPLE4-NEXT: ret [[TMP0]] // -TYPE(svint32) test_svreinterpret_s32_u8(TYPE(svuint8) op) +TYPE(svint32) test_svreinterpret_s32_u8(TYPE(svuint8) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_s32,_u8)(op); } @@ -1257,7 +1268,7 @@ TYPE(svint32) test_svreinterpret_s32_u8(TYPE(svuint8) op) // CPP-TUPLE4-NEXT: [[TMP0:%.*]] = bitcast [[OP:%.*]] to // CPP-TUPLE4-NEXT: ret [[TMP0]] // -TYPE(svint32) test_svreinterpret_s32_u16(TYPE(svuint16) op) +TYPE(svint32) test_svreinterpret_s32_u16(TYPE(svuint16) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_s32,_u16)(op); } @@ -1294,7 +1305,7 @@ TYPE(svint32) test_svreinterpret_s32_u16(TYPE(svuint16) op) // CPP-TUPLE4-NEXT: entry: // CPP-TUPLE4-NEXT: ret [[OP:%.*]] // -TYPE(svint32) test_svreinterpret_s32_u32(TYPE(svuint32) op) +TYPE(svint32) test_svreinterpret_s32_u32(TYPE(svuint32) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_s32,_u32)(op); } @@ -1339,7 +1350,7 @@ TYPE(svint32) test_svreinterpret_s32_u32(TYPE(svuint32) op) // CPP-TUPLE4-NEXT: [[TMP0:%.*]] = bitcast [[OP:%.*]] to // CPP-TUPLE4-NEXT: ret [[TMP0]] // -TYPE(svint32) test_svreinterpret_s32_u64(TYPE(svuint64) op) +TYPE(svint32) test_svreinterpret_s32_u64(TYPE(svuint64) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_s32,_u64)(op); } @@ -1384,7 +1395,7 @@ TYPE(svint32) test_svreinterpret_s32_u64(TYPE(svuint64) op) // CPP-TUPLE4-NEXT: [[TMP0:%.*]] = bitcast [[OP:%.*]] to // CPP-TUPLE4-NEXT: ret [[TMP0]] // -TYPE(svint32) test_svreinterpret_s32_f16(TYPE(svfloat16) op) +TYPE(svint32) test_svreinterpret_s32_f16(TYPE(svfloat16) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_s32,_f16)(op); } @@ -1429,7 +1440,7 @@ TYPE(svint32) test_svreinterpret_s32_f16(TYPE(svfloat16) op) // CPP-TUPLE4-NEXT: [[TMP0:%.*]] = bitcast [[OP:%.*]] to // CPP-TUPLE4-NEXT: ret [[TMP0]] // -TYPE(svint32) test_svreinterpret_s32_f32(TYPE(svfloat32) op) +TYPE(svint32) test_svreinterpret_s32_f32(TYPE(svfloat32) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_s32,_f32)(op); } @@ -1475,7 +1486,7 @@ TYPE(svint32) test_svreinterpret_s32_f32(TYPE(svfloat32) op) // CPP-TUPLE4-NEXT: [[TMP0:%.*]] = bitcast [[OP:%.*]] to // CPP-TUPLE4-NEXT: ret [[TMP0]] // -TYPE(svint32) test_svreinterpret_s32_f64(TYPE(svfloat64) op) +TYPE(svint32) test_svreinterpret_s32_f64(TYPE(svfloat64) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_s32,_f64)(op); } @@ -1520,7 +1531,7 @@ TYPE(svint32) test_svreinterpret_s32_f64(TYPE(svfloat64) op) // CPP-TUPLE4-NEXT: [[TMP0:%.*]] = bitcast [[OP:%.*]] to // CPP-TUPLE4-NEXT: ret [[TMP0]] // -TYPE(svint64) test_svreinterpret_s64_s8(TYPE(svint8) op) +TYPE(svint64) test_svreinterpret_s64_s8(TYPE(svint8) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_s64,_s8)(op); } @@ -1565,7 +1576,7 @@ TYPE(svint64) test_svreinterpret_s64_s8(TYPE(svint8) op) // CPP-TUPLE4-NEXT: [[TMP0:%.*]] = bitcast [[OP:%.*]] to // CPP-TUPLE4-NEXT: ret [[TMP0]] // -TYPE(svint64) test_svreinterpret_s64_s16(TYPE(svint16) op) +TYPE(svint64) test_svreinterpret_s64_s16(TYPE(svint16) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_s64,_s16)(op); } @@ -1610,7 +1621,7 @@ TYPE(svint64) test_svreinterpret_s64_s16(TYPE(svint16) op) // CPP-TUPLE4-NEXT: [[TMP0:%.*]] = bitcast [[OP:%.*]] to // CPP-TUPLE4-NEXT: ret [[TMP0]] // -TYPE(svint64) test_svreinterpret_s64_s32(TYPE(svint32) op) +TYPE(svint64) test_svreinterpret_s64_s32(TYPE(svint32) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_s64,_s32)(op); } @@ -1647,7 +1658,7 @@ TYPE(svint64) test_svreinterpret_s64_s32(TYPE(svint32) op) // CPP-TUPLE4-NEXT: entry: // CPP-TUPLE4-NEXT: ret [[OP:%.*]] // -TYPE(svint64) test_svreinterpret_s64_s64(TYPE(svint64) op) +TYPE(svint64) test_svreinterpret_s64_s64(TYPE(svint64) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_s64,_s64)(op); } @@ -1692,7 +1703,7 @@ TYPE(svint64) test_svreinterpret_s64_s64(TYPE(svint64) op) // CPP-TUPLE4-NEXT: [[TMP0:%.*]] = bitcast [[OP:%.*]] to // CPP-TUPLE4-NEXT: ret [[TMP0]] // -TYPE(svint64) test_svreinterpret_s64_u8(TYPE(svuint8) op) +TYPE(svint64) test_svreinterpret_s64_u8(TYPE(svuint8) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_s64,_u8)(op); } @@ -1737,7 +1748,7 @@ TYPE(svint64) test_svreinterpret_s64_u8(TYPE(svuint8) op) // CPP-TUPLE4-NEXT: [[TMP0:%.*]] = bitcast [[OP:%.*]] to // CPP-TUPLE4-NEXT: ret [[TMP0]] // -TYPE(svint64) test_svreinterpret_s64_u16(TYPE(svuint16) op) +TYPE(svint64) test_svreinterpret_s64_u16(TYPE(svuint16) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_s64,_u16)(op); } @@ -1782,7 +1793,7 @@ TYPE(svint64) test_svreinterpret_s64_u16(TYPE(svuint16) op) // CPP-TUPLE4-NEXT: [[TMP0:%.*]] = bitcast [[OP:%.*]] to // CPP-TUPLE4-NEXT: ret [[TMP0]] // -TYPE(svint64) test_svreinterpret_s64_u32(TYPE(svuint32) op) +TYPE(svint64) test_svreinterpret_s64_u32(TYPE(svuint32) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_s64,_u32)(op); } @@ -1819,7 +1830,7 @@ TYPE(svint64) test_svreinterpret_s64_u32(TYPE(svuint32) op) // CPP-TUPLE4-NEXT: entry: // CPP-TUPLE4-NEXT: ret [[OP:%.*]] // -TYPE(svint64) test_svreinterpret_s64_u64(TYPE(svuint64) op) +TYPE(svint64) test_svreinterpret_s64_u64(TYPE(svuint64) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_s64,_u64)(op); } @@ -1864,7 +1875,7 @@ TYPE(svint64) test_svreinterpret_s64_u64(TYPE(svuint64) op) // CPP-TUPLE4-NEXT: [[TMP0:%.*]] = bitcast [[OP:%.*]] to // CPP-TUPLE4-NEXT: ret [[TMP0]] // -TYPE(svint64) test_svreinterpret_s64_f16(TYPE(svfloat16) op) +TYPE(svint64) test_svreinterpret_s64_f16(TYPE(svfloat16) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_s64,_f16)(op); } @@ -1909,7 +1920,7 @@ TYPE(svint64) test_svreinterpret_s64_f16(TYPE(svfloat16) op) // CPP-TUPLE4-NEXT: [[TMP0:%.*]] = bitcast [[OP:%.*]] to // CPP-TUPLE4-NEXT: ret [[TMP0]] // -TYPE(svint64) test_svreinterpret_s64_f32(TYPE(svfloat32) op) +TYPE(svint64) test_svreinterpret_s64_f32(TYPE(svfloat32) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_s64,_f32)(op); } @@ -1954,7 +1965,7 @@ TYPE(svint64) test_svreinterpret_s64_f32(TYPE(svfloat32) op) // CPP-TUPLE4-NEXT: [[TMP0:%.*]] = bitcast [[OP:%.*]] to // CPP-TUPLE4-NEXT: ret [[TMP0]] // -TYPE(svint64) test_svreinterpret_s64_f64(TYPE(svfloat64) op) +TYPE(svint64) test_svreinterpret_s64_f64(TYPE(svfloat64) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_s64,_f64)(op); } @@ -1991,7 +2002,7 @@ TYPE(svint64) test_svreinterpret_s64_f64(TYPE(svfloat64) op) // CPP-TUPLE4-NEXT: entry: // CPP-TUPLE4-NEXT: ret [[OP:%.*]] // -TYPE(svuint8) test_svreinterpret_u8_s8(TYPE(svint8) op) +TYPE(svuint8) test_svreinterpret_u8_s8(TYPE(svint8) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_u8,_s8)(op); } @@ -2036,7 +2047,7 @@ TYPE(svuint8) test_svreinterpret_u8_s8(TYPE(svint8) op) // CPP-TUPLE4-NEXT: [[TMP0:%.*]] = bitcast [[OP:%.*]] to // CPP-TUPLE4-NEXT: ret [[TMP0]] // -TYPE(svuint8) test_svreinterpret_u8_s16(TYPE(svint16) op) +TYPE(svuint8) test_svreinterpret_u8_s16(TYPE(svint16) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_u8,_s16)(op); } @@ -2081,7 +2092,7 @@ TYPE(svuint8) test_svreinterpret_u8_s16(TYPE(svint16) op) // CPP-TUPLE4-NEXT: [[TMP0:%.*]] = bitcast [[OP:%.*]] to // CPP-TUPLE4-NEXT: ret [[TMP0]] // -TYPE(svuint8) test_svreinterpret_u8_s32(TYPE(svint32) op) +TYPE(svuint8) test_svreinterpret_u8_s32(TYPE(svint32) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_u8,_s32)(op); } @@ -2126,7 +2137,7 @@ TYPE(svuint8) test_svreinterpret_u8_s32(TYPE(svint32) op) // CPP-TUPLE4-NEXT: [[TMP0:%.*]] = bitcast [[OP:%.*]] to // CPP-TUPLE4-NEXT: ret [[TMP0]] // -TYPE(svuint8) test_svreinterpret_u8_s64(TYPE(svint64) op) +TYPE(svuint8) test_svreinterpret_u8_s64(TYPE(svint64) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_u8,_s64)(op); } @@ -2163,7 +2174,7 @@ TYPE(svuint8) test_svreinterpret_u8_s64(TYPE(svint64) op) // CPP-TUPLE4-NEXT: entry: // CPP-TUPLE4-NEXT: ret [[OP:%.*]] // -TYPE(svuint8) test_svreinterpret_u8_u8(TYPE(svuint8) op) +TYPE(svuint8) test_svreinterpret_u8_u8(TYPE(svuint8) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_u8,_u8)(op); } @@ -2208,7 +2219,7 @@ TYPE(svuint8) test_svreinterpret_u8_u8(TYPE(svuint8) op) // CPP-TUPLE4-NEXT: [[TMP0:%.*]] = bitcast [[OP:%.*]] to // CPP-TUPLE4-NEXT: ret [[TMP0]] // -TYPE(svuint8) test_svreinterpret_u8_u16(TYPE(svuint16) op) +TYPE(svuint8) test_svreinterpret_u8_u16(TYPE(svuint16) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_u8,_u16)(op); } @@ -2253,7 +2264,7 @@ TYPE(svuint8) test_svreinterpret_u8_u16(TYPE(svuint16) op) // CPP-TUPLE4-NEXT: [[TMP0:%.*]] = bitcast [[OP:%.*]] to // CPP-TUPLE4-NEXT: ret [[TMP0]] // -TYPE(svuint8) test_svreinterpret_u8_u32(TYPE(svuint32) op) +TYPE(svuint8) test_svreinterpret_u8_u32(TYPE(svuint32) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_u8,_u32)(op); } @@ -2298,7 +2309,7 @@ TYPE(svuint8) test_svreinterpret_u8_u32(TYPE(svuint32) op) // CPP-TUPLE4-NEXT: [[TMP0:%.*]] = bitcast [[OP:%.*]] to // CPP-TUPLE4-NEXT: ret [[TMP0]] // -TYPE(svuint8) test_svreinterpret_u8_u64(TYPE(svuint64) op) +TYPE(svuint8) test_svreinterpret_u8_u64(TYPE(svuint64) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_u8,_u64)(op); } @@ -2343,7 +2354,7 @@ TYPE(svuint8) test_svreinterpret_u8_u64(TYPE(svuint64) op) // CPP-TUPLE4-NEXT: [[TMP0:%.*]] = bitcast [[OP:%.*]] to // CPP-TUPLE4-NEXT: ret [[TMP0]] // -TYPE(svuint8) test_svreinterpret_u8_f16(TYPE(svfloat16) op) +TYPE(svuint8) test_svreinterpret_u8_f16(TYPE(svfloat16) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_u8,_f16)(op); } @@ -2388,7 +2399,7 @@ TYPE(svuint8) test_svreinterpret_u8_f16(TYPE(svfloat16) op) // CPP-TUPLE4-NEXT: [[TMP0:%.*]] = bitcast [[OP:%.*]] to // CPP-TUPLE4-NEXT: ret [[TMP0]] // -TYPE(svuint8) test_svreinterpret_u8_f32(TYPE(svfloat32) op) +TYPE(svuint8) test_svreinterpret_u8_f32(TYPE(svfloat32) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_u8,_f32)(op); } @@ -2433,7 +2444,7 @@ TYPE(svuint8) test_svreinterpret_u8_f32(TYPE(svfloat32) op) // CPP-TUPLE4-NEXT: [[TMP0:%.*]] = bitcast [[OP:%.*]] to // CPP-TUPLE4-NEXT: ret [[TMP0]] // -TYPE(svuint8) test_svreinterpret_u8_f64(TYPE(svfloat64) op) +TYPE(svuint8) test_svreinterpret_u8_f64(TYPE(svfloat64) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_u8,_f64)(op); } @@ -2478,7 +2489,7 @@ TYPE(svuint8) test_svreinterpret_u8_f64(TYPE(svfloat64) op) // CPP-TUPLE4-NEXT: [[TMP0:%.*]] = bitcast [[OP:%.*]] to // CPP-TUPLE4-NEXT: ret [[TMP0]] // -TYPE(svuint16) test_svreinterpret_u16_s8(TYPE(svint8) op) +TYPE(svuint16) test_svreinterpret_u16_s8(TYPE(svint8) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_u16,_s8)(op); } @@ -2515,7 +2526,7 @@ TYPE(svuint16) test_svreinterpret_u16_s8(TYPE(svint8) op) // CPP-TUPLE4-NEXT: entry: // CPP-TUPLE4-NEXT: ret [[OP:%.*]] // -TYPE(svuint16) test_svreinterpret_u16_s16(TYPE(svint16) op) +TYPE(svuint16) test_svreinterpret_u16_s16(TYPE(svint16) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_u16,_s16)(op); } @@ -2560,7 +2571,7 @@ TYPE(svuint16) test_svreinterpret_u16_s16(TYPE(svint16) op) // CPP-TUPLE4-NEXT: [[TMP0:%.*]] = bitcast [[OP:%.*]] to // CPP-TUPLE4-NEXT: ret [[TMP0]] // -TYPE(svuint16) test_svreinterpret_u16_s32(TYPE(svint32) op) +TYPE(svuint16) test_svreinterpret_u16_s32(TYPE(svint32) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_u16,_s32)(op); } @@ -2605,7 +2616,7 @@ TYPE(svuint16) test_svreinterpret_u16_s32(TYPE(svint32) op) // CPP-TUPLE4-NEXT: [[TMP0:%.*]] = bitcast [[OP:%.*]] to // CPP-TUPLE4-NEXT: ret [[TMP0]] // -TYPE(svuint16) test_svreinterpret_u16_s64(TYPE(svint64) op) +TYPE(svuint16) test_svreinterpret_u16_s64(TYPE(svint64) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_u16,_s64)(op); } @@ -2650,7 +2661,7 @@ TYPE(svuint16) test_svreinterpret_u16_s64(TYPE(svint64) op) // CPP-TUPLE4-NEXT: [[TMP0:%.*]] = bitcast [[OP:%.*]] to // CPP-TUPLE4-NEXT: ret [[TMP0]] // -TYPE(svuint16) test_svreinterpret_u16_u8(TYPE(svuint8) op) +TYPE(svuint16) test_svreinterpret_u16_u8(TYPE(svuint8) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_u16,_u8)(op); } @@ -2687,7 +2698,7 @@ TYPE(svuint16) test_svreinterpret_u16_u8(TYPE(svuint8) op) // CPP-TUPLE4-NEXT: entry: // CPP-TUPLE4-NEXT: ret [[OP:%.*]] // -TYPE(svuint16) test_svreinterpret_u16_u16(TYPE(svuint16) op) +TYPE(svuint16) test_svreinterpret_u16_u16(TYPE(svuint16) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_u16,_u16)(op); } @@ -2732,7 +2743,7 @@ TYPE(svuint16) test_svreinterpret_u16_u16(TYPE(svuint16) op) // CPP-TUPLE4-NEXT: [[TMP0:%.*]] = bitcast [[OP:%.*]] to // CPP-TUPLE4-NEXT: ret [[TMP0]] // -TYPE(svuint16) test_svreinterpret_u16_u32(TYPE(svuint32) op) +TYPE(svuint16) test_svreinterpret_u16_u32(TYPE(svuint32) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_u16,_u32)(op); } @@ -2777,7 +2788,7 @@ TYPE(svuint16) test_svreinterpret_u16_u32(TYPE(svuint32) op) // CPP-TUPLE4-NEXT: [[TMP0:%.*]] = bitcast [[OP:%.*]] to // CPP-TUPLE4-NEXT: ret [[TMP0]] // -TYPE(svuint16) test_svreinterpret_u16_u64(TYPE(svuint64) op) +TYPE(svuint16) test_svreinterpret_u16_u64(TYPE(svuint64) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_u16,_u64)(op); } @@ -2822,7 +2833,7 @@ TYPE(svuint16) test_svreinterpret_u16_u64(TYPE(svuint64) op) // CPP-TUPLE4-NEXT: [[TMP0:%.*]] = bitcast [[OP:%.*]] to // CPP-TUPLE4-NEXT: ret [[TMP0]] // -TYPE(svuint16) test_svreinterpret_u16_f16(TYPE(svfloat16) op) +TYPE(svuint16) test_svreinterpret_u16_f16(TYPE(svfloat16) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_u16,_f16)(op); } @@ -2867,7 +2878,7 @@ TYPE(svuint16) test_svreinterpret_u16_f16(TYPE(svfloat16) op) // CPP-TUPLE4-NEXT: [[TMP0:%.*]] = bitcast [[OP:%.*]] to // CPP-TUPLE4-NEXT: ret [[TMP0]] // -TYPE(svuint16) test_svreinterpret_u16_f32(TYPE(svfloat32) op) +TYPE(svuint16) test_svreinterpret_u16_f32(TYPE(svfloat32) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_u16,_f32)(op); } @@ -2912,7 +2923,7 @@ TYPE(svuint16) test_svreinterpret_u16_f32(TYPE(svfloat32) op) // CPP-TUPLE4-NEXT: [[TMP0:%.*]] = bitcast [[OP:%.*]] to // CPP-TUPLE4-NEXT: ret [[TMP0]] // -TYPE(svuint16) test_svreinterpret_u16_f64(TYPE(svfloat64) op) +TYPE(svuint16) test_svreinterpret_u16_f64(TYPE(svfloat64) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_u16,_f64)(op); } @@ -2957,7 +2968,7 @@ TYPE(svuint16) test_svreinterpret_u16_f64(TYPE(svfloat64) op) // CPP-TUPLE4-NEXT: [[TMP0:%.*]] = bitcast [[OP:%.*]] to // CPP-TUPLE4-NEXT: ret [[TMP0]] // -TYPE(svuint32) test_svreinterpret_u32_s8(TYPE(svint8) op) +TYPE(svuint32) test_svreinterpret_u32_s8(TYPE(svint8) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_u32,_s8)(op); } @@ -3002,7 +3013,7 @@ TYPE(svuint32) test_svreinterpret_u32_s8(TYPE(svint8) op) // CPP-TUPLE4-NEXT: [[TMP0:%.*]] = bitcast [[OP:%.*]] to // CPP-TUPLE4-NEXT: ret [[TMP0]] // -TYPE(svuint32) test_svreinterpret_u32_s16(TYPE(svint16) op) +TYPE(svuint32) test_svreinterpret_u32_s16(TYPE(svint16) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_u32,_s16)(op); } @@ -3039,7 +3050,7 @@ TYPE(svuint32) test_svreinterpret_u32_s16(TYPE(svint16) op) // CPP-TUPLE4-NEXT: entry: // CPP-TUPLE4-NEXT: ret [[OP:%.*]] // -TYPE(svuint32) test_svreinterpret_u32_s32(TYPE(svint32) op) +TYPE(svuint32) test_svreinterpret_u32_s32(TYPE(svint32) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_u32,_s32)(op); } @@ -3084,7 +3095,7 @@ TYPE(svuint32) test_svreinterpret_u32_s32(TYPE(svint32) op) // CPP-TUPLE4-NEXT: [[TMP0:%.*]] = bitcast [[OP:%.*]] to // CPP-TUPLE4-NEXT: ret [[TMP0]] // -TYPE(svuint32) test_svreinterpret_u32_s64(TYPE(svint64) op) +TYPE(svuint32) test_svreinterpret_u32_s64(TYPE(svint64) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_u32,_s64)(op); } @@ -3129,7 +3140,7 @@ TYPE(svuint32) test_svreinterpret_u32_s64(TYPE(svint64) op) // CPP-TUPLE4-NEXT: [[TMP0:%.*]] = bitcast [[OP:%.*]] to // CPP-TUPLE4-NEXT: ret [[TMP0]] // -TYPE(svuint32) test_svreinterpret_u32_u8(TYPE(svuint8) op) +TYPE(svuint32) test_svreinterpret_u32_u8(TYPE(svuint8) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_u32,_u8)(op); } @@ -3174,7 +3185,7 @@ TYPE(svuint32) test_svreinterpret_u32_u8(TYPE(svuint8) op) // CPP-TUPLE4-NEXT: [[TMP0:%.*]] = bitcast [[OP:%.*]] to // CPP-TUPLE4-NEXT: ret [[TMP0]] // -TYPE(svuint32) test_svreinterpret_u32_u16(TYPE(svuint16) op) +TYPE(svuint32) test_svreinterpret_u32_u16(TYPE(svuint16) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_u32,_u16)(op); } @@ -3211,7 +3222,7 @@ TYPE(svuint32) test_svreinterpret_u32_u16(TYPE(svuint16) op) // CPP-TUPLE4-NEXT: entry: // CPP-TUPLE4-NEXT: ret [[OP:%.*]] // -TYPE(svuint32) test_svreinterpret_u32_u32(TYPE(svuint32) op) +TYPE(svuint32) test_svreinterpret_u32_u32(TYPE(svuint32) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_u32,_u32)(op); } @@ -3256,7 +3267,7 @@ TYPE(svuint32) test_svreinterpret_u32_u32(TYPE(svuint32) op) // CPP-TUPLE4-NEXT: [[TMP0:%.*]] = bitcast [[OP:%.*]] to // CPP-TUPLE4-NEXT: ret [[TMP0]] // -TYPE(svuint32) test_svreinterpret_u32_u64(TYPE(svuint64) op) +TYPE(svuint32) test_svreinterpret_u32_u64(TYPE(svuint64) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_u32,_u64)(op); } @@ -3301,7 +3312,7 @@ TYPE(svuint32) test_svreinterpret_u32_u64(TYPE(svuint64) op) // CPP-TUPLE4-NEXT: [[TMP0:%.*]] = bitcast [[OP:%.*]] to // CPP-TUPLE4-NEXT: ret [[TMP0]] // -TYPE(svuint32) test_svreinterpret_u32_f16(TYPE(svfloat16) op) +TYPE(svuint32) test_svreinterpret_u32_f16(TYPE(svfloat16) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_u32,_f16)(op); } @@ -3346,7 +3357,7 @@ TYPE(svuint32) test_svreinterpret_u32_f16(TYPE(svfloat16) op) // CPP-TUPLE4-NEXT: [[TMP0:%.*]] = bitcast [[OP:%.*]] to // CPP-TUPLE4-NEXT: ret [[TMP0]] // -TYPE(svuint32) test_svreinterpret_u32_f32(TYPE(svfloat32) op) +TYPE(svuint32) test_svreinterpret_u32_f32(TYPE(svfloat32) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_u32,_f32)(op); } @@ -3391,7 +3402,7 @@ TYPE(svuint32) test_svreinterpret_u32_f32(TYPE(svfloat32) op) // CPP-TUPLE4-NEXT: [[TMP0:%.*]] = bitcast [[OP:%.*]] to // CPP-TUPLE4-NEXT: ret [[TMP0]] // -TYPE(svuint32) test_svreinterpret_u32_f64(TYPE(svfloat64) op) +TYPE(svuint32) test_svreinterpret_u32_f64(TYPE(svfloat64) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_u32,_f64)(op); } @@ -3436,7 +3447,7 @@ TYPE(svuint32) test_svreinterpret_u32_f64(TYPE(svfloat64) op) // CPP-TUPLE4-NEXT: [[TMP0:%.*]] = bitcast [[OP:%.*]] to // CPP-TUPLE4-NEXT: ret [[TMP0]] // -TYPE(svuint64) test_svreinterpret_u64_s8(TYPE(svint8) op) +TYPE(svuint64) test_svreinterpret_u64_s8(TYPE(svint8) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_u64,_s8)(op); } @@ -3481,7 +3492,7 @@ TYPE(svuint64) test_svreinterpret_u64_s8(TYPE(svint8) op) // CPP-TUPLE4-NEXT: [[TMP0:%.*]] = bitcast [[OP:%.*]] to // CPP-TUPLE4-NEXT: ret [[TMP0]] // -TYPE(svuint64) test_svreinterpret_u64_s16(TYPE(svint16) op) +TYPE(svuint64) test_svreinterpret_u64_s16(TYPE(svint16) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_u64,_s16)(op); } @@ -3526,7 +3537,7 @@ TYPE(svuint64) test_svreinterpret_u64_s16(TYPE(svint16) op) // CPP-TUPLE4-NEXT: [[TMP0:%.*]] = bitcast [[OP:%.*]] to // CPP-TUPLE4-NEXT: ret [[TMP0]] // -TYPE(svuint64) test_svreinterpret_u64_s32(TYPE(svint32) op) +TYPE(svuint64) test_svreinterpret_u64_s32(TYPE(svint32) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_u64,_s32)(op); } @@ -3563,7 +3574,7 @@ TYPE(svuint64) test_svreinterpret_u64_s32(TYPE(svint32) op) // CPP-TUPLE4-NEXT: entry: // CPP-TUPLE4-NEXT: ret [[OP:%.*]] // -TYPE(svuint64) test_svreinterpret_u64_s64(TYPE(svint64) op) +TYPE(svuint64) test_svreinterpret_u64_s64(TYPE(svint64) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_u64,_s64)(op); } @@ -3608,7 +3619,7 @@ TYPE(svuint64) test_svreinterpret_u64_s64(TYPE(svint64) op) // CPP-TUPLE4-NEXT: [[TMP0:%.*]] = bitcast [[OP:%.*]] to // CPP-TUPLE4-NEXT: ret [[TMP0]] // -TYPE(svuint64) test_svreinterpret_u64_u8(TYPE(svuint8) op) +TYPE(svuint64) test_svreinterpret_u64_u8(TYPE(svuint8) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_u64,_u8)(op); } @@ -3653,7 +3664,7 @@ TYPE(svuint64) test_svreinterpret_u64_u8(TYPE(svuint8) op) // CPP-TUPLE4-NEXT: [[TMP0:%.*]] = bitcast [[OP:%.*]] to // CPP-TUPLE4-NEXT: ret [[TMP0]] // -TYPE(svuint64) test_svreinterpret_u64_u16(TYPE(svuint16) op) +TYPE(svuint64) test_svreinterpret_u64_u16(TYPE(svuint16) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_u64,_u16)(op); } @@ -3698,7 +3709,7 @@ TYPE(svuint64) test_svreinterpret_u64_u16(TYPE(svuint16) op) // CPP-TUPLE4-NEXT: [[TMP0:%.*]] = bitcast [[OP:%.*]] to // CPP-TUPLE4-NEXT: ret [[TMP0]] // -TYPE(svuint64) test_svreinterpret_u64_u32(TYPE(svuint32) op) +TYPE(svuint64) test_svreinterpret_u64_u32(TYPE(svuint32) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_u64,_u32)(op); } @@ -3735,7 +3746,7 @@ TYPE(svuint64) test_svreinterpret_u64_u32(TYPE(svuint32) op) // CPP-TUPLE4-NEXT: entry: // CPP-TUPLE4-NEXT: ret [[OP:%.*]] // -TYPE(svuint64) test_svreinterpret_u64_u64(TYPE(svuint64) op) +TYPE(svuint64) test_svreinterpret_u64_u64(TYPE(svuint64) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_u64,_u64)(op); } @@ -3780,7 +3791,7 @@ TYPE(svuint64) test_svreinterpret_u64_u64(TYPE(svuint64) op) // CPP-TUPLE4-NEXT: [[TMP0:%.*]] = bitcast [[OP:%.*]] to // CPP-TUPLE4-NEXT: ret [[TMP0]] // -TYPE(svuint64) test_svreinterpret_u64_f16(TYPE(svfloat16) op) +TYPE(svuint64) test_svreinterpret_u64_f16(TYPE(svfloat16) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_u64,_f16)(op); } @@ -3825,7 +3836,7 @@ TYPE(svuint64) test_svreinterpret_u64_f16(TYPE(svfloat16) op) // CPP-TUPLE4-NEXT: [[TMP0:%.*]] = bitcast [[OP:%.*]] to // CPP-TUPLE4-NEXT: ret [[TMP0]] // -TYPE(svuint64) test_svreinterpret_u64_f32(TYPE(svfloat32) op) +TYPE(svuint64) test_svreinterpret_u64_f32(TYPE(svfloat32) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_u64,_f32)(op); } @@ -3870,7 +3881,7 @@ TYPE(svuint64) test_svreinterpret_u64_f32(TYPE(svfloat32) op) // CPP-TUPLE4-NEXT: [[TMP0:%.*]] = bitcast [[OP:%.*]] to // CPP-TUPLE4-NEXT: ret [[TMP0]] // -TYPE(svuint64) test_svreinterpret_u64_f64(TYPE(svfloat64) op) +TYPE(svuint64) test_svreinterpret_u64_f64(TYPE(svfloat64) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_u64,_f64)(op); } @@ -3915,7 +3926,7 @@ TYPE(svuint64) test_svreinterpret_u64_f64(TYPE(svfloat64) op) // CPP-TUPLE4-NEXT: [[TMP0:%.*]] = bitcast [[OP:%.*]] to // CPP-TUPLE4-NEXT: ret [[TMP0]] // -TYPE(svfloat16) test_svreinterpret_f16_s8(TYPE(svint8) op) +TYPE(svfloat16) test_svreinterpret_f16_s8(TYPE(svint8) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_f16,_s8)(op); } @@ -3960,7 +3971,7 @@ TYPE(svfloat16) test_svreinterpret_f16_s8(TYPE(svint8) op) // CPP-TUPLE4-NEXT: [[TMP0:%.*]] = bitcast [[OP:%.*]] to // CPP-TUPLE4-NEXT: ret [[TMP0]] // -TYPE(svfloat16) test_svreinterpret_f16_s16(TYPE(svint16) op) +TYPE(svfloat16) test_svreinterpret_f16_s16(TYPE(svint16) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_f16,_s16)(op); } @@ -4005,7 +4016,7 @@ TYPE(svfloat16) test_svreinterpret_f16_s16(TYPE(svint16) op) // CPP-TUPLE4-NEXT: [[TMP0:%.*]] = bitcast [[OP:%.*]] to // CPP-TUPLE4-NEXT: ret [[TMP0]] // -TYPE(svfloat16) test_svreinterpret_f16_s32(TYPE(svint32) op) +TYPE(svfloat16) test_svreinterpret_f16_s32(TYPE(svint32) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_f16,_s32)(op); } @@ -4050,7 +4061,7 @@ TYPE(svfloat16) test_svreinterpret_f16_s32(TYPE(svint32) op) // CPP-TUPLE4-NEXT: [[TMP0:%.*]] = bitcast [[OP:%.*]] to // CPP-TUPLE4-NEXT: ret [[TMP0]] // -TYPE(svfloat16) test_svreinterpret_f16_s64(TYPE(svint64) op) +TYPE(svfloat16) test_svreinterpret_f16_s64(TYPE(svint64) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_f16,_s64)(op); } @@ -4095,7 +4106,7 @@ TYPE(svfloat16) test_svreinterpret_f16_s64(TYPE(svint64) op) // CPP-TUPLE4-NEXT: [[TMP0:%.*]] = bitcast [[OP:%.*]] to // CPP-TUPLE4-NEXT: ret [[TMP0]] // -TYPE(svfloat16) test_svreinterpret_f16_u8(TYPE(svuint8) op) +TYPE(svfloat16) test_svreinterpret_f16_u8(TYPE(svuint8) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_f16,_u8)(op); } @@ -4140,7 +4151,7 @@ TYPE(svfloat16) test_svreinterpret_f16_u8(TYPE(svuint8) op) // CPP-TUPLE4-NEXT: [[TMP0:%.*]] = bitcast [[OP:%.*]] to // CPP-TUPLE4-NEXT: ret [[TMP0]] // -TYPE(svfloat16) test_svreinterpret_f16_u16(TYPE(svuint16) op) +TYPE(svfloat16) test_svreinterpret_f16_u16(TYPE(svuint16) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_f16,_u16)(op); } @@ -4185,7 +4196,7 @@ TYPE(svfloat16) test_svreinterpret_f16_u16(TYPE(svuint16) op) // CPP-TUPLE4-NEXT: [[TMP0:%.*]] = bitcast [[OP:%.*]] to // CPP-TUPLE4-NEXT: ret [[TMP0]] // -TYPE(svfloat16) test_svreinterpret_f16_u32(TYPE(svuint32) op) +TYPE(svfloat16) test_svreinterpret_f16_u32(TYPE(svuint32) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_f16,_u32)(op); } @@ -4230,7 +4241,7 @@ TYPE(svfloat16) test_svreinterpret_f16_u32(TYPE(svuint32) op) // CPP-TUPLE4-NEXT: [[TMP0:%.*]] = bitcast [[OP:%.*]] to // CPP-TUPLE4-NEXT: ret [[TMP0]] // -TYPE(svfloat16) test_svreinterpret_f16_u64(TYPE(svuint64) op) +TYPE(svfloat16) test_svreinterpret_f16_u64(TYPE(svuint64) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_f16,_u64)(op); } @@ -4267,7 +4278,7 @@ TYPE(svfloat16) test_svreinterpret_f16_u64(TYPE(svuint64) op) // CPP-TUPLE4-NEXT: entry: // CPP-TUPLE4-NEXT: ret [[OP:%.*]] // -TYPE(svfloat16) test_svreinterpret_f16_f16(TYPE(svfloat16) op) +TYPE(svfloat16) test_svreinterpret_f16_f16(TYPE(svfloat16) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_f16,_f16)(op); } @@ -4312,7 +4323,7 @@ TYPE(svfloat16) test_svreinterpret_f16_f16(TYPE(svfloat16) op) // CPP-TUPLE4-NEXT: [[TMP0:%.*]] = bitcast [[OP:%.*]] to // CPP-TUPLE4-NEXT: ret [[TMP0]] // -TYPE(svfloat16) test_svreinterpret_f16_f32(TYPE(svfloat32) op) +TYPE(svfloat16) test_svreinterpret_f16_f32(TYPE(svfloat32) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_f16,_f32)(op); } @@ -4357,7 +4368,7 @@ TYPE(svfloat16) test_svreinterpret_f16_f32(TYPE(svfloat32) op) // CPP-TUPLE4-NEXT: [[TMP0:%.*]] = bitcast [[OP:%.*]] to // CPP-TUPLE4-NEXT: ret [[TMP0]] // -TYPE(svfloat16) test_svreinterpret_f16_f64(TYPE(svfloat64) op) +TYPE(svfloat16) test_svreinterpret_f16_f64(TYPE(svfloat64) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_f16,_f64)(op); } @@ -4402,7 +4413,7 @@ TYPE(svfloat16) test_svreinterpret_f16_f64(TYPE(svfloat64) op) // CPP-TUPLE4-NEXT: [[TMP0:%.*]] = bitcast [[OP:%.*]] to // CPP-TUPLE4-NEXT: ret [[TMP0]] // -TYPE(svfloat32) test_svreinterpret_f32_s8(TYPE(svint8) op) +TYPE(svfloat32) test_svreinterpret_f32_s8(TYPE(svint8) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_f32,_s8)(op); } @@ -4447,7 +4458,7 @@ TYPE(svfloat32) test_svreinterpret_f32_s8(TYPE(svint8) op) // CPP-TUPLE4-NEXT: [[TMP0:%.*]] = bitcast [[OP:%.*]] to // CPP-TUPLE4-NEXT: ret [[TMP0]] // -TYPE(svfloat32) test_svreinterpret_f32_s16(TYPE(svint16) op) +TYPE(svfloat32) test_svreinterpret_f32_s16(TYPE(svint16) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_f32,_s16)(op); } @@ -4492,7 +4503,7 @@ TYPE(svfloat32) test_svreinterpret_f32_s16(TYPE(svint16) op) // CPP-TUPLE4-NEXT: [[TMP0:%.*]] = bitcast [[OP:%.*]] to // CPP-TUPLE4-NEXT: ret [[TMP0]] // -TYPE(svfloat32) test_svreinterpret_f32_s32(TYPE(svint32) op) +TYPE(svfloat32) test_svreinterpret_f32_s32(TYPE(svint32) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_f32,_s32)(op); } @@ -4537,7 +4548,7 @@ TYPE(svfloat32) test_svreinterpret_f32_s32(TYPE(svint32) op) // CPP-TUPLE4-NEXT: [[TMP0:%.*]] = bitcast [[OP:%.*]] to // CPP-TUPLE4-NEXT: ret [[TMP0]] // -TYPE(svfloat32) test_svreinterpret_f32_s64(TYPE(svint64) op) +TYPE(svfloat32) test_svreinterpret_f32_s64(TYPE(svint64) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_f32,_s64)(op); } @@ -4582,7 +4593,7 @@ TYPE(svfloat32) test_svreinterpret_f32_s64(TYPE(svint64) op) // CPP-TUPLE4-NEXT: [[TMP0:%.*]] = bitcast [[OP:%.*]] to // CPP-TUPLE4-NEXT: ret [[TMP0]] // -TYPE(svfloat32) test_svreinterpret_f32_u8(TYPE(svuint8) op) +TYPE(svfloat32) test_svreinterpret_f32_u8(TYPE(svuint8) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_f32,_u8)(op); } @@ -4627,7 +4638,7 @@ TYPE(svfloat32) test_svreinterpret_f32_u8(TYPE(svuint8) op) // CPP-TUPLE4-NEXT: [[TMP0:%.*]] = bitcast [[OP:%.*]] to // CPP-TUPLE4-NEXT: ret [[TMP0]] // -TYPE(svfloat32) test_svreinterpret_f32_u16(TYPE(svuint16) op) +TYPE(svfloat32) test_svreinterpret_f32_u16(TYPE(svuint16) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_f32,_u16)(op); } @@ -4672,7 +4683,7 @@ TYPE(svfloat32) test_svreinterpret_f32_u16(TYPE(svuint16) op) // CPP-TUPLE4-NEXT: [[TMP0:%.*]] = bitcast [[OP:%.*]] to // CPP-TUPLE4-NEXT: ret [[TMP0]] // -TYPE(svfloat32) test_svreinterpret_f32_u32(TYPE(svuint32) op) +TYPE(svfloat32) test_svreinterpret_f32_u32(TYPE(svuint32) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_f32,_u32)(op); } @@ -4717,7 +4728,7 @@ TYPE(svfloat32) test_svreinterpret_f32_u32(TYPE(svuint32) op) // CPP-TUPLE4-NEXT: [[TMP0:%.*]] = bitcast [[OP:%.*]] to // CPP-TUPLE4-NEXT: ret [[TMP0]] // -TYPE(svfloat32) test_svreinterpret_f32_u64(TYPE(svuint64) op) +TYPE(svfloat32) test_svreinterpret_f32_u64(TYPE(svuint64) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_f32,_u64)(op); } @@ -4762,7 +4773,7 @@ TYPE(svfloat32) test_svreinterpret_f32_u64(TYPE(svuint64) op) // CPP-TUPLE4-NEXT: [[TMP0:%.*]] = bitcast [[OP:%.*]] to // CPP-TUPLE4-NEXT: ret [[TMP0]] // -TYPE(svfloat32) test_svreinterpret_f32_f16(TYPE(svfloat16) op) +TYPE(svfloat32) test_svreinterpret_f32_f16(TYPE(svfloat16) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_f32,_f16)(op); } @@ -4799,7 +4810,7 @@ TYPE(svfloat32) test_svreinterpret_f32_f16(TYPE(svfloat16) op) // CPP-TUPLE4-NEXT: entry: // CPP-TUPLE4-NEXT: ret [[OP:%.*]] // -TYPE(svfloat32) test_svreinterpret_f32_f32(TYPE(svfloat32) op) +TYPE(svfloat32) test_svreinterpret_f32_f32(TYPE(svfloat32) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_f32,_f32)(op); } @@ -4844,7 +4855,7 @@ TYPE(svfloat32) test_svreinterpret_f32_f32(TYPE(svfloat32) op) // CPP-TUPLE4-NEXT: [[TMP0:%.*]] = bitcast [[OP:%.*]] to // CPP-TUPLE4-NEXT: ret [[TMP0]] // -TYPE(svfloat32) test_svreinterpret_f32_f64(TYPE(svfloat64) op) +TYPE(svfloat32) test_svreinterpret_f32_f64(TYPE(svfloat64) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_f32,_f64)(op); } @@ -4889,7 +4900,7 @@ TYPE(svfloat32) test_svreinterpret_f32_f64(TYPE(svfloat64) op) // CPP-TUPLE4-NEXT: [[TMP0:%.*]] = bitcast [[OP:%.*]] to // CPP-TUPLE4-NEXT: ret [[TMP0]] // -TYPE(svfloat64) test_svreinterpret_f64_s8(TYPE(svint8) op) +TYPE(svfloat64) test_svreinterpret_f64_s8(TYPE(svint8) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_f64,_s8)(op); } @@ -4934,7 +4945,7 @@ TYPE(svfloat64) test_svreinterpret_f64_s8(TYPE(svint8) op) // CPP-TUPLE4-NEXT: [[TMP0:%.*]] = bitcast [[OP:%.*]] to // CPP-TUPLE4-NEXT: ret [[TMP0]] // -TYPE(svfloat64) test_svreinterpret_f64_s16(TYPE(svint16) op) +TYPE(svfloat64) test_svreinterpret_f64_s16(TYPE(svint16) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_f64,_s16)(op); } @@ -4979,7 +4990,7 @@ TYPE(svfloat64) test_svreinterpret_f64_s16(TYPE(svint16) op) // CPP-TUPLE4-NEXT: [[TMP0:%.*]] = bitcast [[OP:%.*]] to // CPP-TUPLE4-NEXT: ret [[TMP0]] // -TYPE(svfloat64) test_svreinterpret_f64_s32(TYPE(svint32) op) +TYPE(svfloat64) test_svreinterpret_f64_s32(TYPE(svint32) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_f64,_s32)(op); } @@ -5024,7 +5035,7 @@ TYPE(svfloat64) test_svreinterpret_f64_s32(TYPE(svint32) op) // CPP-TUPLE4-NEXT: [[TMP0:%.*]] = bitcast [[OP:%.*]] to // CPP-TUPLE4-NEXT: ret [[TMP0]] // -TYPE(svfloat64) test_svreinterpret_f64_s64(TYPE(svint64) op) +TYPE(svfloat64) test_svreinterpret_f64_s64(TYPE(svint64) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_f64,_s64)(op); } @@ -5069,7 +5080,7 @@ TYPE(svfloat64) test_svreinterpret_f64_s64(TYPE(svint64) op) // CPP-TUPLE4-NEXT: [[TMP0:%.*]] = bitcast [[OP:%.*]] to // CPP-TUPLE4-NEXT: ret [[TMP0]] // -TYPE(svfloat64) test_svreinterpret_f64_u8(TYPE(svuint8) op) +TYPE(svfloat64) test_svreinterpret_f64_u8(TYPE(svuint8) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_f64,_u8)(op); } @@ -5114,7 +5125,7 @@ TYPE(svfloat64) test_svreinterpret_f64_u8(TYPE(svuint8) op) // CPP-TUPLE4-NEXT: [[TMP0:%.*]] = bitcast [[OP:%.*]] to // CPP-TUPLE4-NEXT: ret [[TMP0]] // -TYPE(svfloat64) test_svreinterpret_f64_u16(TYPE(svuint16) op) +TYPE(svfloat64) test_svreinterpret_f64_u16(TYPE(svuint16) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_f64,_u16)(op); } @@ -5159,7 +5170,7 @@ TYPE(svfloat64) test_svreinterpret_f64_u16(TYPE(svuint16) op) // CPP-TUPLE4-NEXT: [[TMP0:%.*]] = bitcast [[OP:%.*]] to // CPP-TUPLE4-NEXT: ret [[TMP0]] // -TYPE(svfloat64) test_svreinterpret_f64_u32(TYPE(svuint32) op) +TYPE(svfloat64) test_svreinterpret_f64_u32(TYPE(svuint32) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_f64,_u32)(op); } @@ -5204,7 +5215,7 @@ TYPE(svfloat64) test_svreinterpret_f64_u32(TYPE(svuint32) op) // CPP-TUPLE4-NEXT: [[TMP0:%.*]] = bitcast [[OP:%.*]] to // CPP-TUPLE4-NEXT: ret [[TMP0]] // -TYPE(svfloat64) test_svreinterpret_f64_u64(TYPE(svuint64) op) +TYPE(svfloat64) test_svreinterpret_f64_u64(TYPE(svuint64) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_f64,_u64)(op); } @@ -5249,7 +5260,7 @@ TYPE(svfloat64) test_svreinterpret_f64_u64(TYPE(svuint64) op) // CPP-TUPLE4-NEXT: [[TMP0:%.*]] = bitcast [[OP:%.*]] to // CPP-TUPLE4-NEXT: ret [[TMP0]] // -TYPE(svfloat64) test_svreinterpret_f64_f16(TYPE(svfloat16) op) +TYPE(svfloat64) test_svreinterpret_f64_f16(TYPE(svfloat16) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_f64,_f16)(op); } @@ -5294,7 +5305,7 @@ TYPE(svfloat64) test_svreinterpret_f64_f16(TYPE(svfloat16) op) // CPP-TUPLE4-NEXT: [[TMP0:%.*]] = bitcast [[OP:%.*]] to // CPP-TUPLE4-NEXT: ret [[TMP0]] // -TYPE(svfloat64) test_svreinterpret_f64_f32(TYPE(svfloat32) op) +TYPE(svfloat64) test_svreinterpret_f64_f32(TYPE(svfloat32) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_f64,_f32)(op); } @@ -5331,7 +5342,7 @@ TYPE(svfloat64) test_svreinterpret_f64_f32(TYPE(svfloat32) op) // CPP-TUPLE4-NEXT: entry: // CPP-TUPLE4-NEXT: ret [[OP:%.*]] // -TYPE(svfloat64) test_svreinterpret_f64_f64(TYPE(svfloat64) op) +TYPE(svfloat64) test_svreinterpret_f64_f64(TYPE(svfloat64) op) MODE_ATTR { return SVE_ACLE_FUNC(svreinterpret_f64,_f64)(op); } diff --git a/clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_reinterpret_from_streaming_mode.c b/clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_reinterpret_from_streaming_mode.c deleted file mode 100644 index f278758361932..0000000000000 --- a/clang/test/CodeGen/aarch64-sve-intrinsics/acle_sve_reinterpret_from_streaming_mode.c +++ /dev/null @@ -1,35 +0,0 @@ -// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py -// REQUIRES: aarch64-registered-target -// RUN: %clang_cc1 -triple aarch64 -target-feature +sve -O1 -Werror -Wall -emit-llvm -o - %s | FileCheck %s -// RUN: %clang_cc1 -triple aarch64 -target-feature +sve -O1 -Werror -Wall -emit-llvm -o - -x c++ %s | FileCheck %s -check-prefix=CPP-CHECK -// RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64 -target-feature +sve -O1 -Werror -Wall -emit-llvm -o - %s | FileCheck %s -// RUN: %clang_cc1 -DSVE_OVERLOADED_FORMS -triple aarch64 -target-feature +sve -O1 -Werror -Wall -emit-llvm -o - -x c++ %s | FileCheck %s -check-prefix=CPP-CHECK -// RUN: %clang_cc1 -triple aarch64 -target-feature +sve -S -O1 -Werror -Wall -o /dev/null %s - -// Note: We need to run this test with '-O1' because oddly enough the svreinterpret is always inlined at -O0. - -#include - -#ifdef SVE_OVERLOADED_FORMS -// A simple used,unused... macro, long enough to represent any SVE builtin. -#define SVE_ACLE_FUNC(A1,A2_UNUSED,A3,A4_UNUSED) A1##A3 -#else -#define SVE_ACLE_FUNC(A1,A2,A3,A4) A1##A2##A3##A4 -#endif - -// Test that svreinterpret is inlined (because it should be streaming-compatible) -__attribute__((target("sme"))) -// CHECK-LABEL: @test_svreinterpret_s16_s8_from_streaming_mode( -// CHECK-NEXT: entry: -// CHECK-NEXT: [[TMP0:%.*]] = bitcast [[OP:%.*]] to -// CHECK-NEXT: ret [[TMP0]] -// -// CPP-CHECK-LABEL: @_Z45test_svreinterpret_s16_s8_from_streaming_modeu10__SVInt8_t( -// CPP-CHECK-NEXT: entry: -// CPP-CHECK-NEXT: [[TMP0:%.*]] = bitcast [[OP:%.*]] to -// CPP-CHECK-NEXT: ret [[TMP0]] -// -svint16_t test_svreinterpret_s16_s8_from_streaming_mode(svint8_t op) __arm_streaming { - return SVE_ACLE_FUNC(svreinterpret_s16,_s8,,)(op); -} - diff --git a/clang/test/CodeGen/attr-cpuspecific.c b/clang/test/CodeGen/attr-cpuspecific.c index 2c3e6931800cd..628892d5809b4 100644 --- a/clang/test/CodeGen/attr-cpuspecific.c +++ b/clang/test/CodeGen/attr-cpuspecific.c @@ -75,8 +75,8 @@ void TwoVersions(void); // LINUX: define weak_odr ptr @TwoVersions.resolver() // LINUX: call void @__cpu_indicator_init // LINUX: %[[FEAT_INIT:.+]] = load i32, ptr getelementptr inbounds ({ i32, i32, i32, [1 x i32] }, ptr @__cpu_model, i32 0, i32 3, i32 0), align 4 -// LINUX: %[[FEAT_JOIN:.+]] = and i32 %[[FEAT_INIT]], 59754495 -// LINUX: %[[FEAT_CHECK:.+]] = icmp eq i32 %[[FEAT_JOIN]], 59754495 +// LINUX: %[[FEAT_JOIN:.+]] = and i32 %[[FEAT_INIT]], 9422847 +// LINUX: %[[FEAT_CHECK:.+]] = icmp eq i32 %[[FEAT_JOIN]], 9422847 // LINUX: ret ptr @TwoVersions.Z // LINUX: ret ptr @TwoVersions.S // LINUX: call void @llvm.trap @@ -85,8 +85,8 @@ void TwoVersions(void); // WINDOWS: define weak_odr dso_local void @TwoVersions() comdat // WINDOWS: call void @__cpu_indicator_init() // WINDOWS: %[[FEAT_INIT:.+]] = load i32, ptr getelementptr inbounds ({ i32, i32, i32, [1 x i32] }, ptr @__cpu_model, i32 0, i32 3, i32 0), align 4 -// WINDOWS: %[[FEAT_JOIN:.+]] = and i32 %[[FEAT_INIT]], 59754495 -// WINDOWS: %[[FEAT_CHECK:.+]] = icmp eq i32 %[[FEAT_JOIN]], 59754495 +// WINDOWS: %[[FEAT_JOIN:.+]] = and i32 %[[FEAT_INIT]], 9422847 +// WINDOWS: %[[FEAT_CHECK:.+]] = icmp eq i32 %[[FEAT_JOIN]], 9422847 // WINDOWS: call void @TwoVersions.Z() // WINDOWS-NEXT: ret void // WINDOWS: call void @TwoVersions.S() @@ -354,7 +354,7 @@ void OrderDispatchUsageSpecific(void) {} // CHECK: attributes #[[S]] = {{.*}}"target-features"="+avx,+cmov,+crc32,+cx16,+cx8,+f16c,+fsgsbase,+fxsr,+mmx,+pclmul,+popcnt,+rdrnd,+sahf,+sse,+sse2,+sse3,+sse4.1,+sse4.2,+ssse3,+x87,+xsave,+xsaveopt" // CHECK-SAME: "tune-cpu"="ivybridge" -// CHECK: attributes #[[K]] = {{.*}}"target-features"="+adx,+aes,+avx,+avx2,+avx512cd,+avx512er,+avx512f,+avx512pf,+bmi,+bmi2,+cmov,+crc32,+cx16,+cx8,+evex512,+f16c,+fma,+fsgsbase,+fxsr,+invpcid,+lzcnt,+mmx,+movbe,+pclmul,+popcnt,+prefetchwt1,+prfchw,+rdrnd,+rdseed,+sahf,+sse,+sse2,+sse3,+sse4.1,+sse4.2,+ssse3,+x87,+xsave,+xsaveopt" +// CHECK: attributes #[[K]] = {{.*}}"target-features"="+adx,+aes,+avx,+avx2,+avx512cd,+avx512f,+bmi,+bmi2,+cmov,+crc32,+cx16,+cx8,+evex512,+f16c,+fma,+fsgsbase,+fxsr,+invpcid,+lzcnt,+mmx,+movbe,+pclmul,+popcnt,+prfchw,+rdrnd,+rdseed,+sahf,+sse,+sse2,+sse3,+sse4.1,+sse4.2,+ssse3,+x87,+xsave,+xsaveopt" // CHECK-SAME: "tune-cpu"="knl" // CHECK: attributes #[[O]] = {{.*}}"target-features"="+cmov,+cx16,+cx8,+fxsr,+mmx,+movbe,+sahf,+sse,+sse2,+sse3,+ssse3,+x87" // CHECK-SAME: "tune-cpu"="atom" diff --git a/clang/test/CodeGen/attr-noinline.cpp b/clang/test/CodeGen/attr-noinline.cpp index f0588cfecf463..c1fb9941b5251 100644 --- a/clang/test/CodeGen/attr-noinline.cpp +++ b/clang/test/CodeGen/attr-noinline.cpp @@ -9,6 +9,7 @@ static int baz(int x) { } [[clang::noinline]] bool noi() { } +[[msvc::noinline]] bool ms_noi() { return true; } void foo(int i) { [[clang::noinline]] bar(); @@ -39,6 +40,31 @@ void foo(int i) { // CHECK: call noundef zeroext i1 @_Z3barv() } +void ms_noi_check(int i) { + [[msvc::noinline]] bar(); +// CHECK: call noundef zeroext i1 @_Z3barv() #[[NOINLINEATTR:[0-9]+]] + [[msvc::noinline]] i = baz(i); +// CHECK: call noundef i32 @_ZL3bazi({{.*}}) #[[NOINLINEATTR]] + [[msvc::noinline]] (i = 4, bar()); +// CHECK: call noundef zeroext i1 @_Z3barv() #[[NOINLINEATTR]] + [[msvc::noinline]] (void)(bar()); +// CHECK: call noundef zeroext i1 @_Z3barv() #[[NOINLINEATTR]] + [[msvc::noinline]] f(bar(), bar()); +// CHECK: call noundef zeroext i1 @_Z3barv() #[[NOINLINEATTR]] +// CHECK: call noundef zeroext i1 @_Z3barv() #[[NOINLINEATTR]] +// CHECK: call void @_Z1fbb({{.*}}) #[[NOINLINEATTR]] + [[msvc::noinline]] [] { bar(); bar(); }(); // noinline only applies to the anonymous function call +// CHECK: call void @"_ZZ12ms_noi_checkiENK3$_0clEv"(ptr {{[^,]*}} %ref.tmp) #[[NOINLINEATTR]] + [[msvc::noinline]] for (bar(); bar(); bar()) {} +// CHECK: call noundef zeroext i1 @_Z3barv() #[[NOINLINEATTR]] +// CHECK: call noundef zeroext i1 @_Z3barv() #[[NOINLINEATTR]] +// CHECK: call noundef zeroext i1 @_Z3barv() #[[NOINLINEATTR]] + [[msvc::noinline]] ms_noi(); +// CHECK: call noundef zeroext i1 @_Z6ms_noiv() + ms_noi(); +// CHECK: call noundef zeroext i1 @_Z6ms_noiv() +} + struct S { friend bool operator==(const S &LHS, const S &RHS); }; @@ -50,6 +76,12 @@ void func(const S &s1, const S &s2) { bool b; [[clang::noinline]] b = s1 == s2; // CHECK: call noundef zeroext i1 @_ZeqRK1SS1_({{.*}}) #[[NOINLINEATTR]] + + [[msvc::noinline]]g(s1 == s2); +// CHECK: call noundef zeroext i1 @_ZeqRK1SS1_({{.*}}) #[[NOINLINEATTR]] +// CHECK: call void @_Z1gb({{.*}}) #[[NOINLINEATTR]] + [[msvc::noinline]] b = s1 == s2; +// CHECK: call noundef zeroext i1 @_ZeqRK1SS1_({{.*}}) #[[NOINLINEATTR]] } // CHECK: attributes #[[NOINLINEATTR]] = { noinline } diff --git a/clang/test/CodeGen/attr-target-x86.c b/clang/test/CodeGen/attr-target-x86.c index 304398678216f..3c2b511157f99 100644 --- a/clang/test/CodeGen/attr-target-x86.c +++ b/clang/test/CodeGen/attr-target-x86.c @@ -59,9 +59,9 @@ void __attribute__((target("avx10.1-512"))) avx10_1_512(void) {} // CHECK: #0 = {{.*}}"target-cpu"="i686" "target-features"="+cmov,+cx8,+x87" "tune-cpu"="i686" // CHECK: #1 = {{.*}}"target-cpu"="ivybridge" "target-features"="+avx,+cmov,+crc32,+cx16,+cx8,+f16c,+fsgsbase,+fxsr,+mmx,+pclmul,+popcnt,+rdrnd,+sahf,+sse,+sse2,+sse3,+sse4.1,+sse4.2,+ssse3,+x87,+xsave,+xsaveopt" // CHECK-NOT: tune-cpu -// CHECK: #2 = {{.*}}"target-cpu"="i686" "target-features"="+cmov,+cx8,+x87,-aes,-avx,-avx10.1-256,-avx10.1-512,-avx2,-avx512bf16,-avx512bitalg,-avx512bw,-avx512cd,-avx512dq,-avx512er,-avx512f,-avx512fp16,-avx512ifma,-avx512pf,-avx512vbmi,-avx512vbmi2,-avx512vl,-avx512vnni,-avx512vp2intersect,-avx512vpopcntdq,-avxifma,-avxneconvert,-avxvnni,-avxvnniint16,-avxvnniint8,-f16c,-fma,-fma4,-gfni,-kl,-pclmul,-sha,-sha512,-sm3,-sm4,-sse2,-sse3,-sse4.1,-sse4.2,-sse4a,-ssse3,-vaes,-vpclmulqdq,-widekl,-xop" "tune-cpu"="i686" +// CHECK: #2 = {{.*}}"target-cpu"="i686" "target-features"="+cmov,+cx8,+x87,-aes,-avx,-avx10.1-256,-avx10.1-512,-avx2,-avx512bf16,-avx512bitalg,-avx512bw,-avx512cd,-avx512dq,-avx512f,-avx512fp16,-avx512ifma,-avx512vbmi,-avx512vbmi2,-avx512vl,-avx512vnni,-avx512vp2intersect,-avx512vpopcntdq,-avxifma,-avxneconvert,-avxvnni,-avxvnniint16,-avxvnniint8,-f16c,-fma,-fma4,-gfni,-kl,-pclmul,-sha,-sha512,-sm3,-sm4,-sse2,-sse3,-sse4.1,-sse4.2,-sse4a,-ssse3,-vaes,-vpclmulqdq,-widekl,-xop" "tune-cpu"="i686" // CHECK: #3 = {{.*}}"target-cpu"="i686" "target-features"="+cmov,+crc32,+cx8,+mmx,+popcnt,+sse,+sse2,+sse3,+sse4.1,+sse4.2,+ssse3,+x87" "tune-cpu"="i686" -// CHECK: #4 = {{.*}}"target-cpu"="i686" "target-features"="+cmov,+cx8,+x87,-avx,-avx10.1-256,-avx10.1-512,-avx2,-avx512bf16,-avx512bitalg,-avx512bw,-avx512cd,-avx512dq,-avx512er,-avx512f,-avx512fp16,-avx512ifma,-avx512pf,-avx512vbmi,-avx512vbmi2,-avx512vl,-avx512vnni,-avx512vp2intersect,-avx512vpopcntdq,-avxifma,-avxneconvert,-avxvnni,-avxvnniint16,-avxvnniint8,-f16c,-fma,-fma4,-sha512,-sm3,-sm4,-sse4.1,-sse4.2,-vaes,-vpclmulqdq,-xop" "tune-cpu"="i686" +// CHECK: #4 = {{.*}}"target-cpu"="i686" "target-features"="+cmov,+cx8,+x87,-avx,-avx10.1-256,-avx10.1-512,-avx2,-avx512bf16,-avx512bitalg,-avx512bw,-avx512cd,-avx512dq,-avx512f,-avx512fp16,-avx512ifma,-avx512vbmi,-avx512vbmi2,-avx512vl,-avx512vnni,-avx512vp2intersect,-avx512vpopcntdq,-avxifma,-avxneconvert,-avxvnni,-avxvnniint16,-avxvnniint8,-f16c,-fma,-fma4,-sha512,-sm3,-sm4,-sse4.1,-sse4.2,-vaes,-vpclmulqdq,-xop" "tune-cpu"="i686" // CHECK: #5 = {{.*}}"target-cpu"="ivybridge" "target-features"="+avx,+cmov,+crc32,+cx16,+cx8,+f16c,+fsgsbase,+fxsr,+mmx,+pclmul,+popcnt,+rdrnd,+sahf,+sse,+sse2,+sse3,+sse4.1,+sse4.2,+ssse3,+x87,+xsave,+xsaveopt,-aes,-avx10.1-256,-avx10.1-512,-vaes" // CHECK-NOT: tune-cpu // CHECK: #6 = {{.*}}"target-cpu"="i686" "target-features"="+cmov,+cx8,+x87,-3dnow,-3dnowa,-mmx" diff --git a/clang/test/CodeGen/builtins-wasm.c b/clang/test/CodeGen/builtins-wasm.c index bcb15969de1c5..93a6ab06081c9 100644 --- a/clang/test/CodeGen/builtins-wasm.c +++ b/clang/test/CodeGen/builtins-wasm.c @@ -11,6 +11,7 @@ typedef unsigned char u8x16 __attribute((vector_size(16))); typedef unsigned short u16x8 __attribute((vector_size(16))); typedef unsigned int u32x4 __attribute((vector_size(16))); typedef unsigned long long u64x2 __attribute((vector_size(16))); +typedef __fp16 f16x8 __attribute((vector_size(16))); typedef float f32x4 __attribute((vector_size(16))); typedef double f64x2 __attribute((vector_size(16))); @@ -813,6 +814,17 @@ void store_f16_f32(float val, __fp16 *addr) { // WEBASSEMBLY-NEXT: ret } +f16x8 splat_f16x8(float a) { + // WEBASSEMBLY: %0 = tail call <8 x half> @llvm.wasm.splat.f16x8(float %a) + // WEBASSEMBLY-NEXT: ret <8 x half> %0 + return __builtin_wasm_splat_f16x8(a); +} + +float extract_lane_f16x8(f16x8 a, int i) { + // WEBASSEMBLY: %0 = tail call float @llvm.wasm.extract.lane.f16x8(<8 x half> %a, i32 %i) + // WEBASSEMBLY-NEXT: ret float %0 + return __builtin_wasm_extract_lane_f16x8(a, i); +} __externref_t externref_null() { return __builtin_wasm_ref_null_extern(); // WEBASSEMBLY: tail call ptr addrspace(10) @llvm.wasm.ref.null.extern() diff --git a/clang/test/CodeGen/function-target-features.c b/clang/test/CodeGen/function-target-features.c index 0d8bfc7e4e44c..d6a73ff8224b6 100644 --- a/clang/test/CodeGen/function-target-features.c +++ b/clang/test/CodeGen/function-target-features.c @@ -4,7 +4,7 @@ // RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -o - %s -target-feature +avx | FileCheck %s -check-prefix=AVX-FEATURE // RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -o - %s -target-feature +avx | FileCheck %s -check-prefix=AVX-NO-CPU -// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -o - %s -target-feature +avx512f -target-feature +avx512er | FileCheck %s -check-prefix=TWO-AVX +// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -o - %s -target-feature +avx512f -target-feature +avx512bw | FileCheck %s -check-prefix=TWO-AVX // RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -o - %s -target-cpu corei7 | FileCheck %s -check-prefix=CORE-CPU // RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -o - %s -target-cpu corei7 -target-feature +avx | FileCheck %s -check-prefix=CORE-CPU-AND-FEATURES // RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -o - %s -target-cpu x86-64 | FileCheck %s -check-prefix=X86-64-CPU @@ -17,7 +17,7 @@ void foo(void) {} // AVX-FEATURE: "target-features"{{.*}}+avx // AVX-NO-CPU-NOT: target-cpu -// TWO-AVX: "target-features"={{.*}}+avx512er{{.*}}+avx512f +// TWO-AVX: "target-features"={{.*}}+avx512bw{{.*}}+avx512f // CORE-CPU: "target-cpu"="corei7" // CORE-CPU-AND-FEATURES: "target-cpu"="corei7" "target-features"={{.*}}+avx // X86-64-CPU: "target-cpu"="x86-64" diff --git a/clang/test/CodeGen/target-builtin-noerror.c b/clang/test/CodeGen/target-builtin-noerror.c index b438e50848a4b..2e16fd8b9fe4d 100644 --- a/clang/test/CodeGen/target-builtin-noerror.c +++ b/clang/test/CodeGen/target-builtin-noerror.c @@ -68,8 +68,6 @@ void verifyfeaturestrings(void) { (void)__builtin_cpu_supports("avx512bw"); (void)__builtin_cpu_supports("avx512dq"); (void)__builtin_cpu_supports("avx512cd"); - (void)__builtin_cpu_supports("avx512er"); - (void)__builtin_cpu_supports("avx512pf"); (void)__builtin_cpu_supports("avx512vbmi"); (void)__builtin_cpu_supports("avx512ifma"); (void)__builtin_cpu_supports("avx5124vnniw"); diff --git a/clang/test/CodeGenCXX/builtin-amdgcn-fence.cpp b/clang/test/CodeGenCXX/builtin-amdgcn-fence.cpp index 630e416b893f4..3af5a21ba0cd5 100644 --- a/clang/test/CodeGenCXX/builtin-amdgcn-fence.cpp +++ b/clang/test/CodeGenCXX/builtin-amdgcn-fence.cpp @@ -1,22 +1,111 @@ +// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 4 // REQUIRES: amdgpu-registered-target // RUN: %clang_cc1 %s -emit-llvm -O0 -o - \ -// RUN: -triple=amdgcn-amd-amdhsa | opt -S | FileCheck %s +// RUN: -triple=amdgcn-amd-amdhsa | FileCheck %s +// CHECK-LABEL: define dso_local void @_Z25test_memory_fence_successv( +// CHECK-SAME: ) #[[ATTR0:[0-9]+]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: fence syncscope("workgroup") seq_cst +// CHECK-NEXT: fence syncscope("agent") acquire +// CHECK-NEXT: fence seq_cst +// CHECK-NEXT: fence syncscope("agent") acq_rel +// CHECK-NEXT: fence syncscope("workgroup") release +// CHECK-NEXT: ret void +// void test_memory_fence_success() { - // CHECK-LABEL: test_memory_fence_success - // CHECK: fence syncscope("workgroup") seq_cst __builtin_amdgcn_fence(__ATOMIC_SEQ_CST, "workgroup"); - // CHECK: fence syncscope("agent") acquire __builtin_amdgcn_fence(__ATOMIC_ACQUIRE, "agent"); - // CHECK: fence seq_cst __builtin_amdgcn_fence(__ATOMIC_SEQ_CST, ""); - // CHECK: fence syncscope("agent") acq_rel __builtin_amdgcn_fence(4, "agent"); - // CHECK: fence syncscope("workgroup") release __builtin_amdgcn_fence(3, "workgroup"); } + +// CHECK-LABEL: define dso_local void @_Z10test_localv( +// CHECK-SAME: ) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: fence syncscope("workgroup") seq_cst, !mmra [[META3:![0-9]+]] +// CHECK-NEXT: fence syncscope("agent") acquire, !mmra [[META3]] +// CHECK-NEXT: fence seq_cst, !mmra [[META3]] +// CHECK-NEXT: fence syncscope("agent") acq_rel, !mmra [[META3]] +// CHECK-NEXT: fence syncscope("workgroup") release, !mmra [[META3]] +// CHECK-NEXT: ret void +// +void test_local() { + __builtin_amdgcn_fence( __ATOMIC_SEQ_CST, "workgroup", "local"); + + __builtin_amdgcn_fence(__ATOMIC_ACQUIRE, "agent", "local"); + + __builtin_amdgcn_fence(__ATOMIC_SEQ_CST, "", "local"); + + __builtin_amdgcn_fence(4, "agent", "local"); + + __builtin_amdgcn_fence(3, "workgroup", "local"); +} + + +// CHECK-LABEL: define dso_local void @_Z11test_globalv( +// CHECK-SAME: ) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: fence syncscope("workgroup") seq_cst, !mmra [[META4:![0-9]+]] +// CHECK-NEXT: fence syncscope("agent") acquire, !mmra [[META4]] +// CHECK-NEXT: fence seq_cst, !mmra [[META4]] +// CHECK-NEXT: fence syncscope("agent") acq_rel, !mmra [[META4]] +// CHECK-NEXT: fence syncscope("workgroup") release, !mmra [[META4]] +// CHECK-NEXT: ret void +// +void test_global() { + __builtin_amdgcn_fence( __ATOMIC_SEQ_CST, "workgroup", "global"); + + __builtin_amdgcn_fence(__ATOMIC_ACQUIRE, "agent", "global"); + + __builtin_amdgcn_fence(__ATOMIC_SEQ_CST, "", "global"); + + __builtin_amdgcn_fence(4, "agent", "global"); + + __builtin_amdgcn_fence(3, "workgroup", "global"); +} + +// CHECK-LABEL: define dso_local void @_Z10test_imagev( +// CHECK-SAME: ) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: fence syncscope("workgroup") seq_cst, !mmra [[META3]] +// CHECK-NEXT: fence syncscope("agent") acquire, !mmra [[META3]] +// CHECK-NEXT: fence seq_cst, !mmra [[META3]] +// CHECK-NEXT: fence syncscope("agent") acq_rel, !mmra [[META3]] +// CHECK-NEXT: fence syncscope("workgroup") release, !mmra [[META3]] +// CHECK-NEXT: ret void +// +void test_image() { + __builtin_amdgcn_fence( __ATOMIC_SEQ_CST, "workgroup", "local"); + + __builtin_amdgcn_fence(__ATOMIC_ACQUIRE, "agent", "local"); + + __builtin_amdgcn_fence(__ATOMIC_SEQ_CST, "", "local"); + + __builtin_amdgcn_fence(4, "agent", "local"); + + __builtin_amdgcn_fence(3, "workgroup", "local"); +} + +// CHECK-LABEL: define dso_local void @_Z10test_mixedv( +// CHECK-SAME: ) #[[ATTR0]] { +// CHECK-NEXT: entry: +// CHECK-NEXT: fence syncscope("workgroup") seq_cst, !mmra [[META5:![0-9]+]] +// CHECK-NEXT: fence syncscope("workgroup") seq_cst, !mmra [[META5]] +// CHECK-NEXT: ret void +// +void test_mixed() { + __builtin_amdgcn_fence( __ATOMIC_SEQ_CST, "workgroup", "local", "global"); + __builtin_amdgcn_fence( __ATOMIC_SEQ_CST, "workgroup", "local", "local", "global", "local", "local"); +} +//. +// CHECK: [[META3]] = !{!"amdgpu-as", !"local"} +// CHECK: [[META4]] = !{!"amdgpu-as", !"global"} +// CHECK: [[META5]] = !{[[META4]], [[META3]]} +//. diff --git a/clang/test/CodeGenCXX/fmv-namespace.cpp b/clang/test/CodeGenCXX/fmv-namespace.cpp new file mode 100644 index 0000000000000..5bcd0da06eebc --- /dev/null +++ b/clang/test/CodeGenCXX/fmv-namespace.cpp @@ -0,0 +1,93 @@ +// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --check-globals all --include-generated-funcs --version 5 +// RUN: %clang_cc1 -triple aarch64-linux-gnu -emit-llvm %s -o - | FileCheck %s + +namespace Name { +int __attribute((target_version("default"))) foo() { return 0; } +} + +namespace Name { +int __attribute((target_version("sve"))) foo() { return 1; } +} + +int bar() { return Name::foo(); } + +namespace OtherName { +int __attribute((target_version("sve"))) foo() { return 2; } +} + +int baz() { return OtherName::foo(); } + +//. +// CHECK: @__aarch64_cpu_features = external dso_local global { i64 } +// CHECK: @_ZN4Name3fooEv.ifunc = weak_odr alias i32 (), ptr @_ZN4Name3fooEv +// CHECK: @_ZN9OtherName3fooEv.ifunc = weak_odr alias i32 (), ptr @_ZN9OtherName3fooEv +// CHECK: @_ZN4Name3fooEv = weak_odr ifunc i32 (), ptr @_ZN4Name3fooEv.resolver +// CHECK: @_ZN9OtherName3fooEv = weak_odr ifunc i32 (), ptr @_ZN9OtherName3fooEv.resolver +//. +// CHECK-LABEL: define dso_local noundef i32 @_ZN4Name3fooEv.default( +// CHECK-SAME: ) #[[ATTR0:[0-9]+]] { +// CHECK-NEXT: [[ENTRY:.*:]] +// CHECK-NEXT: ret i32 0 +// +// +// CHECK-LABEL: define dso_local noundef i32 @_ZN4Name3fooEv._Msve( +// CHECK-SAME: ) #[[ATTR1:[0-9]+]] { +// CHECK-NEXT: [[ENTRY:.*:]] +// CHECK-NEXT: ret i32 1 +// +// +// CHECK-LABEL: define dso_local noundef i32 @_Z3barv( +// CHECK-SAME: ) #[[ATTR0]] { +// CHECK-NEXT: [[ENTRY:.*:]] +// CHECK-NEXT: [[CALL:%.*]] = call noundef i32 @_ZN4Name3fooEv() +// CHECK-NEXT: ret i32 [[CALL]] +// +// +// CHECK-LABEL: define weak_odr ptr @_ZN4Name3fooEv.resolver() comdat { +// CHECK-NEXT: [[RESOLVER_ENTRY:.*:]] +// CHECK-NEXT: call void @__init_cpu_features_resolver() +// CHECK-NEXT: [[TMP0:%.*]] = load i64, ptr @__aarch64_cpu_features, align 8 +// CHECK-NEXT: [[TMP1:%.*]] = and i64 [[TMP0]], 1073741824 +// CHECK-NEXT: [[TMP2:%.*]] = icmp eq i64 [[TMP1]], 1073741824 +// CHECK-NEXT: [[TMP3:%.*]] = and i1 true, [[TMP2]] +// CHECK-NEXT: br i1 [[TMP3]], label %[[RESOLVER_RETURN:.*]], label %[[RESOLVER_ELSE:.*]] +// CHECK: [[RESOLVER_RETURN]]: +// CHECK-NEXT: ret ptr @_ZN4Name3fooEv._Msve +// CHECK: [[RESOLVER_ELSE]]: +// CHECK-NEXT: ret ptr @_ZN4Name3fooEv.default +// +// +// CHECK-LABEL: define dso_local noundef i32 @_ZN9OtherName3fooEv._Msve( +// CHECK-SAME: ) #[[ATTR1]] { +// CHECK-NEXT: [[ENTRY:.*:]] +// CHECK-NEXT: ret i32 2 +// +// +// CHECK-LABEL: define dso_local noundef i32 @_Z3bazv( +// CHECK-SAME: ) #[[ATTR0]] { +// CHECK-NEXT: [[ENTRY:.*:]] +// CHECK-NEXT: [[CALL:%.*]] = call noundef i32 @_ZN9OtherName3fooEv() +// CHECK-NEXT: ret i32 [[CALL]] +// +// +// CHECK-LABEL: define weak_odr ptr @_ZN9OtherName3fooEv.resolver() comdat { +// CHECK-NEXT: [[RESOLVER_ENTRY:.*:]] +// CHECK-NEXT: call void @__init_cpu_features_resolver() +// CHECK-NEXT: [[TMP0:%.*]] = load i64, ptr @__aarch64_cpu_features, align 8 +// CHECK-NEXT: [[TMP1:%.*]] = and i64 [[TMP0]], 1073741824 +// CHECK-NEXT: [[TMP2:%.*]] = icmp eq i64 [[TMP1]], 1073741824 +// CHECK-NEXT: [[TMP3:%.*]] = and i1 true, [[TMP2]] +// CHECK-NEXT: br i1 [[TMP3]], label %[[RESOLVER_RETURN:.*]], label %[[RESOLVER_ELSE:.*]] +// CHECK: [[RESOLVER_RETURN]]: +// CHECK-NEXT: ret ptr @_ZN9OtherName3fooEv._Msve +// CHECK: [[RESOLVER_ELSE]]: +// CHECK-NEXT: ret ptr @_ZN9OtherName3fooEv.default +// +//. +// CHECK: attributes #[[ATTR0]] = { mustprogress noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" } +// CHECK: attributes #[[ATTR1]] = { mustprogress noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-features"="+fp-armv8,+fullfp16,+neon,+sve" } +// CHECK: attributes #[[ATTR2:[0-9]+]] = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" } +//. +// CHECK: [[META0:![0-9]+]] = !{i32 1, !"wchar_size", i32 4} +// CHECK: [[META1:![0-9]+]] = !{!"{{.*}}clang version {{.*}}"} +//. diff --git a/clang/test/CodeGenCXX/ps-dllstorage-vtable-rtti.cpp b/clang/test/CodeGenCXX/ps-dllstorage-vtable-rtti.cpp new file mode 100644 index 0000000000000..377e579058ac1 --- /dev/null +++ b/clang/test/CodeGenCXX/ps-dllstorage-vtable-rtti.cpp @@ -0,0 +1,114 @@ +/// For a class that has a vtable and typeinfo symbol for RTTI, if a user marks +/// either: +/// +/// (a) The entire class as dllexport (dllimport) +/// (b) Any non-inline method of the class as dllexport (dllimport) +/// +/// then Clang must export the vtable and typeinfo symbol from the TU where they +/// are defined (the TU containing the definition of the Itanium C++ ABI "key +/// function") and must import them in other modules where they are referenced. + +// RUN: %clang_cc1 -I%S -fdeclspec -triple x86_64-unknown-windows-itanium -emit-llvm -o - %s -fhalf-no-semantic-interposition \ +// RUN: | FileCheck %s -check-prefix=WI +// RUN: %clang_cc1 -I%S -fdeclspec -triple x86_64-scei-windows-itanium -emit-llvm -o - %s -fhalf-no-semantic-interposition \ +// RUN: | FileCheck %s --check-prefixes=PS +// RUN: %clang_cc1 -I%S -fdeclspec -triple x86_64-scei-ps4 -emit-llvm -o - %s -fhalf-no-semantic-interposition \ +// RUN: | FileCheck %s --check-prefixes=PS +// RUN: %clang_cc1 -I%S -fdeclspec -triple x86_64-sie-ps5 -emit-llvm -o - %s -fhalf-no-semantic-interposition \ +// RUN: | FileCheck %s --check-prefixes=PS + +#include + +/// Case (a) -- Import Aspect +/// The entire class is imported. The typeinfo symbol must also be imported, but +/// the vtable will not be referenced, and so does not need to be imported. + +// PS-DAG: @_ZTI10FullImport = {{.*}}dllimport +// WI-DAG: @_ZTI10FullImport = external dllimport constant ptr +struct __declspec(dllimport) FullImport { + virtual void inlineFunc() const {} + virtual void key(); + virtual void func(); +}; + +/// 'FullImport::key()' is the key function, so the vtable and typeinfo symbol +/// of 'FullImport' will be defined in the TU that contains the definition of +/// 'key()' (and they must be exported from there). +void FullImportTest() { typeid(FullImport).name(); } + +/// Case (a) -- Export Aspect +/// The entire class is exported. The vtable and typeinfo symbols must also be +/// exported. + +// PS-DAG: @_ZTV10FullExport = {{.*}}dllexport +// WI-DAG: @_ZTV10FullExport = {{.*}}dllexport +// PS-DAG: @_ZTI10FullExport = {{.*}}dllexport +// WI-DAG: @_ZTI10FullExport = dso_local dllexport constant { +struct __declspec(dllexport) FullExport { + virtual void inlineFunc() const {} + virtual void key(); + virtual void func(); +}; + +/// This is the key function of the class 'FullExport', so the vtable and +/// typeinfo symbols of 'FullExport' will be defined in this TU, and so they +/// must be exported from this TU. +void FullExport::key() { typeid(FullExport).name(); } + +/// Case (b) -- Import Aspect +/// The class as a whole is not imported, but a non-inline method of the class +/// is, so the vtable and typeinfo symbol must be imported. + +// PS-DAG: @_ZTV10PartImport = {{.*}}dllimport +// WI-DAG: @_ZTV10PartImport = external dso_local unnamed_addr constant { +// PS-DAG: @_ZTI10PartImport = {{.*}}dllimport +// WI-DAG: @_ZTI10PartImport = external dso_local constant ptr +struct PartImport { + virtual void inlineFunc() const {} + virtual void key(); + __declspec(dllimport) virtual void func(); +}; + +/// 'PartImport::key()' is the key function, so the vtable and typeinfo symbol +/// of 'PartImport' will be defined in the TU that contains the definition of +/// 'key()' (and they must be exported from there). Here, we will reference the +/// vtable and typeinfo symbol, so we must also import them. +void PartImportTest() { + PartImport f; + typeid(PartImport).name(); +} + +/// Case (b) -- Export Aspect +/// The class as a whole is not exported, but a non-inline method of the class +/// is, so the vtable and typeinfo symbol must be exported. + +// PS-DAG: @_ZTV10PartExport = {{.*}}dllexport +// WI-DAG: @_ZTV10PartExport = dso_local unnamed_addr constant { +// PS-DAG: @_ZTI10PartExport = {{.*}}dllexport +// WI-DAG: @_ZTI10PartExport = dso_local constant { +struct PartExport { + virtual void inlineFunc() const {} + virtual void key(); + __declspec(dllexport) virtual void func(); +}; + +/// This is the key function of the class 'PartExport', so the vtable and +/// typeinfo symbol of 'PartExport' will be defined in this TU, and so they must +/// be exported from this TU. +void PartExport::key() { typeid(PartExport).name(); } + +/// Case (b) -- Export Aspect +/// The class as a whole is not exported, but the constructor of the class +/// is, so the vtable and typeinfo symbol must be exported. + +// PS-DAG: @_ZTV10ConsExport = {{.*}}dllexport +// WI-DAG: @_ZTV10ConsExport = dso_local unnamed_addr constant { +// PS-DAG: @_ZTI10ConsExport = {{.*}}dllexport +// WI-DAG: @_ZTI10ConsExport = dso_local constant { +struct ConsExport { + __declspec(dllexport) ConsExport(); + virtual void key(); +}; + +ConsExport::ConsExport() {} +void ConsExport::key() { typeid(ConsExport).name(); } diff --git a/clang/test/CodeGenCXX/ps4-dllstorage-vtable-rtti.cpp b/clang/test/CodeGenCXX/ps4-dllstorage-vtable-rtti.cpp deleted file mode 100644 index 5724e78617df9..0000000000000 --- a/clang/test/CodeGenCXX/ps4-dllstorage-vtable-rtti.cpp +++ /dev/null @@ -1,211 +0,0 @@ -// For a class that has a vtable (and hence, also has a typeinfo symbol for -// RTTI), if a user marks either: -// -// (a) the entire class as dllexport (dllimport), or -// (b) all non-inline virtual methods of the class as dllexport (dllimport) -// -// then Clang must export the vtable and typeinfo symbol from the TU where they -// are defined (the TU containing the definition of the Itanium C++ ABI "key -// function"), and must import them in other modules where they are referenced. -// -// Conversely to point (b), if some (but not all) of the non-inline virtual -// methods of a class are marked as dllexport (dllimport), then the vtable and -// typeinfo symbols must not be exported (imported). This will result in a -// link-time failure when linking the importing module. This link-time failure -// is the desired behavior, because the Microsoft toolchain also gets a -// link-time failure in these cases (and since __declspec(dllexport) -// (__declspec(dllimport)) is a Microsoft extension, our intention is to mimic -// that Microsoft behavior). -// -// Side note: It is within the bodies of constructors (and in some cases, -// destructors) that the vtable is explicitly referenced. In case (a) above, -// where the entire class is exported (imported), then all constructors (among -// other things) are exported (imported). So for that situation, an importing -// module for a well-formed program will not actually reference the vtable, -// since constructor calls will all be to functions external to that module -// (and imported into it, from the exporting module). I.e., all vtable -// references will be in that module where the constructor and destructor -// bodies are, therefore, there will not be a need to import the vtable in -// that case. -// -// This test contains 6 test classes: -// 2 for point (a), -// 2 for point (b), -// and 2 negative tests for the converse of point (b). -// -// The two tests for each of these points are one for importing, and one for -// exporting. - -// RUN: %clang_cc1 -I%S -fdeclspec -triple x86_64-unknown-windows-itanium -emit-llvm -o - %s -fhalf-no-semantic-interposition | FileCheck %s -check-prefix=WI -// RUN: %clang_cc1 -I%S -fdeclspec -triple x86_64-scei-windows-itanium -emit-llvm -o - %s -fhalf-no-semantic-interposition | FileCheck %s --check-prefixes=PS4,SCEI_WI -// RUN: %clang_cc1 -I%S -fdeclspec -triple x86_64-scei-ps4 -emit-llvm -o - %s -fhalf-no-semantic-interposition | FileCheck %s --check-prefixes=PS4,SCEI_PS4 -// RUN: %clang_cc1 -I%S -fdeclspec -triple x86_64-sie-ps5 -emit-llvm -o - %s -fhalf-no-semantic-interposition | FileCheck %s --check-prefixes=PS4,SCEI_PS4 - -#include - -// Case (a) -- Import Aspect -// The entire class is imported. The typeinfo symbol must also be imported, -// but the vtable will not be referenced, and so does not need to be imported -// (as described in the "Side note", above). -// -// PS4-DAG: @_ZTI10FullImport = {{.*}}dllimport -// WI-DAG: @_ZTI10FullImport = external dllimport constant ptr -struct __declspec(dllimport) FullImport -{ - virtual void getId() {} - virtual void Bump(); - virtual void Decrement(); -}; - -// 'FullImport::Bump()' is the key function, so the vtable and typeinfo symbol -// of 'FullImport' will be defined in the TU that contains the definition of -// 'Bump()' (and they must be exported from there). -void FullImportTest() -{ - typeid(FullImport).name(); -} - -/////////////////////////////////////////////////////////////////// - -// Case (a) -- Export Aspect -// The entire class is exported. The vtable and typeinfo symbols must also be -// exported, -// -// PS4-DAG: @_ZTV10FullExport ={{.*}}dllexport -// WI-DAG: @_ZTV10FullExport ={{.*}}dllexport -// PS4-DAG: @_ZTI10FullExport ={{.*}}dllexport -// WI-DAG: @_ZTI10FullExport = dso_local dllexport constant { -struct __declspec(dllexport) FullExport // Easy case: Entire class is exported. -{ - virtual void getId() {} - virtual void Bump(); - virtual void Decrement(); -}; - -// This is the key function of the class 'FullExport', so the vtable and -// typeinfo symbols of 'FullExport' will be defined in this TU, and so they -// must be exported from this TU. -void FullExport::Bump() -{ - typeid(FullExport).name(); -} - -/////////////////////////////////////////////////////////////////// - -// Case (b) -- Import Aspect -// The class as a whole is not imported, but all non-inline virtual methods of -// the class are, so the vtable and typeinfo symbol must be imported. -// -// PS4-DAG: @_ZTV9FooImport ={{.*}}dllimport -// WI-DAG: @_ZTV9FooImport = linkonce_odr dso_local unnamed_addr constant { -// PS4-DAG: @_ZTI9FooImport ={{.*}}dllimport -// WI-DAG: @_ZTI9FooImport = linkonce_odr dso_local constant { - - -struct FooImport -{ - virtual void getId() const {} - __declspec(dllimport) virtual void Bump(); - __declspec(dllimport) virtual void Decrement(); -}; - -// 'FooImport::Bump()' is the key function, so the vtable and typeinfo symbol -// of 'FooImport' will be defined in the TU that contains the definition of -// 'Bump()' (and they must be exported from there). Here, we will reference -// the vtable and typeinfo symbol, so we must also import them. -void importTest() -{ - typeid(FooImport).name(); -} - -/////////////////////////////////////////////////////////////////// - -// Case (b) -- Export Aspect -// The class as a whole is not exported, but all non-inline virtual methods of -// the class are, so the vtable and typeinfo symbol must be exported. -// -// PS4-DAG: @_ZTV9FooExport ={{.*}}dllexport -// WI-DAG: @_ZTV9FooExport = dso_local unnamed_addr constant { -// PS4-DAG: @_ZTI9FooExport ={{.*}}dllexport -// WI-DAG: @_ZTI9FooExport = dso_local constant { -struct FooExport -{ - virtual void getId() const {} - __declspec(dllexport) virtual void Bump(); - __declspec(dllexport) virtual void Decrement(); -}; - -// This is the key function of the class 'FooExport', so the vtable and -// typeinfo symbol of 'FooExport' will be defined in this TU, and so they must -// be exported from this TU. -void FooExport::Bump() -{ - FooImport f; - typeid(FooExport).name(); -} - -/////////////////////////////////////////////////////////////////// - -// The tests below verify that the associated vtable and typeinfo symbols are -// not imported/exported. These are the converse of case (b). -// -// Note that ultimately, if the module doing the importing calls a constructor -// of the class with the vtable, or makes a reference to the typeinfo symbol of -// the class, then this will result in an unresolved reference (to the vtable -// or typeinfo symbol) when linking the importing module, and thus a link-time -// failure. -// -// Note that with the Microsoft toolchain there will also be a link-time -// failure when linking the module doing the importing. With the Microsoft -// toolchain, it will be an unresolved reference to the method 'Decrement()' -// of the approriate class, rather than to the vtable or typeinfo symbol of -// the class, because Microsoft defines the vtable and typeinfo symbol (weakly) -// everywhere they are used. - -// Converse of case (b) -- Import Aspect -// The class as a whole is not imported, and not all non-inline virtual methods -// are imported, so the vtable and typeinfo symbol are not to be imported. -// -// CHECK-PS4: @_ZTV11FooNoImport = external dso_local unnamed_addr constant { -// CHECK-WI: @_ZTV11FooNoImport = linkonce_odr dso_local unnamed_addr constant { -// CHECK-PS4: @_ZTI11FooNoImport = external dso_local constant ptr{{$}} -// CHECK-WI: @_ZTI11FooNoImport = linkonce_odr dso_local constant { -struct FooNoImport -{ - virtual void getId() const {} - __declspec(dllimport) virtual void Bump(); - virtual void Decrement(); // Not imported. - int mCounter; -}; - -void importNegativeTest() -{ - FooNoImport f; - typeid(FooNoImport).name(); -} - -/////////////////////////////////////////////////////////////////// - -// Converse of case (b) -- Export Aspect -// The class as a whole is not exported, and not all non-inline virtual methods -// are exported, so the vtable and typeinfo symbol are not to be exported. -// -// SCEI_PS4-DAG: @_ZTV11FooNoImport = external unnamed_addr constant { -// SCEI_WI-DAG: @_ZTV11FooNoExport = dso_local unnamed_addr constant { - -// WI-DAG: @_ZTV11FooNoExport = dso_local unnamed_addr constant { -// SCEI_PS4-DAG: @_ZTI11FooNoExport = constant { -// SCEI_WI-DAG: @_ZTI11FooNoExport = dso_local constant { -// WI-DAG: @_ZTI11FooNoExport = dso_local constant { -struct FooNoExport -{ - virtual void getId() const {} - __declspec(dllexport) virtual void Bump(); - virtual void Decrement(); // Not exported. - int mCounter; -}; - -void FooNoExport::Bump() -{ - typeid(FooNoExport).name(); -} diff --git a/clang/test/CoverageMapping/builtinmacro.c b/clang/test/CoverageMapping/builtinmacro.c index abcdc191523a5..5d5a176aa7d87 100644 --- a/clang/test/CoverageMapping/builtinmacro.c +++ b/clang/test/CoverageMapping/builtinmacro.c @@ -4,7 +4,7 @@ // CHECK: filename const char *filename (const char *name) { // CHECK-NEXT: File 0, [[@LINE]]:41 -> [[@LINE+3]]:2 = #0 - static const char this_file[] = __FILE__; + static const char this_file[] = __FILE__; // CHECK-NEXT: File 0, [[@LINE]]:35 -> [[@LINE]]:35 = #0 return this_file; } diff --git a/clang/test/CoverageMapping/macros.c b/clang/test/CoverageMapping/macros.c index 6bd3be434139a..fcf21170ef135 100644 --- a/clang/test/CoverageMapping/macros.c +++ b/clang/test/CoverageMapping/macros.c @@ -80,12 +80,14 @@ void func7(void) { // CHECK-NEXT: File 0, [[@LINE]]:18 -> [[@LINE+6]]:2 = #0 int kk,ll; // CHECK-NEXT: File 0, [[@LINE+1]]:7 -> [[@LINE+1]]:8 = #0 if (k) // CHECK-NEXT: Branch,File 0, [[@LINE]]:7 -> [[@LINE]]:8 = #1 m(k); // CHECK-NEXT: Gap,File 0, [[@LINE-1]]:9 -> [[@LINE]]:5 = #1 - else // CHECK-NEXT: Expansion,File 0, [[@LINE-1]]:5 -> [[@LINE-1]]:6 = #0 + else // CHECK-NEXT: Expansion,File 0, [[@LINE-1]]:5 -> [[@LINE-1]]:6 = #1 l = m(l); // CHECK-NEXT: Gap,File 0, [[@LINE-2]]:7 -> [[@LINE]]:5 = (#0 - #1) } // CHECK-NEXT: File 0, [[@LINE-1]]:5 -> [[@LINE-1]]:10 = (#0 - #1) // CHECK-NEXT: Expansion,File 0, [[@LINE-2]]:9 -> [[@LINE-2]]:10 = (#0 - #1) - // CHECK-NEXT: File 1, [[@LINE-9]]:14 -> [[@LINE-9]]:18 = #0 - // CHECK-NEXT: File 2, [[@LINE-10]]:14 -> [[@LINE-10]]:15 = (#0 - #1) + // CHECK-NEXT: File 1, [[@LINE-9]]:14 -> [[@LINE-9]]:17 = #1 + // CHECK-NEXT: File 1, [[@LINE-10]]:14 -> [[@LINE-10]]:18 = #0 + // CHECK-NEXT: File 2, [[@LINE-11]]:14 -> [[@LINE-11]]:17 = (#0 - #1) + // CHECK-NEXT: File 2, [[@LINE-12]]:14 -> [[@LINE-12]]:15 = (#0 - #1) int main(int argc, const char *argv[]) { func(); diff --git a/clang/test/CoverageMapping/mcdc-scratch-space.c b/clang/test/CoverageMapping/mcdc-scratch-space.c index 962d10653a028..2b5b12d9dcad6 100644 --- a/clang/test/CoverageMapping/mcdc-scratch-space.c +++ b/clang/test/CoverageMapping/mcdc-scratch-space.c @@ -1,27 +1,65 @@ -// RUN: %clang_cc1 -triple %itanium_abi_triple -std=c99 -fcoverage-mcdc -fprofile-instrument=clang -fcoverage-mapping -dump-coverage-mapping -emit-llvm-only %s -// XFAIL: * -// REQUIRES: asserts +// RUN: %clang_cc1 -triple %itanium_abi_triple -std=c99 -fcoverage-mcdc -fprofile-instrument=clang -fcoverage-mapping -dump-coverage-mapping -emit-llvm-only %s | FileCheck %s +// CHECK: builtin_macro0: int builtin_macro0(int a) { - return (__LINE__ - && a); + // CHECK: Decision,File 0, [[@LINE+1]]:11 -> [[@LINE+2]]:15 = M:0, C:2 + return (__LINE__ // CHECK: Branch,File 0, [[@LINE]]:11 -> [[@LINE]]:11 = 0, 0 [1,2,0] + && a); // CHECK: Branch,File 0, [[@LINE]]:14 -> [[@LINE]]:15 = #2, (#1 - #2) [2,0,0] } +// CHECK: builtin_macro1: int builtin_macro1(int a) { - return (a - || __LINE__); + // CHECK: Decision,File 0, [[@LINE+1]]:11 -> [[@LINE+2]]:22 = M:0, C:2 + return (a // CHECK: Branch,File 0, [[@LINE]]:11 -> [[@LINE]]:12 = (#0 - #1), #1 [1,0,2] + || __LINE__); // CHECK: Branch,File 0, [[@LINE]]:14 -> [[@LINE]]:14 = 0, 0 [2,0,0] } #define PRE(x) pre_##x +// CHECK: pre0: int pre0(int pre_a, int b_post) { + // CHECK: Decision,File 0, [[@LINE+2]]:11 -> [[@LINE+3]]:20 = M:0, C:2 + // CHECK: Expansion,File 0, [[@LINE+1]]:11 -> [[@LINE+1]]:14 = #0 (Expanded file = 1) return (PRE(a) && b_post); + // CHECK: Branch,File 0, [[@LINE-1]]:14 -> [[@LINE-1]]:20 = #2, (#1 - #2) [2,0,0] + // CHECK: Branch,File 1, [[@LINE-9]]:16 -> [[@LINE-9]]:22 = #1, (#0 - #1) [1,2,0] +} + +#define pre_foo pre_a + +// CHECK: pre1: +int pre1(int pre_a, int b_post) { + // CHECK: Decision,File 0, [[@LINE+3]]:11 -> [[@LINE+4]]:20 = M:0, C:2 + // CHECK: Expansion,File 0, [[@LINE+2]]:11 -> [[@LINE+2]]:14 = #0 (Expanded file = 1) + // CHECK: Branch,File 0, [[@LINE+2]]:14 -> [[@LINE+2]]:20 = #2, (#1 - #2) [2,0,0] + return (PRE(foo) + && b_post); + // CHECK: Expansion,File 1, 17:16 -> 17:20 = #0 (Expanded file = 2) + // CHECK: Branch,File 2, 29:17 -> 29:22 = #1, (#0 - #1) [1,2,0] } #define POST(x) x##_post +// CHECK: post0: int post0(int pre_a, int b_post) { + // CHECK: Decision,File 0, [[@LINE+2]]:11 -> [[@LINE+3]]:18 = M:0, C:2 + // CHECK: Branch,File 0, [[@LINE+1]]:11 -> [[@LINE+1]]:16 = (#0 - #1), #1 [1,0,2] return (pre_a || POST(b)); + // CHECK: Expansion,File 0, [[@LINE-1]]:14 -> [[@LINE-1]]:18 = #1 (Expanded file = 1) + // CHECK: Branch,File 1, [[@LINE-9]]:17 -> [[@LINE-9]]:20 = (#1 - #2), #2 [2,0,0] +} + +#define bar_post b_post + +// CHECK: post1: +int post1(int pre_a, int b_post) { + // CHECK: Decision,File 0, [[@LINE+3]]:11 -> [[@LINE+4]]:18 = M:0, C:2 + // CHECK: Branch,File 0, [[@LINE+2]]:11 -> [[@LINE+2]]:16 = (#0 - #1), #1 [1,0,2] + // CHECK: Expansion,File 0, [[@LINE+2]]:14 -> [[@LINE+2]]:18 = 0 (Expanded file = 1) + return (pre_a + || POST(bar)); + // CHECK: Expansion,File 1, 42:17 -> 42:18 = #1 (Expanded file = 2) + // CHECK: Branch,File 2, 54:18 -> 54:24 = (#1 - #2), #2 [2,0,0] } diff --git a/clang/test/CoverageMapping/templates.cpp b/clang/test/CoverageMapping/templates.cpp index 143e566a33cb8..7e7f2208f1145 100644 --- a/clang/test/CoverageMapping/templates.cpp +++ b/clang/test/CoverageMapping/templates.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -mllvm -emptyline-comment-coverage=false -fprofile-instrument=clang -fcoverage-mapping -dump-coverage-mapping -emit-llvm-only -main-file-name templates.cpp %s | FileCheck %s +// RUN: %clang_cc1 -std=c++20 -mllvm -emptyline-comment-coverage=false -fprofile-instrument=clang -fcoverage-mapping -dump-coverage-mapping -emit-llvm-only -main-file-name templates.cpp %s | FileCheck %s template void unused(T x) { @@ -30,5 +30,6 @@ namespace structural_value_crash { void test() { tpl_fn(); + tpl_fn<&arr[1]>(); } } diff --git a/clang/test/Driver/Ofast.c b/clang/test/Driver/Ofast.c index 1f9fc78ec1ef8..8b7f2217eca2f 100644 --- a/clang/test/Driver/Ofast.c +++ b/clang/test/Driver/Ofast.c @@ -3,7 +3,9 @@ // RUN: %clang -fno-fast-math -Ofast -### %s 2>&1 | FileCheck -check-prefix=CHECK-OFAST %s // RUN: %clang -fno-strict-aliasing -Ofast -### %s 2>&1 | FileCheck -check-prefix=CHECK-OFAST %s // RUN: %clang -fno-vectorize -Ofast -### %s 2>&1 | FileCheck -check-prefix=CHECK-OFAST %s -// RUN: %clang -Ofast -O2 -### %s 2>&1 | FileCheck -check-prefix=CHECK-OFAST-O2 %s +// RUN: %clang -Ofast -O2 -### %s 2>&1 | FileCheck -check-prefix=CHECK-OFAST-O2 \ +// RUN: %if target={{.*-windows-msvc.*}} %{ --check-prefix=CHECK-OFAST-O2-ALIASING-MSVC %} \ +// RUN: %else %{ --check-prefix=CHECK-OFAST-O2-ALIASING %} %s // RUN: %clang -Ofast -fno-fast-math -### %s 2>&1 | FileCheck -check-prefix=CHECK-OFAST-NO-FAST-MATH %s // RUN: %clang -Ofast -fno-strict-aliasing -### %s 2>&1 | FileCheck -check-prefix=CHECK-OFAST-NO-STRICT-ALIASING %s // RUN: %clang -Ofast -fno-vectorize -### %s 2>&1 | FileCheck -check-prefix=CHECK-OFAST-NO-VECTORIZE %s @@ -15,7 +17,8 @@ // CHECK-OFAST: -vectorize-loops // CHECK-OFAST-O2: -cc1 -// CHECK-OFAST-O2-NOT: -relaxed-aliasing +// CHECK-OFAST-O2-ALIASING-NOT: -relaxed-aliasing +// CHECK-OFAST-O2-ALIASING-MSVC: -relaxed-aliasing // CHECK-OFAST-O2-NOT: -ffast-math // CHECK-OFAST-O2-NOT: -Ofast // CHECK-OFAST-O2: -vectorize-loops diff --git a/clang/test/Driver/android-unversioned-fallback-warning.cpp b/clang/test/Driver/android-unversioned-fallback-warning.cpp index 62a951d14effa..da666cc4d9faf 100644 --- a/clang/test/Driver/android-unversioned-fallback-warning.cpp +++ b/clang/test/Driver/android-unversioned-fallback-warning.cpp @@ -14,14 +14,14 @@ // RUN: %clang --target=aarch64-none-linux-android -ccc-install-dir %t/bin \ // RUN: -resource-dir %t/resource -### -c %s 2>&1 | \ // RUN: FileCheck --check-prefix=NO-WARNING %s -// NO-WARNING-NOT: Using unversioned Android target directory +// NO-WARNING-NOT: using unversioned Android target directory // RUN: %clang --target=aarch64-none-linux-android21 -ccc-install-dir %t/bin \ // RUN: -resource-dir %t/resource -### -c %s 2>&1 | \ // RUN: FileCheck --check-prefix=ANDROID21 -DDIR=%t -DSEP=%{fs-sep} %s -// ANDROID21-DAG: Using unversioned Android target directory [[DIR]]/bin[[SEP]]..[[SEP]]include[[SEP]]aarch64-none-linux-android -// ANDROID21-DAG: Using unversioned Android target directory [[DIR]]/bin[[SEP]]..[[SEP]]lib[[SEP]]aarch64-none-linux-android -// ANDROID21-DAG: Using unversioned Android target directory [[DIR]]/resource[[SEP]]lib[[SEP]]aarch64-none-linux-android +// ANDROID21-DAG: using unversioned Android target directory [[DIR]]/bin[[SEP]]..[[SEP]]include[[SEP]]aarch64-none-linux-android +// ANDROID21-DAG: using unversioned Android target directory [[DIR]]/bin[[SEP]]..[[SEP]]lib[[SEP]]aarch64-none-linux-android +// ANDROID21-DAG: using unversioned Android target directory [[DIR]]/resource[[SEP]]lib[[SEP]]aarch64-none-linux-android // 23 or newer should use the versioned directory // RUN: %clang --target=aarch64-none-linux-android23 -ccc-install-dir %t/bin \ diff --git a/clang/test/Driver/cl-options.c b/clang/test/Driver/cl-options.c index 571ca5ec9ce7e..523b654c19680 100644 --- a/clang/test/Driver/cl-options.c +++ b/clang/test/Driver/cl-options.c @@ -744,9 +744,10 @@ // NOCLANG-SAME: "-vectorize-slp" // NOCLANG-NOT: "--dependent-lib=msvcrt" -// RUN: %clang_cl -O2 -MD /clang:-fno-slp-vectorize /clang:-MD /clang:-MF /clang:my_dependency_file.dep -### -- %s 2>&1 | FileCheck -check-prefix=CLANG %s +// RUN: %clang_cl -O2 -MD /clang:-fno-slp-vectorize /clang:-MD /clang:-MF /clang:my_dependency_file.dep /c /Fo%/t/cl-options.obj -### -- %s 2>&1 | FileCheck -DPREFIX=%/t -check-prefix=CLANG %s // CLANG: "--dependent-lib=msvcrt" // CLANG-SAME: "-dependency-file" "my_dependency_file.dep" +// CLANG-SAME: "-MT" "[[PREFIX]]/cl-options.obj" // CLANG-NOT: "--dependent-lib=libcmt" // CLANG-NOT: "-vectorize-slp" diff --git a/clang/test/Driver/cl-x86-flags.c b/clang/test/Driver/cl-x86-flags.c index 716b02f02a15e..51b16f0ce3546 100644 --- a/clang/test/Driver/cl-x86-flags.c +++ b/clang/test/Driver/cl-x86-flags.c @@ -69,10 +69,7 @@ // RUN: %clang_cl -m32 -arch:avx2 --target=i386-pc-windows -### -- 2>&1 %s | FileCheck -check-prefix=avx2 %s // avx2: invalid /arch: argument -// RUN: %clang_cl -m32 -arch:AVX512F --target=i386-pc-windows /c /Fo%t.obj -Xclang -verify=KNL1 -DTEST_32_ARCH_AVX512F -- %s -// KNL1-warning@*:* {{KNL, KNM related Intel Xeon Phi CPU's specific ISA's supports will be removed in LLVM 19.}} -// KNL1-warning@*:* {{KNL, KNM related Intel Xeon Phi CPU's specific ISA's supports will be removed in LLVM 19.}} -// KNL1-warning@*:* {{KNL, KNM related Intel Xeon Phi CPU's specific ISA's supports will be removed in LLVM 19.}} +// RUN: %clang_cl -m32 -arch:AVX512F --target=i386-pc-windows /c /Fo%t.obj -Xclang -verify -DTEST_32_ARCH_AVX512F -- %s #if defined(TEST_32_ARCH_AVX512F) #if _M_IX86_FP != 2 || !__AVX__ || !__AVX2__ || !__AVX512F__ || __AVX512BW__ #error fail @@ -112,10 +109,7 @@ // RUN: %clang_cl -m64 -arch:avx2 --target=x86_64-pc-windows -### -- 2>&1 %s | FileCheck -check-prefix=avx264 %s // avx264: invalid /arch: argument -// RUN: %clang_cl -m64 -arch:AVX512F --target=i386-pc-windows /c /Fo%t.obj -Xclang -verify=KNL2 -DTEST_64_ARCH_AVX512F -- %s -// KNL2-warning@*:* {{KNL, KNM related Intel Xeon Phi CPU's specific ISA's supports will be removed in LLVM 19.}} -// KNL2-warning@*:* {{KNL, KNM related Intel Xeon Phi CPU's specific ISA's supports will be removed in LLVM 19.}} -// KNL2-warning@*:* {{KNL, KNM related Intel Xeon Phi CPU's specific ISA's supports will be removed in LLVM 19.}} +// RUN: %clang_cl -m64 -arch:AVX512F --target=i386-pc-windows /c /Fo%t.obj -Xclang -verify -DTEST_64_ARCH_AVX512F -- %s #if defined(TEST_64_ARCH_AVX512F) #if _M_IX86_FP || !__AVX__ || !__AVX2__ || !__AVX512F__ || __AVX512BW__ #error fail diff --git a/clang/test/Driver/clang_f_opts.c b/clang/test/Driver/clang_f_opts.c index 472d0725a7934..d69cd199ac61d 100644 --- a/clang/test/Driver/clang_f_opts.c +++ b/clang/test/Driver/clang_f_opts.c @@ -623,3 +623,9 @@ // RUN: %clang -### --target=aarch64-windows-msvc -fno-ms-volatile %s 2>&1 | FileCheck -check-prefix=CHECK-NO-MS-VOLATILE %s // CHECK-MS-VOLATILE: -fms-volatile // CHECK-NO-MS-VOLATILE-NOT: -fms-volatile + +// RUN: %clang -### --target=x86_64-pc-windows-msvc %s 2>&1 | FileCheck -check-prefix=CHECK-NO-STRICT-ALIASING %s +// RUN: %clang -### --target=x86_64-pc-windows-msvc -fstrict-aliasing %s 2>&1 | FileCheck -check-prefix=CHECK-STRICT-ALIASING %s +// RUN: %clang -### --target=x86_64-pc-windows-msvc -fno-strict-aliasing %s 2>&1 | FileCheck -check-prefix=CHECK-NO-STRICT-ALIASING %s +// CHECK-STRICT-ALIASING-NOT: -relaxed-aliasing +// CHECK-NO-STRICT-ALIASING: -relaxed-aliasing diff --git a/clang/test/Driver/cuda-cross-compiling.c b/clang/test/Driver/cuda-cross-compiling.c index 33a1071c9f302..9819397b96593 100644 --- a/clang/test/Driver/cuda-cross-compiling.c +++ b/clang/test/Driver/cuda-cross-compiling.c @@ -83,8 +83,8 @@ // RUN: not %clang -target nvptx64-nvidia-cuda -march=generic %s -### 2>&1 \ // RUN: | FileCheck -check-prefix=MISSING %s -// MISSING: error: Must pass in an explicit nvptx64 gpu architecture to 'ptxas' -// MISSING: error: Must pass in an explicit nvptx64 gpu architecture to 'nvlink' +// MISSING: error: must pass in an explicit nvptx64 gpu architecture to 'ptxas' +// MISSING: error: must pass in an explicit nvptx64 gpu architecture to 'nvlink' // RUN: %clang -target nvptx64-nvidia-cuda -flto -c %s -### 2>&1 \ // RUN: | FileCheck -check-prefix=GENERIC %s diff --git a/clang/test/Driver/dxc_dxv_path.hlsl b/clang/test/Driver/dxc_dxv_path.hlsl index 4845de11d5b00..db2c87063ac31 100644 --- a/clang/test/Driver/dxc_dxv_path.hlsl +++ b/clang/test/Driver/dxc_dxv_path.hlsl @@ -1,7 +1,7 @@ // RUN: %clang_dxc -I test -Tlib_6_3 -### %s 2>&1 | FileCheck %s // Make sure report warning. -// CHECK:dxv not found. +// CHECK:dxv not found // RUN: echo "dxv" > %T/dxv && chmod 754 %T/dxv && %clang_dxc --dxv-path=%T %s -Tlib_6_3 -### 2>&1 | FileCheck %s --check-prefix=DXV_PATH // DXV_PATH:dxv{{(.exe)?}}" "-" "-o" "-" diff --git a/clang/test/Driver/fast-math.c b/clang/test/Driver/fast-math.c index 274f1f22ea5e9..ffd081948914d 100644 --- a/clang/test/Driver/fast-math.c +++ b/clang/test/Driver/fast-math.c @@ -67,31 +67,31 @@ // RUN: | FileCheck --check-prefixes=CHECK,NO-ERRNO %s // // Target defaults for -fmath-errno (reusing the above checks). -// RUN: %clang -### -target i686-unknown-linux -c %s 2>&1 \ +// RUN: %clang -### --target=i686-unknown-linux -c %s 2>&1 \ // RUN: | FileCheck --check-prefixes=CHECK,ERRNO %s // RUN: %clang -### -target i686-apple-darwin -c %s 2>&1 \ // RUN: | FileCheck --check-prefixes=CHECK,NO-ERRNO %s -// RUN: %clang -### -target x86_64-unknown-freebsd -c %s 2>&1 \ +// RUN: %clang -### --target=x86_64-unknown-freebsd -c %s 2>&1 \ // RUN: | FileCheck --check-prefixes=CHECK,NO-ERRNO %s -// RUN: %clang -### -target x86_64-unknown-netbsd -c %s 2>&1 \ +// RUN: %clang -### --target=x86_64-unknown-netbsd -c %s 2>&1 \ // RUN: | FileCheck --check-prefixes=CHECK,NO-ERRNO %s -// RUN: %clang -### -target x86_64-unknown-openbsd -c %s 2>&1 \ +// RUN: %clang -### --target=x86_64-unknown-openbsd -c %s 2>&1 \ // RUN: | FileCheck --check-prefixes=CHECK,NO-ERRNO %s // RUN: %clang -### --target=x86_64-unknown-haiku -c %s 2>&1 \ // RUN: | FileCheck --check-prefixes=CHECK,NO-ERRNO %s -// RUN: %clang -### -target x86_64-unknown-dragonfly -c %s 2>&1 \ +// RUN: %clang -### --target=x86_64-unknown-dragonfly -c %s 2>&1 \ // RUN: | FileCheck --check-prefixes=CHECK,NO-ERRNO %s -// RUN: %clang -### -target x86_64-fuchsia -c %s 2>&1 \ +// RUN: %clang -### --target=x86_64-fuchsia -c %s 2>&1 \ // RUN: | FileCheck --check-prefixes=CHECK,NO-ERRNO %s -// RUN: %clang -### -target x86_64-linux-android -c %s 2>&1 \ +// RUN: %clang -### --target=x86_64-linux-android -c %s 2>&1 \ // RUN: | FileCheck --check-prefixes=CHECK,NO-ERRNO %s -// RUN: %clang -### -target x86_64-linux-musl -c %s 2>&1 \ +// RUN: %clang -### --target=x86_64-linux-musl -c %s 2>&1 \ // RUN: | FileCheck --check-prefixes=CHECK,NO-ERRNO %s // RUN: %clang -### --target=amdgcn-amd-amdhsa -nogpuinc -nogpulib -c %s 2>&1 \ // RUN: | FileCheck --check-prefixes=CHECK,NO-ERRNO %s -// RUN: %clang -### -target amdgcn-amd-amdpal -c %s 2>&1 \ +// RUN: %clang -### --target=amdgcn-amd-amdpal -c %s 2>&1 \ // RUN: | FileCheck --check-prefixes=CHECK,NO-ERRNO %s -// RUN: %clang -### -target amdgcn-mesa-mesa3d -c %s 2>&1 \ +// RUN: %clang -### --target=amdgcn-mesa-mesa3d -c %s 2>&1 \ // RUN: | FileCheck --check-prefixes=CHECK,NO-ERRNO %s // // Check that -ffast-math disables -fmath-errno, and -fno-fast-math merely @@ -103,9 +103,9 @@ // RUN: | FileCheck --check-prefixes=CHECK,NO-ERRNO %s // RUN: %clang -### -ffast-math -fmath-errno -c %s 2>&1 \ // RUN: | FileCheck --check-prefixes=CHECK,ERRNO %s -// RUN: %clang -### -target i686-unknown-linux -fno-fast-math -c %s 2>&1 \ +// RUN: %clang -### --target=i686-unknown-linux -fno-fast-math -c %s 2>&1 \ // RUN: | FileCheck --check-prefixes=CHECK,ERRNO %s -// RUN: %clang -### -target i686-unknown-linux -fno-math-errno -fno-fast-math -c %s 2>&1 \ +// RUN: %clang -### --target=i686-unknown-linux -fno-math-errno -fno-fast-math -c %s 2>&1 \ // RUN: | FileCheck --check-prefixes=CHECK,ERRNO %s // RUN: %clang -### -target i686-apple-darwin -fno-fast-math -c %s 2>&1 \ // RUN: | FileCheck --check-prefixes=CHECK,NO-ERRNO %s diff --git a/clang/test/Driver/fat-archive-unbundle-ext.c b/clang/test/Driver/fat-archive-unbundle-ext.c index e98b872f0c0c3..e797acccf02b4 100644 --- a/clang/test/Driver/fat-archive-unbundle-ext.c +++ b/clang/test/Driver/fat-archive-unbundle-ext.c @@ -2,7 +2,7 @@ // UNSUPPORTED: target={{.*-windows.*}}, target={{.*}}-macosx{{.*}}, target={{.*-darwin.*}}, target={{.*}}-aix{{.*}} // Generate dummy fat object -// RUN: %clang -O0 -target %itanium_abi_triple %s -c -o %t.host.o +// RUN: %clang -O0 --target=%itanium_abi_triple %s -c -o %t.host.o // RUN: echo 'Content of device file' > %t.tgt.o // RUN: clang-offload-bundler -type=o -targets=host-%itanium_abi_triple,openmp-%itanium_abi_triple -input=%t.host.o -input=%t.tgt.o -output=%t.fat.obj diff --git a/clang/test/Driver/fatal-warnings.c b/clang/test/Driver/fatal-warnings.c index 6239b25e8917b..12c239cf12083 100644 --- a/clang/test/Driver/fatal-warnings.c +++ b/clang/test/Driver/fatal-warnings.c @@ -1,5 +1,5 @@ -// RUN: %clang -### %s -c -o tmp.o -target i686-pc-linux-gnu -integrated-as -Wa,--fatal-warnings 2>&1 | FileCheck %s -// RUN: not %clang %s -c -o %t.o -target i686-pc-linux-gnu -integrated-as -Wa,--fatal-warnings 2>&1 %t.log +// RUN: %clang -### %s -c -o tmp.o --target=i686-pc-linux-gnu -integrated-as -Wa,--fatal-warnings 2>&1 | FileCheck %s +// RUN: not %clang %s -c -o %t.o --target=i686-pc-linux-gnu -integrated-as -Wa,--fatal-warnings 2>&1 %t.log // FileCheck --check-prefix=CHECK-AS %s -input-file %t.log // CHECK: "-cc1" {{.*}} "-massembler-fatal-warnings" diff --git a/clang/test/Driver/fbinutils-version.c b/clang/test/Driver/fbinutils-version.c index 56a49ed2540fa..14b44b4d9dd07 100644 --- a/clang/test/Driver/fbinutils-version.c +++ b/clang/test/Driver/fbinutils-version.c @@ -1,29 +1,29 @@ -// RUN: %clang -### -c -target x86_64-linux %s -fbinutils-version=none 2>&1 | FileCheck %s --check-prefix=NONE +// RUN: %clang -### -c --target=x86_64-linux %s -fbinutils-version=none 2>&1 | FileCheck %s --check-prefix=NONE // NONE: "-fbinutils-version=none" -// RUN: %clang -### -c -target aarch64-linux %s -fbinutils-version=2 2>&1 | FileCheck %s --check-prefix=CHECK2 +// RUN: %clang -### -c --target=aarch64-linux %s -fbinutils-version=2 2>&1 | FileCheck %s --check-prefix=CHECK2 // CHECK2: "-fbinutils-version=2" -// RUN: %clang -### -c -target aarch64-linux %s -fbinutils-version=2.35 2>&1 | FileCheck %s --check-prefix=CHECK2_35 +// RUN: %clang -### -c --target=aarch64-linux %s -fbinutils-version=2.35 2>&1 | FileCheck %s --check-prefix=CHECK2_35 // CHECK2_35: "-fbinutils-version=2.35" /// Disallow -fbinutils-version=0 because we use $major==0 to indicate the MC /// default in the backend. -// RUN: not %clang -c -target x86_64-linux %s -fbinutils-version=0 2>&1 | FileCheck %s --check-prefix=ERR0 +// RUN: not %clang -c --target=x86_64-linux %s -fbinutils-version=0 2>&1 | FileCheck %s --check-prefix=ERR0 // ERR0: error: invalid argument '0' to -fbinutils-version= -// RUN: not %clang -c -target x86_64-linux %s -fbinutils-version=nan 2>&1 | FileCheck %s --check-prefix=ERR1 +// RUN: not %clang -c --target=x86_64-linux %s -fbinutils-version=nan 2>&1 | FileCheck %s --check-prefix=ERR1 // ERR1: error: invalid argument 'nan' to -fbinutils-version= -// RUN: not %clang -c -target x86_64-linux %s -fbinutils-version=2. 2>&1 | FileCheck %s --check-prefix=ERR2 +// RUN: not %clang -c --target=x86_64-linux %s -fbinutils-version=2. 2>&1 | FileCheck %s --check-prefix=ERR2 // ERR2: error: invalid argument '2.' to -fbinutils-version= -// RUN: not %clang -c -target x86_64-linux %s -fbinutils-version=3.-14 2>&1 | FileCheck %s --check-prefix=ERR3 +// RUN: not %clang -c --target=x86_64-linux %s -fbinutils-version=3.-14 2>&1 | FileCheck %s --check-prefix=ERR3 // ERR3: error: invalid argument '3.-14' to -fbinutils-version= diff --git a/clang/test/Driver/fdirect-access-external-data.c b/clang/test/Driver/fdirect-access-external-data.c index a6da776e69777..4dfb700d6c450 100644 --- a/clang/test/Driver/fdirect-access-external-data.c +++ b/clang/test/Driver/fdirect-access-external-data.c @@ -1,13 +1,13 @@ /// -fno-pic code defaults to -fdirect-access-external-data. -// RUN: %clang -### -c -target x86_64 %s 2>&1 | FileCheck %s --check-prefix=DEFAULT -// RUN: %clang -### -c -target x86_64 %s -fdirect-access-external-data 2>&1 | FileCheck %s --check-prefix=DEFAULT -// RUN: %clang -### -c -target x86_64 %s -fdirect-access-external-data -fno-direct-access-external-data 2>&1 | FileCheck %s --check-prefix=INDIRECT +// RUN: %clang -### -c --target=x86_64 %s 2>&1 | FileCheck %s --check-prefix=DEFAULT +// RUN: %clang -### -c --target=x86_64 %s -fdirect-access-external-data 2>&1 | FileCheck %s --check-prefix=DEFAULT +// RUN: %clang -### -c --target=x86_64 %s -fdirect-access-external-data -fno-direct-access-external-data 2>&1 | FileCheck %s --check-prefix=INDIRECT /// -fpie/-fpic code defaults to -fdirect-access-external-data. -// RUN: %clang -### -c -target x86_64 %s -fpie 2>&1 | FileCheck %s --check-prefix=DEFAULT -// RUN: %clang -### -c -target x86_64 %s -fpie -fno-direct-access-external-data -fdirect-access-external-data 2>&1 | FileCheck %s --check-prefix=DIRECT -// RUN: %clang -### -c -target aarch64 %s -fpic 2>&1 | FileCheck %s --check-prefix=DEFAULT -// RUN: %clang -### -c -target aarch64 %s -fpic -fdirect-access-external-data 2>&1 | FileCheck %s --check-prefix=DIRECT +// RUN: %clang -### -c --target=x86_64 %s -fpie 2>&1 | FileCheck %s --check-prefix=DEFAULT +// RUN: %clang -### -c --target=x86_64 %s -fpie -fno-direct-access-external-data -fdirect-access-external-data 2>&1 | FileCheck %s --check-prefix=DIRECT +// RUN: %clang -### -c --target=aarch64 %s -fpic 2>&1 | FileCheck %s --check-prefix=DEFAULT +// RUN: %clang -### -c --target=aarch64 %s -fpic -fdirect-access-external-data 2>&1 | FileCheck %s --check-prefix=DIRECT /// loongarch* targets default to -fno-direct-access-external-data even for -fno-pic. // RUN: %clang -### -c --target=loongarch64 -fno-pic %s 2>&1 | FileCheck %s --check-prefix=INDIRECT diff --git a/clang/test/Driver/fembed-bitcode.c b/clang/test/Driver/fembed-bitcode.c index 970500525a503..9081314d121cb 100644 --- a/clang/test/Driver/fembed-bitcode.c +++ b/clang/test/Driver/fembed-bitcode.c @@ -1,5 +1,5 @@ // RUN: %clang -target x86_64-apple-macosx -fembed-bitcode=all -c %s -o /dev/null -### 2>&1 \ -// RUN: | FileCheck -check-prefix CHECK-X64 %s +// RUN: | FileCheck --check-prefix=CHECK-X64 %s // CHECK-X64: "-cc1" @@ -7,7 +7,7 @@ // CHECK-X64-NOT: "-fdebug-compilation-dir // RUN: %clang -target armv7-apple-ios -fembed-bitcode=all -c %s -o /dev/null -### 2>&1 \ -// RUN: | FileCheck -check-prefix CHECK-ARM %s +// RUN: | FileCheck --check-prefix=CHECK-ARM %s // CHECK-ARM: "-cc1" @@ -17,7 +17,7 @@ // CHECK-ARM-NOT: "-fdebug-compilation-dir // RUN: %clang -target arm64-apple-ios -fembed-bitcode=all -c %s -o /dev/null -### 2>&1 \ -// RUN: | FileCheck -check-prefix CHECK-AARCH64 %s +// RUN: | FileCheck --check-prefix=CHECK-AARCH64 %s // CHECK-AARCH64: "-cc1" @@ -26,12 +26,12 @@ // CHECK-AARCH64: "darwinpcs" // CHECK-AARCH64-NOT: "-fdebug-compilation-dir -// RUN: %clang -target hexagon-unknown-elf -ffixed-r19 -fembed-bitcode=all -c %s -### 2>&1 \ +// RUN: %clang --target=hexagon-unknown-elf -ffixed-r19 -fembed-bitcode=all -c %s -### 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-HEXAGON %s // CHECK-HEXAGON: "-target-feature" // CHECK-HEXAGON: "+reserved-r19" // -// RUN: %clang -target wasm32-unknown-unknown -fembed-bitcode=all -pthread -c %s -o /dev/null -### 2>&1 \ +// RUN: %clang --target=wasm32-unknown-unknown -fembed-bitcode=all -pthread -c %s -o /dev/null -### 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-WASM %s // CHECK-WASM: "-cc1" diff --git a/clang/test/Driver/fexcess-precision.c b/clang/test/Driver/fexcess-precision.c index 68579b606c9b1..0aa1022f17fdc 100644 --- a/clang/test/Driver/fexcess-precision.c +++ b/clang/test/Driver/fexcess-precision.c @@ -1,19 +1,19 @@ // Note: %s must be preceded by --, otherwise it may be interpreted as a // command-line option, e.g. on Mac where %s is commonly under /Users. -// RUN: %clang -### -target i386 -fexcess-precision=fast -c %s 2>&1 \ +// RUN: %clang -### --target=i386 -fexcess-precision=fast -c %s 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-FAST %s -// RUN: %clang_cl -### -target i386 -fexcess-precision=fast -c -- %s 2>&1 \ +// RUN: %clang_cl -### --target=i386 -fexcess-precision=fast -c -- %s 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-FAST %s -// RUN: %clang -### -target i386 -fexcess-precision=standard -c %s 2>&1 \ +// RUN: %clang -### --target=i386 -fexcess-precision=standard -c %s 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-STD %s -// RUN: %clang_cl -### -target i386 -fexcess-precision=standard -c -- %s 2>&1 \ +// RUN: %clang_cl -### --target=i386 -fexcess-precision=standard -c -- %s 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-STD %s -// RUN: %clang -### -target i386 -fexcess-precision=16 -c %s 2>&1 \ +// RUN: %clang -### --target=i386 -fexcess-precision=16 -c %s 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-NONE %s -// RUN: %clang_cl -### -target i386 -fexcess-precision=16 -c -- %s 2>&1 \ +// RUN: %clang_cl -### --target=i386 -fexcess-precision=16 -c -- %s 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-NONE %s // RUN: not %clang -### --target=i386 -fexcess-precision=none -c %s 2>&1 \ @@ -21,19 +21,19 @@ // RUN: not %clang_cl -### --target=i386 -fexcess-precision=none -c -- %s 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-ERR-NONE %s -// RUN: %clang -### -target x86_64 -fexcess-precision=fast -c %s 2>&1 \ +// RUN: %clang -### --target=x86_64 -fexcess-precision=fast -c %s 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-FAST %s -// RUN: %clang_cl -### -target x86_64 -fexcess-precision=fast -c -- %s 2>&1 \ +// RUN: %clang_cl -### --target=x86_64 -fexcess-precision=fast -c -- %s 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-FAST %s -// RUN: %clang -### -target x86_64 -fexcess-precision=standard -c %s 2>&1 \ +// RUN: %clang -### --target=x86_64 -fexcess-precision=standard -c %s 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-STD %s -// RUN: %clang_cl -### -target x86_64 -fexcess-precision=standard -c \ +// RUN: %clang_cl -### --target=x86_64 -fexcess-precision=standard -c \ // RUN: -- %s 2>&1 | FileCheck --check-prefix=CHECK-STD %s -// RUN: %clang -### -target x86_64 -fexcess-precision=16 -c %s 2>&1 \ +// RUN: %clang -### --target=x86_64 -fexcess-precision=16 -c %s 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-NONE %s -// RUN: %clang_cl -### -target x86_64 -fexcess-precision=16 -c -- %s 2>&1 \ +// RUN: %clang_cl -### --target=x86_64 -fexcess-precision=16 -c -- %s 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-NONE %s // RUN: not %clang -### --target=x86_64 -fexcess-precision=none -c %s 2>&1 \ @@ -41,14 +41,14 @@ // RUN: not %clang_cl -### --target=x86_64 -fexcess-precision=none -c -- %s 2>&1 \ // RUN: | FileCheck --check-prefixes=CHECK-ERR-NONE %s -// RUN: %clang -### -target aarch64 -fexcess-precision=fast -c %s 2>&1 \ +// RUN: %clang -### --target=aarch64 -fexcess-precision=fast -c %s 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK %s -// RUN: %clang_cl -### -target aarch64 -fexcess-precision=fast -c -- %s 2>&1 \ +// RUN: %clang_cl -### --target=aarch64 -fexcess-precision=fast -c -- %s 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK %s -// RUN: %clang -### -target aarch64 -fexcess-precision=standard -c %s 2>&1 \ +// RUN: %clang -### --target=aarch64 -fexcess-precision=standard -c %s 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK %s -// RUN: %clang_cl -### -target aarch64 -fexcess-precision=standard -c \ +// RUN: %clang_cl -### --target=aarch64 -fexcess-precision=standard -c \ // RUN: -- %s 2>&1 | FileCheck --check-prefix=CHECK %s // RUN: not %clang -### --target=aarch64 -fexcess-precision=16 -c %s 2>&1 \ diff --git a/clang/test/Driver/fextend-args.c b/clang/test/Driver/fextend-args.c index 7f19f8c5ec487..0b721202a0006 100644 --- a/clang/test/Driver/fextend-args.c +++ b/clang/test/Driver/fextend-args.c @@ -5,7 +5,7 @@ // RUN: | FileCheck -check-prefix=CHECK-64 %s // Unsupported target -// RUN: not %clang -target aarch64-unknown-windows-msvc -fextend-arguments=32 %s 2>&1 \ +// RUN: not %clang --target=aarch64-unknown-windows-msvc -fextend-arguments=32 %s 2>&1 \ // RUN: | FileCheck -check-prefix=UNSUPPORTED-TARGET %s // Invalid option value diff --git a/clang/test/Driver/fforce-dwarf-frame.c b/clang/test/Driver/fforce-dwarf-frame.c index fb5442c56a405..c4bc2619e0ef1 100644 --- a/clang/test/Driver/fforce-dwarf-frame.c +++ b/clang/test/Driver/fforce-dwarf-frame.c @@ -1,6 +1,6 @@ -// RUN: %clang -target arm -c -### %s -fforce-dwarf-frame 2>&1 | FileCheck --check-prefix=CHECK-ALWAYS %s -// RUN: %clang -target arm -c -### %s -fno-force-dwarf-frame 2>&1 | FileCheck --check-prefix=CHECK-NO-ALWAYS %s -// RUN: %clang -target arm -c -### %s 2>&1 | FileCheck --check-prefix=CHECK-NO-ALWAYS %s +// RUN: %clang --target=arm -c -### %s -fforce-dwarf-frame 2>&1 | FileCheck --check-prefix=CHECK-ALWAYS %s +// RUN: %clang --target=arm -c -### %s -fno-force-dwarf-frame 2>&1 | FileCheck --check-prefix=CHECK-NO-ALWAYS %s +// RUN: %clang --target=arm -c -### %s 2>&1 | FileCheck --check-prefix=CHECK-NO-ALWAYS %s // CHECK-ALWAYS: -fforce-dwarf-frame // CHECK-NO-ALWAYS-NOT: -fforce-dwarf-frame diff --git a/clang/test/Driver/fgnuc-version.c b/clang/test/Driver/fgnuc-version.c index dea82bbaae0af..c5c8ca1c159ad 100644 --- a/clang/test/Driver/fgnuc-version.c +++ b/clang/test/Driver/fgnuc-version.c @@ -2,25 +2,25 @@ // Verify -fgnuc-version parsing // -// RUN: %clang -c %s -target i686-linux -### 2>&1 | FileCheck %s -check-prefix GNUC-DEFAULT +// RUN: %clang -c %s --target=i686-linux -### 2>&1 | FileCheck %s --check-prefix=GNUC-DEFAULT // GNUC-DEFAULT: "-fgnuc-version=4.2.1" -// RUN: %clang -c %s -target i686-linux -fgnuc-version=100.99.99 -### 2>&1 | FileCheck %s -check-prefix GNUC-OVERRIDE +// RUN: %clang -c %s --target=i686-linux -fgnuc-version=100.99.99 -### 2>&1 | FileCheck %s --check-prefix=GNUC-OVERRIDE // GNUC-OVERRIDE: "-fgnuc-version=100.99.99" -// RUN: %clang -c %s -target i686-linux -fgnuc-version=0 -### 2>&1 | FileCheck %s -check-prefix GNUC-DISABLE -// RUN: %clang -c %s -target i686-linux -fgnuc-version= -### 2>&1 | FileCheck %s -check-prefix GNUC-DISABLE +// RUN: %clang -c %s --target=i686-linux -fgnuc-version=0 -### 2>&1 | FileCheck %s --check-prefix=GNUC-DISABLE +// RUN: %clang -c %s --target=i686-linux -fgnuc-version= -### 2>&1 | FileCheck %s --check-prefix=GNUC-DISABLE // GNUC-DISABLE-NOT: "-fgnuc-version= -// RUN: not %clang -c %s -target i686-linux -fgnuc-version=100.100.10 2>&1 | FileCheck %s -check-prefix GNUC-INVALID -// RUN: not %clang -c %s -target i686-linux -fgnuc-version=100.10.100 2>&1 | FileCheck %s -check-prefix GNUC-INVALID -// RUN: not %clang -c %s -target i686-linux -fgnuc-version=-1.0.0 2>&1 | FileCheck %s -check-prefix GNUC-INVALID +// RUN: not %clang -c %s --target=i686-linux -fgnuc-version=100.100.10 2>&1 | FileCheck %s --check-prefix=GNUC-INVALID +// RUN: not %clang -c %s --target=i686-linux -fgnuc-version=100.10.100 2>&1 | FileCheck %s --check-prefix=GNUC-INVALID +// RUN: not %clang -c %s --target=i686-linux -fgnuc-version=-1.0.0 2>&1 | FileCheck %s --check-prefix=GNUC-INVALID // GNUC-INVALID: error: invalid value {{.*}} in '-fgnuc-version={{.*}}' -// RUN: %clang -fgnuc-version=100.99.99 %s -dM -E -o - | FileCheck %s -check-prefix GNUC-LARGE +// RUN: %clang -fgnuc-version=100.99.99 %s -dM -E -o - | FileCheck %s --check-prefix=GNUC-LARGE // GNUC-LARGE: #define __GNUC_MINOR__ 99 // GNUC-LARGE: #define __GNUC_PATCHLEVEL__ 99 // GNUC-LARGE: #define __GNUC__ 100 -// RUN: %clang -fgnuc-version=100.99.99 -x c++ %s -dM -E -o - | FileCheck %s -check-prefix GXX-LARGE +// RUN: %clang -fgnuc-version=100.99.99 -x c++ %s -dM -E -o - | FileCheck %s --check-prefix=GXX-LARGE // GXX-LARGE: #define __GNUG__ 100 diff --git a/clang/test/Driver/flags.c b/clang/test/Driver/flags.c index da25a5cd3335c..16b760609c36d 100644 --- a/clang/test/Driver/flags.c +++ b/clang/test/Driver/flags.c @@ -25,11 +25,11 @@ // RUN: %clang -target armv7-apple-darwin10 -### -S -mno-implicit-float -mimplicit-float %s 2>&1 | FileCheck -check-prefix=TEST8 %s // TEST8-NOT: "-no-implicit-float" -// RUN: %clang -target x86_64-linux-gnu -### -c -fclang-abi-compat=3.2 %s 2>&1 | FileCheck -check-prefix=TEST9 %s +// RUN: %clang --target=x86_64-linux-gnu -### -c -fclang-abi-compat=3.2 %s 2>&1 | FileCheck -check-prefix=TEST9 %s // TEST9: "-fclang-abi-compat=3.2" // -// RUN: %clang -target riscv32 -### -S -mno-implicit-float %s 2>&1 | FileCheck -check-prefix=TEST10 %s +// RUN: %clang --target=riscv32 -### -S -mno-implicit-float %s 2>&1 | FileCheck -check-prefix=TEST10 %s // TEST10: "-no-implicit-float" // -// RUN: %clang -target riscv64 -### -S -mno-implicit-float %s 2>&1 | FileCheck -check-prefix=TEST11 %s +// RUN: %clang --target=riscv64 -### -S -mno-implicit-float %s 2>&1 | FileCheck -check-prefix=TEST11 %s // TEST11: "-no-implicit-float" diff --git a/clang/test/Driver/flang/msvc-link.f90 b/clang/test/Driver/flang/msvc-link.f90 index 536da2599431f..463749510eb5f 100644 --- a/clang/test/Driver/flang/msvc-link.f90 +++ b/clang/test/Driver/flang/msvc-link.f90 @@ -1,4 +1,4 @@ -! RUN: %clang --driver-mode=flang -target x86_64-pc-windows-msvc -### %s -Ltest 2>&1 | FileCheck %s +! RUN: %clang --driver-mode=flang --target=x86_64-pc-windows-msvc -### %s -Ltest 2>&1 | FileCheck %s ! ! Test that user provided paths come before the Flang runtimes ! CHECK: "-libpath:test" diff --git a/clang/test/Driver/fmemprof.cpp b/clang/test/Driver/fmemprof.cpp index b00d9f2c81e27..5165c4452fd57 100644 --- a/clang/test/Driver/fmemprof.cpp +++ b/clang/test/Driver/fmemprof.cpp @@ -1,7 +1,7 @@ -// RUN: %clangxx -target x86_64-linux-gnu -fmemory-profile %s -### 2>&1 | FileCheck %s -// RUN: %clangxx -target x86_64-linux-gnu -fmemory-profile=foo %s -### 2>&1 | FileCheck %s --check-prefix=DIR -// RUN: %clangxx -target x86_64-linux-gnu -fmemory-profile -fno-memory-profile %s -### 2>&1 | FileCheck %s --check-prefix=OFF -// RUN: %clangxx -target x86_64-linux-gnu -fmemory-profile=foo -fno-memory-profile %s -### 2>&1 | FileCheck %s --check-prefix=OFF +// RUN: %clangxx --target=x86_64-linux-gnu -fmemory-profile %s -### 2>&1 | FileCheck %s +// RUN: %clangxx --target=x86_64-linux-gnu -fmemory-profile=foo %s -### 2>&1 | FileCheck %s --check-prefix=DIR +// RUN: %clangxx --target=x86_64-linux-gnu -fmemory-profile -fno-memory-profile %s -### 2>&1 | FileCheck %s --check-prefix=OFF +// RUN: %clangxx --target=x86_64-linux-gnu -fmemory-profile=foo -fno-memory-profile %s -### 2>&1 | FileCheck %s --check-prefix=OFF // CHECK: "-cc1" {{.*}} "-fmemory-profile" // CHECK: ld{{.*}}libclang_rt.memprof{{.*}}libclang_rt.memprof_cxx // DIR: "-cc1" {{.*}} "-fmemory-profile=foo" @@ -9,7 +9,7 @@ // OFF-NOT: "-fmemory-profile" // OFF-NOT: libclang_rt.memprof -// RUN: %clangxx -target x86_64-linux-gnu -fmemory-profile-use=foo %s -### 2>&1 | FileCheck %s --check-prefix=USE +// RUN: %clangxx --target=x86_64-linux-gnu -fmemory-profile-use=foo %s -### 2>&1 | FileCheck %s --check-prefix=USE // USE: "-cc1" {{.*}} "-fmemory-profile-use=foo" // RUN: not %clangxx --target=x86_64-linux-gnu -fmemory-profile -fmemory-profile-use=foo %s -### 2>&1 | FileCheck %s --check-prefix=CONFLICTWITHMEMPROFINSTR diff --git a/clang/test/Driver/fopenmp.c b/clang/test/Driver/fopenmp.c index 291946923b3ea..7d343eeee0f3f 100644 --- a/clang/test/Driver/fopenmp.c +++ b/clang/test/Driver/fopenmp.c @@ -1,27 +1,27 @@ -// RUN: %clang -target x86_64-linux-gnu -fopenmp=libomp -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-OPENMP -// RUN: %clang -target x86_64-linux-gnu -fopenmp=libgomp -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-NO-OPENMP -// RUN: %clang -target x86_64-linux-gnu -fopenmp=libiomp5 -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-OPENMP +// RUN: %clang --target=x86_64-linux-gnu -fopenmp=libomp -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-OPENMP +// RUN: %clang --target=x86_64-linux-gnu -fopenmp=libgomp -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-NO-OPENMP +// RUN: %clang --target=x86_64-linux-gnu -fopenmp=libiomp5 -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-OPENMP // RUN: %clang -target x86_64-apple-darwin -fopenmp=libomp -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-OPENMP // RUN: %clang -target x86_64-apple-darwin -fopenmp=libgomp -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-NO-OPENMP // RUN: %clang -target x86_64-apple-darwin -fopenmp=libiomp5 -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-OPENMP -// RUN: %clang -target x86_64-freebsd -fopenmp=libomp -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-OPENMP -// RUN: %clang -target x86_64-freebsd -fopenmp=libgomp -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-NO-OPENMP -// RUN: %clang -target x86_64-freebsd -fopenmp=libiomp5 -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-OPENMP -// RUN: %clang -target x86_64-netbsd -fopenmp=libomp -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-OPENMP -// RUN: %clang -target x86_64-netbsd -fopenmp=libgomp -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-NO-OPENMP -// RUN: %clang -target x86_64-netbsd -fopenmp=libiomp5 -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-OPENMP -// RUN: %clang -target x86_64-openbsd -fopenmp=libomp -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-OPENMP -// RUN: %clang -target x86_64-openbsd -fopenmp=libgomp -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-NO-OPENMP -// RUN: %clang -target x86_64-openbsd -fopenmp=libiomp5 -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-OPENMP -// RUN: %clang -target x86_64-dragonfly -fopenmp=libomp -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-OPENMP -// RUN: %clang -target x86_64-dragonfly -fopenmp=libgomp -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-NO-OPENMP -// RUN: %clang -target x86_64-dragonfly -fopenmp=libiomp5 -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-OPENMP -// RUN: %clang -target i386-pc-solaris2.11 -fopenmp=libomp -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-OPENMP -// RUN: %clang -target i386-pc-solaris2.11 -fopenmp=libgomp -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-NO-OPENMP -// RUN: %clang -target i386-pc-solaris2.11 -fopenmp=libiomp5 -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-OPENMP -// RUN: %clang -target x86_64-windows-gnu -fopenmp=libomp -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-OPENMP -// RUN: %clang -target x86_64-windows-gnu -fopenmp=libgomp -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-NO-OPENMP -// RUN: %clang -target x86_64-windows-gnu -fopenmp=libiomp5 -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-OPENMP +// RUN: %clang --target=x86_64-freebsd -fopenmp=libomp -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-OPENMP +// RUN: %clang --target=x86_64-freebsd -fopenmp=libgomp -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-NO-OPENMP +// RUN: %clang --target=x86_64-freebsd -fopenmp=libiomp5 -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-OPENMP +// RUN: %clang --target=x86_64-netbsd -fopenmp=libomp -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-OPENMP +// RUN: %clang --target=x86_64-netbsd -fopenmp=libgomp -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-NO-OPENMP +// RUN: %clang --target=x86_64-netbsd -fopenmp=libiomp5 -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-OPENMP +// RUN: %clang --target=x86_64-openbsd -fopenmp=libomp -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-OPENMP +// RUN: %clang --target=x86_64-openbsd -fopenmp=libgomp -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-NO-OPENMP +// RUN: %clang --target=x86_64-openbsd -fopenmp=libiomp5 -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-OPENMP +// RUN: %clang --target=x86_64-dragonfly -fopenmp=libomp -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-OPENMP +// RUN: %clang --target=x86_64-dragonfly -fopenmp=libgomp -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-NO-OPENMP +// RUN: %clang --target=x86_64-dragonfly -fopenmp=libiomp5 -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-OPENMP +// RUN: %clang --target=i386-pc-solaris2.11 -fopenmp=libomp -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-OPENMP +// RUN: %clang --target=i386-pc-solaris2.11 -fopenmp=libgomp -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-NO-OPENMP +// RUN: %clang --target=i386-pc-solaris2.11 -fopenmp=libiomp5 -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-OPENMP +// RUN: %clang --target=x86_64-windows-gnu -fopenmp=libomp -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-OPENMP +// RUN: %clang --target=x86_64-windows-gnu -fopenmp=libgomp -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-NO-OPENMP +// RUN: %clang --target=x86_64-windows-gnu -fopenmp=libiomp5 -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-OPENMP // RUN: %clang_cl --target=x86_64-windows-msvc /clang:-fopenmp=libomp /openmp -### -- %s 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-OPENMP // RUN: %clang_cl --target=x86_64-windows-msvc /clang:-fopenmp=libgomp /openmp -### -- %s 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-NO-OPENMP // RUN: %clang_cl --target=x86_64-windows-msvc /clang:-fopenmp=libiomp5 /openmp -### -- %s 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-OPENMP @@ -36,99 +36,99 @@ // CHECK-CC1-NO-OPENMP: "-cc1" // CHECK-CC1-NO-OPENMP-NOT: "-fopenmp" // -// RUN: %clang -target x86_64-linux-gnu -fopenmp=libomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-OMP -// RUN: %clang -target x86_64-linux-gnu -fopenmp=libgomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-GOMP --check-prefix=CHECK-LD-GOMP-RT -// RUN: %clang -target x86_64-linux-gnu -fopenmp=libiomp5 %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-IOMP5 +// RUN: %clang --target=x86_64-linux-gnu -fopenmp=libomp %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-OMP +// RUN: %clang --target=x86_64-linux-gnu -fopenmp=libgomp %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-GOMP --check-prefix=CHECK-LD-GOMP-RT +// RUN: %clang --target=x86_64-linux-gnu -fopenmp=libiomp5 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-IOMP5 // -// RUN: %clang -target x86_64-linux-gnu -fopenmp=libomp -static-openmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-OMP -// RUN: %clang -target x86_64-linux-gnu -fopenmp=libgomp -static-openmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-GOMP --check-prefix=CHECK-LD-STATIC-GOMP-RT -// RUN: %clang -target x86_64-linux-gnu -fopenmp=libiomp5 -static-openmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-IOMP5 -// RUN: %clang -target x86_64-linux-gnu -fopenmp=libiomp5 -static -static-openmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-IOMP5-NO-BDYNAMIC +// RUN: %clang --target=x86_64-linux-gnu -fopenmp=libomp -static-openmp %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-OMP +// RUN: %clang --target=x86_64-linux-gnu -fopenmp=libgomp -static-openmp %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-GOMP --check-prefix=CHECK-LD-STATIC-GOMP-RT +// RUN: %clang --target=x86_64-linux-gnu -fopenmp=libiomp5 -static-openmp %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-IOMP5 +// RUN: %clang --target=x86_64-linux-gnu -fopenmp=libiomp5 -static -static-openmp %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-IOMP5-NO-BDYNAMIC // -// RUN: %clang -nostdlib -target x86_64-linux-gnu -fopenmp=libomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-OMP -// RUN: %clang -nostdlib -target x86_64-linux-gnu -fopenmp=libgomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-GOMP -// RUN: %clang -nostdlib -target x86_64-linux-gnu -fopenmp=libiomp5 %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-IOMP5 +// RUN: %clang -nostdlib --target=x86_64-linux-gnu -fopenmp=libomp %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-OMP +// RUN: %clang -nostdlib --target=x86_64-linux-gnu -fopenmp=libgomp %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-GOMP +// RUN: %clang -nostdlib --target=x86_64-linux-gnu -fopenmp=libiomp5 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-IOMP5 // -// RUN: %clang -target x86_64-darwin -fopenmp=libomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-OMP -// RUN: %clang -target x86_64-darwin -fopenmp=libgomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-GOMP --check-prefix=CHECK-LD-GOMP-NO-RT -// RUN: %clang -target x86_64-darwin -fopenmp=libiomp5 %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-IOMP5 +// RUN: %clang --target=x86_64-darwin -fopenmp=libomp %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-OMP +// RUN: %clang --target=x86_64-darwin -fopenmp=libgomp %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-GOMP --check-prefix=CHECK-LD-GOMP-NO-RT +// RUN: %clang --target=x86_64-darwin -fopenmp=libiomp5 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-IOMP5 // -// RUN: %clang -nostdlib -target x86_64-darwin -fopenmp=libomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-OMP -// RUN: %clang -nostdlib -target x86_64-darwin -fopenmp=libgomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-GOMP -// RUN: %clang -nostdlib -target x86_64-darwin -fopenmp=libiomp5 %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-IOMP5 +// RUN: %clang -nostdlib --target=x86_64-darwin -fopenmp=libomp %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-OMP +// RUN: %clang -nostdlib --target=x86_64-darwin -fopenmp=libgomp %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-GOMP +// RUN: %clang -nostdlib --target=x86_64-darwin -fopenmp=libiomp5 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-IOMP5 // -// RUN: %clang -target x86_64-freebsd -fopenmp=libomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-OMP -// RUN: %clang -target x86_64-freebsd -fopenmp=libgomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-GOMP --check-prefix=CHECK-LD-GOMP-NO-RT -// RUN: %clang -target x86_64-freebsd -fopenmp=libiomp5 %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-IOMP5 +// RUN: %clang --target=x86_64-freebsd -fopenmp=libomp %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-OMP +// RUN: %clang --target=x86_64-freebsd -fopenmp=libgomp %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-GOMP --check-prefix=CHECK-LD-GOMP-NO-RT +// RUN: %clang --target=x86_64-freebsd -fopenmp=libiomp5 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-IOMP5 // -// RUN: %clang -target x86_64-freebsd -fopenmp=libomp -static-openmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-OMP -// RUN: %clang -target x86_64-freebsd -fopenmp=libgomp -static-openmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-GOMP --check-prefix=CHECK-LD-STATIC-GOMP-NO-RT -// RUN: %clang -target x86_64-freebsd -fopenmp=libiomp5 -static-openmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-IOMP5 -// RUN: %clang -target x86_64-freebsd -fopenmp=libiomp5 -static -static-openmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-IOMP5-NO-BDYNAMIC +// RUN: %clang --target=x86_64-freebsd -fopenmp=libomp -static-openmp %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-OMP +// RUN: %clang --target=x86_64-freebsd -fopenmp=libgomp -static-openmp %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-GOMP --check-prefix=CHECK-LD-STATIC-GOMP-NO-RT +// RUN: %clang --target=x86_64-freebsd -fopenmp=libiomp5 -static-openmp %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-IOMP5 +// RUN: %clang --target=x86_64-freebsd -fopenmp=libiomp5 -static -static-openmp %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-IOMP5-NO-BDYNAMIC // -// RUN: %clang -nostdlib -target x86_64-freebsd -fopenmp=libomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-OMP -// RUN: %clang -nostdlib -target x86_64-freebsd -fopenmp=libgomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-GOMP -// RUN: %clang -nostdlib -target x86_64-freebsd -fopenmp=libiomp5 %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-IOMP5 +// RUN: %clang -nostdlib --target=x86_64-freebsd -fopenmp=libomp %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-OMP +// RUN: %clang -nostdlib --target=x86_64-freebsd -fopenmp=libgomp %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-GOMP +// RUN: %clang -nostdlib --target=x86_64-freebsd -fopenmp=libiomp5 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-IOMP5 // -// RUN: %clang -target x86_64-netbsd -fopenmp=libomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-OMP -// RUN: %clang -target x86_64-netbsd -fopenmp=libgomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-GOMP --check-prefix=CHECK-LD-GOMP-NO-RT -// RUN: %clang -target x86_64-netbsd -fopenmp=libiomp5 %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-IOMP5 +// RUN: %clang --target=x86_64-netbsd -fopenmp=libomp %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-OMP +// RUN: %clang --target=x86_64-netbsd -fopenmp=libgomp %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-GOMP --check-prefix=CHECK-LD-GOMP-NO-RT +// RUN: %clang --target=x86_64-netbsd -fopenmp=libiomp5 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-IOMP5 // -// RUN: %clang -target x86_64-netbsd -fopenmp=libomp -static-openmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-OMP -// RUN: %clang -target x86_64-netbsd -fopenmp=libgomp -static-openmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-GOMP --check-prefix=CHECK-LD-STATIC-GOMP-NO-RT -// RUN: %clang -target x86_64-netbsd -fopenmp=libiomp5 -static-openmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-IOMP5 -// RUN: %clang -target x86_64-netbsd -fopenmp=libiomp5 -static -static-openmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-IOMP5-NO-BDYNAMIC +// RUN: %clang --target=x86_64-netbsd -fopenmp=libomp -static-openmp %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-OMP +// RUN: %clang --target=x86_64-netbsd -fopenmp=libgomp -static-openmp %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-GOMP --check-prefix=CHECK-LD-STATIC-GOMP-NO-RT +// RUN: %clang --target=x86_64-netbsd -fopenmp=libiomp5 -static-openmp %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-IOMP5 +// RUN: %clang --target=x86_64-netbsd -fopenmp=libiomp5 -static -static-openmp %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-IOMP5-NO-BDYNAMIC // -// RUN: %clang -nostdlib -target x86_64-netbsd -fopenmp=libomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-OMP -// RUN: %clang -nostdlib -target x86_64-netbsd -fopenmp=libgomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-GOMP -// RUN: %clang -nostdlib -target x86_64-netbsd -fopenmp=libiomp5 %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-IOMP5 +// RUN: %clang -nostdlib --target=x86_64-netbsd -fopenmp=libomp %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-OMP +// RUN: %clang -nostdlib --target=x86_64-netbsd -fopenmp=libgomp %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-GOMP +// RUN: %clang -nostdlib --target=x86_64-netbsd -fopenmp=libiomp5 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-IOMP5 // -// RUN: %clang -target x86_64-openbsd -fopenmp=libomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-OMP -// RUN: %clang -target x86_64-openbsd -fopenmp=libgomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-GOMP --check-prefix=CHECK-LD-GOMP-NO-RT -// RUN: %clang -target x86_64-openbsd -fopenmp=libiomp5 %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-IOMP5 +// RUN: %clang --target=x86_64-openbsd -fopenmp=libomp %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-OMP +// RUN: %clang --target=x86_64-openbsd -fopenmp=libgomp %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-GOMP --check-prefix=CHECK-LD-GOMP-NO-RT +// RUN: %clang --target=x86_64-openbsd -fopenmp=libiomp5 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-IOMP5 // -// RUN: %clang -target x86_64-openbsd -fopenmp=libomp -static-openmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-OMP -// RUN: %clang -target x86_64-openbsd -fopenmp=libgomp -static-openmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-GOMP --check-prefix=CHECK-LD-STATIC-GOMP-NO-RT -// RUN: %clang -target x86_64-openbsd -fopenmp=libiomp5 -static-openmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-IOMP5 -// RUN: %clang -target x86_64-openbsd -fopenmp=libiomp5 -static -static-openmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-IOMP5-NO-BDYNAMIC +// RUN: %clang --target=x86_64-openbsd -fopenmp=libomp -static-openmp %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-OMP +// RUN: %clang --target=x86_64-openbsd -fopenmp=libgomp -static-openmp %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-GOMP --check-prefix=CHECK-LD-STATIC-GOMP-NO-RT +// RUN: %clang --target=x86_64-openbsd -fopenmp=libiomp5 -static-openmp %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-IOMP5 +// RUN: %clang --target=x86_64-openbsd -fopenmp=libiomp5 -static -static-openmp %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-IOMP5-NO-BDYNAMIC // -// RUN: %clang -nostdlib -target x86_64-openbsd -fopenmp=libomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-OMP -// RUN: %clang -nostdlib -target x86_64-openbsd -fopenmp=libgomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-GOMP -// RUN: %clang -nostdlib -target x86_64-openbsd -fopenmp=libiomp5 %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-IOMP5 +// RUN: %clang -nostdlib --target=x86_64-openbsd -fopenmp=libomp %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-OMP +// RUN: %clang -nostdlib --target=x86_64-openbsd -fopenmp=libgomp %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-GOMP +// RUN: %clang -nostdlib --target=x86_64-openbsd -fopenmp=libiomp5 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-IOMP5 // -// RUN: %clang -target x86_64-dragonfly -fopenmp=libomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-OMP -// RUN: %clang -target x86_64-dragonfly -fopenmp=libgomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-GOMP --check-prefix=CHECK-LD-GOMP-NO-RT -// RUN: %clang -target x86_64-dragonfly -fopenmp=libiomp5 %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-IOMP5 +// RUN: %clang --target=x86_64-dragonfly -fopenmp=libomp %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-OMP +// RUN: %clang --target=x86_64-dragonfly -fopenmp=libgomp %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-GOMP --check-prefix=CHECK-LD-GOMP-NO-RT +// RUN: %clang --target=x86_64-dragonfly -fopenmp=libiomp5 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-IOMP5 // -// RUN: %clang -target x86_64-dragonfly -fopenmp=libomp -static-openmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-OMP -// RUN: %clang -target x86_64-dragonfly -fopenmp=libgomp -static-openmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-GOMP --check-prefix=CHECK-LD-STATIC-GOMP-NO-RT -// RUN: %clang -target x86_64-dragonfly -fopenmp=libiomp5 -static-openmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-IOMP5 -// RUN: %clang -target x86_64-dragonfly -fopenmp=libiomp5 -static -static-openmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-IOMP5-NO-BDYNAMIC +// RUN: %clang --target=x86_64-dragonfly -fopenmp=libomp -static-openmp %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-OMP +// RUN: %clang --target=x86_64-dragonfly -fopenmp=libgomp -static-openmp %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-GOMP --check-prefix=CHECK-LD-STATIC-GOMP-NO-RT +// RUN: %clang --target=x86_64-dragonfly -fopenmp=libiomp5 -static-openmp %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-IOMP5 +// RUN: %clang --target=x86_64-dragonfly -fopenmp=libiomp5 -static -static-openmp %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-IOMP5-NO-BDYNAMIC // -// RUN: %clang -nostdlib -target x86_64-dragonfly -fopenmp=libomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-OMP -// RUN: %clang -nostdlib -target x86_64-dragonfly -fopenmp=libgomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-GOMP -// RUN: %clang -nostdlib -target x86_64-dragonfly -fopenmp=libiomp5 %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-IOMP5 +// RUN: %clang -nostdlib --target=x86_64-dragonfly -fopenmp=libomp %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-OMP +// RUN: %clang -nostdlib --target=x86_64-dragonfly -fopenmp=libgomp %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-GOMP +// RUN: %clang -nostdlib --target=x86_64-dragonfly -fopenmp=libiomp5 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-IOMP5 // -// RUN: %clang -target i386-pc-solaris2.11 -fopenmp=libomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-OMP -// RUN: %clang -target i386-pc-solaris2.11 -fopenmp=libgomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-GOMP --check-prefix=CHECK-LD-GOMP-NO-RT -// RUN: %clang -target i386-pc-solaris2.11 -fopenmp=libiomp5 %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-IOMP5 +// RUN: %clang --target=i386-pc-solaris2.11 -fopenmp=libomp %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-OMP +// RUN: %clang --target=i386-pc-solaris2.11 -fopenmp=libgomp %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-GOMP --check-prefix=CHECK-LD-GOMP-NO-RT +// RUN: %clang --target=i386-pc-solaris2.11 -fopenmp=libiomp5 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-IOMP5 // -// RUN: %clang -target i386-pc-solaris2.11 -fopenmp=libomp -static-openmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-OMP -// RUN: %clang -target i386-pc-solaris2.11 -fopenmp=libgomp -static-openmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-GOMP --check-prefix=CHECK-LD-STATIC-GOMP-NO-RT -// RUN: %clang -target i386-pc-solaris2.11 -fopenmp=libiomp5 -static-openmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-IOMP5 -// RUN: %clang -target i386-pc-solaris2.11 -fopenmp=libiomp5 -static -static-openmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-IOMP5-NO-BDYNAMIC +// RUN: %clang --target=i386-pc-solaris2.11 -fopenmp=libomp -static-openmp %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-OMP +// RUN: %clang --target=i386-pc-solaris2.11 -fopenmp=libgomp -static-openmp %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-GOMP --check-prefix=CHECK-LD-STATIC-GOMP-NO-RT +// RUN: %clang --target=i386-pc-solaris2.11 -fopenmp=libiomp5 -static-openmp %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-IOMP5 +// RUN: %clang --target=i386-pc-solaris2.11 -fopenmp=libiomp5 -static -static-openmp %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-STATIC-IOMP5-NO-BDYNAMIC // -// RUN: %clang -nostdlib -target i386-pc-solaris2.11 -fopenmp=libomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-OMP -// RUN: %clang -nostdlib -target i386-pc-solaris2.11 -fopenmp=libgomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-GOMP -// RUN: %clang -nostdlib -target i386-pc-solaris2.11 -fopenmp=libiomp5 %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-IOMP5 +// RUN: %clang -nostdlib --target=i386-pc-solaris2.11 -fopenmp=libomp %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-OMP +// RUN: %clang -nostdlib --target=i386-pc-solaris2.11 -fopenmp=libgomp %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-GOMP +// RUN: %clang -nostdlib --target=i386-pc-solaris2.11 -fopenmp=libiomp5 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-IOMP5 // -// RUN: %clang -target x86_64-windows-gnu -fopenmp=libomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-OMP -// RUN: %clang -target x86_64-windows-gnu -fopenmp=libgomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-GOMP --check-prefix=CHECK-LD-GOMP-NO-RT -// RUN: %clang -target x86_64-windows-gnu -fopenmp=libiomp5 %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-IOMP5MD +// RUN: %clang --target=x86_64-windows-gnu -fopenmp=libomp %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-OMP +// RUN: %clang --target=x86_64-windows-gnu -fopenmp=libgomp %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-GOMP --check-prefix=CHECK-LD-GOMP-NO-RT +// RUN: %clang --target=x86_64-windows-gnu -fopenmp=libiomp5 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-IOMP5MD // -// RUN: %clang -nostdlib -target x86_64-windows-gnu -fopenmp=libomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-OMP -// RUN: %clang -nostdlib -target x86_64-windows-gnu -fopenmp=libgomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-GOMP -// RUN: %clang -nostdlib -target x86_64-windows-gnu -fopenmp=libiomp5 %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-IOMP5MD +// RUN: %clang -nostdlib --target=x86_64-windows-gnu -fopenmp=libomp %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-OMP +// RUN: %clang -nostdlib --target=x86_64-windows-gnu -fopenmp=libgomp %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-GOMP +// RUN: %clang -nostdlib --target=x86_64-windows-gnu -fopenmp=libiomp5 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-IOMP5MD // // CHECK-LD-OMP: "{{.*}}ld{{(.exe)?}}" // CHECK-LD-OMP: "-lomp" @@ -172,7 +172,7 @@ // CHECK-LD-STATIC-IOMP5-NO-BDYNAMIC: "-{{B?}}static" {{.*}} "-liomp5" // CHECK-LD-STATIC-IOMP5-NO-BDYNAMIC-NOT: "-Bdynamic" // -// RUN: %clang -target x86_64-linux-gnu -fopenmp=libomp -fopenmp-enable-irbuilder -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-OPENMPIRBUILDER +// RUN: %clang --target=x86_64-linux-gnu -fopenmp=libomp -fopenmp-enable-irbuilder -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-OPENMPIRBUILDER // // CHECK-CC1-OPENMPIRBUILDER: "-cc1" // CHECK-CC1-OPENMPIRBUILDER-SAME: "-fopenmp" @@ -184,14 +184,14 @@ // test the CC1 invocation. Instead, just ensure we do eventually link *some* // OpenMP runtime. // -// RUN: %clang -target x86_64-linux-gnu -fopenmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-ANY -// RUN: %clang -target x86_64-darwin -fopenmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-ANY -// RUN: %clang -target x86_64-freebsd -fopenmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-ANY -// RUN: %clang -target x86_64-netbsd -fopenmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-ANY -// RUN: %clang -target x86_64-openbsd -fopenmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-ANY -// RUN: %clang -target x86_64-dragonfly -fopenmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-ANY -// RUN: %clang -target i386-pc-solaris2.11 -fopenmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-ANY -// RUN: %clang -target x86_64-windows-gnu -fopenmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-ANYMD +// RUN: %clang --target=x86_64-linux-gnu -fopenmp %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-ANY +// RUN: %clang --target=x86_64-darwin -fopenmp %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-ANY +// RUN: %clang --target=x86_64-freebsd -fopenmp %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-ANY +// RUN: %clang --target=x86_64-netbsd -fopenmp %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-ANY +// RUN: %clang --target=x86_64-openbsd -fopenmp %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-ANY +// RUN: %clang --target=x86_64-dragonfly -fopenmp %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-ANY +// RUN: %clang --target=i386-pc-solaris2.11 -fopenmp %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-ANY +// RUN: %clang --target=x86_64-windows-gnu -fopenmp %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-ANYMD // // CHECK-LD-ANY: "{{.*}}ld{{(.exe)?}}" // CHECK-LD-ANY: "-l{{(omp|gomp|iomp5)}}" diff --git a/clang/test/Driver/fortran.f95 b/clang/test/Driver/fortran.f95 index db3ff2da17e88..275b1886b2fda 100644 --- a/clang/test/Driver/fortran.f95 +++ b/clang/test/Driver/fortran.f95 @@ -1,21 +1,21 @@ ! Check that the clang driver can invoke gcc to compile Fortran when in ! --driver-mode=clang. This is legacy behaviour - see also --driver-mode=flang. -! RUN: %clang -target x86_64-unknown-linux-gnu -integrated-as -c %s -### 2>&1 \ +! RUN: %clang --target=x86_64-unknown-linux-gnu -integrated-as -c %s -### 2>&1 \ ! RUN: | FileCheck --check-prefix=CHECK-OBJECT %s ! CHECK-OBJECT: gcc ! CHECK-OBJECT: "-c" ! CHECK-OBJECT: "-x" "f95" ! CHECK-OBJECT-NOT: "-cc1as" -! RUN: %clang -target x86_64-unknown-linux-gnu -integrated-as -S %s -### 2>&1 \ +! RUN: %clang --target=x86_64-unknown-linux-gnu -integrated-as -S %s -### 2>&1 \ ! RUN: | FileCheck --check-prefix=CHECK-ASM %s ! CHECK-ASM: gcc ! CHECK-ASM: "-S" ! CHECK-ASM: "-x" "f95" ! CHECK-ASM-NOT: "-cc1" -! RUN: %clang -Wall -target x86_64-unknown-linux-gnu -integrated-as %s -o %t -### 2>&1 | FileCheck --check-prefix=CHECK-WARN %s +! RUN: %clang -Wall --target=x86_64-unknown-linux-gnu -integrated-as %s -### 2>&1 | FileCheck --check-prefix=CHECK-WARN %s ! CHECK-WARN: gcc ! CHECK-WARN-NOT: "-Wall" ! CHECK-WARN: ld diff --git a/clang/test/Driver/fpatchable-function-entry.c b/clang/test/Driver/fpatchable-function-entry.c index 4d0d609584c8d..ab04fd39ffa1c 100644 --- a/clang/test/Driver/fpatchable-function-entry.c +++ b/clang/test/Driver/fpatchable-function-entry.c @@ -1,23 +1,23 @@ -// RUN: %clang -target i386 %s -fpatchable-function-entry=1 -c -### 2>&1 | FileCheck %s -// RUN: %clang -target x86_64 %s -fpatchable-function-entry=1 -c -### 2>&1 | FileCheck %s -// RUN: %clang -target aarch64 %s -fpatchable-function-entry=1 -c -### 2>&1 | FileCheck %s -// RUN: %clang -target aarch64 %s -fpatchable-function-entry=1,0 -c -### 2>&1 | FileCheck %s -// RUN: %clang -target loongarch32 %s -fpatchable-function-entry=1,0 -c -### 2>&1 | FileCheck %s -// RUN: %clang -target loongarch64 %s -fpatchable-function-entry=1,0 -c -### 2>&1 | FileCheck %s -// RUN: %clang -target riscv32 %s -fpatchable-function-entry=1,0 -c -### 2>&1 | FileCheck %s -// RUN: %clang -target riscv64 %s -fpatchable-function-entry=1,0 -c -### 2>&1 | FileCheck %s +// RUN: %clang --target=i386 %s -fpatchable-function-entry=1 -c -### 2>&1 | FileCheck %s +// RUN: %clang --target=x86_64 %s -fpatchable-function-entry=1 -c -### 2>&1 | FileCheck %s +// RUN: %clang --target=aarch64 %s -fpatchable-function-entry=1 -c -### 2>&1 | FileCheck %s +// RUN: %clang --target=aarch64 %s -fpatchable-function-entry=1,0 -c -### 2>&1 | FileCheck %s +// RUN: %clang --target=loongarch32 %s -fpatchable-function-entry=1,0 -c -### 2>&1 | FileCheck %s +// RUN: %clang --target=loongarch64 %s -fpatchable-function-entry=1,0 -c -### 2>&1 | FileCheck %s +// RUN: %clang --target=riscv32 %s -fpatchable-function-entry=1,0 -c -### 2>&1 | FileCheck %s +// RUN: %clang --target=riscv64 %s -fpatchable-function-entry=1,0 -c -### 2>&1 | FileCheck %s // CHECK: "-fpatchable-function-entry=1" -// RUN: %clang -target aarch64 -fsyntax-only %s -fpatchable-function-entry=1,1 -c -### 2>&1 | FileCheck --check-prefix=11 %s +// RUN: %clang --target=aarch64 -fsyntax-only %s -fpatchable-function-entry=1,1 -c -### 2>&1 | FileCheck --check-prefix=11 %s // 11: "-fpatchable-function-entry=1" "-fpatchable-function-entry-offset=1" -// RUN: %clang -target aarch64 -fsyntax-only %s -fpatchable-function-entry=2,1 -c -### 2>&1 | FileCheck --check-prefix=21 %s +// RUN: %clang --target=aarch64 -fsyntax-only %s -fpatchable-function-entry=2,1 -c -### 2>&1 | FileCheck --check-prefix=21 %s // 21: "-fpatchable-function-entry=2" "-fpatchable-function-entry-offset=1" -// RUN: not %clang -target ppc64 -fsyntax-only %s -fpatchable-function-entry=1 2>&1 | FileCheck --check-prefix=TARGET %s +// RUN: not %clang --target=ppc64 -fsyntax-only %s -fpatchable-function-entry=1 2>&1 | FileCheck --check-prefix=TARGET %s // TARGET: error: unsupported option '-fpatchable-function-entry=1' for target 'ppc64' -// RUN: not %clang -target x86_64 -fsyntax-only %s -fpatchable-function-entry=1,0, 2>&1 | FileCheck --check-prefix=EXCESS %s +// RUN: not %clang --target=x86_64 -fsyntax-only %s -fpatchable-function-entry=1,0, 2>&1 | FileCheck --check-prefix=EXCESS %s // EXCESS: error: invalid argument '1,0,' to -fpatchable-function-entry= -// RUN: not %clang -target aarch64-linux -fsyntax-only %s -fxray-instrument -fpatchable-function-entry=1 2>&1 | FileCheck --check-prefix=XRAY %s +// RUN: not %clang --target=aarch64-linux -fsyntax-only %s -fxray-instrument -fpatchable-function-entry=1 2>&1 | FileCheck --check-prefix=XRAY %s // XRAY: error: invalid argument '-fxray-instrument' not allowed with '-fpatchable-function-entry=' diff --git a/clang/test/Driver/frame-pointer-elim.c b/clang/test/Driver/frame-pointer-elim.c index e1b0a468ab825..cdedcc7ae4c89 100644 --- a/clang/test/Driver/frame-pointer-elim.c +++ b/clang/test/Driver/frame-pointer-elim.c @@ -6,39 +6,39 @@ // KEEP-NONE: "-mframe-pointer=none" // On Linux x86, omit frame pointer when optimization is enabled. -// RUN: %clang -### -target i386-linux -S -fomit-frame-pointer %s 2>&1 | \ +// RUN: %clang -### --target=i386-linux -S -fomit-frame-pointer %s 2>&1 | \ // RUN: FileCheck --check-prefix=KEEP-NONE %s -// RUN: %clang -### -target i386-linux -S -O1 %s 2>&1 | \ +// RUN: %clang -### --target=i386-linux -S -O1 %s 2>&1 | \ // RUN: FileCheck --check-prefix=KEEP-NONE %s // -fno-omit-frame-pointer or -pg disables frame pointer omission. -// RUN: %clang -### -target i386-linux -S %s 2>&1 | \ +// RUN: %clang -### --target=i386-linux -S %s 2>&1 | \ // RUN: FileCheck --check-prefix=KEEP-ALL %s -// RUN: %clang -### -target i386-linux -S -O1 -fno-omit-frame-pointer %s 2>&1 | \ +// RUN: %clang -### --target=i386-linux -S -O1 -fno-omit-frame-pointer %s 2>&1 | \ // RUN: FileCheck --check-prefix=KEEP-ALL %s -// RUN: %clang -### -target i386-linux -S -O1 -pg %s 2>&1 | \ +// RUN: %clang -### --target=i386-linux -S -O1 -pg %s 2>&1 | \ // RUN: FileCheck --check-prefix=KEEP-ALL %s // -momit-leaf-frame-pointer omits leaf frame pointer. // -fno-omit-frame-pointer loses out to -momit-leaf-frame-pointer. -// RUN: %clang -### -target i386 -S -momit-leaf-frame-pointer %s 2>&1 | \ +// RUN: %clang -### --target=i386 -S -momit-leaf-frame-pointer %s 2>&1 | \ // RUN: FileCheck --check-prefix=KEEP-NON-LEAF %s -// RUN: %clang -### -target i386-linux -S -O1 -fno-omit-frame-pointer -momit-leaf-frame-pointer %s 2>&1 | \ +// RUN: %clang -### --target=i386-linux -S -O1 -fno-omit-frame-pointer -momit-leaf-frame-pointer %s 2>&1 | \ // RUN: FileCheck --check-prefix=KEEP-NON-LEAF %s -// RUN: %clang -### -target i386-linux -S -O1 -momit-leaf-frame-pointer %s 2>&1 | \ +// RUN: %clang -### --target=i386-linux -S -O1 -momit-leaf-frame-pointer %s 2>&1 | \ // RUN: FileCheck --check-prefix=KEEP-NONE %s // fno-omit-frame-pointer -momit-leaf-frame-pointer can be overwritten by // fomit-frame-pointer later on the command without warning -// RUN: %clang -### -target i386-linux -S -O1 -fno-omit-frame-pointer -momit-leaf-frame-pointer -fomit-frame-pointer %s 2>&1 | \ +// RUN: %clang -### --target=i386-linux -S -O1 -fno-omit-frame-pointer -momit-leaf-frame-pointer -fomit-frame-pointer %s 2>&1 | \ // RUN: FileCheck --check-prefix=KEEP-NONE %s -// RUN: %clang -### -target i386-linux -S -O1 -fno-omit-frame-pointer -momit-leaf-frame-pointer %s 2>&1 | \ +// RUN: %clang -### --target=i386-linux -S -O1 -fno-omit-frame-pointer -momit-leaf-frame-pointer %s 2>&1 | \ // RUN: FileCheck --check-prefix=KEEP-NON-LEAF %s // Explicit or default -fomit-frame-pointer wins over -mno-omit-leaf-frame-pointer. -// RUN: %clang -### -target i386 -S %s -fomit-frame-pointer -mno-omit-leaf-frame-pointer 2>&1 | \ +// RUN: %clang -### --target=i386 -S %s -fomit-frame-pointer -mno-omit-leaf-frame-pointer 2>&1 | \ // RUN: FileCheck --check-prefix=KEEP-NONE %s -// RUN: %clang -### -target i386-linux -S %s -O1 -mno-omit-leaf-frame-pointer 2>&1 | \ +// RUN: %clang -### --target=i386-linux -S %s -O1 -mno-omit-leaf-frame-pointer 2>&1 | \ // RUN: FileCheck --check-prefix=KEEP-NONE %s // -pg -fomit-frame-pointer => error. @@ -48,10 +48,10 @@ // CHECK-MIX-NO-OMIT-FP-PG-NOT: '-fomit-frame-pointer' not allowed with '-pg' // NetBSD follows the same rules as Linux. -// RUN: %clang -### -target x86_64-unknown-netbsd -S -O1 %s 2>&1 | \ +// RUN: %clang -### --target=x86_64-unknown-netbsd -S -O1 %s 2>&1 | \ // RUN: FileCheck --check-prefix=KEEP-NONE %s -// RUN: %clang -### -target x86_64-unknown-netbsd -S %s 2>&1 | \ +// RUN: %clang -### --target=x86_64-unknown-netbsd -S %s 2>&1 | \ // RUN: FileCheck --check-prefix=KEEP-ALL %s // Darwin disables omitting the leaf frame pointer even under optimization @@ -62,10 +62,10 @@ // RUN: %clang -### -target i386-apple-darwin -S -O1 %s 2>&1 | \ // RUN: FileCheck --check-prefix=KEEP-ALL %s -// RUN: %clang -### -target i386-darwin -S -fomit-frame-pointer %s 2>&1 | \ +// RUN: %clang -### --target=i386-darwin -S -fomit-frame-pointer %s 2>&1 | \ // RUN: FileCheck --check-prefix=KEEP-NONE %s -// RUN: %clang -### -target i386-darwin -S -momit-leaf-frame-pointer %s 2>&1 | \ +// RUN: %clang -### --target=i386-darwin -S -momit-leaf-frame-pointer %s 2>&1 | \ // RUN: FileCheck --check-prefix=KEEP-NON-LEAF %s // RUN: %clang -### -target armv7s-apple-ios -fomit-frame-pointer %s 2>&1 | \ @@ -85,19 +85,19 @@ // On AArch64, PS4, PS5, and VE, default to omitting the frame pointer on leaf // functions -// RUN: %clang -### -target aarch64 -S %s 2>&1 | \ +// RUN: %clang -### --target=aarch64 -S %s 2>&1 | \ // RUN: FileCheck --check-prefix=KEEP-NON-LEAF %s -// RUN: %clang -### -target x86_64-scei-ps4 -S %s 2>&1 | \ +// RUN: %clang -### --target=x86_64-scei-ps4 -S %s 2>&1 | \ // RUN: FileCheck --check-prefix=KEEP-NON-LEAF %s -// RUN: %clang -### -target x86_64-scei-ps4 -S -O2 %s 2>&1 | \ +// RUN: %clang -### --target=x86_64-scei-ps4 -S -O2 %s 2>&1 | \ // RUN: FileCheck --check-prefix=KEEP-NON-LEAF %s -// RUN: %clang -### -target x86_64-sie-ps5 -S %s 2>&1 | \ +// RUN: %clang -### --target=x86_64-sie-ps5 -S %s 2>&1 | \ // RUN: FileCheck --check-prefix=KEEP-NON-LEAF %s -// RUN: %clang -### -target x86_64-sie-ps5 -S -O2 %s 2>&1 | \ +// RUN: %clang -### --target=x86_64-sie-ps5 -S -O2 %s 2>&1 | \ // RUN: FileCheck --check-prefix=KEEP-NON-LEAF %s // RUN: %clang -### -target aarch64-apple-darwin -arch arm64_32 -S %s 2>&1 | \ // RUN: FileCheck --check-prefix=KEEP-NON-LEAF %s -// RUN: %clang -### -target ve-unknown-linux-gnu -S %s 2>&1 | \ +// RUN: %clang -### --target=ve-unknown-linux-gnu -S %s 2>&1 | \ // RUN: FileCheck --check-prefix=KEEP-NON-LEAF %s // RUN: %clang -### --target=aarch64-linux-android -S %s 2>&1 | \ // RUN: FileCheck --check-prefix=KEEP-NON-LEAF %s @@ -106,57 +106,57 @@ // RUN: %clang -### --target=aarch64-linux-android -S -Os %s 2>&1 | \ // RUN: FileCheck --check-prefix=KEEP-NON-LEAF %s -// RUN: %clang -### -target powerpc64 -S %s 2>&1 | \ +// RUN: %clang -### --target=powerpc64 -S %s 2>&1 | \ // RUN: FileCheck --check-prefix=KEEP-ALL %s -// RUN: %clang -### -target powerpc64 -S -O1 %s 2>&1 | \ +// RUN: %clang -### --target=powerpc64 -S -O1 %s 2>&1 | \ // RUN: FileCheck --check-prefix=KEEP-NONE %s // SPARC targets omit the frame pointer when optimizations are enabled. -// RUN: %clang -### -target sparc -S %s 2>&1 | \ +// RUN: %clang -### --target=sparc -S %s 2>&1 | \ // RUN: FileCheck --check-prefix=KEEP-ALL %s -// RUN: %clang -### -target sparc -S -O1 %s 2>&1 | \ +// RUN: %clang -### --target=sparc -S -O1 %s 2>&1 | \ // RUN: FileCheck --check-prefix=KEEP-NONE %s -// RUN: %clang -### -target sparcel -S %s 2>&1 | \ +// RUN: %clang -### --target=sparcel -S %s 2>&1 | \ // RUN: FileCheck --check-prefix=KEEP-ALL %s -// RUN: %clang -### -target sparcel -S -O1 %s 2>&1 | \ +// RUN: %clang -### --target=sparcel -S -O1 %s 2>&1 | \ // RUN: FileCheck --check-prefix=KEEP-NONE %s -// RUN: %clang -### -target sparc64 -S %s 2>&1 | \ +// RUN: %clang -### --target=sparc64 -S %s 2>&1 | \ // RUN: FileCheck --check-prefix=KEEP-ALL %s -// RUN: %clang -### -target sparc64 -S -O1 %s 2>&1 | \ +// RUN: %clang -### --target=sparc64 -S -O1 %s 2>&1 | \ // RUN: FileCheck --check-prefix=KEEP-NONE %s // M68k targets omit the frame pointer when optimizations are enabled. -// RUN: %clang -### -target m68k -S %s 2>&1 | \ +// RUN: %clang -### --target=m68k -S %s 2>&1 | \ // RUN: FileCheck --check-prefix=KEEP-ALL %s -// RUN: %clang -### -target m68k -S -O1 %s 2>&1 | \ +// RUN: %clang -### --target=m68k -S -O1 %s 2>&1 | \ // RUN: FileCheck --check-prefix=KEEP-NONE %s // For AAarch32 (A32, T32) linux targets, default omit frame pointer when // optimizations are enabled. -// RUN: %clang -### -target arm-linux-gnueabihf- -marm -S %s 2>&1 | \ +// RUN: %clang -### --target=arm-linux-gnueabihf- -marm -S %s 2>&1 | \ // RUN: FileCheck --check-prefix=KEEP-ALL %s -// RUN: %clang -### -target arm-linux-gnueabihf- -mthumb -S %s 2>&1 | \ +// RUN: %clang -### --target=arm-linux-gnueabihf- -mthumb -S %s 2>&1 | \ // RUN: FileCheck --check-prefix=KEEP-ALL %s -// RUN: %clang -### -target arm-linux-gnueabihf- -marm -mbig-endian -S %s 2>&1 | \ +// RUN: %clang -### --target=arm-linux-gnueabihf- -marm -mbig-endian -S %s 2>&1 | \ // RUN: FileCheck --check-prefix=KEEP-ALL %s -// RUN: %clang -### -target arm-linux-gnueabihf- -mthumb -mbig-endian -S %s 2>&1 | \ +// RUN: %clang -### --target=arm-linux-gnueabihf- -mthumb -mbig-endian -S %s 2>&1 | \ // RUN: FileCheck --check-prefix=KEEP-ALL %s -// RUN: %clang -### -target arm-linux-gnueabihf- -marm -O1 -S %s 2>&1 | \ +// RUN: %clang -### --target=arm-linux-gnueabihf- -marm -O1 -S %s 2>&1 | \ // RUN: FileCheck --check-prefix=KEEP-NONE %s -// RUN: %clang -### -target arm-linux-gnueabihf- -mthumb -O1 -S %s 2>&1 | \ +// RUN: %clang -### --target=arm-linux-gnueabihf- -mthumb -O1 -S %s 2>&1 | \ // RUN: FileCheck --check-prefix=KEEP-NONE %s -// RUN: %clang -### -target arm-linux-gnueabihf- -marm -mbig-endian -O1 -S %s 2>&1 | \ +// RUN: %clang -### --target=arm-linux-gnueabihf- -marm -mbig-endian -O1 -S %s 2>&1 | \ // RUN: FileCheck --check-prefix=KEEP-NONE %s -// RUN: %clang -### -target arm-linux-gnueabihf- -mthumb -mbig-endian -O1 -S %s 2>&1 | \ +// RUN: %clang -### --target=arm-linux-gnueabihf- -mthumb -mbig-endian -O1 -S %s 2>&1 | \ // RUN: FileCheck --check-prefix=KEEP-NONE %s // For Android, keep the framepointers always. -// RUN: %clang -### -target armv7a-linux-androideabi- -marm -O1 -S %s 2>&1 | \ +// RUN: %clang -### --target=armv7a-linux-androideabi- -marm -O1 -S %s 2>&1 | \ // RUN: FileCheck --check-prefix=KEEP-ALL %s -// RUN: %clang -### -target armv7a-linux-androideabi- -mthumb -O1 -S %s 2>&1 | \ +// RUN: %clang -### --target=armv7a-linux-androideabi- -mthumb -O1 -S %s 2>&1 | \ // RUN: FileCheck --check-prefix=KEEP-ALL %s -// RUN: %clang -### -target armv7a-linux-androideabi- -marm -mbig-endian -O1 -S %s 2>&1 | \ +// RUN: %clang -### --target=armv7a-linux-androideabi- -marm -mbig-endian -O1 -S %s 2>&1 | \ // RUN: FileCheck --check-prefix=KEEP-ALL %s -// RUN: %clang -### -target armv7a-linux-androideabi- -mthumb -mbig-endian -O1 -S %s 2>&1 | \ +// RUN: %clang -### --target=armv7a-linux-androideabi- -mthumb -mbig-endian -O1 -S %s 2>&1 | \ // RUN: FileCheck --check-prefix=KEEP-ALL %s // RUN: %clang -### --target=riscv64-linux-android -O1 -S %s 2>&1 | \ // RUN: FileCheck --check-prefix=KEEP-NON-LEAF %s diff --git a/clang/test/Driver/freebsd-mips-as.c b/clang/test/Driver/freebsd-mips-as.c index a053c2180e52c..428644ab78a9f 100644 --- a/clang/test/Driver/freebsd-mips-as.c +++ b/clang/test/Driver/freebsd-mips-as.c @@ -1,91 +1,91 @@ // Check passing options to the assembler for MIPS targets. // -// RUN: %clang -target mips-unknown-freebsd -### \ +// RUN: %clang --target=mips-unknown-freebsd -### \ // RUN: -no-integrated-as -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS32-EB-AS %s // MIPS32-EB-AS: as{{(.exe)?}}" "-march" "mips2" "-mabi" "32" "-EB" // MIPS32-EB-AS-NOT: "-KPIC" // -// RUN: %clang -target mips-unknown-freebsd -### \ +// RUN: %clang --target=mips-unknown-freebsd -### \ // RUN: -no-integrated-as -fPIC -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS32-EB-PIC %s // MIPS32-EB-PIC: as{{(.exe)?}}" "-march" "mips2" "-mabi" "32" "-EB" // MIPS32-EB-PIC: "-KPIC" // -// RUN: %clang -target mips-unknown-freebsd -### \ +// RUN: %clang --target=mips-unknown-freebsd -### \ // RUN: -no-integrated-as -fpic -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS32-EB-PIC-SMALL %s // MIPS32-EB-PIC-SMALL: as{{(.exe)?}}" "-march" "mips2" "-mabi" "32" "-EB" // MIPS32-EB-PIC-SMALL: "-KPIC" // -// RUN: %clang -target mips-unknown-freebsd -### \ +// RUN: %clang --target=mips-unknown-freebsd -### \ // RUN: -no-integrated-as -fPIE -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS32-EB-PIE %s // MIPS32-EB-PIE: as{{(.exe)?}}" "-march" "mips2" "-mabi" "32" "-EB" // MIPS32-EB-PIE: "-KPIC" // -// RUN: %clang -target mips-unknown-freebsd -### \ +// RUN: %clang --target=mips-unknown-freebsd -### \ // RUN: -no-integrated-as -fpie -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS32-EB-PIE-SMALL %s // MIPS32-EB-PIE-SMALL: as{{(.exe)?}}" "-march" "mips2" "-mabi" "32" "-EB" // MIPS32-EB-PIE-SMALL: "-KPIC" // -// RUN: %clang -target mipsel-unknown-freebsd -### \ +// RUN: %clang --target=mipsel-unknown-freebsd -### \ // RUN: -no-integrated-as -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS32-DEF-EL-AS %s // MIPS32-DEF-EL-AS: as{{(.exe)?}}" "-march" "mips2" "-mabi" "32" "-EL" // -// RUN: %clang -target mips64-unknown-freebsd -### \ +// RUN: %clang --target=mips64-unknown-freebsd -### \ // RUN: -no-integrated-as -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS64-EB-AS %s // MIPS64-EB-AS: as{{(.exe)?}}" "-march" "mips3" "-mabi" "64" "-EB" // -// RUN: %clang -target mips64el-unknown-freebsd -### \ +// RUN: %clang --target=mips64el-unknown-freebsd -### \ // RUN: -no-integrated-as -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS64-DEF-EL-AS %s // MIPS64-DEF-EL-AS: as{{(.exe)?}}" "-march" "mips3" "-mabi" "64" "-EL" // -// RUN: %clang -target mips64-unknown-freebsd -mabi=n32 -### \ +// RUN: %clang --target=mips64-unknown-freebsd -mabi=n32 -### \ // RUN: -no-integrated-as -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS-N32 %s // MIPS-N32: as{{(.exe)?}}" "-march" "mips3" "-mabi" "n32" "-EB" // -// RUN: %clang -target mipsel-unknown-freebsd -mabi=32 -### \ +// RUN: %clang --target=mipsel-unknown-freebsd -mabi=32 -### \ // RUN: -no-integrated-as -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS32-EL-AS %s // MIPS32-EL-AS: as{{(.exe)?}}" "-march" "mips2" "-mabi" "32" "-EL" // -// RUN: %clang -target mips64el-unknown-freebsd -mabi=64 -### \ +// RUN: %clang --target=mips64el-unknown-freebsd -mabi=64 -### \ // RUN: -no-integrated-as -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS64-EL-AS %s // MIPS64-EL-AS: as{{(.exe)?}}" "-march" "mips3" "-mabi" "64" "-EL" // -// RUN: %clang -target mips-linux-freebsd -march=mips32r2 -### \ +// RUN: %clang --target=mips-linux-freebsd -march=mips32r2 -### \ // RUN: -no-integrated-as -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS-32R2 %s // MIPS-32R2: as{{(.exe)?}}" "-march" "mips32r2" "-mabi" "32" "-EB" // -// RUN: %clang -target mips-unknown-freebsd -mips32 -### \ +// RUN: %clang --target=mips-unknown-freebsd -mips32 -### \ // RUN: -no-integrated-as -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS-ALIAS-32 %s // MIPS-ALIAS-32: as{{(.exe)?}}" "-march" "mips32" "-mabi" "32" "-EB" // -// RUN: %clang -target mips-unknown-freebsd -mips32r2 -### \ +// RUN: %clang --target=mips-unknown-freebsd -mips32r2 -### \ // RUN: -no-integrated-as -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS-ALIAS-32R2 %s // MIPS-ALIAS-32R2: as{{(.exe)?}}" "-march" "mips32r2" "-mabi" "32" "-EB" // -// RUN: %clang -target mips64-unknown-freebsd -mips64 -### \ +// RUN: %clang --target=mips64-unknown-freebsd -mips64 -### \ // RUN: -no-integrated-as -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS-ALIAS-64 %s // MIPS-ALIAS-64: as{{(.exe)?}}" "-march" "mips64" "-mabi" "64" "-EB" // -// RUN: %clang -target mips64-unknown-freebsd -mips64r2 -### \ +// RUN: %clang --target=mips64-unknown-freebsd -mips64r2 -### \ // RUN: -no-integrated-as -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS-ALIAS-64R2 %s // MIPS-ALIAS-64R2: as{{(.exe)?}}" "-march" "mips64r2" "-mabi" "64" "-EB" // -// RUN: %clang -target mips-unknown-freebsd -### \ +// RUN: %clang --target=mips-unknown-freebsd -### \ // RUN: -no-integrated-as -G0 -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS32-EB-AS-G0 %s // MIPS32-EB-AS-G0: as{{(.exe)?}}" "-march" "mips2" "-mabi" "32" "-EB" "-G0" diff --git a/clang/test/Driver/freebsd.cpp b/clang/test/Driver/freebsd.cpp index 6ddab91999055..dc8c98d3c3cb7 100644 --- a/clang/test/Driver/freebsd.cpp +++ b/clang/test/Driver/freebsd.cpp @@ -1,15 +1,15 @@ -// RUN: %clangxx %s -### -o %t.o -target amd64-unknown-freebsd -stdlib=platform 2>&1 \ +// RUN: %clangxx %s -### -o %t.o --target=amd64-unknown-freebsd -stdlib=platform 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-DEFAULT %s -// RUN: %clangxx %s -### -o %t.o -target amd64-unknown-freebsd10.0 -stdlib=platform 2>&1 \ +// RUN: %clangxx %s -### -o %t.o --target=amd64-unknown-freebsd10.0 -stdlib=platform 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-TEN %s // CHECK-DEFAULT: "-lc++" "-lm" // CHECK-TEN: "-lc++" "-lm" -// RUN: %clangxx %s -### -pg -o %t.o -target amd64-unknown-freebsd -stdlib=platform 2>&1 \ +// RUN: %clangxx %s -### -pg -o %t.o --target=amd64-unknown-freebsd -stdlib=platform 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-PG-DEFAULT %s -// RUN: %clangxx %s -### -pg -o %t.o -target amd64-unknown-freebsd14.0 -stdlib=platform 2>&1 \ +// RUN: %clangxx %s -### -pg -o %t.o --target=amd64-unknown-freebsd14.0 -stdlib=platform 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-PG-FOURTEEN %s -// RUN: %clangxx %s -### -pg -o %t.o -target amd64-unknown-freebsd10.0 -stdlib=platform 2>&1 \ +// RUN: %clangxx %s -### -pg -o %t.o --target=amd64-unknown-freebsd10.0 -stdlib=platform 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-PG-TEN %s // CHECK-PG-DEFAULT: "-lc++" "-lm" // CHECK-PG-FOURTEEN: "-lc++" "-lm" diff --git a/clang/test/Driver/fsanitize-coverage.c b/clang/test/Driver/fsanitize-coverage.c index d34ad5f6698fa..c2de897f80eeb 100644 --- a/clang/test/Driver/fsanitize-coverage.c +++ b/clang/test/Driver/fsanitize-coverage.c @@ -1,45 +1,45 @@ -// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-coverage=0 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-0 -// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-coverage=edge -fsanitize-coverage=0 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-0 -// RUN: %clang -target x86_64-linux-gnu -fsanitize=address %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-0 +// RUN: %clang --target=x86_64-linux-gnu -fsanitize=address -fsanitize-coverage=0 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-0 +// RUN: %clang --target=x86_64-linux-gnu -fsanitize=address -fsanitize-coverage=edge -fsanitize-coverage=0 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-0 +// RUN: %clang --target=x86_64-linux-gnu -fsanitize=address %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-0 // CHECK-SANITIZE-COVERAGE-0-NOT: fsanitize-coverage-type // CHECK-SANITIZE-COVERAGE-0: -fsanitize=address -// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-coverage=func,trace-pc %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-FUNC -// RUN: %clang -target x86_64-linux-gnu -fsanitize=kernel-address -fsanitize-coverage=func,trace-pc %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-FUNC -// RUN: %clang -target x86_64-linux-gnu -fsanitize=hwaddress -fsanitize-coverage=func,trace-pc %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-FUNC -// RUN: %clang -target x86_64-linux-gnu -fsanitize=kernel-hwaddress -fsanitize-coverage=func,trace-pc %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-FUNC -// RUN: %clang -target x86_64-linux-gnu -fsanitize=memory -fsanitize-coverage=func,trace-pc %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-FUNC -// RUN: %clang -target x86_64-linux-gnu -fsanitize=kernel-memory -fsanitize-coverage=func,trace-pc %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-FUNC -// RUN: %clang -target x86_64-linux-gnu -fsanitize=leak -fsanitize-coverage=func,trace-pc %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-FUNC -// RUN: %clang -target x86_64-linux-gnu -fsanitize=undefined -fsanitize-coverage=func,trace-pc %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-FUNC -// RUN: %clang -target x86_64-linux-gnu -fsanitize=bounds -fsanitize-coverage=func,trace-pc %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-FUNC -// RUN: %clang -target x86_64-linux-gnu -fsanitize=bool -fsanitize-coverage=func,trace-pc %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-FUNC -// RUN: %clang -target x86_64-linux-gnu -fsanitize=dataflow -fsanitize-coverage=func,trace-pc %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-FUNC -// RUN: %clang -target x86_64-linux-gnu -fsanitize=thread -fsanitize-coverage=func,trace-pc %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-FUNC -// RUN: %clang -target x86_64-linux-gnu -fsanitize=kcfi -fsanitize-coverage=func,trace-pc %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-FUNC -// RUN: %clang -target %itanium_abi_triple -fsanitize=float-divide-by-zero -fsanitize-coverage=func,trace-pc %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-FUNC -// RUN: %clang -target x86_64-linux-gnu -fsanitize-coverage=func,trace-pc %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-FUNC +// RUN: %clang --target=x86_64-linux-gnu -fsanitize=address -fsanitize-coverage=func,trace-pc %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-FUNC +// RUN: %clang --target=x86_64-linux-gnu -fsanitize=kernel-address -fsanitize-coverage=func,trace-pc %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-FUNC +// RUN: %clang --target=x86_64-linux-gnu -fsanitize=hwaddress -fsanitize-coverage=func,trace-pc %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-FUNC +// RUN: %clang --target=x86_64-linux-gnu -fsanitize=kernel-hwaddress -fsanitize-coverage=func,trace-pc %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-FUNC +// RUN: %clang --target=x86_64-linux-gnu -fsanitize=memory -fsanitize-coverage=func,trace-pc %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-FUNC +// RUN: %clang --target=x86_64-linux-gnu -fsanitize=kernel-memory -fsanitize-coverage=func,trace-pc %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-FUNC +// RUN: %clang --target=x86_64-linux-gnu -fsanitize=leak -fsanitize-coverage=func,trace-pc %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-FUNC +// RUN: %clang --target=x86_64-linux-gnu -fsanitize=undefined -fsanitize-coverage=func,trace-pc %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-FUNC +// RUN: %clang --target=x86_64-linux-gnu -fsanitize=bounds -fsanitize-coverage=func,trace-pc %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-FUNC +// RUN: %clang --target=x86_64-linux-gnu -fsanitize=bool -fsanitize-coverage=func,trace-pc %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-FUNC +// RUN: %clang --target=x86_64-linux-gnu -fsanitize=dataflow -fsanitize-coverage=func,trace-pc %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-FUNC +// RUN: %clang --target=x86_64-linux-gnu -fsanitize=thread -fsanitize-coverage=func,trace-pc %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-FUNC +// RUN: %clang --target=x86_64-linux-gnu -fsanitize=kcfi -fsanitize-coverage=func,trace-pc %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-FUNC +// RUN: %clang --target=%itanium_abi_triple -fsanitize=float-divide-by-zero -fsanitize-coverage=func,trace-pc %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-FUNC +// RUN: %clang --target=x86_64-linux-gnu -fsanitize-coverage=func,trace-pc %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-FUNC // CHECK-SANITIZE-COVERAGE-FUNC: fsanitize-coverage-type=1 -// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-coverage=bb %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-BB +// RUN: %clang --target=x86_64-linux-gnu -fsanitize=address -fsanitize-coverage=bb %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-BB // CHECK-SANITIZE-COVERAGE-BB: fsanitize-coverage-type=2 -// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-coverage=edge %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-EDGE +// RUN: %clang --target=x86_64-linux-gnu -fsanitize=address -fsanitize-coverage=edge %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-EDGE // CHECK-SANITIZE-COVERAGE-EDGE: fsanitize-coverage-type=3 -// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-coverage=edge,indirect-calls %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-FUNC_INDIR +// RUN: %clang --target=x86_64-linux-gnu -fsanitize=address -fsanitize-coverage=edge,indirect-calls %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-FUNC_INDIR // CHECK-SANITIZE-COVERAGE-FUNC_INDIR: fsanitize-coverage-type=3 // CHECK-SANITIZE-COVERAGE-FUNC_INDIR: fsanitize-coverage-indirect-calls -// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-coverage=1 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-1 +// RUN: %clang --target=x86_64-linux-gnu -fsanitize=address -fsanitize-coverage=1 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-1 // CHECK-SANITIZE-COVERAGE-1: warning: argument '-fsanitize-coverage=1' is deprecated, use '-fsanitize-coverage=trace-pc-guard' instead -// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-coverage=func %s -### 2>&1 | FileCheck %s --check-prefix=CHECK_FUNC_BB_EDGE_DEPRECATED -// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-coverage=bb %s -### 2>&1 | FileCheck %s --check-prefix=CHECK_FUNC_BB_EDGE_DEPRECATED -// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-coverage=edge %s -### 2>&1 | FileCheck %s --check-prefix=CHECK_FUNC_BB_EDGE_DEPRECATED +// RUN: %clang --target=x86_64-linux-gnu -fsanitize=address -fsanitize-coverage=func %s -### 2>&1 | FileCheck %s --check-prefix=CHECK_FUNC_BB_EDGE_DEPRECATED +// RUN: %clang --target=x86_64-linux-gnu -fsanitize=address -fsanitize-coverage=bb %s -### 2>&1 | FileCheck %s --check-prefix=CHECK_FUNC_BB_EDGE_DEPRECATED +// RUN: %clang --target=x86_64-linux-gnu -fsanitize=address -fsanitize-coverage=edge %s -### 2>&1 | FileCheck %s --check-prefix=CHECK_FUNC_BB_EDGE_DEPRECATED // CHECK_FUNC_BB_EDGE_DEPRECATED: warning: argument '-fsanitize-coverage=[func|bb|edge]' is deprecated, use '-fsanitize-coverage=[func|bb|edge],[trace-pc-guard|trace-pc],[control-flow]' instead -// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-coverage=edge,indirect-calls,trace-pc,trace-cmp,trace-loads,trace-stores,trace-div,trace-gep %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-FEATURES +// RUN: %clang --target=x86_64-linux-gnu -fsanitize=address -fsanitize-coverage=edge,indirect-calls,trace-pc,trace-cmp,trace-loads,trace-stores,trace-div,trace-gep %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANITIZE-COVERAGE-FEATURES // CHECK-SANITIZE-COVERAGE-FEATURES: -fsanitize-coverage-type=3 // CHECK-SANITIZE-COVERAGE-FEATURES: -fsanitize-coverage-indirect-calls // CHECK-SANITIZE-COVERAGE-FEATURES: -fsanitize-coverage-trace-cmp @@ -49,7 +49,7 @@ // CHECK-SANITIZE-COVERAGE-FEATURES: -fsanitize-coverage-trace-loads // CHECK-SANITIZE-COVERAGE-FEATURES: -fsanitize-coverage-trace-stores -// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-coverage=func,edge,indirect-calls,trace-cmp -fno-sanitize-coverage=edge,indirect-calls %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-MASK +// RUN: %clang --target=x86_64-linux-gnu -fsanitize=address -fsanitize-coverage=func,edge,indirect-calls,trace-cmp -fno-sanitize-coverage=edge,indirect-calls %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-MASK // CHECK-MASK: -fsanitize-coverage-type=1 // CHECK-MASK: -fsanitize-coverage-trace-cmp // CHECK-MASK-NOT: -fsanitize-coverage- @@ -60,30 +60,30 @@ // RUN: not %clang --target=x86_64-linux-gnu -fsanitize=address -fsanitize-coverage=func -fsanitize-coverage=edge %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-INCOMPATIBLE // CHECK-INCOMPATIBLE: error: invalid argument '-fsanitize-coverage=func' not allowed with '-fsanitize-coverage=edge' -// RUN: %clang -target x86_64-linux-gnu -fsanitize-coverage=8bit-counters %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-8BIT +// RUN: %clang --target=x86_64-linux-gnu -fsanitize-coverage=8bit-counters %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-8BIT // CHECK-8BIT: warning: argument '-fsanitize-coverage=8bit-counters' is deprecated, use '-fsanitize-coverage=trace-pc-guard' instead -// RUN: %clang -target x86_64-linux-gnu -fsanitize-coverage=trace-bb %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-TRACE-BB +// RUN: %clang --target=x86_64-linux-gnu -fsanitize-coverage=trace-bb %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-TRACE-BB // CHECK-TRACE-BB: warning: argument '-fsanitize-coverage=trace-bb' is deprecated, use '-fsanitize-coverage=trace-pc-guard' instead -// RUN: %clang -target x86_64-linux-gnu -fsanitize-coverage=trace-pc %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-TRACE_PC_EDGE -// RUN: %clang -target x86_64-linux-gnu -fsanitize-coverage=edge,trace-pc %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-TRACE_PC_EDGE +// RUN: %clang --target=x86_64-linux-gnu -fsanitize-coverage=trace-pc %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-TRACE_PC_EDGE +// RUN: %clang --target=x86_64-linux-gnu -fsanitize-coverage=edge,trace-pc %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-TRACE_PC_EDGE // CHECK-TRACE_PC_EDGE: -fsanitize-coverage-type=3 // CHECK-TRACE_PC_EDGE: -fsanitize-coverage-trace-pc -// RUN: %clang -target x86_64-linux-gnu -fsanitize-coverage=func,trace-pc %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-TRACE_PC_FUNC +// RUN: %clang --target=x86_64-linux-gnu -fsanitize-coverage=func,trace-pc %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-TRACE_PC_FUNC // CHECK-TRACE_PC_FUNC: -fsanitize-coverage-type=1 // CHECK-TRACE_PC_FUNC: -fsanitize-coverage-trace-pc -// RUN: %clang -target x86_64-linux-gnu -fsanitize-coverage=trace-pc-guard %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-TRACE_PC_GUARD_EDGE -// RUN: %clang -target x86_64-linux-gnu -fsanitize-coverage=edge,trace-pc-guard %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-TRACE_PC_GUARD_EDGE +// RUN: %clang --target=x86_64-linux-gnu -fsanitize-coverage=trace-pc-guard %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-TRACE_PC_GUARD_EDGE +// RUN: %clang --target=x86_64-linux-gnu -fsanitize-coverage=edge,trace-pc-guard %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-TRACE_PC_GUARD_EDGE // CHECK-TRACE_PC_GUARD_EDGE: -fsanitize-coverage-type=3 // CHECK-TRACE_PC_GUARD_EDGE: -fsanitize-coverage-trace-pc-guard -// RUN: %clang -target x86_64-linux-gnu -fsanitize-coverage=func,trace-pc-guard %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-TRACE_PC_GUARD_FUNC +// RUN: %clang --target=x86_64-linux-gnu -fsanitize-coverage=func,trace-pc-guard %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-TRACE_PC_GUARD_FUNC // CHECK-TRACE_PC_GUARD_FUNC: -fsanitize-coverage-type=1 // CHECK-TRACE_PC_GUARD_FUNC: -fsanitize-coverage-trace-pc-guard -// RUN: %clang -target x86_64-linux-gnu -fsanitize-coverage=stack-depth %s \ +// RUN: %clang --target=x86_64-linux-gnu -fsanitize-coverage=stack-depth %s \ // RUN: -### 2>&1 | FileCheck %s --check-prefix=CHECK-STACK-DEPTH -// RUN: %clang -target x86_64-linux-gnu \ +// RUN: %clang --target=x86_64-linux-gnu \ // RUN: -fsanitize-coverage=trace-pc-guard,stack-depth %s -### 2>&1 | \ // RUN: FileCheck %s --check-prefix=CHECK-STACK-DEPTH-PC-GUARD // CHECK-STACK-DEPTH: -fsanitize-coverage-type=1 @@ -92,35 +92,35 @@ // CHECK-STACK-DEPTH-PC-GUARD: -fsanitize-coverage-trace-pc-guard // CHECK-STACK-DEPTH-PC-GUARD: -fsanitize-coverage-stack-depth -// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-coverage=trace-cmp,indirect-calls %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-TYPE-NECESSARY +// RUN: %clang --target=x86_64-linux-gnu -fsanitize=address -fsanitize-coverage=trace-cmp,indirect-calls %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-TYPE-NECESSARY // CHECK-NO-TYPE-NECESSARY-NOT: error: // CHECK-NO-TYPE-NECESSARY: -fsanitize-coverage-indirect-calls // CHECK-NO-TYPE-NECESSARY: -fsanitize-coverage-trace-cmp -// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-coverage=func -fsanitize-coverage=trace-cmp %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-EXTEND-LEGACY +// RUN: %clang --target=x86_64-linux-gnu -fsanitize=address -fsanitize-coverage=func -fsanitize-coverage=trace-cmp %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-EXTEND-LEGACY // CHECK-EXTEND-LEGACY: -fsanitize-coverage-type=1 // CHECK-EXTEND-LEGACY: -fsanitize-coverage-trace-cmp -// RUN: %clang -target x86_64-linux-gnu -fsanitize-coverage=no-prune,trace-pc %s -### 2>&1 | FileCheck %s --check-prefix=CHECK_NOPRUNE -// RUN: %clang -target x86_64-linux-gnu -fsanitize-coverage=no-prune,func,trace-pc-guard %s -### 2>&1 | FileCheck %s --check-prefix=CHECK_NOPRUNE +// RUN: %clang --target=x86_64-linux-gnu -fsanitize-coverage=no-prune,trace-pc %s -### 2>&1 | FileCheck %s --check-prefix=CHECK_NOPRUNE +// RUN: %clang --target=x86_64-linux-gnu -fsanitize-coverage=no-prune,func,trace-pc-guard %s -### 2>&1 | FileCheck %s --check-prefix=CHECK_NOPRUNE // CHECK_NOPRUNE: -fsanitize-coverage-no-prune -// RUN: %clang -target x86_64-linux-gnu -fsanitize-coverage=inline-8bit-counters %s -### 2>&1 | FileCheck %s --check-prefix=CHECK_INLINE8BIT -// RUN: %clang -target x86_64-linux-gnu -fsanitize-coverage=bb,inline-8bit-counters %s -### 2>&1 | FileCheck %s --check-prefix=CHECK_INLINE8BIT +// RUN: %clang --target=x86_64-linux-gnu -fsanitize-coverage=inline-8bit-counters %s -### 2>&1 | FileCheck %s --check-prefix=CHECK_INLINE8BIT +// RUN: %clang --target=x86_64-linux-gnu -fsanitize-coverage=bb,inline-8bit-counters %s -### 2>&1 | FileCheck %s --check-prefix=CHECK_INLINE8BIT // CHECK_INLINE8BIT-NOT: warning: // CHECK_INLINE8BIT: -fsanitize-coverage-inline-8bit-counters -// RUN: %clang -target x86_64-linux-gnu -fsanitize-coverage=inline-8bit-counters,pc-table %s -### 2>&1 | FileCheck %s --check-prefix=CHECK_PC_TABLE_FOR_INLINE8BIT -// RUN: %clang -target x86_64-linux-gnu -fsanitize-coverage=trace-pc-guard,pc-table %s -### 2>&1 | FileCheck %s --check-prefix=CHECK_PC_TABLE_FOR_INLINE8BIT +// RUN: %clang --target=x86_64-linux-gnu -fsanitize-coverage=inline-8bit-counters,pc-table %s -### 2>&1 | FileCheck %s --check-prefix=CHECK_PC_TABLE_FOR_INLINE8BIT +// RUN: %clang --target=x86_64-linux-gnu -fsanitize-coverage=trace-pc-guard,pc-table %s -### 2>&1 | FileCheck %s --check-prefix=CHECK_PC_TABLE_FOR_INLINE8BIT // CHECK_PC_TABLE_FOR_INLINE8BIT: -fsanitize-coverage-pc-table -// RUN: %clang -target x86_64-linux-gnu -fsanitize-coverage=inline-bool-flag %s -### 2>&1 | FileCheck %s --check-prefix=CHECK_INLINE_BOOL_FLAG -// RUN: %clang -target x86_64-linux-gnu -fsanitize-coverage=bb,inline-bool-flag %s -### 2>&1 | FileCheck %s --check-prefix=CHECK_INLINE_BOOL_FLAG +// RUN: %clang --target=x86_64-linux-gnu -fsanitize-coverage=inline-bool-flag %s -### 2>&1 | FileCheck %s --check-prefix=CHECK_INLINE_BOOL_FLAG +// RUN: %clang --target=x86_64-linux-gnu -fsanitize-coverage=bb,inline-bool-flag %s -### 2>&1 | FileCheck %s --check-prefix=CHECK_INLINE_BOOL_FLAG // CHECK_INLINE_BOOL_FLAG-NOT: warning: // CHECK_INLINE_BOOL_FLAG: -fsanitize-coverage-inline-bool-flag -// RUN: %clang -target x86_64-linux-gnu -fsanitize-coverage=inline-bool-flag,pc-table %s -### 2>&1 | FileCheck %s --check-prefix=CHECK_PC_TABLE_FOR_INLINEBOOL -// RUN: %clang -target x86_64-linux-gnu -fsanitize-coverage=trace-pc-guard,pc-table %s -### 2>&1 | FileCheck %s --check-prefix=CHECK_PC_TABLE_FOR_INLINEBOOL +// RUN: %clang --target=x86_64-linux-gnu -fsanitize-coverage=inline-bool-flag,pc-table %s -### 2>&1 | FileCheck %s --check-prefix=CHECK_PC_TABLE_FOR_INLINEBOOL +// RUN: %clang --target=x86_64-linux-gnu -fsanitize-coverage=trace-pc-guard,pc-table %s -### 2>&1 | FileCheck %s --check-prefix=CHECK_PC_TABLE_FOR_INLINEBOOL // CHECK_PC_TABLE_FOR_INLINEBOOL: -fsanitize-coverage-pc-table // RUN: %clang_cl --target=i386-pc-win32 -fsanitize=address -fsanitize-coverage=func,trace-pc-guard -c -### -- %s 2>&1 | FileCheck %s -check-prefix=CLANG-CL-COVERAGE @@ -131,11 +131,11 @@ // CLANG-CL-COVERAGE: -fsanitize-coverage-type=1 // CLANG-CL-COVERAGE: -fsanitize=address -// RUN: %clang -target x86_64-linux-gnu -fsanitize=safe-stack -fsanitize-coverage=trace-pc-guard %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-VS-SAFESTACK +// RUN: %clang --target=x86_64-linux-gnu -fsanitize=safe-stack -fsanitize-coverage=trace-pc-guard %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-VS-SAFESTACK // CHECK-VS-SAFESTACK: -fsanitize-coverage-trace-pc-guard // CHECK-VS-SAFESTACK: -fsanitize=safe-stack -// RUN: %clang -target x86_64-linux-gnu -fsanitize=safe-stack -fsanitize-coverage=trace-pc-guard -fno-sanitize=safe-stack %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-SAFESTACK +// RUN: %clang --target=x86_64-linux-gnu -fsanitize=safe-stack -fsanitize-coverage=trace-pc-guard -fno-sanitize=safe-stack %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-SAFESTACK // CHECK-NO-SAFESTACK-NOT: error: // CHECK-NO-SAFESTACK-NOT: warning: // CHECK-NO-SAFESTACK-NOT: argument unused @@ -143,11 +143,11 @@ // CHECK-NO-SAFESTACK-NOT: -fsanitize=safe-stack // CHECK-NO-SAFESTACK: -fsanitize-coverage-trace-pc-guard -// RUN: %clang -target x86_64-linux-gnu -fsanitize=shadow-call-stack -fsanitize-coverage=trace-pc-guard %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-VS-SHADOWCALLSTACK +// RUN: %clang --target=x86_64-linux-gnu -fsanitize=shadow-call-stack -fsanitize-coverage=trace-pc-guard %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-VS-SHADOWCALLSTACK // CHECK-VS-SHADOWCALLSTACK: -fsanitize-coverage-trace-pc-guard // CHECK-VS-SHADOWCALLSTACK: -fsanitize=shadow-call-stack -// RUN: %clang -target x86_64-linux-gnu -fsanitize=shadow-call-stack -fsanitize-coverage=trace-pc-guard -fno-sanitize=shadow-call-stack %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-SAFESTACK +// RUN: %clang --target=x86_64-linux-gnu -fsanitize=shadow-call-stack -fsanitize-coverage=trace-pc-guard -fno-sanitize=shadow-call-stack %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-SAFESTACK // CHECK-NO-SHADOWCALLSTACK-NOT: error: // CHECK-NO-SHADOWCALLSTACK-NOT: warning: // CHECK-NO-SHADOWCALLSTACK-NOT: argument unused diff --git a/clang/test/Driver/fsanitize-ignorelist.c b/clang/test/Driver/fsanitize-ignorelist.c index c4669e50bb091..7dd666a453198 100644 --- a/clang/test/Driver/fsanitize-ignorelist.c +++ b/clang/test/Driver/fsanitize-ignorelist.c @@ -11,37 +11,37 @@ // RUN: echo "fun:bar" > %t.second // RUN: echo "badline" > %t.bad -// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-ignorelist=%t.good -fsanitize-ignorelist=%t.second %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-IGNORELIST -// RUN: %clang -target aarch64-linux-gnu -fsanitize=hwaddress -fsanitize-ignorelist=%t.good -fsanitize-ignorelist=%t.second %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-IGNORELIST +// RUN: %clang --target=x86_64-linux-gnu -fsanitize=address -fsanitize-ignorelist=%t.good -fsanitize-ignorelist=%t.second %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-IGNORELIST +// RUN: %clang --target=aarch64-linux-gnu -fsanitize=hwaddress -fsanitize-ignorelist=%t.good -fsanitize-ignorelist=%t.second %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-IGNORELIST // CHECK-IGNORELIST: -fsanitize-ignorelist={{.*}}.good" "-fsanitize-ignorelist={{.*}}.second // Check that the default ignorelist is not added as an extra dependency. -// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -resource-dir=%S/Inputs/resource_dir %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-DEFAULT-IGNORELIST-ASAN --implicit-check-not=fdepfile-entry --implicit-check-not=-fsanitize-ignorelist= +// RUN: %clang --target=x86_64-linux-gnu -fsanitize=address -resource-dir=%S/Inputs/resource_dir %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-DEFAULT-IGNORELIST-ASAN --implicit-check-not=fdepfile-entry --implicit-check-not=-fsanitize-ignorelist= // CHECK-DEFAULT-IGNORELIST-ASAN: -fsanitize-system-ignorelist={{.*[^w]}}asan_ignorelist.txt -// RUN: %clang -target x86_64-linux-gnu -fsanitize=hwaddress -resource-dir=%S/Inputs/resource_dir %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-DEFAULT-IGNORELIST-HWASAN --implicit-check-not=fdepfile-entry --implicit-check-not=-fsanitize-ignorelist= +// RUN: %clang --target=x86_64-linux-gnu -fsanitize=hwaddress -resource-dir=%S/Inputs/resource_dir %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-DEFAULT-IGNORELIST-HWASAN --implicit-check-not=fdepfile-entry --implicit-check-not=-fsanitize-ignorelist= // CHECK-DEFAULT-IGNORELIST-HWASAN: -fsanitize-system-ignorelist={{.*}}hwasan_ignorelist.txt -// RUN: %clang -target x86_64-linux-gnu -fsanitize=integer -resource-dir=%S/Inputs/resource_dir %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-DEFAULT-UBSAN-IGNORELIST --implicit-check-not=fdepfile-entry --implicit-check-not=-fsanitize-ignorelist= -// RUN: %clang -target x86_64-linux-gnu -fsanitize=nullability -resource-dir=%S/Inputs/resource_dir %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-DEFAULT-UBSAN-IGNORELIST --implicit-check-not=fdepfile-entry --implicit-check-not=-fsanitize-ignorelist= -// RUN: %clang -target x86_64-linux-gnu -fsanitize=undefined -resource-dir=%S/Inputs/resource_dir %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-DEFAULT-UBSAN-IGNORELIST --implicit-check-not=fdepfile-entry --implicit-check-not=-fsanitize-ignorelist= -// RUN: %clang -target x86_64-linux-gnu -fsanitize=alignment -resource-dir=%S/Inputs/resource_dir %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-DEFAULT-UBSAN-IGNORELIST --implicit-check-not=fdepfile-entry --implicit-check-not=-fsanitize-ignorelist= -// RUN: %clang -target %itanium_abi_triple -fsanitize=float-divide-by-zero -resource-dir=%S/Inputs/resource_dir %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-DEFAULT-UBSAN-IGNORELIST --implicit-check-not=fdepfile-entry --implicit-check-not=-fsanitize-ignorelist= +// RUN: %clang --target=x86_64-linux-gnu -fsanitize=integer -resource-dir=%S/Inputs/resource_dir %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-DEFAULT-UBSAN-IGNORELIST --implicit-check-not=fdepfile-entry --implicit-check-not=-fsanitize-ignorelist= +// RUN: %clang --target=x86_64-linux-gnu -fsanitize=nullability -resource-dir=%S/Inputs/resource_dir %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-DEFAULT-UBSAN-IGNORELIST --implicit-check-not=fdepfile-entry --implicit-check-not=-fsanitize-ignorelist= +// RUN: %clang --target=x86_64-linux-gnu -fsanitize=undefined -resource-dir=%S/Inputs/resource_dir %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-DEFAULT-UBSAN-IGNORELIST --implicit-check-not=fdepfile-entry --implicit-check-not=-fsanitize-ignorelist= +// RUN: %clang --target=x86_64-linux-gnu -fsanitize=alignment -resource-dir=%S/Inputs/resource_dir %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-DEFAULT-UBSAN-IGNORELIST --implicit-check-not=fdepfile-entry --implicit-check-not=-fsanitize-ignorelist= +// RUN: %clang --target=%itanium_abi_triple -fsanitize=float-divide-by-zero -resource-dir=%S/Inputs/resource_dir %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-DEFAULT-UBSAN-IGNORELIST --implicit-check-not=fdepfile-entry --implicit-check-not=-fsanitize-ignorelist= // CHECK-DEFAULT-UBSAN-IGNORELIST: -fsanitize-system-ignorelist={{.*}}ubsan_ignorelist.txt // Check that combining ubsan and another sanitizer results in both ignorelists being used. -// RUN: %clang -target x86_64-linux-gnu -fsanitize=undefined,address -resource-dir=%S/Inputs/resource_dir %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-DEFAULT-UBSAN-IGNORELIST --check-prefix=CHECK-DEFAULT-IGNORELIST-ASAN --implicit-check-not=fdepfile-entry --implicit-check-not=-fsanitize-ignorelist= +// RUN: %clang --target=x86_64-linux-gnu -fsanitize=undefined,address -resource-dir=%S/Inputs/resource_dir %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-DEFAULT-UBSAN-IGNORELIST --check-prefix=CHECK-DEFAULT-IGNORELIST-ASAN --implicit-check-not=fdepfile-entry --implicit-check-not=-fsanitize-ignorelist= // Ignore -fsanitize-ignorelist flag if there is no -fsanitize flag. -// RUN: %clang -target x86_64-linux-gnu -fsanitize-ignorelist=%t.good %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-SANITIZE --check-prefix=DELIMITERS +// RUN: %clang --target=x86_64-linux-gnu -fsanitize-ignorelist=%t.good %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-SANITIZE --check-prefix=DELIMITERS // CHECK-NO-SANITIZE-NOT: -fsanitize-ignorelist // Ignore -fsanitize-ignorelist flag if there is no -fsanitize flag. // Now, check for the absence of -fdepfile-entry flags. -// RUN: %clang -target x86_64-linux-gnu -fsanitize-ignorelist=%t.good %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-SANITIZE2 --check-prefix=DELIMITERS +// RUN: %clang --target=x86_64-linux-gnu -fsanitize-ignorelist=%t.good %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-SANITIZE2 --check-prefix=DELIMITERS // CHECK-NO-SANITIZE2-NOT: -fdepfile-entry // Flag -fno-sanitize-ignorelist wins if it is specified later. -// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-ignorelist=%t.good -fno-sanitize-ignorelist %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-IGNORELIST --check-prefix=DELIMITERS +// RUN: %clang --target=x86_64-linux-gnu -fsanitize=address -fsanitize-ignorelist=%t.good -fno-sanitize-ignorelist %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-IGNORELIST --check-prefix=DELIMITERS // CHECK-NO-IGNORELIST-NOT: -fsanitize-ignorelist // Driver barks on unexisting ignorelist files. @@ -53,13 +53,13 @@ // CHECK-BAD-IGNORELIST: error: malformed sanitizer ignorelist: 'error parsing file '{{.*}}.bad': malformed line 1: 'badline'' // -fno-sanitize-ignorelist disables all ignorelists specified earlier. -// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-ignorelist=%t.good -fno-sanitize-ignorelist -fsanitize-ignorelist=%t.second %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-ONLY-FIRST-DISABLED --implicit-check-not=-fsanitize-ignorelist= +// RUN: %clang --target=x86_64-linux-gnu -fsanitize=address -fsanitize-ignorelist=%t.good -fno-sanitize-ignorelist -fsanitize-ignorelist=%t.second %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-ONLY-FIRST-DISABLED --implicit-check-not=-fsanitize-ignorelist= // CHECK-ONLY_FIRST-DISABLED-NOT: good // CHECK-ONLY-FIRST-DISABLED: -fsanitize-ignorelist={{.*}}.second // CHECK-ONLY_FIRST-DISABLED-NOT: good // -fno-sanitize-ignorelist disables the system ignorelists. -// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fno-sanitize-ignorelist %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-DISABLED-SYSTEM --check-prefix=DELIMITERS +// RUN: %clang --target=x86_64-linux-gnu -fsanitize=address -fno-sanitize-ignorelist %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-DISABLED-SYSTEM --check-prefix=DELIMITERS // CHECK-DISABLED-SYSTEM-NOT: -fsanitize-system-ignorelist // If cfi_ignorelist.txt cannot be found in the resource dir, driver should fail. @@ -67,7 +67,7 @@ // CHECK-MISSING-CFI-IGNORELIST: error: missing sanitizer ignorelist: '{{.*}}cfi_ignorelist.txt' // -fno-sanitize-ignorelist disables checking for cfi_ignorelist.txt in the resource dir. -// RUN: %clang -target x86_64-linux-gnu -fsanitize=cfi -flto -fvisibility=default -fno-sanitize-ignorelist -resource-dir=/dev/null %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-MISSING-CFI-NO-IGNORELIST +// RUN: %clang --target=x86_64-linux-gnu -fsanitize=cfi -flto -fvisibility=default -fno-sanitize-ignorelist -resource-dir=/dev/null %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-MISSING-CFI-NO-IGNORELIST // CHECK-MISSING-CFI-NO-IGNORELIST-NOT: error: no such file or directory: '{{.*}}cfi_ignorelist.txt' // DELIMITERS: {{^ *"}} diff --git a/clang/test/Driver/fsanitize-memory-param-retval.c b/clang/test/Driver/fsanitize-memory-param-retval.c index 79ade32178b69..99d8cb7f55e5d 100644 --- a/clang/test/Driver/fsanitize-memory-param-retval.c +++ b/clang/test/Driver/fsanitize-memory-param-retval.c @@ -1,14 +1,14 @@ -// RUN: %clang -target i386-gnu-linux %s -fsanitize=memory -fno-sanitize-memory-param-retval -c -### 2>&1 | FileCheck %s -// RUN: %clang -target x86_64-linux-gnu %s -fsanitize=memory -fno-sanitize-memory-param-retval -c -### 2>&1 | FileCheck %s -// RUN: %clang -target aarch64-linux-gnu %s -fsanitize=memory -fno-sanitize-memory-param-retval -c -### 2>&1 | FileCheck %s -// RUN: %clang -target riscv32-linux-gnu %s -fsanitize=memory -fno-sanitize-memory-param-retval -c -### 2>&1 | FileCheck %s -// RUN: %clang -target riscv64-linux-gnu %s -fsanitize=memory -fno-sanitize-memory-param-retval -c -### 2>&1 | FileCheck %s -// RUN: %clang -target x86_64-linux-gnu %s -fsanitize=kernel-memory -fno-sanitize-memory-param-retval -c -### 2>&1 | FileCheck %s +// RUN: %clang --target=i386-gnu-linux %s -fsanitize=memory -fno-sanitize-memory-param-retval -c -### 2>&1 | FileCheck %s +// RUN: %clang --target=x86_64-linux-gnu %s -fsanitize=memory -fno-sanitize-memory-param-retval -c -### 2>&1 | FileCheck %s +// RUN: %clang --target=aarch64-linux-gnu %s -fsanitize=memory -fno-sanitize-memory-param-retval -c -### 2>&1 | FileCheck %s +// RUN: %clang --target=riscv32-linux-gnu %s -fsanitize=memory -fno-sanitize-memory-param-retval -c -### 2>&1 | FileCheck %s +// RUN: %clang --target=riscv64-linux-gnu %s -fsanitize=memory -fno-sanitize-memory-param-retval -c -### 2>&1 | FileCheck %s +// RUN: %clang --target=x86_64-linux-gnu %s -fsanitize=kernel-memory -fno-sanitize-memory-param-retval -c -### 2>&1 | FileCheck %s // CHECK: "-fno-sanitize-memory-param-retval" -// RUN: %clang -target aarch64-linux-gnu -fsyntax-only %s -fsanitize=memory -fno-sanitize-memory-param-retval -c -### 2>&1 | FileCheck --check-prefix=11 %s +// RUN: %clang --target=aarch64-linux-gnu -fsyntax-only %s -fsanitize=memory -fno-sanitize-memory-param-retval -c -### 2>&1 | FileCheck --check-prefix=11 %s // 11: "-fno-sanitize-memory-param-retval" -// RUN: not %clang -target x86_64-linux-gnu -fsyntax-only %s -fsanitize=memory -fno-sanitize-memory-param-retval=1 2>&1 | FileCheck --check-prefix=EXCESS %s +// RUN: not %clang --target=x86_64-linux-gnu -fsyntax-only %s -fsanitize=memory -fno-sanitize-memory-param-retval=1 2>&1 | FileCheck --check-prefix=EXCESS %s // EXCESS: error: unknown argument: '-fno-sanitize-memory-param-retval= diff --git a/clang/test/Driver/fsanitize-metadata-ignorelist.c b/clang/test/Driver/fsanitize-metadata-ignorelist.c index 65a45ccb1404f..ad5f4be167683 100644 --- a/clang/test/Driver/fsanitize-metadata-ignorelist.c +++ b/clang/test/Driver/fsanitize-metadata-ignorelist.c @@ -3,12 +3,12 @@ // RUN: echo "fun:foo" > %t.1 // RUN: echo "fun:bar" > %t.2 -// RUN: %clang -target x86_64-linux-gnu -fexperimental-sanitize-metadata=all -fexperimental-sanitize-metadata-ignorelist=%t.1 -fexperimental-sanitize-metadata-ignorelist=%t.2 %s -### 2>&1 | FileCheck %s -// RUN: %clang -target aarch64-linux-gnu -fexperimental-sanitize-metadata=atomics -fexperimental-sanitize-metadata-ignorelist=%t.1 -fexperimental-sanitize-metadata-ignorelist=%t.2 %s -### 2>&1 | FileCheck %s +// RUN: %clang --target=x86_64-linux-gnu -fexperimental-sanitize-metadata=all -fexperimental-sanitize-metadata-ignorelist=%t.1 -fexperimental-sanitize-metadata-ignorelist=%t.2 %s -### 2>&1 | FileCheck %s +// RUN: %clang --target=aarch64-linux-gnu -fexperimental-sanitize-metadata=atomics -fexperimental-sanitize-metadata-ignorelist=%t.1 -fexperimental-sanitize-metadata-ignorelist=%t.2 %s -### 2>&1 | FileCheck %s // CHECK: "-fexperimental-sanitize-metadata-ignorelist={{.*}}.1" "-fexperimental-sanitize-metadata-ignorelist={{.*}}.2" // Verify -fsanitize-metadata-ignorelist flag not passed if there is no -fsanitize-metadata flag. -// RUN: %clang -target x86_64-linux-gnu -fexperimental-sanitize-metadata-ignorelist=%t.1 -fexperimental-sanitize-metadata-ignorelist=%t.2 %s -### 2>&1 | FileCheck %s --check-prefix=NOSANMD -// RUN: %clang -target aarch64-linux-gnu -fexperimental-sanitize-metadata-ignorelist=%t.1 -fexperimental-sanitize-metadata-ignorelist=%t.2 %s -### 2>&1 | FileCheck %s --check-prefix=NOSANMD +// RUN: %clang --target=x86_64-linux-gnu -fexperimental-sanitize-metadata-ignorelist=%t.1 -fexperimental-sanitize-metadata-ignorelist=%t.2 %s -### 2>&1 | FileCheck %s --check-prefix=NOSANMD +// RUN: %clang --target=aarch64-linux-gnu -fexperimental-sanitize-metadata-ignorelist=%t.1 -fexperimental-sanitize-metadata-ignorelist=%t.2 %s -### 2>&1 | FileCheck %s --check-prefix=NOSANMD // NOSANMD: warning: argument unused during compilation: '-fexperimental-sanitize-metadata-ignorelist // NOSANMD-NOT: "-fexperimental-sanitize-metadata-ignorelist diff --git a/clang/test/Driver/fsanitize-object-size.c b/clang/test/Driver/fsanitize-object-size.c index 50c67838df39a..78c7202886416 100644 --- a/clang/test/Driver/fsanitize-object-size.c +++ b/clang/test/Driver/fsanitize-object-size.c @@ -1,27 +1,27 @@ // Check that the object size check is disabled at -O0. // -// RUN: %clang -target x86_64-linux-gnu -fsanitize=object-size %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-OSIZE -// RUN: %clang -target x86_64-linux-gnu -fsanitize=object-size %s -O0 -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-OSIZE -// RUN: %clang -target x86_64-linux-gnu -fsanitize=null,object-size %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-OSIZE -// RUN: %clang -target x86_64-linux-gnu -Werror -fsanitize=null,object-size %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-OSIZE -// RUN: %clang -target x86_64-linux-gnu -fsanitize=undefined %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-OSIZE-NO-WARNING +// RUN: %clang --target=x86_64-linux-gnu -fsanitize=object-size %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-OSIZE +// RUN: %clang --target=x86_64-linux-gnu -fsanitize=object-size %s -O0 -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-OSIZE +// RUN: %clang --target=x86_64-linux-gnu -fsanitize=null,object-size %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-OSIZE +// RUN: %clang --target=x86_64-linux-gnu -Werror -fsanitize=null,object-size %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-OSIZE +// RUN: %clang --target=x86_64-linux-gnu -fsanitize=undefined %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-OSIZE-NO-WARNING // Check that the object size check is enabled at other optimization levels. // -// RUN: %clang -target x86_64-linux-gnu -fsanitize=undefined -O1 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-HAS-OSIZE -// RUN: %clang -target x86_64-linux-gnu -fsanitize=object-size -O2 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-HAS-OSIZE -// RUN: %clang -target x86_64-linux-gnu -fsanitize=object-size -O3 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-HAS-OSIZE -// RUN: %clang -target x86_64-linux-gnu -fsanitize=object-size -O4 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-HAS-OSIZE -// RUN: %clang -target x86_64-linux-gnu -fsanitize=object-size -Ofast %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-HAS-OSIZE -// RUN: %clang -target x86_64-linux-gnu -fsanitize=object-size -Os %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-HAS-OSIZE -// RUN: %clang -target x86_64-linux-gnu -fsanitize=object-size -Oz %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-HAS-OSIZE -// RUN: %clang -target x86_64-linux-gnu -fsanitize=object-size -Og %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-HAS-OSIZE +// RUN: %clang --target=x86_64-linux-gnu -fsanitize=undefined -O1 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-HAS-OSIZE +// RUN: %clang --target=x86_64-linux-gnu -fsanitize=object-size -O2 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-HAS-OSIZE +// RUN: %clang --target=x86_64-linux-gnu -fsanitize=object-size -O3 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-HAS-OSIZE +// RUN: %clang --target=x86_64-linux-gnu -fsanitize=object-size -O4 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-HAS-OSIZE +// RUN: %clang --target=x86_64-linux-gnu -fsanitize=object-size -Ofast %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-HAS-OSIZE +// RUN: %clang --target=x86_64-linux-gnu -fsanitize=object-size -Os %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-HAS-OSIZE +// RUN: %clang --target=x86_64-linux-gnu -fsanitize=object-size -Oz %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-HAS-OSIZE +// RUN: %clang --target=x86_64-linux-gnu -fsanitize=object-size -Og %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-HAS-OSIZE // Use of trap mode shouldn't affect the object size check. // -// RUN: %clang -target x86_64-linux-gnu -fsanitize=undefined -fsanitize-trap=undefined -O1 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-HAS-OSIZE -// RUN: %clang -target x86_64-linux-gnu -fsanitize=undefined-trap -O1 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-HAS-OSIZE -// RUN: %clang -target x86_64-linux-gnu -fsanitize=undefined-trap -fsanitize-undefined-trap-on-error -O1 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-HAS-OSIZE +// RUN: %clang --target=x86_64-linux-gnu -fsanitize=undefined -fsanitize-trap=undefined -O1 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-HAS-OSIZE +// RUN: %clang --target=x86_64-linux-gnu -fsanitize=undefined-trap -O1 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-HAS-OSIZE +// RUN: %clang --target=x86_64-linux-gnu -fsanitize=undefined-trap -fsanitize-undefined-trap-on-error -O1 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-HAS-OSIZE // CHECK-HAS-OSIZE-NOT: warning: the object size sanitizer // CHECK-HAS-OSIZE: -fsanitize={{[^ ]*}}object-size diff --git a/clang/test/Driver/fsemantic-interposition.c b/clang/test/Driver/fsemantic-interposition.c index 0ee0dbb3be347..aaa44878483c5 100644 --- a/clang/test/Driver/fsemantic-interposition.c +++ b/clang/test/Driver/fsemantic-interposition.c @@ -1,20 +1,20 @@ -// RUN: %clang --sysroot=%S/Inputs -target x86_64 %s -Werror -fpic -fsemantic-interposition -c -### 2>&1 | FileCheck %s -// RUN: %clang --sysroot=%S/Inputs -target x86_64 %s -Werror -fPIC -fsemantic-interposition -c -### 2>&1 | FileCheck %s +// RUN: %clang --sysroot=%S/Inputs --target=x86_64 %s -Werror -fpic -fsemantic-interposition -c -### 2>&1 | FileCheck %s +// RUN: %clang --sysroot=%S/Inputs --target=x86_64 %s -Werror -fPIC -fsemantic-interposition -c -### 2>&1 | FileCheck %s // CHECK: "-fsemantic-interposition" /// No-op for -fno-pic/-fpie. -// RUN: %clang --sysroot=%S/Inputs -target x86_64 %s -Werror -fsemantic-interposition -c -### 2>&1 | FileCheck --check-prefix=NOOP %s -// RUN: %clang --sysroot=%S/Inputs -target x86_64 %s -Werror -fPIE -fsemantic-interposition -c -### 2>&1 | FileCheck --check-prefix=NOOP %s +// RUN: %clang --sysroot=%S/Inputs --target=x86_64 %s -Werror -fsemantic-interposition -c -### 2>&1 | FileCheck --check-prefix=NOOP %s +// RUN: %clang --sysroot=%S/Inputs --target=x86_64 %s -Werror -fPIE -fsemantic-interposition -c -### 2>&1 | FileCheck --check-prefix=NOOP %s // NOOP-NOT: "-fsemantic-interposition" // NOOP-NOT: "-fno-semantic-interposition" /// If -fno-semantic-interposition is specified and the target supports local /// aliases, neither CC1 option is set. -// RUN: %clang --sysroot=%S/Inputs -target aarch64 %s -Werror -fPIC -fno-semantic-interposition -c -### 2>&1 | FileCheck --check-prefix=NO %s -// RUN: %clang --sysroot=%S/Inputs -target riscv32 %s -Werror -fPIC -fno-semantic-interposition -c -### 2>&1 | FileCheck --check-prefix=NO %s -// RUN: %clang --sysroot=%S/Inputs -target riscv64 %s -Werror -fPIC -fno-semantic-interposition -c -### 2>&1 | FileCheck --check-prefix=NO %s -// RUN: %clang --sysroot=%S/Inputs -target i386 %s -Werror -fPIC -fno-semantic-interposition -c -### 2>&1 | FileCheck --check-prefix=NO %s -// RUN: %clang --sysroot=%S/Inputs -target x86_64 %s -Werror -fPIC -fno-semantic-interposition -c -### 2>&1 | FileCheck --check-prefix=NO %s +// RUN: %clang --sysroot=%S/Inputs --target=aarch64 %s -Werror -fPIC -fno-semantic-interposition -c -### 2>&1 | FileCheck --check-prefix=NO %s +// RUN: %clang --sysroot=%S/Inputs --target=riscv32 %s -Werror -fPIC -fno-semantic-interposition -c -### 2>&1 | FileCheck --check-prefix=NO %s +// RUN: %clang --sysroot=%S/Inputs --target=riscv64 %s -Werror -fPIC -fno-semantic-interposition -c -### 2>&1 | FileCheck --check-prefix=NO %s +// RUN: %clang --sysroot=%S/Inputs --target=i386 %s -Werror -fPIC -fno-semantic-interposition -c -### 2>&1 | FileCheck --check-prefix=NO %s +// RUN: %clang --sysroot=%S/Inputs --target=x86_64 %s -Werror -fPIC -fno-semantic-interposition -c -### 2>&1 | FileCheck --check-prefix=NO %s // NO-NOT: "-fsemantic-interposition" // NO-NOT: "-fhalf-no-semantic-interposition" @@ -23,8 +23,8 @@ /// local aliases, use the traditional half-baked behavor: interprocedural /// optimizations are allowed but local aliases are not used. If references are /// not optimized out, semantic interposition at runtime is possible. -// RUN: %clang --sysroot=%S/Inputs -target ppc64le %s -Werror -fPIC -fno-semantic-interposition -c -### 2>&1 | FileCheck --check-prefix=HALF %s +// RUN: %clang --sysroot=%S/Inputs --target=ppc64le %s -Werror -fPIC -fno-semantic-interposition -c -### 2>&1 | FileCheck --check-prefix=HALF %s -// RUN: %clang --sysroot=%S/Inputs -target x86_64 %s -Werror -fPIC -c -### 2>&1 | FileCheck --check-prefix=HALF %s +// RUN: %clang --sysroot=%S/Inputs --target=x86_64 %s -Werror -fPIC -c -### 2>&1 | FileCheck --check-prefix=HALF %s // // HALF: "-fhalf-no-semantic-interposition" diff --git a/clang/test/Driver/fsjlj-exceptions.c b/clang/test/Driver/fsjlj-exceptions.c index fd16a51b1f692..122513f6b611a 100644 --- a/clang/test/Driver/fsjlj-exceptions.c +++ b/clang/test/Driver/fsjlj-exceptions.c @@ -1,6 +1,6 @@ // RUN: %clang -target armv7-apple-ios -fexceptions -c %s -o /dev/null -### 2>&1 | FileCheck -check-prefix CHECK-IOS %s -// RUN: %clang -target i686-windows-gnu -fexceptions -c %s -o /dev/null -### 2>&1 | FileCheck -check-prefix CHECK-MINGW-DEFAULT %s -// RUN: %clang -target i686-windows-gnu -fexceptions -fsjlj-exceptions -c %s -o /dev/null -### 2>&1 | FileCheck -check-prefix CHECK-MINGW-SJLJ %s +// RUN: %clang --target=i686-windows-gnu -fexceptions -c %s -o /dev/null -### 2>&1 | FileCheck --check-prefix=CHECK-MINGW-DEFAULT %s +// RUN: %clang --target=i686-windows-gnu -fexceptions -fsjlj-exceptions -c %s -o /dev/null -### 2>&1 | FileCheck --check-prefix=CHECK-MINGW-SJLJ %s // CHECK-IOS: -exception-model=sjlj // CHECK-MINGW-DEFAULT-NOT: -exception-model=sjlj diff --git a/clang/test/Driver/fuse-ld-windows.c b/clang/test/Driver/fuse-ld-windows.c index 089f2961b75dc..8a5af61c6e092 100644 --- a/clang/test/Driver/fuse-ld-windows.c +++ b/clang/test/Driver/fuse-ld-windows.c @@ -1,23 +1,23 @@ // REQUIRES: system-windows // We used to require adding ".exe" suffix when cross-compiling on Windows. -// RUN: %clang %s -### -o %t.o -target i386-unknown-linux \ +// RUN: %clang %s -### -o %t.o --target=i386-unknown-linux \ // RUN: -B %S/Inputs/fuse_ld_windows -fuse-ld=foo 2>&1 \ // RUN: | FileCheck %s // Check that the old variant still works. -// RUN: %clang %s -### -o %t.o -target i386-unknown-linux \ +// RUN: %clang %s -### -o %t.o --target=i386-unknown-linux \ // RUN: -B %S/Inputs/fuse_ld_windows -fuse-ld=foo.exe 2>&1 \ // RUN: | FileCheck %s // With the full path, the extension can be omitted, too, // because Windows allows that. -// RUN: %clang %s -### -o %t.o -target i386-unknown-linux \ +// RUN: %clang %s -### -o %t.o --target=i386-unknown-linux \ // RUN: -fuse-ld=%S/Inputs/fuse_ld_windows/ld.foo 2>&1 \ // RUN: | FileCheck %s // Check that the full path with the extension works too. -// RUN: %clang %s -### -o %t.o -target i386-unknown-linux \ +// RUN: %clang %s -### -o %t.o --target=i386-unknown-linux \ // RUN: -fuse-ld=%S/Inputs/fuse_ld_windows/ld.foo.exe 2>&1 \ // RUN: | FileCheck %s diff --git a/clang/test/Driver/fuse-ld.c b/clang/test/Driver/fuse-ld.c index ef2f8c92a3706..f807434dad107 100644 --- a/clang/test/Driver/fuse-ld.c +++ b/clang/test/Driver/fuse-ld.c @@ -15,88 +15,88 @@ // CHECK-NO-WARN-NOT: warning: // RUN: %clang %s -### \ -// RUN: -target x86_64-unknown-freebsd 2>&1 \ +// RUN: --target=x86_64-unknown-freebsd 2>&1 \ // RUN: | FileCheck %s --check-prefix=CHECK-FREEBSD-LD // CHECK-FREEBSD-LD: ld // RUN: %clang %s -### -fuse-ld=bfd \ // RUN: --sysroot=%S/Inputs/basic_freebsd_tree \ -// RUN: -target x86_64-unknown-freebsd \ +// RUN: --target=x86_64-unknown-freebsd \ // RUN: -B%S/Inputs/basic_freebsd_tree/usr/bin 2>&1 \ // RUN: | FileCheck %s -check-prefix=CHECK-FREEBSD-BFD // CHECK-FREEBSD-BFD: Inputs/basic_freebsd_tree/usr/bin{{/|\\+}}ld.bfd // RUN: %clang %s -### -fuse-ld=gold \ // RUN: --sysroot=%S/Inputs/basic_freebsd_tree \ -// RUN: -target x86_64-unknown-freebsd \ +// RUN: --target=x86_64-unknown-freebsd \ // RUN: -B%S/Inputs/basic_freebsd_tree/usr/bin 2>&1 \ // RUN: | FileCheck %s -check-prefix=CHECK-FREEBSD-GOLD // CHECK-FREEBSD-GOLD: Inputs/basic_freebsd_tree/usr/bin{{/|\\+}}ld.gold // RUN: not %clang %s -### -fuse-ld=plib \ // RUN: --sysroot=%S/Inputs/basic_freebsd_tree \ -// RUN: -target x86_64-unknown-freebsd \ +// RUN: --target=x86_64-unknown-freebsd \ // RUN: -B%S/Inputs/basic_freebsd_tree/usr/bin 2>&1 \ // RUN: | FileCheck %s -check-prefix=CHECK-FREEBSD-PLIB // CHECK-FREEBSD-PLIB: error: invalid linker name // RUN: %clang %s -### -fuse-ld=ld \ -// RUN: -target arm-linux-androideabi \ +// RUN: --target=arm-linux-androideabi \ // RUN: -B%S/Inputs/basic_android_tree/bin/arm-linux-androideabi- 2>&1 \ // RUN: | FileCheck %s --check-prefix=CHECK-ANDROID-ARM-LD // CHECK-ANDROID-ARM-LD: ld.lld // RUN: %clang %s -### -fuse-ld=bfd \ -// RUN: -target arm-linux-androideabi \ +// RUN: --target=arm-linux-androideabi \ // RUN: -B%S/Inputs/basic_android_tree/bin/arm-linux-androideabi- 2>&1 \ // RUN: | FileCheck %s -check-prefix=CHECK-ANDROID-ARM-BFD // CHECK-ANDROID-ARM-BFD: Inputs/basic_android_tree/bin{{/|\\+}}arm-linux-androideabi-ld.bfd // RUN: %clang %s -### -fuse-ld=gold \ -// RUN: -target arm-linux-androideabi \ +// RUN: --target=arm-linux-androideabi \ // RUN: -B%S/Inputs/basic_android_tree/bin/arm-linux-androideabi- 2>&1 \ // RUN: | FileCheck %s -check-prefix=CHECK-ANDROID-ARM-GOLD // CHECK-ANDROID-ARM-GOLD: Inputs/basic_android_tree/bin{{/|\\+}}arm-linux-androideabi-ld.gold // RUN: %clang %s -### -fuse-ld=ld \ -// RUN: -target arm-linux-androideabi \ +// RUN: --target=arm-linux-androideabi \ // RUN: --gcc-toolchain=%S/Inputs/basic_android_tree 2>&1 \ // RUN: | FileCheck %s --check-prefix=CHECK-ANDROID-ARM-LD-TC // CHECK-ANDROID-ARM-LD-TC: ld.lld // RUN: %clang %s -### -fuse-ld=bfd \ -// RUN: -target arm-linux-androideabi \ +// RUN: --target=arm-linux-androideabi \ // RUN: --gcc-toolchain=%S/Inputs/basic_android_tree 2>&1 \ // RUN: | FileCheck %s -check-prefix=CHECK-ANDROID-ARM-BFD-TC // CHECK-ANDROID-ARM-BFD-TC: Inputs/basic_android_tree/lib/gcc/arm-linux-androideabi/4.4.3/../../../../arm-linux-androideabi/bin{{/|\\+}}ld.bfd // RUN: %clang %s -### -fuse-ld=gold \ -// RUN: -target arm-linux-androideabi \ +// RUN: --target=arm-linux-androideabi \ // RUN: --gcc-toolchain=%S/Inputs/basic_android_tree 2>&1 \ // RUN: | FileCheck %s -check-prefix=CHECK-ANDROID-ARM-GOLD-TC // CHECK-ANDROID-ARM-GOLD-TC: Inputs/basic_android_tree/lib/gcc/arm-linux-androideabi/4.4.3/../../../../arm-linux-androideabi/bin{{/|\\+}}ld.gold // RUN: %clang %s -### -fuse-ld=link \ -// RUN: -target i686-unknown-windows-msvc 2>&1 \ +// RUN: --target=i686-unknown-windows-msvc 2>&1 \ // RUN: | FileCheck %s --check-prefix CHECK-WINDOWS-MSVC-LINK // CHECK-WINDOWS-MSVC-LINK: "{{.*}}link.exe" // CHECK-WINDOWS-MSVC-LINK-SAME: "-out:{{.*}}" // RUN: %clang %s -### -fuse-ld=lld \ -// RUN: -target i686-unknown-windows-msvc 2>&1 \ +// RUN: --target=i686-unknown-windows-msvc 2>&1 \ // RUN: | FileCheck %s --check-prefix CHECK-WINDOWS-MSVC-LLD // CHECK-WINDOWS-MSVC-LLD: "{{.*}}lld-link{{\.exe"|"}} // CHECK-WINDOWS-MSVC-LLD-SAME: "-out:{{.*}}" // RUN: %clang %s -### -fuse-ld=lld-link \ -// RUN: -target i686-unknown-windows-msvc 2>&1 \ +// RUN: --target=i686-unknown-windows-msvc 2>&1 \ // RUN: | FileCheck %s --check-prefix CHECK-WINDOWS-MSVC-LLD-LINK // CHECK-WINDOWS-MSVC-LLD-LINK: "{{.*}}lld-link{{\.exe"|"}} // CHECK-WINDOWS-MSVC-LLD-LINK-SAME: "-out:{{.*}}" // RUN: %clang %s -### -fuse-ld=bfd \ -// RUN: -target i686-unknown-windows-msvc \ +// RUN: --target=i686-unknown-windows-msvc \ // RUN: -B %S/Inputs/Windows/usr/bin 2>&1 \ // RUN: | FileCheck %s --check-prefix CHECK-WINDOWS-MSVC-BFD // CHECK-WINDOWS-MSVC-BFD: "{{.*}}ld.bfd" diff --git a/clang/test/Driver/fuzzer.c b/clang/test/Driver/fuzzer.c index 14caf7690057d..409fbfac8ce1d 100644 --- a/clang/test/Driver/fuzzer.c +++ b/clang/test/Driver/fuzzer.c @@ -8,7 +8,7 @@ // CHECK-COVERAGE-SAME: -fsanitize-coverage-pc-table // CHECK-FUZZER-LIB: libclang_rt.fuzzer -// RUN: %clang -fsanitize=fuzzer -target i386-unknown-linux -stdlib=platform %s -### 2>&1 | FileCheck --check-prefixes=CHECK-LIBCXX-LINUX %s +// RUN: %clang -fsanitize=fuzzer --target=i386-unknown-linux -stdlib=platform %s -### 2>&1 | FileCheck --check-prefixes=CHECK-LIBCXX-LINUX %s // // CHECK-LIBCXX-LINUX: -lstdc++ @@ -29,18 +29,18 @@ // Check that we respect whether thes tandard library should be linked // statically. // -// RUN: %clang -fsanitize=fuzzer -target i386-unknown-linux -stdlib=libstdc++ %s -### 2>&1 | FileCheck --check-prefixes=CHECK-LIBSTDCXX-DYNAMIC %s +// RUN: %clang -fsanitize=fuzzer --target=i386-unknown-linux -stdlib=libstdc++ %s -### 2>&1 | FileCheck --check-prefixes=CHECK-LIBSTDCXX-DYNAMIC %s // CHECK-LIBSTDCXX-DYNAMIC-NOT: -Bstatic // CHECK-LIBSTDCXX-DYNAMIC: -lstdc++ // -// RUN: %clang -fsanitize=fuzzer -target i386-unknown-linux -stdlib=libstdc++ -static-libstdc++ %s -### 2>&1 | FileCheck --check-prefixes=CHECK-LIBSTDCXX-STATIC %s +// RUN: %clang -fsanitize=fuzzer --target=i386-unknown-linux -stdlib=libstdc++ -static-libstdc++ %s -### 2>&1 | FileCheck --check-prefixes=CHECK-LIBSTDCXX-STATIC %s // CHECK-LIBSTDCXX-STATIC: "-Bstatic" "-lstdc++" // -// RUN: %clang -fsanitize=fuzzer -target i386-unknown-linux -stdlib=libc++ %s -### 2>&1 | FileCheck --check-prefixes=CHECK-LIBCXX-DYNAMIC %s +// RUN: %clang -fsanitize=fuzzer --target=i386-unknown-linux -stdlib=libc++ %s -### 2>&1 | FileCheck --check-prefixes=CHECK-LIBCXX-DYNAMIC %s // CHECK-LIBCXX-DYNAMIC-NOT: -Bstatic // CHECK-LIBCXX-DYNAMIC: -lc++ // -// RUN: %clang -fsanitize=fuzzer -target i386-unknown-linux -stdlib=libc++ -static-libstdc++ %s -### 2>&1 | FileCheck --check-prefixes=CHECK-LIBCXX-STATIC %s +// RUN: %clang -fsanitize=fuzzer --target=i386-unknown-linux -stdlib=libc++ -static-libstdc++ %s -### 2>&1 | FileCheck --check-prefixes=CHECK-LIBCXX-STATIC %s // CHECK-LIBCXX-STATIC: "-Bstatic" "-lc++" int LLVMFuzzerTestOneInput(const char *Data, long Size) { diff --git a/clang/test/Driver/fveclib.c b/clang/test/Driver/fveclib.c index 8a230284bcdfe..9b0f1ce13aa2b 100644 --- a/clang/test/Driver/fveclib.c +++ b/clang/test/Driver/fveclib.c @@ -1,11 +1,11 @@ -// RUN: %clang -### -c -fveclib=none %s 2>&1 | FileCheck -check-prefix CHECK-NOLIB %s -// RUN: %clang -### -c -fveclib=Accelerate %s 2>&1 | FileCheck -check-prefix CHECK-ACCELERATE %s -// RUN: %clang -### -c -fveclib=libmvec %s 2>&1 | FileCheck -check-prefix CHECK-libmvec %s -// RUN: %clang -### -c -fveclib=MASSV %s 2>&1 | FileCheck -check-prefix CHECK-MASSV %s -// RUN: %clang -### -c -fveclib=Darwin_libsystem_m %s 2>&1 | FileCheck -check-prefix CHECK-DARWIN_LIBSYSTEM_M %s -// RUN: %clang -### -c --target=aarch64-none-none -fveclib=SLEEF %s 2>&1 | FileCheck -check-prefix CHECK-SLEEF %s -// RUN: %clang -### -c --target=aarch64-none-none -fveclib=ArmPL %s 2>&1 | FileCheck -check-prefix CHECK-ARMPL %s -// RUN: not %clang -c -fveclib=something %s 2>&1 | FileCheck -check-prefix CHECK-INVALID %s +// RUN: %clang -### -c -fveclib=none %s 2>&1 | FileCheck --check-prefix=CHECK-NOLIB %s +// RUN: %clang -### -c -fveclib=Accelerate %s 2>&1 | FileCheck --check-prefix=CHECK-ACCELERATE %s +// RUN: %clang -### -c -fveclib=libmvec %s 2>&1 | FileCheck --check-prefix=CHECK-libmvec %s +// RUN: %clang -### -c -fveclib=MASSV %s 2>&1 | FileCheck --check-prefix=CHECK-MASSV %s +// RUN: %clang -### -c -fveclib=Darwin_libsystem_m %s 2>&1 | FileCheck --check-prefix=CHECK-DARWIN_LIBSYSTEM_M %s +// RUN: %clang -### -c --target=aarch64 -fveclib=SLEEF %s 2>&1 | FileCheck --check-prefix=CHECK-SLEEF %s +// RUN: %clang -### -c --target=aarch64 -fveclib=ArmPL %s 2>&1 | FileCheck --check-prefix=CHECK-ARMPL %s +// RUN: not %clang -c -fveclib=something %s 2>&1 | FileCheck --check-prefix=CHECK-INVALID %s // CHECK-NOLIB: "-fveclib=none" // CHECK-ACCELERATE: "-fveclib=Accelerate" @@ -17,10 +17,10 @@ // CHECK-INVALID: error: invalid value 'something' in '-fveclib=something' -// RUN: not %clang --target=x86-none-none -c -fveclib=SLEEF %s 2>&1 | FileCheck -check-prefix CHECK-ERROR %s -// RUN: not %clang --target=x86-none-none -c -fveclib=ArmPL %s 2>&1 | FileCheck -check-prefix CHECK-ERROR %s -// RUN: not %clang --target=aarch64-none-none -c -fveclib=LIBMVEC-X86 %s 2>&1 | FileCheck -check-prefix CHECK-ERROR %s -// RUN: not %clang --target=aarch64-none-none -c -fveclib=SVML %s 2>&1 | FileCheck -check-prefix CHECK-ERROR %s +// RUN: not %clang --target=x86 -c -fveclib=SLEEF %s 2>&1 | FileCheck --check-prefix=CHECK-ERROR %s +// RUN: not %clang --target=x86 -c -fveclib=ArmPL %s 2>&1 | FileCheck --check-prefix=CHECK-ERROR %s +// RUN: not %clang --target=aarch64 -c -fveclib=LIBMVEC-X86 %s 2>&1 | FileCheck --check-prefix=CHECK-ERROR %s +// RUN: not %clang --target=aarch64 -c -fveclib=SVML %s 2>&1 | FileCheck --check-prefix=CHECK-ERROR %s // CHECK-ERROR: unsupported option {{.*}} for target // RUN: %clang -fveclib=Accelerate %s -target arm64-apple-ios8.0.0 -### 2>&1 | FileCheck --check-prefix=CHECK-LINK %s @@ -35,17 +35,17 @@ /* Verify that the correct vector library is passed to LTO flags. */ -// RUN: %clang -### --target=x86_64-unknown-linux-gnu -fveclib=LIBMVEC -flto %s 2>&1 | FileCheck -check-prefix CHECK-LTO-LIBMVEC %s +// RUN: %clang -### --target=x86_64-unknown-linux-gnu -fveclib=LIBMVEC -flto %s 2>&1 | FileCheck --check-prefix=CHECK-LTO-LIBMVEC %s // CHECK-LTO-LIBMVEC: "-plugin-opt=-vector-library=LIBMVEC-X86" -// RUN: %clang -### --target=powerpc64-unknown-linux-gnu -fveclib=MASSV -flto %s 2>&1 | FileCheck -check-prefix CHECK-LTO-MASSV %s +// RUN: %clang -### --target=powerpc64-unknown-linux-gnu -fveclib=MASSV -flto %s 2>&1 | FileCheck --check-prefix=CHECK-LTO-MASSV %s // CHECK-LTO-MASSV: "-plugin-opt=-vector-library=MASSV" -// RUN: %clang -### --target=x86_64-unknown-linux-gnu -fveclib=SVML -flto %s 2>&1 | FileCheck -check-prefix CHECK-LTO-SVML %s +// RUN: %clang -### --target=x86_64-unknown-linux-gnu -fveclib=SVML -flto %s 2>&1 | FileCheck --check-prefix=CHECK-LTO-SVML %s // CHECK-LTO-SVML: "-plugin-opt=-vector-library=SVML" -// RUN: %clang -### --target=aarch64-linux-gnu -fveclib=SLEEF -flto %s 2>&1 | FileCheck -check-prefix CHECK-LTO-SLEEF %s +// RUN: %clang -### --target=aarch64-linux-gnu -fveclib=SLEEF -flto %s 2>&1 | FileCheck --check-prefix=CHECK-LTO-SLEEF %s // CHECK-LTO-SLEEF: "-plugin-opt=-vector-library=sleefgnuabi" -// RUN: %clang -### --target=aarch64-linux-gnu -fveclib=ArmPL -flto %s 2>&1 | FileCheck -check-prefix CHECK-LTO-ARMPL %s +// RUN: %clang -### --target=aarch64-linux-gnu -fveclib=ArmPL -flto %s 2>&1 | FileCheck --check-prefix=CHECK-LTO-ARMPL %s // CHECK-LTO-ARMPL: "-plugin-opt=-vector-library=ArmPL" diff --git a/clang/test/Driver/loongarch-mlasx-error.c b/clang/test/Driver/loongarch-mlasx-error.c index e66f277f7c292..1d88f0f1a7c63 100644 --- a/clang/test/Driver/loongarch-mlasx-error.c +++ b/clang/test/Driver/loongarch-mlasx-error.c @@ -11,5 +11,5 @@ // RUN: not %clang --target=loongarch64 %s -fsyntax-only -mlasx -mno-lsx 2>&1 \ // RUN: FileCheck --check-prefix=ERROR_LASX_FPU128 %s -// ERROR_LASX_FPU64: error: wrong fpu width; LASX depends on 64-bit FPU. -// ERROR_LASX_FPU128: error: invalid option combination; LASX depends on LSX. +// ERROR_LASX_FPU64: error: wrong fpu width; LASX depends on 64-bit FPU +// ERROR_LASX_FPU128: error: invalid option combination; LASX depends on LSX diff --git a/clang/test/Driver/loongarch-mlsx-error.c b/clang/test/Driver/loongarch-mlsx-error.c index bd6b8e2718bf6..db1f6fb2e5a0e 100644 --- a/clang/test/Driver/loongarch-mlsx-error.c +++ b/clang/test/Driver/loongarch-mlsx-error.c @@ -9,4 +9,4 @@ // RUN: not %clang --target=loongarch64 %s -fsyntax-only -mlsx -mfpu=none 2>&1 \ // RUN: FileCheck --check-prefix=ERROR_LSX_FPU64 %s -// ERROR_LSX_FPU64: error: wrong fpu width; LSX depends on 64-bit FPU. +// ERROR_LSX_FPU64: error: wrong fpu width; LSX depends on 64-bit FPU diff --git a/clang/test/Driver/m68k-features.cpp b/clang/test/Driver/m68k-features.cpp index a5222a72a57ff..67cdc0fe1b4fd 100644 --- a/clang/test/Driver/m68k-features.cpp +++ b/clang/test/Driver/m68k-features.cpp @@ -1,79 +1,79 @@ // REQUIRES: m68k-registered-target -// RUN: %clang -target m68k -ffixed-a0 -### %s 2> %t +// RUN: %clang --target=m68k -ffixed-a0 -### %s 2> %t // RUN: FileCheck --check-prefix=CHECK-FIXED-A0 < %t %s // CHECK-FIXED-A0: "-target-feature" "+reserve-a0" -// RUN: %clang -target m68k -ffixed-a1 -### %s 2> %t +// RUN: %clang --target=m68k -ffixed-a1 -### %s 2> %t // RUN: FileCheck --check-prefix=CHECK-FIXED-A1 < %t %s // CHECK-FIXED-A1: "-target-feature" "+reserve-a1" -// RUN: %clang -target m68k -ffixed-a2 -### %s 2> %t +// RUN: %clang --target=m68k -ffixed-a2 -### %s 2> %t // RUN: FileCheck --check-prefix=CHECK-FIXED-A2 < %t %s // CHECK-FIXED-A2: "-target-feature" "+reserve-a2" -// RUN: %clang -target m68k -ffixed-a3 -### %s 2> %t +// RUN: %clang --target=m68k -ffixed-a3 -### %s 2> %t // RUN: FileCheck --check-prefix=CHECK-FIXED-A3 < %t %s // CHECK-FIXED-A3: "-target-feature" "+reserve-a3" -// RUN: %clang -target m68k -ffixed-a4 -### %s 2> %t +// RUN: %clang --target=m68k -ffixed-a4 -### %s 2> %t // RUN: FileCheck --check-prefix=CHECK-FIXED-A4 < %t %s // CHECK-FIXED-A4: "-target-feature" "+reserve-a4" -// RUN: %clang -target m68k -ffixed-a5 -### %s 2> %t +// RUN: %clang --target=m68k -ffixed-a5 -### %s 2> %t // RUN: FileCheck --check-prefix=CHECK-FIXED-A5 < %t %s // CHECK-FIXED-A5: "-target-feature" "+reserve-a5" -// RUN: %clang -target m68k -ffixed-a6 -### %s 2> %t +// RUN: %clang --target=m68k -ffixed-a6 -### %s 2> %t // RUN: FileCheck --check-prefix=CHECK-FIXED-A6 < %t %s // CHECK-FIXED-A6: "-target-feature" "+reserve-a6" -// RUN: %clang -target m68k -ffixed-d0 -### %s 2> %t +// RUN: %clang --target=m68k -ffixed-d0 -### %s 2> %t // RUN: FileCheck --check-prefix=CHECK-FIXED-D0 < %t %s // CHECK-FIXED-D0: "-target-feature" "+reserve-d0" -// RUN: %clang -target m68k -ffixed-d1 -### %s 2> %t +// RUN: %clang --target=m68k -ffixed-d1 -### %s 2> %t // RUN: FileCheck --check-prefix=CHECK-FIXED-D1 < %t %s // CHECK-FIXED-D1: "-target-feature" "+reserve-d1" -// RUN: %clang -target m68k -ffixed-d2 -### %s 2> %t +// RUN: %clang --target=m68k -ffixed-d2 -### %s 2> %t // RUN: FileCheck --check-prefix=CHECK-FIXED-D2 < %t %s // CHECK-FIXED-D2: "-target-feature" "+reserve-d2" -// RUN: %clang -target m68k -ffixed-d3 -### %s 2> %t +// RUN: %clang --target=m68k -ffixed-d3 -### %s 2> %t // RUN: FileCheck --check-prefix=CHECK-FIXED-D3 < %t %s // CHECK-FIXED-D3: "-target-feature" "+reserve-d3" -// RUN: %clang -target m68k -ffixed-d4 -### %s 2> %t +// RUN: %clang --target=m68k -ffixed-d4 -### %s 2> %t // RUN: FileCheck --check-prefix=CHECK-FIXED-D4 < %t %s // CHECK-FIXED-D4: "-target-feature" "+reserve-d4" -// RUN: %clang -target m68k -ffixed-d5 -### %s 2> %t +// RUN: %clang --target=m68k -ffixed-d5 -### %s 2> %t // RUN: FileCheck --check-prefix=CHECK-FIXED-D5 < %t %s // CHECK-FIXED-D5: "-target-feature" "+reserve-d5" -// RUN: %clang -target m68k -ffixed-d6 -### %s 2> %t +// RUN: %clang --target=m68k -ffixed-d6 -### %s 2> %t // RUN: FileCheck --check-prefix=CHECK-FIXED-D6 < %t %s // CHECK-FIXED-D6: "-target-feature" "+reserve-d6" -// RUN: %clang -target m68k -ffixed-d7 -### %s 2> %t +// RUN: %clang --target=m68k -ffixed-d7 -### %s 2> %t // RUN: FileCheck --check-prefix=CHECK-FIXED-D7 < %t %s // CHECK-FIXED-D7: "-target-feature" "+reserve-d7" // ==== Floating point ==== -// RUN: %clang -target m68k -m68000 -mhard-float -### %s 2> %t +// RUN: %clang --target=m68k -m68000 -mhard-float -### %s 2> %t // RUN: FileCheck --check-prefix=CHECK-MX881 < %t %s -// RUN: %clang -target m68k -m68000 -m68881 -### %s 2> %t +// RUN: %clang --target=m68k -m68000 -m68881 -### %s 2> %t // RUN: FileCheck --check-prefix=CHECK-MX881 < %t %s -// RUN: %clang -target m68k -m68010 -mhard-float -### %s 2> %t +// RUN: %clang --target=m68k -m68010 -mhard-float -### %s 2> %t // RUN: FileCheck --check-prefix=CHECK-MX881 < %t %s -// RUN: %clang -target m68k -m68010 -m68881 -### %s 2> %t +// RUN: %clang --target=m68k -m68010 -m68881 -### %s 2> %t // RUN: FileCheck --check-prefix=CHECK-MX881 < %t %s -// RUN: %clang -target m68k -m68020 -### %s 2> %t +// RUN: %clang --target=m68k -m68020 -### %s 2> %t // RUN: FileCheck --check-prefix=CHECK-MX881 < %t %s -// RUN: %clang -target m68k -m68030 -### %s 2> %t +// RUN: %clang --target=m68k -m68030 -### %s 2> %t // RUN: FileCheck --check-prefix=CHECK-MX882 < %t %s // CHECK-MX881: "-target-feature" "+isa-68881" diff --git a/clang/test/Driver/m68k-macros.cpp b/clang/test/Driver/m68k-macros.cpp index c61248ee0232a..ae5b3e0ddd378 100644 --- a/clang/test/Driver/m68k-macros.cpp +++ b/clang/test/Driver/m68k-macros.cpp @@ -4,18 +4,18 @@ // CHECK-MX881: #define __HAVE_68881__ 1 // CHECK-NOMX881-NOT: #define __HAVE_68881__ 1 -// RUN: %clang -target m68k-unknown-linux -m68000 -std=c++11 -dM -E %s | FileCheck --check-prefixes=CHECK-MX,CHECK-NOMX881 %s -// RUN: %clang -target m68k-unknown-linux -m68000 -std=gnu++11 -dM -E %s | FileCheck --check-prefixes=CHECK-MX,CHECK-MX-GNU,CHECK-NOMX881 %s -// RUN: %clang -target m68k-unknown-linux -m68000 -mhard-float -dM -E %s | FileCheck --check-prefix=CHECK-MX881 %s -// RUN: %clang -target m68k-unknown-linux -m68000 -m68881 -dM -E %s | FileCheck --check-prefix=CHECK-MX881 %s +// RUN: %clang --target=m68k-unknown-linux -m68000 -std=c++11 -dM -E %s | FileCheck --check-prefixes=CHECK-MX,CHECK-NOMX881 %s +// RUN: %clang --target=m68k-unknown-linux -m68000 -std=gnu++11 -dM -E %s | FileCheck --check-prefixes=CHECK-MX,CHECK-MX-GNU,CHECK-NOMX881 %s +// RUN: %clang --target=m68k-unknown-linux -m68000 -mhard-float -dM -E %s | FileCheck --check-prefix=CHECK-MX881 %s +// RUN: %clang --target=m68k-unknown-linux -m68000 -m68881 -dM -E %s | FileCheck --check-prefix=CHECK-MX881 %s // CHECK-MX: #define __mc68000 1 // CHECK-MX: #define __mc68000__ 1 // CHECK-MX-GNU: #define mc68000 1 -// RUN: %clang -target m68k-unknown-linux -m68010 -std=c++11 -dM -E %s | FileCheck --check-prefixes=CHECK-MX10,CHECK-NOMX881 %s -// RUN: %clang -target m68k-unknown-linux -m68010 -std=gnu++11 -dM -E %s | FileCheck --check-prefixes=CHECK-MX10,CHECK-MX10-GNU,CHECK-NOMX881 %s -// RUN: %clang -target m68k-unknown-linux -m68010 -mhard-float -dM -E %s | FileCheck --check-prefix=CHECK-MX881 %s -// RUN: %clang -target m68k-unknown-linux -m68010 -m68881 -dM -E %s | FileCheck --check-prefix=CHECK-MX881 %s +// RUN: %clang --target=m68k-unknown-linux -m68010 -std=c++11 -dM -E %s | FileCheck --check-prefixes=CHECK-MX10,CHECK-NOMX881 %s +// RUN: %clang --target=m68k-unknown-linux -m68010 -std=gnu++11 -dM -E %s | FileCheck --check-prefixes=CHECK-MX10,CHECK-MX10-GNU,CHECK-NOMX881 %s +// RUN: %clang --target=m68k-unknown-linux -m68010 -mhard-float -dM -E %s | FileCheck --check-prefix=CHECK-MX881 %s +// RUN: %clang --target=m68k-unknown-linux -m68010 -m68881 -dM -E %s | FileCheck --check-prefix=CHECK-MX881 %s // CHECK-MX10: #define __mc68000 1 // CHECK-MX10: #define __mc68000__ 1 // CHECK-MX10: #define __mc68010 1 @@ -23,9 +23,9 @@ // CHECK-MX10-GNU: #define mc68000 1 // CHECK-MX10-GNU: #define mc68010 1 -// RUN: %clang -target m68k-unknown-linux -m68020 -std=c++11 -dM -E %s | FileCheck --check-prefixes=CHECK-MX20,CHECK-MX881 %s -// RUN: %clang -target m68k-unknown-linux -m68020 -std=gnu++11 -dM -E %s | FileCheck --check-prefixes=CHECK-MX20,CHECK-MX20-GNU,CHECK-MX881 %s -// RUN: %clang -target m68k-unknown-linux -m68020 -msoft-float -dM -E %s | FileCheck --check-prefix=CHECK-NOMX881 %s +// RUN: %clang --target=m68k-unknown-linux -m68020 -std=c++11 -dM -E %s | FileCheck --check-prefixes=CHECK-MX20,CHECK-MX881 %s +// RUN: %clang --target=m68k-unknown-linux -m68020 -std=gnu++11 -dM -E %s | FileCheck --check-prefixes=CHECK-MX20,CHECK-MX20-GNU,CHECK-MX881 %s +// RUN: %clang --target=m68k-unknown-linux -m68020 -msoft-float -dM -E %s | FileCheck --check-prefix=CHECK-NOMX881 %s // CHECK-MX20: #define __mc68000 1 // CHECK-MX20: #define __mc68000__ 1 // CHECK-MX20: #define __mc68020 1 @@ -33,9 +33,9 @@ // CHECK-MX20-GNU: #define mc68000 1 // CHECK-MX20-GNU: #define mc68020 1 -// RUN: %clang -target m68k-unknown-linux -m68030 -std=c++11 -dM -E %s | FileCheck --check-prefixes=CHECK-MX30,CHECK-MX881 %s -// RUN: %clang -target m68k-unknown-linux -m68030 -std=gnu++11 -dM -E %s | FileCheck --check-prefixes=CHECK-MX30,CHECK-MX30-GNU,CHECK-MX881 %s -// RUN: %clang -target m68k-unknown-linux -m68030 -msoft-float -dM -E %s | FileCheck --check-prefix=CHECK-NOMX881 %s +// RUN: %clang --target=m68k-unknown-linux -m68030 -std=c++11 -dM -E %s | FileCheck --check-prefixes=CHECK-MX30,CHECK-MX881 %s +// RUN: %clang --target=m68k-unknown-linux -m68030 -std=gnu++11 -dM -E %s | FileCheck --check-prefixes=CHECK-MX30,CHECK-MX30-GNU,CHECK-MX881 %s +// RUN: %clang --target=m68k-unknown-linux -m68030 -msoft-float -dM -E %s | FileCheck --check-prefix=CHECK-NOMX881 %s // CHECK-MX30: #define __mc68000 1 // CHECK-MX30: #define __mc68000__ 1 // CHECK-MX30: #define __mc68030 1 @@ -43,9 +43,9 @@ // CHECK-MX30-GNU: #define mc68000 1 // CHECK-MX30-GNU: #define mc68030 1 -// RUN: %clang -target m68k-unknown-linux -m68040 -std=c++11 -dM -E %s | FileCheck --check-prefixes=CHECK-MX40,CHECK-MX881 %s -// RUN: %clang -target m68k-unknown-linux -m68040 -std=gnu++11 -dM -E %s | FileCheck --check-prefixes=CHECK-MX40,CHECK-MX40-GNU,CHECK-MX881 %s -// RUN: %clang -target m68k-unknown-linux -m68040 -msoft-float -dM -E %s | FileCheck --check-prefix=CHECK-NOMX881 %s +// RUN: %clang --target=m68k-unknown-linux -m68040 -std=c++11 -dM -E %s | FileCheck --check-prefixes=CHECK-MX40,CHECK-MX881 %s +// RUN: %clang --target=m68k-unknown-linux -m68040 -std=gnu++11 -dM -E %s | FileCheck --check-prefixes=CHECK-MX40,CHECK-MX40-GNU,CHECK-MX881 %s +// RUN: %clang --target=m68k-unknown-linux -m68040 -msoft-float -dM -E %s | FileCheck --check-prefix=CHECK-NOMX881 %s // CHECK-MX40: #define __mc68000 1 // CHECK-MX40: #define __mc68000__ 1 // CHECK-MX40: #define __mc68040 1 @@ -53,9 +53,9 @@ // CHECK-MX40-GNU: #define mc68000 1 // CHECK-MX40-GNU: #define mc68040 1 -// RUN: %clang -target m68k-unknown-linux -m68060 -std=c++11 -dM -E %s | FileCheck --check-prefixes=CHECK-MX60,CHECK-MX881 %s -// RUN: %clang -target m68k-unknown-linux -m68060 -std=gnu++11 -dM -E %s | FileCheck --check-prefixes=CHECK-MX60,CHECK-MX60-GNU,CHECK-MX881 %s -// RUN: %clang -target m68k-unknown-linux -m68060 -msoft-float -dM -E %s | FileCheck --check-prefix=CHECK-NOMX881 %s +// RUN: %clang --target=m68k-unknown-linux -m68060 -std=c++11 -dM -E %s | FileCheck --check-prefixes=CHECK-MX60,CHECK-MX881 %s +// RUN: %clang --target=m68k-unknown-linux -m68060 -std=gnu++11 -dM -E %s | FileCheck --check-prefixes=CHECK-MX60,CHECK-MX60-GNU,CHECK-MX881 %s +// RUN: %clang --target=m68k-unknown-linux -m68060 -msoft-float -dM -E %s | FileCheck --check-prefix=CHECK-NOMX881 %s // CHECK-MX60: #define __mc68000 1 // CHECK-MX60: #define __mc68000__ 1 // CHECK-MX60: #define __mc68060 1 diff --git a/clang/test/Driver/m68k-sub-archs.cpp b/clang/test/Driver/m68k-sub-archs.cpp index e5517d237cdd5..e21ed404ca009 100644 --- a/clang/test/Driver/m68k-sub-archs.cpp +++ b/clang/test/Driver/m68k-sub-archs.cpp @@ -1,35 +1,35 @@ -// RUN: %clang -### -target m68k-unknown-linux -mcpu=68000 %s 2>&1 | FileCheck --check-prefix=CHECK-M00 %s -// RUN: %clang -### -target m68k-unknown-linux -mcpu=m68000 %s 2>&1 | FileCheck --check-prefix=CHECK-M00 %s -// RUN: %clang -### -target m68k-unknown-linux -mcpu=M68000 %s 2>&1 | FileCheck --check-prefix=CHECK-M00 %s -// RUN: %clang -### -target m68k-unknown-linux -m68000 %s 2>&1 | FileCheck --check-prefix=CHECK-M00 %s +// RUN: %clang -### --target=m68k-unknown-linux -mcpu=68000 %s 2>&1 | FileCheck --check-prefix=CHECK-M00 %s +// RUN: %clang -### --target=m68k-unknown-linux -mcpu=m68000 %s 2>&1 | FileCheck --check-prefix=CHECK-M00 %s +// RUN: %clang -### --target=m68k-unknown-linux -mcpu=M68000 %s 2>&1 | FileCheck --check-prefix=CHECK-M00 %s +// RUN: %clang -### --target=m68k-unknown-linux -m68000 %s 2>&1 | FileCheck --check-prefix=CHECK-M00 %s // CHECK-M00: "-target-cpu" "M68000" -// RUN: %clang -### -target m68k-unknown-linux -mcpu=68010 %s 2>&1 | FileCheck --check-prefix=CHECK-M10 %s -// RUN: %clang -### -target m68k-unknown-linux -mcpu=m68010 %s 2>&1 | FileCheck --check-prefix=CHECK-M10 %s -// RUN: %clang -### -target m68k-unknown-linux -mcpu=M68010 %s 2>&1 | FileCheck --check-prefix=CHECK-M10 %s -// RUN: %clang -### -target m68k-unknown-linux -m68010 %s 2>&1 | FileCheck --check-prefix=CHECK-M10 %s +// RUN: %clang -### --target=m68k-unknown-linux -mcpu=68010 %s 2>&1 | FileCheck --check-prefix=CHECK-M10 %s +// RUN: %clang -### --target=m68k-unknown-linux -mcpu=m68010 %s 2>&1 | FileCheck --check-prefix=CHECK-M10 %s +// RUN: %clang -### --target=m68k-unknown-linux -mcpu=M68010 %s 2>&1 | FileCheck --check-prefix=CHECK-M10 %s +// RUN: %clang -### --target=m68k-unknown-linux -m68010 %s 2>&1 | FileCheck --check-prefix=CHECK-M10 %s // CHECK-M10: "-target-cpu" "M68010" -// RUN: %clang -### -target m68k-unknown-linux -mcpu=68020 %s 2>&1 | FileCheck --check-prefix=CHECK-M20 %s -// RUN: %clang -### -target m68k-unknown-linux -mcpu=m68020 %s 2>&1 | FileCheck --check-prefix=CHECK-M20 %s -// RUN: %clang -### -target m68k-unknown-linux -mcpu=M68020 %s 2>&1 | FileCheck --check-prefix=CHECK-M20 %s -// RUN: %clang -### -target m68k-unknown-linux -m68020 %s 2>&1 | FileCheck --check-prefix=CHECK-M20 %s +// RUN: %clang -### --target=m68k-unknown-linux -mcpu=68020 %s 2>&1 | FileCheck --check-prefix=CHECK-M20 %s +// RUN: %clang -### --target=m68k-unknown-linux -mcpu=m68020 %s 2>&1 | FileCheck --check-prefix=CHECK-M20 %s +// RUN: %clang -### --target=m68k-unknown-linux -mcpu=M68020 %s 2>&1 | FileCheck --check-prefix=CHECK-M20 %s +// RUN: %clang -### --target=m68k-unknown-linux -m68020 %s 2>&1 | FileCheck --check-prefix=CHECK-M20 %s // CHECK-M20: "-target-cpu" "M68020" -// RUN: %clang -### -target m68k-unknown-linux -mcpu=68030 %s 2>&1 | FileCheck --check-prefix=CHECK-M30 %s -// RUN: %clang -### -target m68k-unknown-linux -mcpu=m68030 %s 2>&1 | FileCheck --check-prefix=CHECK-M30 %s -// RUN: %clang -### -target m68k-unknown-linux -mcpu=M68030 %s 2>&1 | FileCheck --check-prefix=CHECK-M30 %s -// RUN: %clang -### -target m68k-unknown-linux -m68030 %s 2>&1 | FileCheck --check-prefix=CHECK-M30 %s +// RUN: %clang -### --target=m68k-unknown-linux -mcpu=68030 %s 2>&1 | FileCheck --check-prefix=CHECK-M30 %s +// RUN: %clang -### --target=m68k-unknown-linux -mcpu=m68030 %s 2>&1 | FileCheck --check-prefix=CHECK-M30 %s +// RUN: %clang -### --target=m68k-unknown-linux -mcpu=M68030 %s 2>&1 | FileCheck --check-prefix=CHECK-M30 %s +// RUN: %clang -### --target=m68k-unknown-linux -m68030 %s 2>&1 | FileCheck --check-prefix=CHECK-M30 %s // CHECK-M30: "-target-cpu" "M68030" -// RUN: %clang -### -target m68k-unknown-linux -mcpu=68040 %s 2>&1 | FileCheck --check-prefix=CHECK-M40 %s -// RUN: %clang -### -target m68k-unknown-linux -mcpu=m68040 %s 2>&1 | FileCheck --check-prefix=CHECK-M40 %s -// RUN: %clang -### -target m68k-unknown-linux -mcpu=M68040 %s 2>&1 | FileCheck --check-prefix=CHECK-M40 %s -// RUN: %clang -### -target m68k-unknown-linux -m68040 %s 2>&1 | FileCheck --check-prefix=CHECK-M40 %s +// RUN: %clang -### --target=m68k-unknown-linux -mcpu=68040 %s 2>&1 | FileCheck --check-prefix=CHECK-M40 %s +// RUN: %clang -### --target=m68k-unknown-linux -mcpu=m68040 %s 2>&1 | FileCheck --check-prefix=CHECK-M40 %s +// RUN: %clang -### --target=m68k-unknown-linux -mcpu=M68040 %s 2>&1 | FileCheck --check-prefix=CHECK-M40 %s +// RUN: %clang -### --target=m68k-unknown-linux -m68040 %s 2>&1 | FileCheck --check-prefix=CHECK-M40 %s // CHECK-M40: "-target-cpu" "M68040" -// RUN: %clang -### -target m68k-unknown-linux -mcpu=68060 %s 2>&1 | FileCheck --check-prefix=CHECK-M60 %s -// RUN: %clang -### -target m68k-unknown-linux -mcpu=m68060 %s 2>&1 | FileCheck --check-prefix=CHECK-M60 %s -// RUN: %clang -### -target m68k-unknown-linux -mcpu=M68060 %s 2>&1 | FileCheck --check-prefix=CHECK-M60 %s -// RUN: %clang -### -target m68k-unknown-linux -m68060 %s 2>&1 | FileCheck --check-prefix=CHECK-M60 %s +// RUN: %clang -### --target=m68k-unknown-linux -mcpu=68060 %s 2>&1 | FileCheck --check-prefix=CHECK-M60 %s +// RUN: %clang -### --target=m68k-unknown-linux -mcpu=m68060 %s 2>&1 | FileCheck --check-prefix=CHECK-M60 %s +// RUN: %clang -### --target=m68k-unknown-linux -mcpu=M68060 %s 2>&1 | FileCheck --check-prefix=CHECK-M60 %s +// RUN: %clang -### --target=m68k-unknown-linux -m68060 %s 2>&1 | FileCheck --check-prefix=CHECK-M60 %s // CHECK-M60: "-target-cpu" "M68060" diff --git a/clang/test/Driver/masm.c b/clang/test/Driver/masm.c index 90ecaa2fe7967..92cacc4cc95e1 100644 --- a/clang/test/Driver/masm.c +++ b/clang/test/Driver/masm.c @@ -1,7 +1,7 @@ -// RUN: %clang -target i386-unknown-linux -masm=intel -S %s -### 2>&1 | FileCheck --check-prefix=CHECK-INTEL %s -// RUN: %clang -target i386-unknown-linux -masm=att -S %s -### 2>&1 | FileCheck --check-prefix=CHECK-ATT %s +// RUN: %clang --target=i386-unknown-linux -masm=intel -S %s -### 2>&1 | FileCheck --check-prefix=CHECK-INTEL %s +// RUN: %clang --target=i386-unknown-linux -masm=att -S %s -### 2>&1 | FileCheck --check-prefix=CHECK-ATT %s // RUN: not %clang --target=i386-unknown-linux -S -masm=somerequired %s -### 2>&1 | FileCheck --check-prefix=CHECK-SOMEREQUIRED %s -// RUN: %clang -target arm-unknown-eabi -S -masm=intel %s -### 2>&1 | FileCheck --check-prefix=CHECK-ARM %s +// RUN: %clang --target=arm-unknown-eabi -S -masm=intel %s -### 2>&1 | FileCheck --check-prefix=CHECK-ARM %s // RUN: %clang_cl --target=x86_64 /FA -### -- %s 2>&1 | FileCheck --check-prefix=CHECK-CL %s int f() { diff --git a/clang/test/Driver/masm.s b/clang/test/Driver/masm.s index d08c63ac24ca4..c1c34747bcf6a 100644 --- a/clang/test/Driver/masm.s +++ b/clang/test/Driver/masm.s @@ -1,7 +1,7 @@ -// RUN: %clang -target i386-unknown-linux -masm=intel -c %s -### 2>&1 | FileCheck --check-prefix=CHECK-INTEL %s -// RUN: %clang -target i386-unknown-linux -masm=att -c %s -### 2>&1 | FileCheck --check-prefix=CHECK-ATT %s +// RUN: %clang --target=i386-unknown-linux -masm=intel -c %s -### 2>&1 | FileCheck --check-prefix=CHECK-INTEL %s +// RUN: %clang --target=i386-unknown-linux -masm=att -c %s -### 2>&1 | FileCheck --check-prefix=CHECK-ATT %s // RUN: not %clang --target=i386-unknown-linux -c -masm=somerequired %s -### 2>&1 | FileCheck --check-prefix=CHECK-SOMEREQUIRED %s -// RUN: %clang -target arm-unknown-eabi -c -masm=intel %s -### 2>&1 | FileCheck --check-prefix=CHECK-ARM %s +// RUN: %clang --target=arm-unknown-eabi -c -masm=intel %s -### 2>&1 | FileCheck --check-prefix=CHECK-ARM %s // CHECK-INTEL: -x86-asm-syntax=intel // CHECK-ATT: -x86-asm-syntax=att diff --git a/clang/test/Driver/mbackchain.c b/clang/test/Driver/mbackchain.c index 7aa020741c977..bab555685620a 100644 --- a/clang/test/Driver/mbackchain.c +++ b/clang/test/Driver/mbackchain.c @@ -1,5 +1,5 @@ // RUN: not %clang --target=s390x -c -### %s -mpacked-stack -mbackchain 2>&1 | FileCheck %s -// RUN: %clang -target s390x -c -### %s -mpacked-stack -mbackchain -msoft-float \ +// RUN: %clang --target=s390x -c -### %s -mpacked-stack -mbackchain -msoft-float \ // RUN: 2>&1 | FileCheck %s --check-prefix=KERNEL-BUILD // REQUIRES: systemz-registered-target diff --git a/clang/test/Driver/mcount.c b/clang/test/Driver/mcount.c index b9139ab8cb132..70f554745b9c3 100644 --- a/clang/test/Driver/mcount.c +++ b/clang/test/Driver/mcount.c @@ -1,10 +1,10 @@ -// RUN: %clang -target s390x -c -### %s -mnop-mcount -mrecord-mcount 2>&1 | FileCheck %s +// RUN: %clang --target=s390x -c -### %s -mnop-mcount -mrecord-mcount 2>&1 | FileCheck %s // CHECK: "-mnop-mcount" // CHECK: "-mrecord-mcount" -// RUN: not %clang -target x86_64 -c -### %s -mnop-mcount -mrecord-mcount 2>&1 | FileCheck --check-prefix=ERR1 %s -// RUN: not %clang -target aarch64 -c -### %s -mnop-mcount -mrecord-mcount 2>&1 | FileCheck --check-prefix=ERR2 %s +// RUN: not %clang --target=x86_64 -c -### %s -mnop-mcount -mrecord-mcount 2>&1 | FileCheck --check-prefix=ERR1 %s +// RUN: not %clang --target=aarch64 -c -### %s -mnop-mcount -mrecord-mcount 2>&1 | FileCheck --check-prefix=ERR2 %s // ERR1: error: unsupported option '-mnop-mcount' for target 'x86_64' // ERR1: error: unsupported option '-mrecord-mcount' for target 'x86_64' diff --git a/clang/test/Driver/mdouble.c b/clang/test/Driver/mdouble.c index 0d4881edea434..71e953ec48530 100644 --- a/clang/test/Driver/mdouble.c +++ b/clang/test/Driver/mdouble.c @@ -1,4 +1,4 @@ -// RUN: %clang -target avr -c -### %s -mdouble=64 2>&1 | FileCheck %s +// RUN: %clang --target=avr -c -### %s -mdouble=64 2>&1 | FileCheck %s // CHECK: "-mdouble=64" diff --git a/clang/test/Driver/memtag-stack.c b/clang/test/Driver/memtag-stack.c index 58003fd1b02b9..8ee49bec3e364 100644 --- a/clang/test/Driver/memtag-stack.c +++ b/clang/test/Driver/memtag-stack.c @@ -1,7 +1,7 @@ -// RUN: %clang -target aarch64-unknown-linux -march=armv8+memtag -fsanitize=memtag-stack -mllvm -stack-safety-print=1 %s -S -o - 2>&1 | FileCheck %s --check-prefix=CHECK-NO-SAFETY -// RUN: %clang -O1 -target aarch64-unknown-linux -march=armv8+memtag -fsanitize=memtag-stack -mllvm -stack-safety-print=1 %s -S -o - 2>&1 | FileCheck %s --check-prefix=CHECK-SAFETY -// RUN: %clang -O2 -target aarch64-unknown-linux -march=armv8+memtag -fsanitize=memtag-stack -mllvm -stack-safety-print=1 %s -S -o - 2>&1 | FileCheck %s --check-prefix=CHECK-SAFETY -// RUN: %clang -O3 -target aarch64-unknown-linux -march=armv8+memtag -fsanitize=memtag-stack -mllvm -stack-safety-print=1 %s -S -o - 2>&1 | FileCheck %s --check-prefix=CHECK-SAFETY +// RUN: %clang --target=aarch64 -march=armv8+memtag -fsanitize=memtag-stack -mllvm -stack-safety-print=1 %s -S -o - 2>&1 | FileCheck %s --check-prefix=CHECK-NO-SAFETY +// RUN: %clang -O1 --target=aarch64 -march=armv8+memtag -fsanitize=memtag-stack -mllvm -stack-safety-print=1 %s -S -o - 2>&1 | FileCheck %s --check-prefix=CHECK-SAFETY +// RUN: %clang -O2 --target=aarch64 -march=armv8+memtag -fsanitize=memtag-stack -mllvm -stack-safety-print=1 %s -S -o - 2>&1 | FileCheck %s --check-prefix=CHECK-SAFETY +// RUN: %clang -O3 --target=aarch64 -march=armv8+memtag -fsanitize=memtag-stack -mllvm -stack-safety-print=1 %s -S -o - 2>&1 | FileCheck %s --check-prefix=CHECK-SAFETY // REQUIRES: aarch64-registered-target diff --git a/clang/test/Driver/mfentry.c b/clang/test/Driver/mfentry.c index 934f5c71c26be..9251ce54ee7b8 100644 --- a/clang/test/Driver/mfentry.c +++ b/clang/test/Driver/mfentry.c @@ -1,12 +1,12 @@ -// RUN: %clang -target s390x -c -### %s -mfentry 2>&1 | FileCheck %s -// RUN: %clang -target i386 -c -### %s -mfentry 2>&1 | FileCheck %s -// RUN: %clang -target x86_64 -c -### %s -mfentry 2>&1 | FileCheck %s -// RUN: %clang -target x86_64-linux-gnu -pg -mfentry -O0 -### -E %s 2>&1 | FileCheck -check-prefix=FP %s -// RUN: %clang -target x86_64-linux-gnu -pg -mfentry -O2 -fno-omit-frame-pointer -### -E %s 2>&1 | FileCheck -check-prefix=FP %s -// RUN: %clang -target x86_64-linux-gnu -pg -mfentry -O2 -### -E %s 2>&1 | FileCheck -check-prefix=NOFP %s -// RUN: %clang -target x86_64 -pg -mfentry -O0 -### -E %s 2>&1 | FileCheck -check-prefix=FP %s -// RUN: %clang -target x86_64 -pg -mfentry -O2 -fno-omit-frame-pointer -### -E %s 2>&1 | FileCheck -check-prefix=FP %s -// RUN: %clang -target x86_64 -pg -mfentry -O2 -### -E %s 2>&1 | FileCheck -check-prefix=FP %s +// RUN: %clang --target=s390x -c -### %s -mfentry 2>&1 | FileCheck %s +// RUN: %clang --target=i386 -c -### %s -mfentry 2>&1 | FileCheck %s +// RUN: %clang --target=x86_64 -c -### %s -mfentry 2>&1 | FileCheck %s +// RUN: %clang --target=x86_64-linux-gnu -pg -mfentry -O0 -### -E %s 2>&1 | FileCheck -check-prefix=FP %s +// RUN: %clang --target=x86_64-linux-gnu -pg -mfentry -O2 -fno-omit-frame-pointer -### -E %s 2>&1 | FileCheck -check-prefix=FP %s +// RUN: %clang --target=x86_64-linux-gnu -pg -mfentry -O2 -### -E %s 2>&1 | FileCheck -check-prefix=NOFP %s +// RUN: %clang --target=x86_64 -pg -mfentry -O0 -### -E %s 2>&1 | FileCheck -check-prefix=FP %s +// RUN: %clang --target=x86_64 -pg -mfentry -O2 -fno-omit-frame-pointer -### -E %s 2>&1 | FileCheck -check-prefix=FP %s +// RUN: %clang --target=x86_64 -pg -mfentry -O2 -### -E %s 2>&1 | FileCheck -check-prefix=FP %s // CHECK: "-mfentry" diff --git a/clang/test/Driver/mglobal-merge.c b/clang/test/Driver/mglobal-merge.c index 4ea7ae03e78f4..42019e1cae00b 100644 --- a/clang/test/Driver/mglobal-merge.c +++ b/clang/test/Driver/mglobal-merge.c @@ -1,40 +1,40 @@ -// RUN: %clang -target armv7-unknown-unknown -### -fsyntax-only %s 2> %t \ +// RUN: %clang --target=armv7 -### -fsyntax-only %s 2> %t \ // RUN: -mno-global-merge // RUN: FileCheck --check-prefix=CHECK-NGM-ARM < %t %s -// RUN: %clang -target aarch64-unknown-unknown -### -fsyntax-only %s 2> %t \ +// RUN: %clang --target=aarch64 -### -fsyntax-only %s 2> %t \ // RUN: -mno-global-merge // RUN: FileCheck --check-prefix=CHECK-NGM-AARCH64 < %t %s -// RUN: %clang -target x86_64-unknown-unknown -### -fsyntax-only %s 2> %t \ +// RUN: %clang --target=x86_64 -### -fsyntax-only %s 2> %t \ // RUN: -mno-global-merge // RUN: FileCheck --check-prefix=CHECK-NONE < %t %s // CHECK-NGM-ARM: "-mllvm" "-arm-global-merge=false" // CHECK-NGM-AARCH64: "-mllvm" "-aarch64-enable-global-merge=false" -// RUN: %clang -target armv7-unknown-unknown -### -fsyntax-only %s 2> %t \ +// RUN: %clang --target=armv7 -### -fsyntax-only %s 2> %t \ // RUN: -mglobal-merge // RUN: FileCheck --check-prefix=CHECK-GM-ARM < %t %s -// RUN: %clang -target aarch64-unknown-unknown -### -fsyntax-only %s 2> %t \ +// RUN: %clang --target=aarch64 -### -fsyntax-only %s 2> %t \ // RUN: -mglobal-merge // RUN: FileCheck --check-prefix=CHECK-GM-AARCH64 < %t %s -// RUN: %clang -target x86_64-unknown-unknown -### -fsyntax-only %s 2> %t \ +// RUN: %clang --target=x86_64 -### -fsyntax-only %s 2> %t \ // RUN: -mglobal-merge // RUN: FileCheck --check-prefix=CHECK-NONE < %t %s // CHECK-GM-ARM: "-mllvm" "-arm-global-merge=true" // CHECK-GM-AARCH64: "-mllvm" "-aarch64-enable-global-merge=true" -// RUN: %clang -target armv7-unknown-unknown -### -fsyntax-only %s 2> %t +// RUN: %clang --target=armv7 -### -fsyntax-only %s 2> %t // RUN: FileCheck --check-prefix=CHECK-NONE < %t %s -// RUN: %clang -target aarch64-unknown-unknown -### -fsyntax-only %s 2> %t +// RUN: %clang --target=aarch64 -### -fsyntax-only %s 2> %t // RUN: FileCheck --check-prefix=CHECK-NONE < %t %s -// RUN: %clang -target x86_64-unknown-unknown -### -fsyntax-only %s 2> %t +// RUN: %clang --target=x86_64 -### -fsyntax-only %s 2> %t // RUN: FileCheck --check-prefix=CHECK-NONE < %t %s // CHECK-NONE-NOT: -global-merge= diff --git a/clang/test/Driver/mingw-implicit-extension-windows.c b/clang/test/Driver/mingw-implicit-extension-windows.c index bc15f6abb266b..6320a4a936729 100644 --- a/clang/test/Driver/mingw-implicit-extension-windows.c +++ b/clang/test/Driver/mingw-implicit-extension-windows.c @@ -1,10 +1,10 @@ // Test how an implicit .exe extension is added. -// RUN: %clang -target i686-windows-gnu -### --sysroot=%S/Inputs/mingw_clang_tree/mingw32 %s -o outputname 2>&1 | FileCheck %s --check-prefix=CHECK-OUTPUTNAME-EXE +// RUN: %clang --target=i686-windows-gnu -### --sysroot=%S/Inputs/mingw_clang_tree/mingw32 %s -o outputname 2>&1 | FileCheck %s --check-prefix=CHECK-OUTPUTNAME-EXE -// RUN: %clang -target i686-windows-gnu -### --sysroot=%S/Inputs/mingw_clang_tree/mingw32 %s -o outputname.exe 2>&1 | FileCheck %s --check-prefix=CHECK-OUTPUTNAME-EXE +// RUN: %clang --target=i686-windows-gnu -### --sysroot=%S/Inputs/mingw_clang_tree/mingw32 %s -o outputname.exe 2>&1 | FileCheck %s --check-prefix=CHECK-OUTPUTNAME-EXE -// RUN: %clang -target i686-windows-gnu -### --sysroot=%S/Inputs/mingw_clang_tree/mingw32 %s -o outputname.q 2>&1 | FileCheck %s --check-prefix=CHECK-OUTPUTNAME-Q +// RUN: %clang --target=i686-windows-gnu -### --sysroot=%S/Inputs/mingw_clang_tree/mingw32 %s -o outputname.q 2>&1 | FileCheck %s --check-prefix=CHECK-OUTPUTNAME-Q // CHECK-OUTPUTNAME-EXE: "-o" "outputname.exe" // CHECK-OUTPUTNAME-Q: "-o" "outputname.q" diff --git a/clang/test/Driver/mingw-libgcc.c b/clang/test/Driver/mingw-libgcc.c index bfe2360ed4e6a..f9635a8036097 100644 --- a/clang/test/Driver/mingw-libgcc.c +++ b/clang/test/Driver/mingw-libgcc.c @@ -2,24 +2,24 @@ // Verified with gcc version 5.1.0 (i686-posix-dwarf-rev0, Built by MinGW-W64 project). // gcc, static -// RUN: %clang -v -target i686-pc-windows-gnu -rtlib=platform -### %s 2>&1 | FileCheck -check-prefixes=CHECK_STATIC,CHECK_BDYNAMIC %s -// RUN: %clang -static -v -target i686-pc-windows-gnu -rtlib=platform -### %s 2>&1 | FileCheck -check-prefixes=CHECK_STATIC,CHECK_BSTATIC %s -// RUN: %clang -static-libgcc -v -target i686-pc-windows-gnu -rtlib=platform -### %s 2>&1 | FileCheck -check-prefixes=CHECK_STATIC,CHECK_BDYNAMIC %s -// RUN: %clang -static -shared -v -target i686-pc-windows-gnu -rtlib=platform -### %s 2>&1 | FileCheck -check-prefixes=CHECK_STATIC,CHECK_SHARED,CHECK_BSTATIC %s -// RUN: %clang -static-libgcc -shared -v -target i686-pc-windows-gnu -rtlib=platform -### %s 2>&1 | FileCheck -check-prefixes=CHECK_STATIC,CHECK_SHARED,CHECK_BDYNAMIC %s +// RUN: %clang -v --target=i686-pc-windows-gnu -rtlib=platform -### %s 2>&1 | FileCheck -check-prefixes=CHECK_STATIC,CHECK_BDYNAMIC %s +// RUN: %clang -static -v --target=i686-pc-windows-gnu -rtlib=platform -### %s 2>&1 | FileCheck -check-prefixes=CHECK_STATIC,CHECK_BSTATIC %s +// RUN: %clang -static-libgcc -v --target=i686-pc-windows-gnu -rtlib=platform -### %s 2>&1 | FileCheck -check-prefixes=CHECK_STATIC,CHECK_BDYNAMIC %s +// RUN: %clang -static -shared -v --target=i686-pc-windows-gnu -rtlib=platform -### %s 2>&1 | FileCheck -check-prefixes=CHECK_STATIC,CHECK_SHARED,CHECK_BSTATIC %s +// RUN: %clang -static-libgcc -shared -v --target=i686-pc-windows-gnu -rtlib=platform -### %s 2>&1 | FileCheck -check-prefixes=CHECK_STATIC,CHECK_SHARED,CHECK_BDYNAMIC %s // gcc, dynamic -// RUN: %clang -shared -v -target i686-pc-windows-gnu -rtlib=platform -### %s 2>&1 | FileCheck -check-prefix=CHECK_DYNAMIC %s +// RUN: %clang -shared -v --target=i686-pc-windows-gnu -rtlib=platform -### %s 2>&1 | FileCheck -check-prefix=CHECK_DYNAMIC %s // g++, static -// RUN: %clang -static --driver-mode=g++ -v -target i686-pc-windows-gnu -rtlib=platform -### %s 2>&1 | FileCheck -check-prefix=CHECK_STATIC %s -// RUN: %clang -static-libgcc --driver-mode=g++ -v -target i686-pc-windows-gnu -rtlib=platform -### %s 2>&1 | FileCheck -check-prefix=CHECK_STATIC %s -// RUN: %clang -static -shared --driver-mode=g++ -v -target i686-pc-windows-gnu -rtlib=platform -### %s 2>&1 | FileCheck -check-prefix=CHECK_STATIC %s -// RUN: %clang -static-libgcc -shared --driver-mode=g++ -v -target i686-pc-windows-gnu -rtlib=platform -### %s 2>&1 | FileCheck -check-prefix=CHECK_STATIC %s +// RUN: %clang -static --driver-mode=g++ -v --target=i686-pc-windows-gnu -rtlib=platform -### %s 2>&1 | FileCheck -check-prefix=CHECK_STATIC %s +// RUN: %clang -static-libgcc --driver-mode=g++ -v --target=i686-pc-windows-gnu -rtlib=platform -### %s 2>&1 | FileCheck -check-prefix=CHECK_STATIC %s +// RUN: %clang -static -shared --driver-mode=g++ -v --target=i686-pc-windows-gnu -rtlib=platform -### %s 2>&1 | FileCheck -check-prefix=CHECK_STATIC %s +// RUN: %clang -static-libgcc -shared --driver-mode=g++ -v --target=i686-pc-windows-gnu -rtlib=platform -### %s 2>&1 | FileCheck -check-prefix=CHECK_STATIC %s // g++, dynamic -// RUN: %clang --driver-mode=g++ -v -target i686-pc-windows-gnu -rtlib=platform -### %s 2>&1 | FileCheck -check-prefix=CHECK_DYNAMIC %s -// RUN: %clang -shared --driver-mode=g++ -v -target i686-pc-windows-gnu -rtlib=platform -### %s 2>&1 | FileCheck -check-prefix=CHECK_DYNAMIC %s +// RUN: %clang --driver-mode=g++ -v --target=i686-pc-windows-gnu -rtlib=platform -### %s 2>&1 | FileCheck -check-prefix=CHECK_DYNAMIC %s +// RUN: %clang -shared --driver-mode=g++ -v --target=i686-pc-windows-gnu -rtlib=platform -### %s 2>&1 | FileCheck -check-prefix=CHECK_DYNAMIC %s // CHECK_SHARED: "--shared" // CHECK_BSTATIC: "-Bstatic" diff --git a/clang/test/Driver/mingw-msvcrt.c b/clang/test/Driver/mingw-msvcrt.c index 48a30d8469cb6..340ce1f57b0f8 100644 --- a/clang/test/Driver/mingw-msvcrt.c +++ b/clang/test/Driver/mingw-msvcrt.c @@ -1,8 +1,8 @@ -// RUN: %clang -v -target i686-pc-windows-gnu -### %s 2>&1 | FileCheck -check-prefix=CHECK_DEFAULT %s -// RUN: %clang -v -target i686-pc-windows-gnu -lmsvcr120 -### %s 2>&1 | FileCheck -check-prefix=CHECK_MSVCR120 %s -// RUN: %clang -v -target i686-pc-windows-gnu -lucrtbase -### %s 2>&1 | FileCheck -check-prefix=CHECK_UCRTBASE %s -// RUN: %clang -v -target i686-pc-windows-gnu -lucrt -### %s 2>&1 | FileCheck -check-prefix=CHECK_UCRT %s -// RUN: %clang -v -target i686-pc-windows-gnu -lcrtdll -### %s 2>&1 | FileCheck -check-prefix=CHECK_CRTDLL %s +// RUN: %clang -v --target=i686-pc-windows-gnu -### %s 2>&1 | FileCheck -check-prefix=CHECK_DEFAULT %s +// RUN: %clang -v --target=i686-pc-windows-gnu -lmsvcr120 -### %s 2>&1 | FileCheck -check-prefix=CHECK_MSVCR120 %s +// RUN: %clang -v --target=i686-pc-windows-gnu -lucrtbase -### %s 2>&1 | FileCheck -check-prefix=CHECK_UCRTBASE %s +// RUN: %clang -v --target=i686-pc-windows-gnu -lucrt -### %s 2>&1 | FileCheck -check-prefix=CHECK_UCRT %s +// RUN: %clang -v --target=i686-pc-windows-gnu -lcrtdll -### %s 2>&1 | FileCheck -check-prefix=CHECK_CRTDLL %s // CHECK_DEFAULT: "-lmingwex" "-lmsvcrt" "-ladvapi32" // CHECK_DEFAULT-SAME: "-lmsvcrt" "-lkernel32" "{{.*}}crtend.o" diff --git a/clang/test/Driver/mingw-sanitizers.c b/clang/test/Driver/mingw-sanitizers.c index 2325f8f0f1f23..618c1b7ba332f 100644 --- a/clang/test/Driver/mingw-sanitizers.c +++ b/clang/test/Driver/mingw-sanitizers.c @@ -1,6 +1,6 @@ // RUN: touch %t.a -// RUN: %clang -target i686-windows-gnu %s -### -fsanitize=address -lcomponent %/t.a 2>&1 | FileCheck --check-prefixes=ASAN-ALL,ASAN-I686 -DINPUT=%/t.a %s -// RUN: %clang -target x86_64-windows-gnu %s -### -fsanitize=address -lcomponent %/t.a 2>&1 | FileCheck --check-prefixes=ASAN-ALL,ASAN-X86_64 -DINPUT=%/t.a %s +// RUN: %clang --target=i686-windows-gnu %s -### -fsanitize=address -lcomponent %/t.a 2>&1 | FileCheck --check-prefixes=ASAN-ALL,ASAN-I686 -DINPUT=%/t.a %s +// RUN: %clang --target=x86_64-windows-gnu %s -### -fsanitize=address -lcomponent %/t.a 2>&1 | FileCheck --check-prefixes=ASAN-ALL,ASAN-X86_64 -DINPUT=%/t.a %s // // ASAN-ALL-NOT:"-l{{[^"]+"]}}" // ASAN-ALL-NOT:"[[INPUT]]" @@ -17,4 +17,4 @@ // ASAN-X86_64: "--require-defined" "__asan_seh_interceptor" // ASAN-X86_64: "--whole-archive" "{{[^"]*}}libclang_rt.asan_dynamic_runtime_thunk.a" "--no-whole-archive" -// RUN: %clang -target x86_64-windows-gnu %s -### -fsanitize=vptr +// RUN: %clang --target=x86_64-windows-gnu %s -### -fsanitize=vptr diff --git a/clang/test/Driver/mingw-sysroot.cpp b/clang/test/Driver/mingw-sysroot.cpp index 5d512e6669709..de5cdedcbff1d 100644 --- a/clang/test/Driver/mingw-sysroot.cpp +++ b/clang/test/Driver/mingw-sysroot.cpp @@ -33,7 +33,7 @@ // directory to the path - this would end up including /usr/include for // cross toolchains installed in /usr. -// RUN: env "PATH=%T/testroot-gcc/bin:%PATH%" %clang -target x86_64-w64-mingw32 -rtlib=platform -stdlib=libstdc++ --sysroot="" -c -### %s 2>&1 | FileCheck -check-prefix=CHECK_TESTROOT_GCC %s --implicit-check-not="\"{{.*}}/testroot-gcc{{/|\\\\}}include\"" +// RUN: env "PATH=%T/testroot-gcc/bin:%PATH%" %clang --target=x86_64-w64-mingw32 -rtlib=platform -stdlib=libstdc++ --sysroot="" -c -### %s 2>&1 | FileCheck -check-prefix=CHECK_TESTROOT_GCC %s --implicit-check-not="\"{{.*}}/testroot-gcc{{/|\\\\}}include\"" // CHECK_TESTROOT_GCC: "-internal-isystem" "[[BASE:[^"]+]]/testroot-gcc{{/|\\\\}}lib{{/|\\\\}}gcc{{/|\\\\}}x86_64-w64-mingw32{{/|\\\\}}10.2-posix{{/|\\\\}}include{{/|\\\\}}c++" // CHECK_TESTROOT_GCC-SAME: {{^}} "-internal-isystem" "[[BASE]]/testroot-gcc{{/|\\\\}}lib{{/|\\\\}}gcc{{/|\\\\}}x86_64-w64-mingw32{{/|\\\\}}10.2-posix{{/|\\\\}}include{{/|\\\\}}c++{{/|\\\\}}x86_64-w64-mingw32" // CHECK_TESTROOT_GCC-SAME: {{^}} "-internal-isystem" "[[BASE]]/testroot-gcc{{/|\\\\}}lib{{/|\\\\}}gcc{{/|\\\\}}x86_64-w64-mingw32{{/|\\\\}}10.2-posix{{/|\\\\}}include{{/|\\\\}}c++{{/|\\\\}}backward" @@ -45,7 +45,7 @@ // If we pass --sysroot explicitly, then we do include /include // even when cross compiling. -// RUN: %clang -target x86_64-w64-mingw32 -rtlib=platform -stdlib=libstdc++ --sysroot="%T/testroot-gcc" -c -### %s 2>&1 | FileCheck -check-prefix=CHECK_TESTROOT_GCC_EXPLICIT %s +// RUN: %clang --target=x86_64-w64-mingw32 -rtlib=platform -stdlib=libstdc++ --sysroot="%T/testroot-gcc" -c -### %s 2>&1 | FileCheck -check-prefix=CHECK_TESTROOT_GCC_EXPLICIT %s // CHECK_TESTROOT_GCC_EXPLICIT: "-internal-isystem" "{{[^"]+}}/testroot-gcc{{/|\\\\}}include" @@ -63,7 +63,7 @@ // happens to be in the same directory as gcc, make sure we still can pick up // the libgcc directory: -// RUN: env "PATH=%T/testroot-gcc/bin:%PATH%" %T/testroot-gcc/bin/x86_64-w64-mingw32-clang -target x86_64-w64-mingw32 -rtlib=platform -stdlib=libstdc++ --sysroot="" -c -### %s 2>&1 | FileCheck -check-prefix=CHECK_TESTROOT_GCC %s +// RUN: env "PATH=%T/testroot-gcc/bin:%PATH%" %T/testroot-gcc/bin/x86_64-w64-mingw32-clang --target=x86_64-w64-mingw32 -rtlib=platform -stdlib=libstdc++ --sysroot="" -c -### %s 2>&1 | FileCheck -check-prefix=CHECK_TESTROOT_GCC %s // If we're executing clang from a directory with what looks like a mingw sysroot, diff --git a/clang/test/Driver/mingw-windowsapp.c b/clang/test/Driver/mingw-windowsapp.c index bf6f2ec3fa3d1..d0a44952b30a3 100644 --- a/clang/test/Driver/mingw-windowsapp.c +++ b/clang/test/Driver/mingw-windowsapp.c @@ -1,5 +1,5 @@ -// RUN: %clang -v -target i686-pc-windows-gnu -### %s 2>&1 | FileCheck -check-prefix=CHECK_DEFAULT %s -// RUN: %clang -v -target i686-pc-windows-gnu -### %s -lwindowsapp 2>&1 | FileCheck -check-prefix=CHECK_WINDOWSAPP %s +// RUN: %clang -v --target=i686-pc-windows-gnu -### %s 2>&1 | FileCheck -check-prefix=CHECK_DEFAULT %s +// RUN: %clang -v --target=i686-pc-windows-gnu -### %s -lwindowsapp 2>&1 | FileCheck -check-prefix=CHECK_WINDOWSAPP %s // CHECK_DEFAULT: "-lmsvcrt" "-ladvapi32" "-lshell32" "-luser32" "-lkernel32" "-lmingw32" // CHECK_WINDOWSAPP: "-lwindowsapp" "-lmingw32" diff --git a/clang/test/Driver/mingw.cpp b/clang/test/Driver/mingw.cpp index e42ff4554e452..4a9ba4d259b46 100644 --- a/clang/test/Driver/mingw.cpp +++ b/clang/test/Driver/mingw.cpp @@ -1,15 +1,15 @@ -// RUN: %clang -target i686-windows-gnu -rtlib=platform -c -### --sysroot=%S/Inputs/mingw_clang_tree/mingw32 %s 2>&1 | FileCheck -check-prefix=CHECK_MINGW_CLANG_TREE %s +// RUN: %clang --target=i686-windows-gnu -rtlib=platform -c -### --sysroot=%S/Inputs/mingw_clang_tree/mingw32 %s 2>&1 | FileCheck -check-prefix=CHECK_MINGW_CLANG_TREE %s // CHECK_MINGW_CLANG_TREE: "[[BASE:[^"]+]]/Inputs/mingw_clang_tree/mingw32{{/|\\\\}}i686-w64-mingw32{{/|\\\\}}include" // CHECK_MINGW_CLANG_TREE: "[[BASE:[^"]+]]/Inputs/mingw_clang_tree/mingw32{{/|\\\\}}i686-w64-mingw32{{/|\\\\}}usr{{/|\\\\}}include" // CHECK_MINGW_CLANG_TREE: "[[BASE]]/Inputs/mingw_clang_tree/mingw32{{/|\\\\}}include" -// RUN: %clang -target i686-windows-gnu -rtlib=platform -stdlib=libc++ -c -### --sysroot=%S/Inputs/mingw_clang_tree/mingw32 %s 2>&1 | FileCheck -check-prefix=CHECK_MINGW_CLANG_TREE_LIBCXX %s +// RUN: %clang --target=i686-windows-gnu -rtlib=platform -stdlib=libc++ -c -### --sysroot=%S/Inputs/mingw_clang_tree/mingw32 %s 2>&1 | FileCheck -check-prefix=CHECK_MINGW_CLANG_TREE_LIBCXX %s // CHECK_MINGW_CLANG_TREE_LIBCXX: "[[BASE:[^"]+]]/Inputs/mingw_clang_tree/mingw32{{/|\\\\}}include{{/|\\\\}}i686-unknown-windows-gnu{{/|\\\\}}c++{{/|\\\\}}v1" // CHECK_MINGW_CLANG_TREE_LIBCXX: "[[BASE:[^"]+]]/Inputs/mingw_clang_tree/mingw32{{/|\\\\}}i686-w64-mingw32{{/|\\\\}}include{{/|\\\\}}c++{{/|\\\\}}v1" -// RUN: %clang -target i686-pc-windows-gnu -rtlib=platform -stdlib=libstdc++ -c -### --sysroot=%S/Inputs/mingw_mingw_org_tree/mingw %s 2>&1 | FileCheck -check-prefix=CHECK_MINGW_ORG_TREE %s +// RUN: %clang --target=i686-pc-windows-gnu -rtlib=platform -stdlib=libstdc++ -c -### --sysroot=%S/Inputs/mingw_mingw_org_tree/mingw %s 2>&1 | FileCheck -check-prefix=CHECK_MINGW_ORG_TREE %s // CHECK_MINGW_ORG_TREE: "[[BASE:[^"]+]]/Inputs/mingw_mingw_org_tree/mingw{{/|\\\\}}lib{{/|\\\\}}gcc{{/|\\\\}}mingw32{{/|\\\\}}4.8.1{{/|\\\\}}include{{/|\\\\}}c++" // CHECK_MINGW_ORG_TREE: "[[BASE]]/Inputs/mingw_mingw_org_tree/mingw{{/|\\\\}}lib{{/|\\\\}}gcc{{/|\\\\}}mingw32{{/|\\\\}}4.8.1{{/|\\\\}}include{{/|\\\\}}c++{{/|\\\\}}mingw32" // CHECK_MINGW_ORG_TREE: "[[BASE]]/Inputs/mingw_mingw_org_tree/mingw{{/|\\\\}}lib{{/|\\\\}}gcc{{/|\\\\}}mingw32{{/|\\\\}}4.8.1{{/|\\\\}}include{{/|\\\\}}c++{{/|\\\\}}backward" @@ -17,14 +17,14 @@ // CHECK_MINGW_ORG_TREE: "[[BASE]]/Inputs/mingw_mingw_org_tree/mingw{{/|\\\\}}include" -// RUN: %clang -target i686-pc-windows-gnu -rtlib=platform -stdlib=libstdc++ -c -### --sysroot=%S/Inputs/mingw_mingw_builds_tree/mingw32 %s 2>&1 | FileCheck -check-prefix=CHECK_MINGW_BUILDS_TREE %s +// RUN: %clang --target=i686-pc-windows-gnu -rtlib=platform -stdlib=libstdc++ -c -### --sysroot=%S/Inputs/mingw_mingw_builds_tree/mingw32 %s 2>&1 | FileCheck -check-prefix=CHECK_MINGW_BUILDS_TREE %s // CHECK_MINGW_BUILDS_TREE: "[[BASE:[^"]+]]/Inputs/mingw_mingw_builds_tree/mingw32{{/|\\\\}}i686-w64-mingw32{{/|\\\\}}include{{/|\\\\}}c++" // CHECK_MINGW_BUILDS_TREE: "[[BASE]]/Inputs/mingw_mingw_builds_tree/mingw32{{/|\\\\}}i686-w64-mingw32{{/|\\\\}}include{{/|\\\\}}c++{{/|\\\\}}i686-w64-mingw32" // CHECK_MINGW_BUILDS_TREE: "[[BASE]]/Inputs/mingw_mingw_builds_tree/mingw32{{/|\\\\}}i686-w64-mingw32{{/|\\\\}}include{{/|\\\\}}c++{{/|\\\\}}backward" // CHECK_MINGW_BUILDS_TREE: "[[BASE]]/Inputs/mingw_mingw_builds_tree/mingw32{{/|\\\\}}i686-w64-mingw32{{/|\\\\}}include" -// RUN: %clang -target i686-pc-windows-gnu -rtlib=platform -stdlib=libstdc++ -c -### --sysroot=%S/Inputs/mingw_msys2_tree/msys64/mingw32 %s 2>&1 | FileCheck -check-prefix=CHECK_MINGW_MSYS_TREE %s +// RUN: %clang --target=i686-pc-windows-gnu -rtlib=platform -stdlib=libstdc++ -c -### --sysroot=%S/Inputs/mingw_msys2_tree/msys64/mingw32 %s 2>&1 | FileCheck -check-prefix=CHECK_MINGW_MSYS_TREE %s // CHECK_MINGW_MSYS_TREE: "[[BASE:[^"]+]]/Inputs/mingw_msys2_tree/msys64{{/|\\\\}}mingw32{{/|\\\\}}include{{/|\\\\}}c++{{/|\\\\}}4.9.2" // CHECK_MINGW_MSYS_TREE: "[[BASE]]/Inputs/mingw_msys2_tree/msys64/mingw32{{/|\\\\}}include{{/|\\\\}}c++{{/|\\\\}}4.9.2{{/|\\\\}}i686-w64-mingw32" // CHECK_MINGW_MSYS_TREE: "[[BASE]]/Inputs/mingw_msys2_tree/msys64/mingw32{{/|\\\\}}include{{/|\\\\}}c++{{/|\\\\}}4.9.2{{/|\\\\}}backward" @@ -32,55 +32,55 @@ // CHECK_MINGW_MSYS_TREE: "[[BASE]]/Inputs/mingw_msys2_tree/msys64/mingw32{{/|\\\\}}include" -// RUN: %clang -target x86_64-pc-windows-gnu -rtlib=platform -stdlib=libstdc++ -c -### --sysroot=%S/Inputs/mingw_opensuse_tree/usr %s 2>&1 | FileCheck -check-prefix=CHECK_MINGW_OPENSUSE_TREE %s +// RUN: %clang --target=x86_64-pc-windows-gnu -rtlib=platform -stdlib=libstdc++ -c -### --sysroot=%S/Inputs/mingw_opensuse_tree/usr %s 2>&1 | FileCheck -check-prefix=CHECK_MINGW_OPENSUSE_TREE %s // CHECK_MINGW_OPENSUSE_TREE: "[[BASE:[^"]+]]/Inputs/mingw_opensuse_tree/usr{{/|\\\\}}lib64{{/|\\\\}}gcc{{/|\\\\}}x86_64-w64-mingw32{{/|\\\\}}5.1.0{{/|\\\\}}include{{/|\\\\}}c++" // CHECK_MINGW_OPENSUSE_TREE: "[[BASE]]/Inputs/mingw_opensuse_tree/usr{{/|\\\\}}lib64{{/|\\\\}}gcc{{/|\\\\}}x86_64-w64-mingw32{{/|\\\\}}5.1.0{{/|\\\\}}include{{/|\\\\}}c++{{/|\\\\}}x86_64-w64-mingw32" // CHECK_MINGW_OPENSUSE_TREE: "[[BASE]]/Inputs/mingw_opensuse_tree/usr{{/|\\\\}}lib64{{/|\\\\}}gcc{{/|\\\\}}x86_64-w64-mingw32{{/|\\\\}}5.1.0{{/|\\\\}}include{{/|\\\\}}c++{{/|\\\\}}backward" // CHECK_MINGW_OPENSUSE_TREE: "[[BASE]]/Inputs/mingw_opensuse_tree/usr{{/|\\\\}}x86_64-w64-mingw32/sys-root/mingw{{/|\\\\}}include" -// RUN: %clang -target x86_64-pc-windows-gnu -rtlib=platform -stdlib=libstdc++ -c -### --sysroot=%S/Inputs/mingw_fedora_tree/usr %s 2>&1 | FileCheck -check-prefix=CHECK_MINGW_FEDORA_TREE %s +// RUN: %clang --target=x86_64-pc-windows-gnu -rtlib=platform -stdlib=libstdc++ -c -### --sysroot=%S/Inputs/mingw_fedora_tree/usr %s 2>&1 | FileCheck -check-prefix=CHECK_MINGW_FEDORA_TREE %s // CHECK_MINGW_FEDORA_TREE: "[[BASE:[^"]+]]/Inputs/mingw_fedora_tree/usr{{/|\\\\}}x86_64-w64-mingw32ucrt/sys-root/mingw{{/|\\\\}}include{{/|\\\\}}c++" // CHECK_MINGW_FEDORA_TREE: "[[BASE]]/Inputs/mingw_fedora_tree/usr{{/|\\\\}}x86_64-w64-mingw32ucrt/sys-root/mingw{{/|\\\\}}include{{/|\\\\}}c++{{/|\\\\}}x86_64-w64-mingw32ucrt" // CHECK_MINGW_FEDORA_TREE: "[[BASE]]/Inputs/mingw_fedora_tree/usr{{/|\\\\}}x86_64-w64-mingw32ucrt/sys-root/mingw{{/|\\\\}}include{{/|\\\\}}c++{{/|\\\\}}backward" // CHECK_MINGW_FEDORA_TREE: "[[BASE]]/Inputs/mingw_fedora_tree/usr{{/|\\\\}}x86_64-w64-mingw32ucrt/sys-root/mingw{{/|\\\\}}include" -// RUN: %clang -target i686-pc-windows-gnu -rtlib=platform -stdlib=libstdc++ -c -### --sysroot=%S/Inputs/mingw_arch_tree/usr %s 2>&1 | FileCheck -check-prefix=CHECK_MINGW_ARCH_TREE %s +// RUN: %clang --target=i686-pc-windows-gnu -rtlib=platform -stdlib=libstdc++ -c -### --sysroot=%S/Inputs/mingw_arch_tree/usr %s 2>&1 | FileCheck -check-prefix=CHECK_MINGW_ARCH_TREE %s // CHECK_MINGW_ARCH_TREE: "[[BASE:[^"]+]]/Inputs/mingw_arch_tree/usr{{/|\\\\}}i686-w64-mingw32{{/|\\\\}}include{{/|\\\\}}c++{{/|\\\\}}5.1.0" // CHECK_MINGW_ARCH_TREE: "[[BASE]]/Inputs/mingw_arch_tree/usr{{/|\\\\}}i686-w64-mingw32{{/|\\\\}}include{{/|\\\\}}c++{{/|\\\\}}5.1.0{{/|\\\\}}i686-w64-mingw32" // CHECK_MINGW_ARCH_TREE: "[[BASE]]/Inputs/mingw_arch_tree/usr{{/|\\\\}}i686-w64-mingw32{{/|\\\\}}include{{/|\\\\}}c++{{/|\\\\}}5.1.0{{/|\\\\}}backward" // CHECK_MINGW_ARCH_TREE: "[[BASE]]/Inputs/mingw_arch_tree/usr{{/|\\\\}}i686-w64-mingw32{{/|\\\\}}include" -// RUN: %clang -target x86_64-pc-windows-gnu -rtlib=platform -stdlib=libstdc++ -c -### --sysroot=%S/Inputs/mingw_ubuntu_tree/usr %s 2>&1 | FileCheck -check-prefix=CHECK_MINGW_UBUNTU_TREE %s +// RUN: %clang --target=x86_64-pc-windows-gnu -rtlib=platform -stdlib=libstdc++ -c -### --sysroot=%S/Inputs/mingw_ubuntu_tree/usr %s 2>&1 | FileCheck -check-prefix=CHECK_MINGW_UBUNTU_TREE %s // CHECK_MINGW_UBUNTU_TREE: "[[BASE:[^"]+]]/Inputs/mingw_ubuntu_tree/usr{{/|\\\\}}include{{/|\\\\}}c++{{/|\\\\}}4.8" // CHECK_MINGW_UBUNTU_TREE: "[[BASE]]/Inputs/mingw_ubuntu_tree/usr{{/|\\\\}}include{{/|\\\\}}c++{{/|\\\\}}4.8{{/|\\\\}}x86_64-w64-mingw32" // CHECK_MINGW_UBUNTU_TREE: "[[BASE]]/Inputs/mingw_ubuntu_tree/usr{{/|\\\\}}include{{/|\\\\}}c++{{/|\\\\}}4.8{{/|\\\\}}backward" // CHECK_MINGW_UBUNTU_TREE: "[[BASE]]/Inputs/mingw_ubuntu_tree/usr{{/|\\\\}}x86_64-w64-mingw32{{/|\\\\}}include" -// RUN: %clang -target x86_64-pc-windows-gnu -rtlib=platform -stdlib=libstdc++ -c -### --sysroot=%S/Inputs/mingw_ubuntu_posix_tree/usr %s 2>&1 | FileCheck -check-prefix=CHECK_MINGW_UBUNTU_POSIX_TREE %s +// RUN: %clang --target=x86_64-pc-windows-gnu -rtlib=platform -stdlib=libstdc++ -c -### --sysroot=%S/Inputs/mingw_ubuntu_posix_tree/usr %s 2>&1 | FileCheck -check-prefix=CHECK_MINGW_UBUNTU_POSIX_TREE %s // CHECK_MINGW_UBUNTU_POSIX_TREE: "[[BASE:[^"]+]]/Inputs/mingw_ubuntu_posix_tree/usr{{/|\\\\}}lib{{/|\\\\}}gcc{{/|\\\\}}x86_64-w64-mingw32{{/|\\\\}}10.2-posix{{/|\\\\}}include{{/|\\\\}}c++" // CHECK_MINGW_UBUNTU_POSIX_TREE: "[[BASE]]/Inputs/mingw_ubuntu_posix_tree/usr{{/|\\\\}}lib{{/|\\\\}}gcc{{/|\\\\}}x86_64-w64-mingw32{{/|\\\\}}10.2-posix{{/|\\\\}}include{{/|\\\\}}c++{{/|\\\\}}x86_64-w64-mingw32" // CHECK_MINGW_UBUNTU_POSIX_TREE: "[[BASE]]/Inputs/mingw_ubuntu_posix_tree/usr{{/|\\\\}}lib{{/|\\\\}}gcc{{/|\\\\}}x86_64-w64-mingw32{{/|\\\\}}10.2-posix{{/|\\\\}}include{{/|\\\\}}c++{{/|\\\\}}backward" // CHECK_MINGW_UBUNTU_POSIX_TREE: "[[BASE]]/Inputs/mingw_ubuntu_posix_tree/usr{{/|\\\\}}x86_64-w64-mingw32{{/|\\\\}}include" -// RUN: %clang -target i686-windows-gnu -E -### %s 2>&1 | FileCheck -check-prefix=CHECK_MINGW_NO_UNICODE %s -// RUN: %clang -target i686-windows-gnu -E -### %s -municode 2>&1 | FileCheck -check-prefix=CHECK_MINGW_UNICODE %s +// RUN: %clang --target=i686-windows-gnu -E -### %s 2>&1 | FileCheck -check-prefix=CHECK_MINGW_NO_UNICODE %s +// RUN: %clang --target=i686-windows-gnu -E -### %s -municode 2>&1 | FileCheck -check-prefix=CHECK_MINGW_UNICODE %s // CHECK_MINGW_NO_UNICODE-NOT: "-DUNICODE" // CHECK_MINGW_UNICODE: "-DUNICODE" -// RUN: %clang -target i686-windows-gnu -### %s 2>&1 | FileCheck -check-prefix=CHECK_NO_SUBSYS %s -// RUN: %clang -target i686-windows-gnu -### %s -mwindows -mconsole 2>&1 | FileCheck -check-prefix=CHECK_SUBSYS_CONSOLE %s -// RUN: %clang -target i686-windows-gnu -### %s -mconsole -mwindows 2>&1 | FileCheck -check-prefix=CHECK_SUBSYS_WINDOWS %s +// RUN: %clang --target=i686-windows-gnu -### %s 2>&1 | FileCheck -check-prefix=CHECK_NO_SUBSYS %s +// RUN: %clang --target=i686-windows-gnu -### %s -mwindows -mconsole 2>&1 | FileCheck -check-prefix=CHECK_SUBSYS_CONSOLE %s +// RUN: %clang --target=i686-windows-gnu -### %s -mconsole -mwindows 2>&1 | FileCheck -check-prefix=CHECK_SUBSYS_WINDOWS %s // CHECK_NO_SUBSYS-NOT: "--subsystem" // CHECK_SUBSYS_CONSOLE: "--subsystem" "console" // CHECK_SUBSYS_WINDOWS: "--subsystem" "windows" -// RUN: %clang -target i686-windows-gnu -### %s 2>&1 | FileCheck -check-prefix=CHECK_NO_INIT_ARRAY %s +// RUN: %clang --target=i686-windows-gnu -### %s 2>&1 | FileCheck -check-prefix=CHECK_NO_INIT_ARRAY %s // CHECK_NO_INIT_ARRAY: "-fno-use-init-array" -// RUN: %clang -target arm64ec-windows-gnu -### -o /dev/null %s 2>&1 \ +// RUN: %clang --target=arm64ec-windows-gnu -### -o /dev/null %s 2>&1 \ // RUN: | FileCheck %s --check-prefix CHECK_MINGW_EC_LINK // CHECK_MINGW_EC_LINK: "-m" "arm64ecpe" diff --git a/clang/test/Driver/mips-abi.c b/clang/test/Driver/mips-abi.c index 98384ce8b3154..05277520a94b1 100644 --- a/clang/test/Driver/mips-abi.c +++ b/clang/test/Driver/mips-abi.c @@ -2,168 +2,168 @@ // // REQUIRES: mips-registered-target // -// RUN: %clang -target mips-linux-gnu -### -c %s 2>&1 \ +// RUN: %clang --target=mips-linux-gnu -### -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS32R2-O32 %s -// RUN: %clang -target mips64-linux-gnu -mips32r2 -mabi=32 -### -c %s 2>&1 \ +// RUN: %clang --target=mips64-linux-gnu -mips32r2 -mabi=32 -### -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS32R2-O32 %s // MIPS32R2-O32: "-target-cpu" "mips32r2" // MIPS32R2-O32: "-target-abi" "o32" // -// RUN: %clang -target mips64-linux-gnu -### -c %s 2>&1 \ +// RUN: %clang --target=mips64-linux-gnu -### -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS64R2-N64 %s -// RUN: %clang -target mips-img-linux-gnu -mips64r2 -### -c %s 2>&1 \ +// RUN: %clang --target=mips-img-linux-gnu -mips64r2 -### -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS64R2-N64 %s -// RUN: %clang -target mips-mti-linux-gnu -mips64r2 -### -c %s 2>&1 \ +// RUN: %clang --target=mips-mti-linux-gnu -mips64r2 -### -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS64R2-N64 %s -// RUN: %clang -target mips-linux-gnu -mips64r2 -mabi=64 -### -c %s 2>&1 \ +// RUN: %clang --target=mips-linux-gnu -mips64r2 -mabi=64 -### -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS64R2-N64 %s // MIPS64R2-N64: "-target-cpu" "mips64r2" // MIPS64R2-N64: "-target-abi" "n64" // -// RUN: %clang -target mips64-linux-gnu -### -mips64r3 -c %s 2>&1 \ +// RUN: %clang --target=mips64-linux-gnu -### -mips64r3 -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS64R3-N64 %s -// RUN: %clang -target mips-img-linux-gnu -mips64r3 -### -c %s 2>&1 \ +// RUN: %clang --target=mips-img-linux-gnu -mips64r3 -### -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS64R3-N64 %s -// RUN: %clang -target mips-mti-linux-gnu -mips64r3 -### -c %s 2>&1 \ +// RUN: %clang --target=mips-mti-linux-gnu -mips64r3 -### -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS64R3-N64 %s // MIPS64R3-N64: "-target-cpu" "mips64r3" // MIPS64R3-N64: "-target-abi" "n64" // -// RUN: %clang -target mips-linux-gnu -### -c %s \ +// RUN: %clang --target=mips-linux-gnu -### -c %s \ // RUN: -mabi=32 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS-ABI-32 %s // MIPS-ABI-32: "-target-cpu" "mips32r2" // MIPS-ABI-32: "-target-abi" "o32" // -// RUN: %clang -target mips-linux-gnu -### -c %s \ +// RUN: %clang --target=mips-linux-gnu -### -c %s \ // RUN: -mabi=o32 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS-ABI-O32 %s // MIPS-ABI-O32: "-target-cpu" "mips32r2" // MIPS-ABI-O32: "-target-abi" "o32" // -// RUN: %clang -target mips-linux-gnu -### -c %s \ +// RUN: %clang --target=mips-linux-gnu -### -c %s \ // RUN: -mabi=n32 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS-ABI-N32 %s // MIPS-ABI-N32: "-target-cpu" "mips64r2" // MIPS-ABI-N32: "-target-abi" "n32" // -// RUN: %clang -target mips64-linux-gnu -### -c %s \ +// RUN: %clang --target=mips64-linux-gnu -### -c %s \ // RUN: -mabi=64 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS-ABI-64 %s // MIPS-ABI-64: "-target-cpu" "mips64r2" // MIPS-ABI-64: "-target-abi" "n64" // -// RUN: %clang -target mips64-linux-gnu -### -c %s \ +// RUN: %clang --target=mips64-linux-gnu -### -c %s \ // RUN: -mabi=n64 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS-ABI-N64 %s // MIPS-ABI-N64: "-target-cpu" "mips64r2" // MIPS-ABI-N64: "-target-abi" "n64" // -// RUN: not %clang -target mips64-linux-gnu -c %s \ +// RUN: not %clang --target=mips64-linux-gnu -c %s \ // RUN: -mabi=o64 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS-ABI-O64 %s // MIPS-ABI-O64: error: unknown target ABI 'o64' // -// RUN: not %clang -target mips-linux-gnu -c %s \ +// RUN: not %clang --target=mips-linux-gnu -c %s \ // RUN: -mabi=unknown 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS-ABI-UNKNOWN %s // MIPS-ABI-UNKNOWN: error: unknown target ABI 'unknown' // -// RUN: %clang -target mips-linux-gnu -### -c %s \ +// RUN: %clang --target=mips-linux-gnu -### -c %s \ // RUN: -march=mips1 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS-ARCH-1 %s // MIPS-ARCH-1: "-target-cpu" "mips1" // MIPS-ARCH-1: "-target-abi" "o32" // -// RUN: %clang -target mips-linux-gnu -### -c %s \ +// RUN: %clang --target=mips-linux-gnu -### -c %s \ // RUN: -march=mips2 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS-ARCH-2 %s // MIPS-ARCH-2: "-target-cpu" "mips2" // MIPS-ARCH-2: "-target-abi" "o32" // -// RUN: %clang -target mips-linux-gnu -### -c %s \ +// RUN: %clang --target=mips-linux-gnu -### -c %s \ // RUN: -march=mips3 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS-ARCH-3 %s // MIPS-ARCH-3: "-target-cpu" "mips3" // MIPS-ARCH-3: "-target-abi" "o32" // -// RUN: %clang -target mips-linux-gnu -### -c %s \ +// RUN: %clang --target=mips-linux-gnu -### -c %s \ // RUN: -march=mips4 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS-ARCH-4 %s // MIPS-ARCH-4: "-target-cpu" "mips4" // MIPS-ARCH-4: "-target-abi" "o32" // -// RUN: %clang -target mips-linux-gnu -### -c %s \ +// RUN: %clang --target=mips-linux-gnu -### -c %s \ // RUN: -march=mips5 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS-ARCH-5 %s // MIPS-ARCH-5: "-target-cpu" "mips5" // MIPS-ARCH-5: "-target-abi" "o32" // -// RUN: %clang -target mips-linux-gnu -### -c %s \ +// RUN: %clang --target=mips-linux-gnu -### -c %s \ // RUN: -march=mips32 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS-ARCH-32 %s // MIPS-ARCH-32: "-target-cpu" "mips32" // MIPS-ARCH-32: "-target-abi" "o32" // -// RUN: %clang -target mips-linux-gnu -### -c %s \ +// RUN: %clang --target=mips-linux-gnu -### -c %s \ // RUN: -march=mips32r2 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS-ARCH-32R2 %s // MIPS-ARCH-32R2: "-target-cpu" "mips32r2" // MIPS-ARCH-32R2: "-target-abi" "o32" // -// RUN: %clang -target mips-linux-gnu -### -c %s \ +// RUN: %clang --target=mips-linux-gnu -### -c %s \ // RUN: -march=p5600 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS-ARCH-P5600 %s // MIPS-ARCH-P5600: "-target-cpu" "p5600" // MIPS-ARCH-P5600: "-target-abi" "o32" // -// RUN: not %clang -target mips-linux-gnu -c %s \ +// RUN: not %clang --target=mips-linux-gnu -c %s \ // RUN: -march=p5600 -mabi=64 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS-ARCH-P5600-N64 %s // MIPS-ARCH-P5600-N64: error: ABI 'n64' is not supported on CPU 'p5600' // -// RUN: %clang -target mips-linux-gnu -### -c %s \ +// RUN: %clang --target=mips-linux-gnu -### -c %s \ // RUN: -march=mips64 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS-ARCH-3264 %s // MIPS-ARCH-3264: "-target-cpu" "mips64" // MIPS-ARCH-3264: "-target-abi" "o32" // -// RUN: %clang -target mips64-linux-gnu -### -c %s \ +// RUN: %clang --target=mips64-linux-gnu -### -c %s \ // RUN: -march=mips64 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS-ARCH-64 %s // MIPS-ARCH-64: "-target-cpu" "mips64" // MIPS-ARCH-64: "-target-abi" "n64" // -// RUN: %clang -target mips64-linux-gnu -### -c %s \ +// RUN: %clang --target=mips64-linux-gnu -### -c %s \ // RUN: -march=mips64r2 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS-ARCH-64R2 %s // MIPS-ARCH-64R2: "-target-cpu" "mips64r2" // MIPS-ARCH-64R2: "-target-abi" "n64" // -// RUN: %clang -target mips64-linux-gnu -### -c %s \ +// RUN: %clang --target=mips64-linux-gnu -### -c %s \ // RUN: -march=octeon 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS-ARCH-OCTEON %s // MIPS-ARCH-OCTEON: "-target-cpu" "octeon" // MIPS-ARCH-OCTEON: "-target-abi" "n64" // -// RUN: %clang -target mips64-linux-gnu -### -c %s \ +// RUN: %clang --target=mips64-linux-gnu -### -c %s \ // RUN: -march=octeon+ 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS-ARCH-OCTEONP %s // MIPS-ARCH-OCTEONP: "-target-cpu" "octeon+" // MIPS-ARCH-OCTEONP: "-target-abi" "n64" // -// RUN: not %clang -target mips64-linux-gnu -c %s \ +// RUN: not %clang --target=mips64-linux-gnu -c %s \ // RUN: -march=mips32 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS-ARCH-6432 %s // MIPS-ARCH-6432: error: ABI 'n64' is not supported on CPU 'mips32' // -// RUN: not %clang -target mips-linux-gnu -c %s \ +// RUN: not %clang --target=mips-linux-gnu -c %s \ // RUN: -march=unknown 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS-ARCH-UNKNOWN %s // MIPS-ARCH-UNKNOWN: error: unknown target CPU 'unknown' // Check adjusting of target triple accordingly to `-mabi` option. -// RUN: %clang -target mips64-linux-gnuabi64 -mabi=32 -### %s 2>&1 \ +// RUN: %clang --target=mips64-linux-gnuabi64 -mabi=32 -### %s 2>&1 \ // RUN: | FileCheck -check-prefix=TARGET-O32 %s // TARGET-O32: "-triple" "mips-unknown-linux-gnu" // TARGET-O32: "-target-cpu" "mips32r2" @@ -171,7 +171,7 @@ // TARGET-O32: ld{{(.exe)?}}" // TARGET-O32: "-m" "elf32btsmip" -// RUN: %clang -target mips-linux-gnu -mabi=n32 -### %s 2>&1 \ +// RUN: %clang --target=mips-linux-gnu -mabi=n32 -### %s 2>&1 \ // RUN: | FileCheck -check-prefix=TARGET-N32 %s // TARGET-N32: "-triple" "mips64-unknown-linux-gnuabin32" // TARGET-N32: "-target-cpu" "mips64r2" @@ -179,7 +179,7 @@ // TARGET-N32: ld{{(.exe)?}}" // TARGET-N32: "-m" "elf32btsmipn32" -// RUN: %clang -target mips-linux-gnu -mabi=64 -### %s 2>&1 \ +// RUN: %clang --target=mips-linux-gnu -mabi=64 -### %s 2>&1 \ // RUN: | FileCheck -check-prefix=TARGET-N64 %s // TARGET-N64: "-triple" "mips64-unknown-linux-gnuabi64" // TARGET-N64: "-target-cpu" "mips64r2" diff --git a/clang/test/Driver/mips-abicalls-error.c b/clang/test/Driver/mips-abicalls-error.c index 03ef68b02de6d..a576208a16edb 100644 --- a/clang/test/Driver/mips-abicalls-error.c +++ b/clang/test/Driver/mips-abicalls-error.c @@ -1,2 +1,2 @@ -// RUN: not %clang -c -target mips64-linux-gnu -fPIC -mno-abicalls %s 2>&1 | FileCheck %s +// RUN: not %clang -c --target=mips64-linux-gnu -fPIC -mno-abicalls %s 2>&1 | FileCheck %s // CHECK: error: position-independent code requires '-mabicalls' diff --git a/clang/test/Driver/mips-abicalls-warning.c b/clang/test/Driver/mips-abicalls-warning.c index 09f341eb9a33c..f65d831127072 100644 --- a/clang/test/Driver/mips-abicalls-warning.c +++ b/clang/test/Driver/mips-abicalls-warning.c @@ -1,30 +1,30 @@ // REQUIRES: mips-registered-target -// RUN: %clang -### -c -target mips64-mti-elf -fno-pic %s 2>&1 | FileCheck -check-prefix=CHECK-PIC1-IMPLICIT %s +// RUN: %clang -### -c --target=mips64-mti-elf -fno-pic %s 2>&1 | FileCheck -check-prefix=CHECK-PIC1-IMPLICIT %s // CHECK-PIC1-IMPLICIT: warning: ignoring '-fno-pic' option as it cannot be used with implicit usage of -mabicalls and the N64 ABI -// RUN: %clang -### -c -target mips64-mti-elf -fno-pic -mabicalls %s 2>&1 | FileCheck -check-prefix=CHECK-PIC1-EXPLICIT %s +// RUN: %clang -### -c --target=mips64-mti-elf -fno-pic -mabicalls %s 2>&1 | FileCheck -check-prefix=CHECK-PIC1-EXPLICIT %s // CHECK-PIC1-EXPLICIT: warning: ignoring '-fno-pic' option as it cannot be used with -mabicalls and the N64 ABI -// RUN: %clang -### -c -target mips64-mti-elf -fno-PIC %s 2>&1 | FileCheck -check-prefix=CHECK-PIC2-IMPLICIT %s +// RUN: %clang -### -c --target=mips64-mti-elf -fno-PIC %s 2>&1 | FileCheck -check-prefix=CHECK-PIC2-IMPLICIT %s // CHECK-PIC2-IMPLICIT: warning: ignoring '-fno-PIC' option as it cannot be used with implicit usage of -mabicalls and the N64 ABI -// RUN: %clang -### -c -target mips64-mti-elf -fno-PIC -mabicalls %s 2>&1 | FileCheck -check-prefix=CHECK-PIC2-EXPLICIT %s +// RUN: %clang -### -c --target=mips64-mti-elf -fno-PIC -mabicalls %s 2>&1 | FileCheck -check-prefix=CHECK-PIC2-EXPLICIT %s // CHECK-PIC2-EXPLICIT: warning: ignoring '-fno-PIC' option as it cannot be used with -mabicalls and the N64 ABI -// RUN: %clang -### -c -target mips64-mti-elf -fno-pie %s 2>&1 | FileCheck -check-prefix=CHECK-PIE1-IMPLICIT %s +// RUN: %clang -### -c --target=mips64-mti-elf -fno-pie %s 2>&1 | FileCheck -check-prefix=CHECK-PIE1-IMPLICIT %s // CHECK-PIE1-IMPLICIT: warning: ignoring '-fno-pie' option as it cannot be used with implicit usage of -mabicalls and the N64 ABI -// RUN: %clang -### -c -target mips64-mti-elf -fno-pie -mabicalls %s 2>&1 | FileCheck -check-prefix=CHECK-PIE1-EXPLICIT %s +// RUN: %clang -### -c --target=mips64-mti-elf -fno-pie -mabicalls %s 2>&1 | FileCheck -check-prefix=CHECK-PIE1-EXPLICIT %s // CHECK-PIE1-EXPLICIT: warning: ignoring '-fno-pie' option as it cannot be used with -mabicalls and the N64 ABI -// RUN: %clang -### -c -target mips64-mti-elf -fno-PIE %s 2>&1 | FileCheck -check-prefix=CHECK-PIE2-IMPLICIT %s +// RUN: %clang -### -c --target=mips64-mti-elf -fno-PIE %s 2>&1 | FileCheck -check-prefix=CHECK-PIE2-IMPLICIT %s // CHECK-PIE2-IMPLICIT: warning: ignoring '-fno-PIE' option as it cannot be used with implicit usage of -mabicalls and the N64 ABI -// RUN: %clang -### -c -target mips64-mti-elf -fno-PIE -mabicalls %s 2>&1 | FileCheck -check-prefix=CHECK-PIE2-EXPLICIT %s +// RUN: %clang -### -c --target=mips64-mti-elf -fno-PIE -mabicalls %s 2>&1 | FileCheck -check-prefix=CHECK-PIE2-EXPLICIT %s // CHECK-PIE2-EXPLICIT: warning: ignoring '-fno-PIE' option as it cannot be used with -mabicalls and the N64 ABI -// RUN: %clang -### -c -target mips-mti-elf -mlong-calls %s 2>&1 | FileCheck -check-prefix=LONGCALL-IMP %s +// RUN: %clang -### -c --target=mips-mti-elf -mlong-calls %s 2>&1 | FileCheck -check-prefix=LONGCALL-IMP %s // LONGCALL-IMP: warning: ignoring '-mlong-calls' option as it is not currently supported with the implicit usage of -mabicalls -// RUN: %clang -### -c -target mips-mti-elf -mlong-calls -mabicalls %s 2>&1 | FileCheck -check-prefix=LONGCALL-EXP %s +// RUN: %clang -### -c --target=mips-mti-elf -mlong-calls -mabicalls %s 2>&1 | FileCheck -check-prefix=LONGCALL-EXP %s // LONGCALL-EXP: warning: ignoring '-mlong-calls' option as it is not currently supported with -mabicalls diff --git a/clang/test/Driver/mips-as.c b/clang/test/Driver/mips-as.c index a3399f1078fcd..fc366f529ffbb 100644 --- a/clang/test/Driver/mips-as.c +++ b/clang/test/Driver/mips-as.c @@ -1,275 +1,275 @@ // Check passing options to the assembler for MIPS targets. // -// RUN: %clang -target mips-linux-gnu -### \ -// RUN: -no-integrated-as -fno-pic -c %s 2>&1 \ +// RUN: %clang --target=mips-linux-gnu -### \ +// RUN: -fno-integrated-as -fno-pic -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS32R2-EB-AS %s -// RUN: %clang -target mipsel-linux-gnu -### \ -// RUN: -no-integrated-as -fno-pic -c -EB %s 2>&1 \ +// RUN: %clang --target=mipsel-linux-gnu -### \ +// RUN: -fno-integrated-as -fno-pic -c -EB %s 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS32R2-EB-AS %s // MIPS32R2-EB-AS: as{{(.exe)?}}" "-march" "mips32r2" "-mabi" "32" "-mno-shared" "-call_nonpic" "-EB" // MIPS32R2-EB-AS-NOT: "{{[ A-Za-z\\\/]*}}as{{(.exe)?}}{{.*}}"-KPIC" // -// RUN: %clang -target mips-linux-gnu -### \ -// RUN: -no-integrated-as -fPIC -c %s 2>&1 \ +// RUN: %clang --target=mips-linux-gnu -### \ +// RUN: -fno-integrated-as -fPIC -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS32R2-EB-PIC %s // MIPS32R2-EB-PIC: as{{(.exe)?}}" "-march" "mips32r2" "-mabi" "32" "-call_nonpic" "-EB" // MIPS32R2-EB-PIC: "-KPIC" // -// RUN: %clang -target mipsel-linux-gnu -### \ -// RUN: -no-integrated-as -fno-pic -c %s 2>&1 \ +// RUN: %clang --target=mipsel-linux-gnu -### \ +// RUN: -fno-integrated-as -fno-pic -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS32R2-DEF-EL-AS %s // MIPS32R2-DEF-EL-AS: as{{(.exe)?}}" "-march" "mips32r2" "-mabi" "32" "-mno-shared" "-call_nonpic" "-EL" // -// RUN: %clang -target mips64-linux-gnu -### \ -// RUN: -no-integrated-as -fno-pic -mno-abicalls -c %s 2>&1 \ +// RUN: %clang --target=mips64-linux-gnu -### \ +// RUN: -fno-integrated-as -fno-pic -mno-abicalls -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS64R2-EB-AS %s // MIPS64R2-EB-AS: as{{(.exe)?}}" "-march" "mips64r2" "-mabi" "64" "-mno-shared" "-EB" // -// RUN: %clang -target mips64-linux-gnu -### \ -// RUN: -no-integrated-as -fno-pic -c %s 2>&1 \ +// RUN: %clang --target=mips64-linux-gnu -### \ +// RUN: -fno-integrated-as -fno-pic -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS64R2-EB-AS-PIC %s // MIPS64R2-EB-AS-PIC: as{{(.exe)?}}" "-march" "mips64r2" "-mabi" "64" "-EB" "-KPIC" // -// RUN: %clang -target mips64el-linux-gnu -### \ -// RUN: -no-integrated-as -fno-pic -c -fno-pic -mno-abicalls %s 2>&1 \ +// RUN: %clang --target=mips64el-linux-gnu -### \ +// RUN: -fno-integrated-as -fno-pic -c -fno-pic -mno-abicalls %s 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS64R2-DEF-EL-AS %s // MIPS64R2-DEF-EL-AS: as{{(.exe)?}}" "-march" "mips64r2" "-mabi" "64" "-mno-shared" "-EL" // -// RUN: %clang -target mips64el-linux-gnu -### \ -// RUN: -no-integrated-as -c %s 2>&1 \ +// RUN: %clang --target=mips64el-linux-gnu -### \ +// RUN: -fno-integrated-as -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS64R2-DEF-EL-AS-PIC %s // MIPS64R2-DEF-EL-AS-PIC: as{{(.exe)?}}" "-march" "mips64r2" "-mabi" "64" "-EL" "-KPIC" // -// RUN: %clang -target mips64-linux-gnu -mabi=n32 -### \ -// RUN: -no-integrated-as -c %s 2>&1 \ +// RUN: %clang --target=mips64-linux-gnu -mabi=n32 -### \ +// RUN: -fno-integrated-as -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS-N32-PIC %s // MIPS-N32-PIC: as{{(.exe)?}}" "-march" "mips64r2" "-mabi" "n32" "-call_nonpic" "-EB" "-KPIC" // -// RUN: %clang -target mips64-linux-gnu -mabi=n32 -### \ -// RUN: -no-integrated-as -fno-pic -c %s -fno-pic 2>&1 \ +// RUN: %clang --target=mips64-linux-gnu -mabi=n32 -### \ +// RUN: -fno-integrated-as -fno-pic -c %s -fno-pic 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS-N32 %s // MIPS-N32: as{{(.exe)?}}" "-march" "mips64r2" "-mabi" "n32" "-mno-shared" "-call_nonpic" "-EB" // -// RUN: %clang -target mipsel-linux-gnu -mabi=32 -### \ -// RUN: -no-integrated-as -fno-pic -c %s 2>&1 \ +// RUN: %clang --target=mipsel-linux-gnu -mabi=32 -### \ +// RUN: -fno-integrated-as -fno-pic -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS32R2-EL-AS %s -// RUN: %clang -target mips-linux-gnu -mabi=32 -### \ -// RUN: -no-integrated-as -fno-pic -c %s -EL 2>&1 \ +// RUN: %clang --target=mips-linux-gnu -mabi=32 -### \ +// RUN: -fno-integrated-as -fno-pic -c %s -EL 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS32R2-EL-AS %s // MIPS32R2-EL-AS: as{{(.exe)?}}" "-march" "mips32r2" "-mabi" "32" "-mno-shared" "-call_nonpic" "-EL" // -// RUN: %clang -target mips64el-linux-gnu -mabi=64 -### \ -// RUN: -no-integrated-as -fno-pic -c %s 2>&1 \ +// RUN: %clang --target=mips64el-linux-gnu -mabi=64 -### \ +// RUN: -fno-integrated-as -fno-pic -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS64R2-EL-AS-PIC %s // MIPS64R2-EL-AS-PIC: as{{(.exe)?}}" "-march" "mips64r2" "-mabi" "64" "-EL" "-KPIC" // -// RUN: %clang -target mips64el-linux-gnu -mabi=64 -### \ -// RUN: -no-integrated-as -fno-pic -c %s -fno-pic -mno-abicalls 2>&1 \ +// RUN: %clang --target=mips64el-linux-gnu -mabi=64 -### \ +// RUN: -fno-integrated-as -fno-pic -c %s -fno-pic -mno-abicalls 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS64R2-EL-AS %s // MIPS64R2-EL-AS: as{{(.exe)?}}" "-march" "mips64r2" "-mabi" "64" "-mno-shared" "-EL" // -// RUN: %clang -target mips-linux-gnu -march=mips32r2 -### \ -// RUN: -no-integrated-as -fno-pic -c %s 2>&1 \ +// RUN: %clang --target=mips-linux-gnu -march=mips32r2 -### \ +// RUN: -fno-integrated-as -fno-pic -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS-32R2 %s // MIPS-32R2: as{{(.exe)?}}" "-march" "mips32r2" "-mabi" "32" "-mno-shared" "-call_nonpic" "-EB" // -// RUN: %clang -target mips-linux-gnu -march=p5600 -### \ -// RUN: -no-integrated-as -fno-pic -c %s 2>&1 \ +// RUN: %clang --target=mips-linux-gnu -march=p5600 -### \ +// RUN: -fno-integrated-as -fno-pic -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS-P5600 %s // MIPS-P5600: as{{(.exe)?}}" "-march" "p5600" "-mabi" "32" "-mno-shared" "-call_nonpic" "-EB" // -// RUN: %clang -target mips64-linux-gnu -march=octeon -### \ -// RUN: -no-integrated-as -fno-pic -c %s 2>&1 \ +// RUN: %clang --target=mips64-linux-gnu -march=octeon -### \ +// RUN: -fno-integrated-as -fno-pic -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS-OCTEON-PIC %s // MIPS-OCTEON-PIC: as{{(.exe)?}}" "-march" "octeon" "-mabi" "64" "-EB" "-KPIC" // -// RUN: %clang -target mips64-linux-gnu -march=octeon -### \ -// RUN: -no-integrated-as -fno-pic -c %s -fno-pic -mno-abicalls 2>&1 \ +// RUN: %clang --target=mips64-linux-gnu -march=octeon -### \ +// RUN: -fno-integrated-as -fno-pic -c %s -fno-pic -mno-abicalls 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS-OCTEON %s // MIPS-OCTEON: as{{(.exe)?}}" "-march" "octeon" "-mabi" "64" "-mno-shared" "-EB" // -// RUN: %clang -target mips64-linux-gnu -march=octeon+ -### \ -// RUN: -no-integrated-as -fno-pic -c %s 2>&1 \ +// RUN: %clang --target=mips64-linux-gnu -march=octeon+ -### \ +// RUN: -fno-integrated-as -fno-pic -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS-OCTEONP-PIC %s // MIPS-OCTEONP-PIC: as{{(.exe)?}}" "-march" "octeon+" "-mabi" "64" "-EB" "-KPIC" // -// RUN: %clang -target mips64-linux-gnu -march=octeon+ -### \ -// RUN: -no-integrated-as -fno-pic -c %s -fno-pic -mno-abicalls 2>&1 \ +// RUN: %clang --target=mips64-linux-gnu -march=octeon+ -### \ +// RUN: -fno-integrated-as -fno-pic -c %s -fno-pic -mno-abicalls 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS-OCTEONP %s // MIPS-OCTEONP: as{{(.exe)?}}" "-march" "octeon+" "-mabi" "64" "-mno-shared" "-EB" // -// RUN: %clang -target mips-linux-gnu -mips1 -### \ -// RUN: -no-integrated-as -fno-pic -c %s 2>&1 \ +// RUN: %clang --target=mips-linux-gnu -mips1 -### \ +// RUN: -fno-integrated-as -fno-pic -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS-ALIAS-1 %s // MIPS-ALIAS-1: as{{(.exe)?}}" "-march" "mips1" "-mabi" "32" "-mno-shared" "-call_nonpic" "-EB" // -// RUN: %clang -target mips-linux-gnu -mips2 -### \ -// RUN: -no-integrated-as -fno-pic -c %s 2>&1 \ +// RUN: %clang --target=mips-linux-gnu -mips2 -### \ +// RUN: -fno-integrated-as -fno-pic -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS-ALIAS-2 %s // MIPS-ALIAS-2: as{{(.exe)?}}" "-march" "mips2" "-mabi" "32" "-mno-shared" "-call_nonpic" "-EB" // -// RUN: %clang -target mips-linux-gnu -mips3 -### \ -// RUN: -no-integrated-as -fno-pic -c %s 2>&1 \ +// RUN: %clang --target=mips-linux-gnu -mips3 -### \ +// RUN: -fno-integrated-as -fno-pic -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS-ALIAS-3 %s // MIPS-ALIAS-3: as{{(.exe)?}}" "-march" "mips3" "-mabi" "32" "-mno-shared" "-call_nonpic" "-EB" // -// RUN: %clang -target mips-linux-gnu -mips4 -### \ -// RUN: -no-integrated-as -fno-pic -c %s 2>&1 \ +// RUN: %clang --target=mips-linux-gnu -mips4 -### \ +// RUN: -fno-integrated-as -fno-pic -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS-ALIAS-4 %s // MIPS-ALIAS-4: as{{(.exe)?}}" "-march" "mips4" "-mabi" "32" "-mno-shared" "-call_nonpic" "-EB" // -// RUN: %clang -target mips-linux-gnu -mips5 -### \ -// RUN: -no-integrated-as -fno-pic -c %s 2>&1 \ +// RUN: %clang --target=mips-linux-gnu -mips5 -### \ +// RUN: -fno-integrated-as -fno-pic -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS-ALIAS-5 %s // MIPS-ALIAS-5: as{{(.exe)?}}" "-march" "mips5" "-mabi" "32" "-mno-shared" "-call_nonpic" "-EB" // -// RUN: %clang -target mips-linux-gnu -mips32 -### \ -// RUN: -no-integrated-as -fno-pic -c %s 2>&1 \ +// RUN: %clang --target=mips-linux-gnu -mips32 -### \ +// RUN: -fno-integrated-as -fno-pic -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS-ALIAS-32 %s // MIPS-ALIAS-32: as{{(.exe)?}}" "-march" "mips32" "-mabi" "32" "-mno-shared" "-call_nonpic" "-EB" // -// RUN: %clang -target mips-linux-gnu -mips32r2 -### \ -// RUN: -no-integrated-as -fno-pic -c %s 2>&1 \ +// RUN: %clang --target=mips-linux-gnu -mips32r2 -### \ +// RUN: -fno-integrated-as -fno-pic -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS-ALIAS-32R2 %s // MIPS-ALIAS-32R2: as{{(.exe)?}}" "-march" "mips32r2" "-mabi" "32" "-mno-shared" "-call_nonpic" "-EB" // -// RUN: %clang -target mips-linux-gnu -mips32r3 -### \ -// RUN: -no-integrated-as -fno-pic -c %s 2>&1 \ +// RUN: %clang --target=mips-linux-gnu -mips32r3 -### \ +// RUN: -fno-integrated-as -fno-pic -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS-ALIAS-32R3 %s // MIPS-ALIAS-32R3: as{{(.exe)?}}" "-march" "mips32r3" "-mabi" "32" "-mno-shared" "-call_nonpic" "-EB" // -// RUN: %clang -target mips-linux-gnu -mips32r5 -### \ -// RUN: -no-integrated-as -fno-pic -c %s 2>&1 \ +// RUN: %clang --target=mips-linux-gnu -mips32r5 -### \ +// RUN: -fno-integrated-as -fno-pic -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS-ALIAS-32R5 %s // MIPS-ALIAS-32R5: as{{(.exe)?}}" "-march" "mips32r5" "-mabi" "32" "-mno-shared" "-call_nonpic" "-EB" // -// RUN: %clang -target mips-linux-gnu -mips32r6 -### \ -// RUN: -no-integrated-as -fno-pic -c %s 2>&1 \ +// RUN: %clang --target=mips-linux-gnu -mips32r6 -### \ +// RUN: -fno-integrated-as -fno-pic -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS-ALIAS-32R6 %s // MIPS-ALIAS-32R6: as{{(.exe)?}}" "-march" "mips32r6" "-mabi" "32" "-mno-shared" "-call_nonpic" "-EB" // -// RUN: %clang -target mips64-linux-gnu -mips64 -### \ -// RUN: -no-integrated-as -fno-pic -c %s 2>&1 \ +// RUN: %clang --target=mips64-linux-gnu -mips64 -### \ +// RUN: -fno-integrated-as -fno-pic -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS-ALIAS-64-PIC %s // MIPS-ALIAS-64-PIC: as{{(.exe)?}}" "-march" "mips64" "-mabi" "64" "-EB" "-KPIC" // -// RUN: %clang -target mips64-linux-gnu -mips64 -### \ -// RUN: -no-integrated-as -fno-pic -c -fno-pic -mno-abicalls %s 2>&1 \ +// RUN: %clang --target=mips64-linux-gnu -mips64 -### \ +// RUN: -fno-integrated-as -fno-pic -c -fno-pic -mno-abicalls %s 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS-ALIAS-64 %s // MIPS-ALIAS-64: as{{(.exe)?}}" "-march" "mips64" "-mabi" "64" "-mno-shared" "-EB" // -// RUN: %clang -target mips64-linux-gnu -mips64r2 -### \ -// RUN: -no-integrated-as -fno-pic -c %s 2>&1 \ +// RUN: %clang --target=mips64-linux-gnu -mips64r2 -### \ +// RUN: -fno-integrated-as -fno-pic -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS-ALIAS-64R2-PIC %s // MIPS-ALIAS-64R2-PIC: as{{(.exe)?}}" "-march" "mips64r2" "-mabi" "64" "-EB" "-KPIC" // -// RUN: %clang -target mips64-linux-gnu -mips64r3 -### \ -// RUN: -no-integrated-as -fno-pic -c %s 2>&1 \ +// RUN: %clang --target=mips64-linux-gnu -mips64r3 -### \ +// RUN: -fno-integrated-as -fno-pic -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS-ALIAS-64R3-PIC %s // MIPS-ALIAS-64R3-PIC: as{{(.exe)?}}" "-march" "mips64r3" "-mabi" "64" "-EB" "-KPIC" // -// RUN: %clang -target mips64-linux-gnu -mips64r3 -### \ -// RUN: -no-integrated-as -fno-pic -c %s -fno-pic -mno-abicalls 2>&1 \ +// RUN: %clang --target=mips64-linux-gnu -mips64r3 -### \ +// RUN: -fno-integrated-as -fno-pic -c %s -fno-pic -mno-abicalls 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS-ALIAS-64R3 %s // MIPS-ALIAS-64R3: as{{(.exe)?}}" "-march" "mips64r3" "-mabi" "64" "-mno-shared" "-EB" // -// RUN: %clang -target mips64-linux-gnu -mips64r5 -### \ -// RUN: -no-integrated-as -fno-pic -c %s 2>&1 \ +// RUN: %clang --target=mips64-linux-gnu -mips64r5 -### \ +// RUN: -fno-integrated-as -fno-pic -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS-ALIAS-64R5-PIC %s // MIPS-ALIAS-64R5-PIC: as{{(.exe)?}}" "-march" "mips64r5" "-mabi" "64" "-EB" "-KPIC" // -// RUN: %clang -target mips64-linux-gnu -mips64r5 -### \ -// RUN: -no-integrated-as -fno-pic -c %s -fno-pic -mno-abicalls 2>&1 \ +// RUN: %clang --target=mips64-linux-gnu -mips64r5 -### \ +// RUN: -fno-integrated-as -fno-pic -c %s -fno-pic -mno-abicalls 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS-ALIAS-64R5 %s // MIPS-ALIAS-64R5: as{{(.exe)?}}" "-march" "mips64r5" "-mabi" "64" "-mno-shared" "-EB" // -// RUN: %clang -target mips64-linux-gnu -mips64r6 -### \ -// RUN: -no-integrated-as -fno-pic -c %s 2>&1 \ +// RUN: %clang --target=mips64-linux-gnu -mips64r6 -### \ +// RUN: -fno-integrated-as -fno-pic -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS-ALIAS-64R6-PIC %s // MIPS-ALIAS-64R6-PIC: as{{(.exe)?}}" "-march" "mips64r6" "-mabi" "64" "-EB" "-KPIC" // -// RUN: %clang -target mips64-linux-gnu -mips64r6 -### \ -// RUN: -no-integrated-as -fno-pic -c %s -fno-pic -mno-abicalls 2>&1 \ +// RUN: %clang --target=mips64-linux-gnu -mips64r6 -### \ +// RUN: -fno-integrated-as -fno-pic -c %s -fno-pic -mno-abicalls 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS-ALIAS-64R6 %s // MIPS-ALIAS-64R6: as{{(.exe)?}}" "-march" "mips64r6" "-mabi" "64" "-mno-shared" "-EB" // -// RUN: %clang -target mips-linux-gnu -mno-mips16 -mips16 -### \ -// RUN: -no-integrated-as -fno-pic -c %s 2>&1 \ +// RUN: %clang --target=mips-linux-gnu -mno-mips16 -mips16 -### \ +// RUN: -fno-integrated-as -fno-pic -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS-16 %s // MIPS-16: as{{(.exe)?}}" "-march" "mips32r2" "-mabi" "32" "-mno-shared" "-call_nonpic" "-EB" "-mfpxx" "-mips16" // -// RUN: %clang -target mips-linux-gnu -mips16 -mno-mips16 -### \ -// RUN: -no-integrated-as -fno-pic -c %s 2>&1 \ +// RUN: %clang --target=mips-linux-gnu -mips16 -mno-mips16 -### \ +// RUN: -fno-integrated-as -fno-pic -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS-N16 %s // MIPS-N16: as{{(.exe)?}}" // MIPS-N16: -no-mips16 // -// RUN: %clang -target mips-linux-gnu -mno-micromips -mmicromips -### \ -// RUN: -no-integrated-as -fno-pic -c %s 2>&1 \ +// RUN: %clang --target=mips-linux-gnu -mno-micromips -mmicromips -### \ +// RUN: -fno-integrated-as -fno-pic -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS-MICRO %s // MIPS-MICRO: as{{(.exe)?}}" "-march" "mips32r2" "-mabi" "32" "-mno-shared" "-call_nonpic" "-EB" "-mfpxx" "-mmicromips" // -// RUN: %clang -target mips-linux-gnu -mmicromips -mno-micromips -### \ -// RUN: -no-integrated-as -fno-pic -c %s 2>&1 \ +// RUN: %clang --target=mips-linux-gnu -mmicromips -mno-micromips -### \ +// RUN: -fno-integrated-as -fno-pic -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS-NMICRO %s // MIPS-NMICRO: as{{(.exe)?}}" // MIPS-NMICRO-NOT: {{[A-Za-z\\\/]*}}as{{(.exe)?}}{{.*}}"-mmicromips" // -// RUN: %clang -target mips-linux-gnu -mno-dsp -mdsp -### \ -// RUN: -no-integrated-as -fno-pic -c %s 2>&1 \ +// RUN: %clang --target=mips-linux-gnu -mno-dsp -mdsp -### \ +// RUN: -fno-integrated-as -fno-pic -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS-DSP %s // MIPS-DSP: as{{(.exe)?}}" "-march" "mips32r2" "-mabi" "32" "-mno-shared" "-call_nonpic" "-EB" "-mfpxx" "-mdsp" // -// RUN: %clang -target mips-linux-gnu -mdsp -mno-dsp -### \ -// RUN: -no-integrated-as -fno-pic -c %s 2>&1 \ +// RUN: %clang --target=mips-linux-gnu -mdsp -mno-dsp -### \ +// RUN: -fno-integrated-as -fno-pic -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS-NDSP %s // MIPS-NDSP: as{{(.exe)?}}" // MIPS-NDSP-NOT: "{{[ A-Za-z\\\/]*}}as{{(.exe)?}}{{.*}}"-mdsp" // -// RUN: %clang -target mips-linux-gnu -mno-dspr2 -mdspr2 -### \ -// RUN: -no-integrated-as -fno-pic -c %s 2>&1 \ +// RUN: %clang --target=mips-linux-gnu -mno-dspr2 -mdspr2 -### \ +// RUN: -fno-integrated-as -fno-pic -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS-DSPR2 %s // MIPS-DSPR2: as{{(.exe)?}}" "-march" "mips32r2" "-mabi" "32" "-mno-shared" "-call_nonpic" "-EB" "-mfpxx" "-mdspr2" // -// RUN: %clang -target mips-linux-gnu -mdspr2 -mno-dspr2 -### \ -// RUN: -no-integrated-as -fno-pic -c %s 2>&1 \ +// RUN: %clang --target=mips-linux-gnu -mdspr2 -mno-dspr2 -### \ +// RUN: -fno-integrated-as -fno-pic -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS-NDSPR2 %s // MIPS-NDSPR2: as{{(.exe)?}}" // MIPS-NDSPR2-NOT: "{{[ A-Za-z\\\/]*}}as{{(.exe)?}}{{.*}}"-mdspr2" // -// RUN: %clang -target mips-linux-gnu -mnan=legacy -mnan=2008 -### \ -// RUN: -no-integrated-as -fno-pic -c %s 2>&1 \ +// RUN: %clang --target=mips-linux-gnu -mnan=legacy -mnan=2008 -### \ +// RUN: -fno-integrated-as -fno-pic -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS-NAN2008 %s // MIPS-NAN2008: as{{(.exe)?}}" "-march" "mips32r2" "-mabi" "32" "-mno-shared" "-call_nonpic" "-EB" "-mnan=2008" // -// RUN: %clang -target mips-linux-gnu -mnan=2008 -mnan=legacy -### \ -// RUN: -no-integrated-as -fno-pic -c %s 2>&1 \ +// RUN: %clang --target=mips-linux-gnu -mnan=2008 -mnan=legacy -### \ +// RUN: -fno-integrated-as -fno-pic -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS-NAN-LEGACY %s // MIPS-NAN-LEGACY: as{{(.exe)?}}" // MIPS-NAN-LEGACY-NOT: "{{[ A-Za-z\\\/]*}}as{{(.exe)?}}{{.*}}"-mnan={{.*}}" // -// RUN: %clang -target mips-linux-gnu -mfp64 -mfpxx -mfp32 -### \ -// RUN: -no-integrated-as -fno-pic -c %s 2>&1 \ +// RUN: %clang --target=mips-linux-gnu -mfp64 -mfpxx -mfp32 -### \ +// RUN: -fno-integrated-as -fno-pic -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS-MFP32 %s // MIPS-MFP32: as{{(.exe)?}}" "-march" "mips32r2" "-mabi" "32" "-mno-shared" "-call_nonpic" "-EB" "-mfp32" // -// RUN: %clang -target mips-linux-gnu -mfp32 -mfp64 -mfpxx -### \ -// RUN: -no-integrated-as -fno-pic -c %s 2>&1 \ +// RUN: %clang --target=mips-linux-gnu -mfp32 -mfp64 -mfpxx -### \ +// RUN: -fno-integrated-as -fno-pic -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS-MFPXX %s // MIPS-MFPXX: as{{(.exe)?}}" "-march" "mips32r2" "-mabi" "32" "-mno-shared" "-call_nonpic" "-EB" "-mfpxx" // -// RUN: %clang -target mips-linux-gnu -mfpxx -mfp32 -mfp64 -### \ -// RUN: -no-integrated-as -fno-pic -c %s 2>&1 \ +// RUN: %clang --target=mips-linux-gnu -mfpxx -mfp32 -mfp64 -### \ +// RUN: -fno-integrated-as -fno-pic -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS-MFP64 %s // MIPS-MFP64: as{{(.exe)?}}" "-march" "mips32r2" "-mabi" "32" "-mno-shared" "-call_nonpic" "-EB" "-mfp64" // -// RUN: %clang -target mips-linux-gnu -mno-msa -mmsa -### \ -// RUN: -no-integrated-as -fno-pic -c %s 2>&1 \ +// RUN: %clang --target=mips-linux-gnu -mno-msa -mmsa -### \ +// RUN: -fno-integrated-as -fno-pic -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS-MSA %s // MIPS-MSA: as{{(.exe)?}}" "-march" "mips32r2" "-mabi" "32" "-mno-shared" "-call_nonpic" "-EB" "-mmsa" // -// RUN: %clang -target mips-linux-gnu -mmsa -mno-msa -### \ -// RUN: -no-integrated-as -fno-pic -c %s 2>&1 \ +// RUN: %clang --target=mips-linux-gnu -mmsa -mno-msa -### \ +// RUN: -fno-integrated-as -fno-pic -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=MIPS-NMSA %s // MIPS-NMSA: as{{(.exe)?}}" // MIPS-NMSA-NOT: "{{[ A-Za-z\\\/]*}}as{{(.exe)?}}{{.*}}"-mmsa" @@ -277,137 +277,137 @@ // We've already tested MIPS32r2 and MIPS64r2 thoroughly. Do minimal tests on // the remaining CPU's since it was possible to pass on a -mabi with no value // when the CPU name is absent from a StringSwitch in getMipsCPUAndABI() -// RUN: %clang -target mips-linux-gnu -### -no-integrated-as -fno-pic -c %s -mcpu=mips1 \ +// RUN: %clang --target=mips-linux-gnu -### -fno-integrated-as -fno-pic -c %s -mcpu=mips1 \ // RUN: 2>&1 | FileCheck -check-prefix=MIPS1-EB-AS %s // MIPS1-EB-AS: as{{(.exe)?}}" "-march" "mips1" "-mabi" "32" "-mno-shared" "-call_nonpic" "-EB" // MIPS1-EB-AS-NOT: "{{[ A-Za-z\\\/]*}}as{{(.exe)?}}{{.*}}"-KPIC" // -// RUN: %clang -target mips-linux-gnu -### -no-integrated-as -fno-pic -c %s -mcpu=mips2 \ +// RUN: %clang --target=mips-linux-gnu -### -fno-integrated-as -fno-pic -c %s -mcpu=mips2 \ // RUN: 2>&1 | FileCheck -check-prefix=MIPS2-EB-AS %s // MIPS2-EB-AS: as{{(.exe)?}}" "-march" "mips2" "-mabi" "32" "-mno-shared" "-call_nonpic" "-EB" // MIPS2-EB-AS-NOT: "{{[ A-Za-z\\\/]*}}as{{(.exe)?}}{{.*}}"-KPIC" // -// RUN: %clang -target mips64-linux-gnu -### -no-integrated-as -fno-pic -c %s -mcpu=mips3 \ +// RUN: %clang --target=mips64-linux-gnu -### -fno-integrated-as -fno-pic -c %s -mcpu=mips3 \ // RUN: 2>&1 | FileCheck -check-prefix=MIPS3-EB-AS %s // MIPS3-EB-AS: as{{(.exe)?}}" "-march" "mips3" "-mabi" "64" "-EB" "-KPIC" // -// RUN: %clang -target mips64-linux-gnu -### -no-integrated-as -fno-pic -c %s -mcpu=mips4 \ +// RUN: %clang --target=mips64-linux-gnu -### -fno-integrated-as -fno-pic -c %s -mcpu=mips4 \ // RUN: 2>&1 | FileCheck -check-prefix=MIPS4-EB-AS %s // MIPS4-EB-AS: as{{(.exe)?}}" "-march" "mips4" "-mabi" "64" "-EB" "-KPIC" // -// RUN: %clang -target mips64-linux-gnu -### -no-integrated-as -fno-pic -c %s -mcpu=mips5 \ +// RUN: %clang --target=mips64-linux-gnu -### -fno-integrated-as -fno-pic -c %s -mcpu=mips5 \ // RUN: 2>&1 | FileCheck -check-prefix=MIPS5-EB-AS %s // MIPS5-EB-AS: as{{(.exe)?}}" "-march" "mips5" "-mabi" "64" "-EB" "-KPIC" // -// RUN: %clang -target mips-linux-gnu -### -no-integrated-as -fno-pic -c %s -mcpu=mips32 \ +// RUN: %clang --target=mips-linux-gnu -### -fno-integrated-as -fno-pic -c %s -mcpu=mips32 \ // RUN: 2>&1 | FileCheck -check-prefix=MIPS32-EB-AS %s // MIPS32-EB-AS: as{{(.exe)?}}" "-march" "mips32" "-mabi" "32" "-mno-shared" "-call_nonpic" "-EB" // MIPS32-EB-AS-NOT: "{{[ A-Za-z\\\/]*}}as{{(.exe)?}}{{.*}}"-KPIC" // -// RUN: %clang -target mips-linux-gnu -### -no-integrated-as -fno-pic -c %s -mcpu=mips32r6 \ +// RUN: %clang --target=mips-linux-gnu -### -fno-integrated-as -fno-pic -c %s -mcpu=mips32r6 \ // RUN: 2>&1 | FileCheck -check-prefix=MIPS32R6-EB-AS %s // MIPS32R6-EB-AS: as{{(.exe)?}}" "-march" "mips32r6" "-mabi" "32" "-mno-shared" "-call_nonpic" "-EB" // MIPS32R6-EB-AS-NOT: "{{[ A-Za-z\\\/]*}}as{{(.exe)?}}{{.*}}"-KPIC" // -// RUN: %clang -target mips64-linux-gnu -### -no-integrated-as -fno-pic -c %s -mcpu=mips64 \ +// RUN: %clang --target=mips64-linux-gnu -### -fno-integrated-as -fno-pic -c %s -mcpu=mips64 \ // RUN: 2>&1 | FileCheck -check-prefix=MIPS64-EB-AS %s // MIPS64-EB-AS: as{{(.exe)?}}" "-march" "mips64" "-mabi" "64" "-EB" "-KPIC" // -// RUN: %clang -target mips64-linux-gnu -### -no-integrated-as -fno-pic -c %s -mcpu=mips64r6 \ +// RUN: %clang --target=mips64-linux-gnu -### -fno-integrated-as -fno-pic -c %s -mcpu=mips64r6 \ // RUN: 2>&1 | FileCheck -check-prefix=MIPS64R6-EB-AS %s // MIPS64R6-EB-AS: as{{(.exe)?}}" "-march" "mips64r6" "-mabi" "64" "-EB" "-KPIC" // -// RUN: %clang -target mips-linux-gnu -### -no-integrated-as -msoft-float -mhard-float -c %s 2>&1 \ +// RUN: %clang --target=mips-linux-gnu -### -fno-integrated-as -msoft-float -mhard-float -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=HARDFLOAT --implicit-check-not=-msoft-float %s // HARDFLOAT: as{{(.exe)?}}" // HARDFLOAT: -mhard-float // -// RUN: %clang -target mips-linux-gnu -### -no-integrated-as -mhard-float -msoft-float -c %s 2>&1 \ +// RUN: %clang --target=mips-linux-gnu -### -fno-integrated-as -mhard-float -msoft-float -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=SOFTFLOAT --implicit-check-not=-mhard-float %s // SOFTFLOAT: as{{(.exe)?}}" // SOFTFLOAT: -msoft-float // -// RUN: %clang -target mips-linux-gnu -### -no-integrated-as -mno-odd-spreg -modd-spreg -c %s 2>&1 \ +// RUN: %clang --target=mips-linux-gnu -### -fno-integrated-as -mno-odd-spreg -modd-spreg -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=ODDSPREG --implicit-check-not=-mno-odd-spreg %s // ODDSPREG: as{{(.exe)?}}" // ODDSPREG: -modd-spreg // -// RUN: %clang -target mips-linux-gnu -### -no-integrated-as -modd-spreg -mno-odd-spreg -c %s 2>&1 \ +// RUN: %clang --target=mips-linux-gnu -### -fno-integrated-as -modd-spreg -mno-odd-spreg -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=NOODDSPREG --implicit-check-not=-modd-spreg %s // NOODDSPREG: as{{(.exe)?}}" // NOODDSPREG: -mno-odd-spreg // -// RUN: %clang -target mips-linux-gnu -### -no-integrated-as -mdouble-float -msingle-float -c %s 2>&1 \ +// RUN: %clang --target=mips-linux-gnu -### -fno-integrated-as -mdouble-float -msingle-float -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=SINGLEFLOAT --implicit-check-not=-mdouble-float %s // SINGLEFLOAT: as{{(.exe)?}}" // SINGLEFLOAT: -msingle-float // -// RUN: %clang -target mips-linux-gnu -### -no-integrated-as -msingle-float -mdouble-float -c %s 2>&1 \ +// RUN: %clang --target=mips-linux-gnu -### -fno-integrated-as -msingle-float -mdouble-float -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=DOUBLEFLOAT --implicit-check-not=-msingle-float %s // DOUBLEFLOAT: as{{(.exe)?}}" // DOUBLEFLOAT: -mdouble-float // -// RUN: %clang -target mips-linux-gnu -### -no-integrated-as -msoft-float -c %s 2>&1 \ +// RUN: %clang --target=mips-linux-gnu -### -fno-integrated-as -msoft-float -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=SOFTFLOAT-IMPLICIT-FPXX --implicit-check-not=-mfpxx %s // SOFTFLOAT-IMPLICIT-FPXX: as{{(.exe)?}}" // SOFTFLOAT-IMPLICIT-FPXX: -msoft-float // -// RUN: %clang -target mips-linux-gnu -### -no-integrated-as -msoft-float -mfpxx -c %s 2>&1 \ +// RUN: %clang --target=mips-linux-gnu -### -fno-integrated-as -msoft-float -mfpxx -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=SOFTFLOAT-EXPLICIT-FPXX %s // SOFTFLOAT-EXPLICIT-FPXX: as{{(.exe)?}}" // SOFTFLOAT-EXPLICIT-FPXX: -mfpxx // SOFTFLOAT-EXPLICIT-FPXX: -msoft-float // -// RUN: %clang -target mips-mti-linux-gnu -### -no-integrated-as -msoft-float -c %s 2>&1 \ +// RUN: %clang --target=mips-mti-linux-gnu -### -fno-integrated-as -msoft-float -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=MTI-SOFTFLOAT-IMPLICIT-FPXX --implicit-check-not=-mfpxx %s // MTI-SOFTFLOAT-IMPLICIT-FPXX: as{{(.exe)?}}" // MTI-SOFTFLOAT-IMPLICIT-FPXX: -msoft-float // -// RUN: %clang -target mips-mti-linux-gnu -### -no-integrated-as -msoft-float -mfpxx -c %s 2>&1 \ +// RUN: %clang --target=mips-mti-linux-gnu -### -fno-integrated-as -msoft-float -mfpxx -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=MTI-SOFTFLOAT-EXPLICIT-FPXX %s // MTI-SOFTFLOAT-EXPLICIT-FPXX: as{{(.exe)?}}" // MTI-SOFTFLOAT-EXPLICIT-FPXX: -mfpxx // MTI-SOFTFLOAT-EXPLICIT-FPXX: -msoft-float // -// RUN: %clang -target mips-img-linux-gnu -### -no-integrated-as -msoft-float -c %s 2>&1 \ +// RUN: %clang --target=mips-img-linux-gnu -### -fno-integrated-as -msoft-float -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=IMG-SOFTFLOAT-IMPLICIT-FPXX --implicit-check-not=-mfpxx %s // IMG-SOFTFLOAT-IMPLICIT-FPXX: as{{(.exe)?}}" // IMG-SOFTFLOAT-IMPLICIT-FPXX: -msoft-float // -// RUN: %clang -target mips-img-linux-gnu -### -no-integrated-as -msoft-float -mfpxx -c %s 2>&1 \ +// RUN: %clang --target=mips-img-linux-gnu -### -fno-integrated-as -msoft-float -mfpxx -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=IMG-SOFTFLOAT-EXPLICIT-FPXX %s // IMG-SOFTFLOAT-EXPLICIT-FPXX: as{{(.exe)?}}" // IMG-SOFTFLOAT-EXPLICIT-FPXX: -mfpxx // IMG-SOFTFLOAT-EXPLICIT-FPXX: -msoft-float // -// RUN: %clang -target mips-linux-gnu -### -no-integrated-as -msingle-float -c %s 2>&1 \ +// RUN: %clang --target=mips-linux-gnu -### -fno-integrated-as -msingle-float -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=SINGLEFLOAT-IMPLICIT-FPXX --implicit-check-not=-mfpxx %s // SINGLEFLOAT-IMPLICIT-FPXX: as{{(.exe)?}}" // SINGLEFLOAT-IMPLICIT-FPXX: -msingle-float // -// RUN: %clang -target mips-linux-gnu -### -no-integrated-as -msingle-float -mfpxx -c %s 2>&1 \ +// RUN: %clang --target=mips-linux-gnu -### -fno-integrated-as -msingle-float -mfpxx -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=SINGLEFLOAT-EXPLICIT-FPXX %s // SINGLEFLOAT-EXPLICIT-FPXX: as{{(.exe)?}}" // SINGLEFLOAT-EXPLICIT-FPXX: -mfpxx // SINGLEFLOAT-EXPLICIT-FPXX: -msingle-float // -// RUN: %clang -target mips-mti-linux-gnu -### -no-integrated-as -msingle-float -c %s 2>&1 \ +// RUN: %clang --target=mips-mti-linux-gnu -### -fno-integrated-as -msingle-float -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=MTI-SINGLEFLOAT-IMPLICIT-FPXX --implicit-check-not=-mfpxx %s // MTI-SINGLEFLOAT-IMPLICIT-FPXX: as{{(.exe)?}}" // MTI-SINGLEFLOAT-IMPLICIT-FPXX: -msingle-float // -// RUN: %clang -target mips-mti-linux-gnu -### -no-integrated-as -msingle-float -mfpxx -c %s 2>&1 \ +// RUN: %clang --target=mips-mti-linux-gnu -### -fno-integrated-as -msingle-float -mfpxx -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=MTI-SINGLEFLOAT-EXPLICIT-FPXX %s // MTI-SINGLEFLOAT-EXPLICIT-FPXX: as{{(.exe)?}}" // MTI-SINGLEFLOAT-EXPLICIT-FPXX: -mfpxx // MTI-SINGLEFLOAT-EXPLICIT-FPXX: -msingle-float // -// RUN: %clang -target mips-img-linux-gnu -### -no-integrated-as -msingle-float -c %s 2>&1 \ +// RUN: %clang --target=mips-img-linux-gnu -### -fno-integrated-as -msingle-float -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=IMG-SINGLEFLOAT-IMPLICIT-FPXX --implicit-check-not=-mfpxx %s // IMG-SINGLEFLOAT-IMPLICIT-FPXX: as{{(.exe)?}}" // IMG-SINGLEFLOAT-IMPLICIT-FPXX: -msingle-float // -// RUN: %clang -target mips-img-linux-gnu -### -no-integrated-as -msingle-float -mfpxx -c %s 2>&1 \ +// RUN: %clang --target=mips-img-linux-gnu -### -fno-integrated-as -msingle-float -mfpxx -c %s 2>&1 \ // RUN: | FileCheck -check-prefix=IMG-SINGLEFLOAT-EXPLICIT-FPXX %s // IMG-SINGLEFLOAT-EXPLICIT-FPXX: as{{(.exe)?}}" // IMG-SINGLEFLOAT-EXPLICIT-FPXX: -mfpxx diff --git a/clang/test/Driver/mips-features.c b/clang/test/Driver/mips-features.c index 8b8db4c4a341b..ee370051d1ebe 100644 --- a/clang/test/Driver/mips-features.c +++ b/clang/test/Driver/mips-features.c @@ -1,255 +1,255 @@ // Check handling MIPS specific features options. // // -mabicalls -// RUN: %clang -target mips-linux-gnu -### -c %s -mno-abicalls -mabicalls 2>&1 \ +// RUN: %clang --target=mips-linux-gnu -### -c %s -mno-abicalls -mabicalls 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-MABICALLS %s // CHECK-MABICALLS: "-target-feature" "-noabicalls" // // -mno-abicalls -// RUN: %clang -target mips-linux-gnu -### -c %s -mabicalls -mno-abicalls 2>&1 \ +// RUN: %clang --target=mips-linux-gnu -### -c %s -mabicalls -mno-abicalls 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-MNOABICALLS %s // CHECK-MNOABICALLS: "-target-feature" "+noabicalls" // // -mno-abicalls non-PIC N64 -// RUN: %clang -target mips64-linux-gnu -### -c -fno-PIC -mno-abicalls %s 2>&1 \ +// RUN: %clang --target=mips64-linux-gnu -### -c -fno-PIC -mno-abicalls %s 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-MNOABICALLS-N64NPIC %s // CHECK-MNOABICALLS-N64NPIC: "-target-feature" "+noabicalls" // // -mgpopt -// RUN: %clang -target mips-linux-gnu -### -c %s -mno-gpopt -mgpopt -Wno-unsupported-gpopt 2>&1 \ +// RUN: %clang --target=mips-linux-gnu -### -c %s -mno-gpopt -mgpopt -Wno-unsupported-gpopt 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-MGPOPT-DEF-ABICALLS %s // CHECK-MGPOPT-DEF-ABICALLS-NOT: "-mllvm" "-mgpopt" // // -mabicalls -mgpopt -// RUN: %clang -target mips-linux-gnu -### -c %s -mabicalls -mno-gpopt -mgpopt -Wno-unsupported-gpopt 2>&1 \ +// RUN: %clang --target=mips-linux-gnu -### -c %s -mabicalls -mno-gpopt -mgpopt -Wno-unsupported-gpopt 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-MGPOPT-EXPLICIT-ABICALLS %s // CHECK-MGPOPT-EXPLICIT-ABICALLS-NOT: "-mllvm" "-mgpopt" // // -mno-abicalls -mgpopt -// RUN: %clang -target mips-linux-gnu -### -c %s -mno-abicalls -mno-gpopt -mgpopt 2>&1 \ +// RUN: %clang --target=mips-linux-gnu -### -c %s -mno-abicalls -mno-gpopt -mgpopt 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-MGPOPT %s // CHECK-MGPOPT: "-mllvm" "-mgpopt" // // -mno-abicalls -mno-gpopt -// RUN: %clang -target mips-linux-gnu -### -c %s -mno-abicalls -mgpopt -mno-gpopt 2>&1 \ +// RUN: %clang --target=mips-linux-gnu -### -c %s -mno-abicalls -mgpopt -mno-gpopt 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-MNOGPOPT %s // CHECK-MNOGPOPT-NOT: "-mllvm" "-mgpopt" // // -mno-abicalls -// RUN: %clang -target mips-linux-gnu -### -c %s -mno-abicalls 2>&1 \ +// RUN: %clang --target=mips-linux-gnu -### -c %s -mno-abicalls 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-MGPOPTDEF %s // CHECK-MGPOPTDEF: "-mllvm" "-mgpopt" // // -mgpopt -mno-abicalls -mlocal-sdata -// RUN: %clang -target mips-linux-gnu -### -c %s -mno-abicalls -mno-gpopt -mgpopt -mno-local-sdata -mlocal-sdata 2>&1 \ +// RUN: %clang --target=mips-linux-gnu -### -c %s -mno-abicalls -mno-gpopt -mgpopt -mno-local-sdata -mlocal-sdata 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-MLOCALSDATA %s // CHECK-MLOCALSDATA: "-mllvm" "-mlocal-sdata=1" // // -mgpopt -mno-abicalls -mno-local-sdata -// RUN: %clang -target mips-linux-gnu -### -c %s -mno-abicalls -mno-gpopt -mgpopt -mlocal-sdata -mno-local-sdata 2>&1 \ +// RUN: %clang --target=mips-linux-gnu -### -c %s -mno-abicalls -mno-gpopt -mgpopt -mlocal-sdata -mno-local-sdata 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-MNOLOCALSDATA %s // CHECK-MNOLOCALSDATA: "-mllvm" "-mlocal-sdata=0" // // -mgpopt -mno-abicalls -// RUN: %clang -target mips-linux-gnu -### -c %s -mno-abicalls -mgpopt 2>&1 \ +// RUN: %clang --target=mips-linux-gnu -### -c %s -mno-abicalls -mgpopt 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-MLOCALSDATADEF %s // CHECK-MLOCALSDATADEF-NOT: "-mllvm" "-mlocal-sdata" // // -mno-abicalls -mgpopt -mextern-sdata -// RUN: %clang -target mips-linux-gnu -### -c %s -mno-abicalls -mgpopt -mno-extern-sdata -mextern-sdata 2>&1 \ +// RUN: %clang --target=mips-linux-gnu -### -c %s -mno-abicalls -mgpopt -mno-extern-sdata -mextern-sdata 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-MEXTERNSDATA %s // CHECK-MEXTERNSDATA: "-mllvm" "-mextern-sdata=1" // // -mno-abicalls -mgpopt -mno-extern-sdata -// RUN: %clang -target mips-linux-gnu -### -c %s -mno-abicalls -mgpopt -mextern-sdata -mno-extern-sdata 2>&1 \ +// RUN: %clang --target=mips-linux-gnu -### -c %s -mno-abicalls -mgpopt -mextern-sdata -mno-extern-sdata 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-MNOEXTERNSDATA %s // CHECK-MNOEXTERNSDATA: "-mllvm" "-mextern-sdata=0" // // -mno-abicalls -mgpopt -// RUN: %clang -target mips-linux-gnu -### -c %s -mno-abicalls -mgpopt 2>&1 \ +// RUN: %clang --target=mips-linux-gnu -### -c %s -mno-abicalls -mgpopt 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-MEXTERNSDATADEF %s // CHECK-MEXTERNSDATADEF-NOT: "-mllvm" "-mextern-sdata" // // -mno-abicalls -mgpopt -membedded-data -// RUN: %clang -target mips-linux-gnu -### -c %s -mno-abicalls -mgpopt -mno-embedded-data -membedded-data 2>&1 \ +// RUN: %clang --target=mips-linux-gnu -### -c %s -mno-abicalls -mgpopt -mno-embedded-data -membedded-data 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-MEMBEDDEDDATA %s // CHECK-MEMBEDDEDDATA: "-mllvm" "-membedded-data=1" // // -mno-abicalls -mgpopt -mno-embedded-data -// RUN: %clang -target mips-linux-gnu -### -c %s -mno-abicalls -mgpopt -membedded-data -mno-embedded-data 2>&1 \ +// RUN: %clang --target=mips-linux-gnu -### -c %s -mno-abicalls -mgpopt -membedded-data -mno-embedded-data 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-MNOEMBEDDEDDATA %s // CHECK-MNOEMBEDDEDDATA: "-mllvm" "-membedded-data=0" // // -mno-abicalls -mgpopt -// RUN: %clang -target mips-linux-gnu -### -c %s -mno-abicalls -mgpopt 2>&1 \ +// RUN: %clang --target=mips-linux-gnu -### -c %s -mno-abicalls -mgpopt 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-MEMBEDDEDDATADEF %s // CHECK-MEMBEDDEDDATADEF-NOT: "-mllvm" "-membedded-data" // // MIPS64 + N64: -fno-pic -> -mno-abicalls -mgpopt -// RUN: %clang -target mips64-mti-elf -mabi=64 -### -c %s -fno-pic -mno-abicalls 2>&1 \ +// RUN: %clang --target=mips64-mti-elf -mabi=64 -### -c %s -fno-pic -mno-abicalls 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-N64-GPOPT %s // CHECK-N64-GPOPT: "-target-feature" "+noabicalls" // CHECK-N64-GPOPT: "-mllvm" "-mgpopt" // // MIPS64 + N64: -fno-pic -mno-gpopt -// RUN: %clang -target mips64-mti-elf -mabi=64 -### -c %s -fno-pic -mno-abicalls -mno-gpopt 2>&1 \ +// RUN: %clang --target=mips64-mti-elf -mabi=64 -### -c %s -fno-pic -mno-abicalls -mno-gpopt 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-N64-MNO-GPOPT %s // CHECK-N64-MNO-GPOPT: "-target-feature" "+noabicalls" // CHECK-N64-MNO-GPOPT-NOT: "-mllvm" "-mgpopt" // // MIPS64 + N64: -mgpopt (-fpic is implicit) -// RUN: %clang -target mips64-mti-linux-gnu -mabi=64 -### -c %s -mgpopt 2>&1 \ +// RUN: %clang --target=mips64-mti-linux-gnu -mabi=64 -### -c %s -mgpopt 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-N64-PIC-GPOPT %s // CHECK-N64-PIC-GPOPT-NOT: "-mllvm" "-mgpopt" // CHECK-N64-PIC-GPOPT: ignoring '-mgpopt' option as it cannot be used with the implicit usage of -mabicalls // // -mips16 -// RUN: %clang -target mips-linux-gnu -### -c %s \ +// RUN: %clang --target=mips-linux-gnu -### -c %s \ // RUN: -mno-mips16 -mips16 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-MIPS16 %s // CHECK-MIPS16: "-target-feature" "+mips16" // // -mno-mips16 -// RUN: %clang -target mips-linux-gnu -### -c %s \ +// RUN: %clang --target=mips-linux-gnu -### -c %s \ // RUN: -mips16 -mno-mips16 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-NOMIPS16 %s // CHECK-NOMIPS16: "-target-feature" "-mips16" // // -mmicromips -// RUN: %clang -target mips-linux-gnu -### -c %s \ +// RUN: %clang --target=mips-linux-gnu -### -c %s \ // RUN: -mno-micromips -mmicromips 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-MICROMIPS %s // CHECK-MICROMIPS: "-target-feature" "+micromips" // // -mno-micromips -// RUN: %clang -target mips-linux-gnu -### -c %s \ +// RUN: %clang --target=mips-linux-gnu -### -c %s \ // RUN: -mmicromips -mno-micromips 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-NOMICROMIPS %s // CHECK-NOMICROMIPS: "-target-feature" "-micromips" // // -mdsp -// RUN: %clang -target mips-linux-gnu -### -c %s \ +// RUN: %clang --target=mips-linux-gnu -### -c %s \ // RUN: -mno-dsp -mdsp 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-MDSP %s // CHECK-MDSP: "-target-feature" "+dsp" // // -mno-dsp -// RUN: %clang -target mips-linux-gnu -### -c %s \ +// RUN: %clang --target=mips-linux-gnu -### -c %s \ // RUN: -mdsp -mno-dsp 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-NOMDSP %s // CHECK-NOMDSP: "-target-feature" "-dsp" // // -mdspr2 -// RUN: %clang -target mips-linux-gnu -### -c %s \ +// RUN: %clang --target=mips-linux-gnu -### -c %s \ // RUN: -mno-dspr2 -mdspr2 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-MDSPR2 %s // CHECK-MDSPR2: "-target-feature" "+dspr2" // // -mno-dspr2 -// RUN: %clang -target mips-linux-gnu -### -c %s \ +// RUN: %clang --target=mips-linux-gnu -### -c %s \ // RUN: -mdspr2 -mno-dspr2 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-NOMDSPR2 %s // CHECK-NOMDSPR2: "-target-feature" "-dspr2" // // -mmsa -// RUN: %clang -target mips-linux-gnu -### -c %s \ +// RUN: %clang --target=mips-linux-gnu -### -c %s \ // RUN: -mno-msa -mmsa 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-MMSA %s // CHECK-MMSA: "-target-feature" "+msa" // // -mno-msa -// RUN: %clang -target mips-linux-gnu -### -c %s \ +// RUN: %clang --target=mips-linux-gnu -### -c %s \ // RUN: -mmsa -mno-msa 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-NOMMSA %s // CHECK-NOMMSA: "-target-feature" "-msa" // // -mmsa -// RUN: %clang -target mips-linux-gnu -### -c %s \ +// RUN: %clang --target=mips-linux-gnu -### -c %s \ // RUN: -mmsa 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-MMSA-MFP64 %s // CHECK-MMSA-MFP64: "-target-feature" "+msa" "-target-feature" "+fp64" // // -mmt -// RUN: %clang -target mips-linux-gnu -### -c %s \ +// RUN: %clang --target=mips-linux-gnu -### -c %s \ // RUN: -mno-mt -mmt 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-MMT %s // CHECK-MMT: "-target-feature" "+mt" // // -mno-mt -// RUN: %clang -target mips-linux-gnu -### -c %s \ +// RUN: %clang --target=mips-linux-gnu -### -c %s \ // RUN: -mmt -mno-mt 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-NOMMT %s // CHECK-NOMMT: "-target-feature" "-mt" // // -modd-spreg -// RUN: %clang -target mips-linux-gnu -### -c %s -mno-odd-spreg -modd-spreg 2>&1 \ +// RUN: %clang --target=mips-linux-gnu -### -c %s -mno-odd-spreg -modd-spreg 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-MODDSPREG %s // CHECK-MODDSPREG: "-target-feature" "-nooddspreg" // // -mno-odd-spreg -// RUN: %clang -target mips-linux-gnu -### -c %s -modd-spreg -mno-odd-spreg 2>&1 \ +// RUN: %clang --target=mips-linux-gnu -### -c %s -modd-spreg -mno-odd-spreg 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-NOMODDSPREG %s // CHECK-NOMODDSPREG: "-target-feature" "+nooddspreg" // // -mfpxx -// RUN: %clang -target mips-linux-gnu -### -c %s -mfpxx 2>&1 \ +// RUN: %clang --target=mips-linux-gnu -### -c %s -mfpxx 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-MFPXX %s // CHECK-MFPXX: "-target-feature" "+fpxx" // CHECK-MFPXX: "-target-feature" "+nooddspreg" // // -mfpxx -modd-spreg -// RUN: %clang -target mips-linux-gnu -### -c %s -mfpxx -modd-spreg 2>&1 \ +// RUN: %clang --target=mips-linux-gnu -### -c %s -mfpxx -modd-spreg 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-MFPXX-ODDSPREG %s // CHECK-MFPXX-ODDSPREG: "-target-feature" "+fpxx" // CHECK-MFPXX-ODDSPREG: "-target-feature" "-nooddspreg" // // -mfp64 -// RUN: %clang -target mips-linux-gnu -### -c %s \ +// RUN: %clang --target=mips-linux-gnu -### -c %s \ // RUN: -mfp32 -mfp64 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-MFP64 %s // CHECK-MFP64: "-target-feature" "+fp64" // // -mfp32 -// RUN: %clang -target mips-linux-gnu -### -c %s \ +// RUN: %clang --target=mips-linux-gnu -### -c %s \ // RUN: -mfp64 -mfp32 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-NOMFP64 %s // CHECK-NOMFP64: "-target-feature" "-fp64" // // -mnan=2008 -// RUN: %clang -target mips-linux-gnu -march=mips32r3 -### -c %s \ +// RUN: %clang --target=mips-linux-gnu -march=mips32r3 -### -c %s \ // RUN: -mnan=legacy -mnan=2008 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-NAN2008 %s // CHECK-NAN2008: "-target-feature" "+nan2008" "-target-feature" "+abs2008" // // -mnan=2008 -mabs=legacy -// RUN: %clang -target mips-linux-gnu -march=mips32r3 -### -c %s \ +// RUN: %clang --target=mips-linux-gnu -march=mips32r3 -### -c %s \ // RUN: -mabs=legacy -mnan=2008 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-ABSLEGACYNAN2008 %s // CHECK-ABSLEGACYNAN2008: "-target-feature" "+nan2008" "-target-feature" "-abs2008" // // -mnan=legacy -// RUN: %clang -target mips-linux-gnu -march=mips32r3 -### -c %s \ +// RUN: %clang --target=mips-linux-gnu -march=mips32r3 -### -c %s \ // RUN: -mnan=2008 -mnan=legacy 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-NANLEGACY %s // CHECK-NANLEGACY: "-target-feature" "-nan2008" // // -mabs=2008 on pre R2 -// RUN: %clang -target mips-linux-gnu -march=mips32 -### -c %s \ +// RUN: %clang --target=mips-linux-gnu -march=mips32 -### -c %s \ // RUN: -mabs=2008 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-ABSLEGACY %s // // -mabs=2008 -// RUN: %clang -target mips-linux-gnu -march=mips32r3 -### -c %s \ +// RUN: %clang --target=mips-linux-gnu -march=mips32r3 -### -c %s \ // RUN: -mabs=2008 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-ABS2008 %s // // -mabs=legacy -// RUN: %clang -target mips-linux-gnu -march=mips32r3 -### -c %s \ +// RUN: %clang --target=mips-linux-gnu -march=mips32r3 -### -c %s \ // RUN: -mabs=legacy 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-ABSLEGACY %s // // -mabs=legacy on R6 -// RUN: %clang -target mips-linux-gnu -march=mips32r6 -### -c %s \ +// RUN: %clang --target=mips-linux-gnu -march=mips32r6 -### -c %s \ // RUN: -mabs=legacy 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-ABS2008 %s // @@ -259,147 +259,147 @@ // CHECK-ABS2008-NOT: "-target-feature" "-abs2008" // // -mcompact-branches=never -// RUN: %clang -target mips-linux-gnu -march=mips32r6 -### -c %s \ +// RUN: %clang --target=mips-linux-gnu -march=mips32r6 -### -c %s \ // RUN: -mcompact-branches=never 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-CBNEVER %s // CHECK-CBNEVER: "-mllvm" "-mips-compact-branches=never" // // -mcompact-branches=optimal -// RUN: %clang -target mips-linux-gnu -march=mips32r6 -### -c %s \ +// RUN: %clang --target=mips-linux-gnu -march=mips32r6 -### -c %s \ // RUN: -mcompact-branches=optimal 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-CBOPTIMAL %s // CHECK-CBOPTIMAL: "-mllvm" "-mips-compact-branches=optimal" // // -mcompact-branches=always -// RUN: %clang -target mips-linux-gnu -march=mips32r6 -### -c %s \ +// RUN: %clang --target=mips-linux-gnu -march=mips32r6 -### -c %s \ // RUN: -mcompact-branches=always 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-CBALWAYS %s // CHECK-CBALWAYS: "-mllvm" "-mips-compact-branches=always" // // -mxgot -// RUN: %clang -target mips-linux-gnu -### -c %s \ +// RUN: %clang --target=mips-linux-gnu -### -c %s \ // RUN: -mno-xgot -mxgot 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-XGOT %s // CHECK-XGOT: "-target-feature" "+xgot" // // -mno-xgot -// RUN: %clang -target mips-linux-gnu -### -c %s \ +// RUN: %clang --target=mips-linux-gnu -### -c %s \ // RUN: -mxgot -mno-xgot 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-NOXGOT %s // CHECK-NOXGOT: "-target-feature" "-xgot" // // -mldc1-sdc1 -// RUN: %clang -target mips-linux-gnu -### -c %s \ +// RUN: %clang --target=mips-linux-gnu -### -c %s \ // RUN: -mno-ldc1-sdc1 -mldc1-sdc1 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-LDC1SDC1 %s // CHECK-LDC1SDC1-NOT: "-mllvm" "-mno-ldc1-sdc1" // // -mno-ldc1-sdc1 -// RUN: %clang -target mips-linux-gnu -### -c %s \ +// RUN: %clang --target=mips-linux-gnu -### -c %s \ // RUN: -mldc1-sdc1 -mno-ldc1-sdc1 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-NOLDC1SDC1 %s // CHECK-NOLDC1SDC1: "-mllvm" "-mno-ldc1-sdc1" // // -mcheck-zero-division -// RUN: %clang -target mips-linux-gnu -### -c %s \ +// RUN: %clang --target=mips-linux-gnu -### -c %s \ // RUN: -mno-check-zero-division -mcheck-zero-division 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-ZERODIV %s // CHECK-ZERODIV-NOT: "-mllvm" "-mno-check-zero-division" // // -mno-check-zero-division -// RUN: %clang -target mips-linux-gnu -### -c %s \ +// RUN: %clang --target=mips-linux-gnu -### -c %s \ // RUN: -mcheck-zero-division -mno-check-zero-division 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-NOZERODIV %s // CHECK-NOZERODIV: "-mllvm" "-mno-check-zero-division" // // -G -// RUN: %clang -target mips-linux-gnu -### -c %s \ +// RUN: %clang --target=mips-linux-gnu -### -c %s \ // RUN: -G 16 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-MIPS-G %s // CHECK-MIPS-G: "-mllvm" "-mips-ssection-threshold=16" // // -msoft-float (unknown vendor) -// RUN: %clang -target mips-linux-gnu -### -c %s -msoft-float 2>&1 \ +// RUN: %clang --target=mips-linux-gnu -### -c %s -msoft-float 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-SOFTFLOAT %s // CHECK-SOFTFLOAT: "-target-feature" "+soft-float" // CHECK-SOFTFLOAT-NOT: "-target-feature" "+fpxx" // // -msoft-float -mfpxx (unknown vendor) -// RUN: %clang -target mips-linux-gnu -### -c %s -msoft-float -mfpxx 2>&1 \ +// RUN: %clang --target=mips-linux-gnu -### -c %s -msoft-float -mfpxx 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-SOFTFLOAT-FPXX %s // CHECK-SOFTFLOAT-FPXX: "-target-feature" "+soft-float" // CHECK-SOFTFLOAT-FPXX: "-target-feature" "+fpxx" // // -msoft-float (MTI) -// RUN: %clang -target mips-mti-linux-gnu -### -c %s -msoft-float 2>&1 \ +// RUN: %clang --target=mips-mti-linux-gnu -### -c %s -msoft-float 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-MTI-SOFTFLOAT %s // CHECK-MTI-SOFTFLOAT: "-target-feature" "+soft-float" // CHECK-MTI-SOFTFLOAT-NOT: "-target-feature" "+fpxx" // // -msoft-float -mfpxx (MTI) -// RUN: %clang -target mips-mti-linux-gnu -### -c %s -msoft-float -mfpxx 2>&1 \ +// RUN: %clang --target=mips-mti-linux-gnu -### -c %s -msoft-float -mfpxx 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-MTI-SOFTFLOAT-FPXX %s // CHECK-MTI-SOFTFLOAT-FPXX: "-target-feature" "+soft-float" // CHECK-MTI-SOFTFLOAT-FPXX: "-target-feature" "+fpxx" // // -msoft-float (IMG) -// RUN: %clang -target mips-img-linux-gnu -### -c %s -msoft-float 2>&1 \ +// RUN: %clang --target=mips-img-linux-gnu -### -c %s -msoft-float 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-IMG-SOFTFLOAT %s // CHECK-IMG-SOFTFLOAT: "-target-feature" "+soft-float" // CHECK-IMG-SOFTFLOAT-NOT: "-target-feature" "+fpxx" // // -msoft-float -mfpxx (IMG) -// RUN: %clang -target mips-img-linux-gnu -### -c %s -msoft-float -mfpxx 2>&1 \ +// RUN: %clang --target=mips-img-linux-gnu -### -c %s -msoft-float -mfpxx 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-IMG-SOFTFLOAT-FPXX %s // CHECK-IMG-SOFTFLOAT-FPXX: "-target-feature" "+soft-float" // CHECK-IMG-SOFTFLOAT-FPXX: "-target-feature" "+fpxx" // // -msingle-float (unknown vendor) -// RUN: %clang -target mips-linux-gnu -### -c %s -msingle-float 2>&1 \ +// RUN: %clang --target=mips-linux-gnu -### -c %s -msingle-float 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-SINGLEFLOAT %s // CHECK-SINGLEFLOAT: "-target-feature" "+single-float" // CHECK-SINGLEFLOAT-NOT: "-target-feature" "+fpxx" // // -msingle-float -mfpxx (unknown vendor) -// RUN: %clang -target mips-linux-gnu -### -c %s -msingle-float -mfpxx 2>&1 \ +// RUN: %clang --target=mips-linux-gnu -### -c %s -msingle-float -mfpxx 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-SINGLEFLOAT-FPXX %s // CHECK-SINGLEFLOAT-FPXX: "-target-feature" "+single-float" // CHECK-SINGLEFLOAT-FPXX: "-target-feature" "+fpxx" // // -msingle-float (MTI) -// RUN: %clang -target mips-mti-linux-gnu -### -c %s -msingle-float 2>&1 \ +// RUN: %clang --target=mips-mti-linux-gnu -### -c %s -msingle-float 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-MTI-SINGLEFLOAT %s // CHECK-MTI-SINGLEFLOAT: "-target-feature" "+single-float" // CHECK-MTI-SINGLEFLOAT-NOT: "-target-feature" "+fpxx" // // -msingle-float -mfpxx (MTI) -// RUN: %clang -target mips-mti-linux-gnu -### -c %s -msingle-float -mfpxx 2>&1 \ +// RUN: %clang --target=mips-mti-linux-gnu -### -c %s -msingle-float -mfpxx 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-MTI-SINGLEFLOAT-FPXX %s // CHECK-MTI-SINGLEFLOAT-FPXX: "-target-feature" "+single-float" // CHECK-MTI-SINGLEFLOAT-FPXX: "-target-feature" "+fpxx" // // -msingle-float (IMG) -// RUN: %clang -target mips-img-linux-gnu -### -c %s -msingle-float 2>&1 \ +// RUN: %clang --target=mips-img-linux-gnu -### -c %s -msingle-float 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-IMG-SINGLEFLOAT %s // CHECK-IMG-SINGLEFLOAT: "-target-feature" "+single-float" // CHECK-IMG-SINGLEFLOAT-NOT: "-target-feature" "+fpxx" // // -msingle-float -mfpxx (IMG) -// RUN: %clang -target mips-img-linux-gnu -### -c %s -msingle-float -mfpxx 2>&1 \ +// RUN: %clang --target=mips-img-linux-gnu -### -c %s -msingle-float -mfpxx 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-IMG-SINGLEFLOAT-FPXX %s // CHECK-IMG-SINGLEFLOAT-FPXX: "-target-feature" "+single-float" // CHECK-IMG-SINGLEFLOAT-FPXX: "-target-feature" "+fpxx" // -mlong-call -// RUN: %clang -target mips-img-linux-gnu -### -c %s \ +// RUN: %clang --target=mips-img-linux-gnu -### -c %s \ // RUN: -mno-abicalls -mlong-calls 2>&1 \ // RUN: | FileCheck --check-prefix=LONG-CALLS-ON %s -// RUN: %clang -target mips-img-linux-gnu -### -c %s \ +// RUN: %clang --target=mips-img-linux-gnu -### -c %s \ // RUN: -mno-abicalls -mno-long-calls 2>&1 \ // RUN: | FileCheck --check-prefix=LONG-CALLS-OFF %s -// RUN: %clang -target mips-img-linux-gnu -### -c %s 2>&1 \ +// RUN: %clang --target=mips-img-linux-gnu -### -c %s 2>&1 \ // RUN: | FileCheck --check-prefix=LONG-CALLS-DEF %s -// RUN: %clang -target mips-img-linux-gnu -### -c %s -mlong-calls 2>&1 \ +// RUN: %clang --target=mips-img-linux-gnu -### -c %s -mlong-calls 2>&1 \ // RUN: | FileCheck --check-prefix=LONG-CALLS-DEF %s // LONG-CALLS-ON: "-target-feature" "+long-calls" // LONG-CALLS-OFF: "-target-feature" "-long-calls" @@ -416,81 +416,81 @@ // NO-BRANCH-LIKELY: argument unused during compilation: '-mno-branch-likely' // -mindirect-jump=hazard -// RUN: %clang -target mips-unknown-linux-gnu -### -c %s \ +// RUN: %clang --target=mips-unknown-linux-gnu -### -c %s \ // RUN: -mindirect-jump=hazard 2>&1 \ // RUN: | FileCheck --check-prefix=INDIRECT-BH %s // INDIRECT-BH: "-target-feature" "+use-indirect-jump-hazard" // // -mcrc -// RUN: %clang -target mips-unknown-linux-gnu -### -c %s \ +// RUN: %clang --target=mips-unknown-linux-gnu -### -c %s \ // RUN: -mno-crc -mcrc 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-CRC %s // CHECK-CRC: "-target-feature" "+crc" // // -mno-crc -// RUN: %clang -target mips-unknown-linux-gnu -### -c %s \ +// RUN: %clang --target=mips-unknown-linux-gnu -### -c %s \ // RUN: -mcrc -mno-crc 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-NO-CRC %s // CHECK-NO-CRC: "-target-feature" "-crc" // // -mvirt -// RUN: %clang -target mips-unknown-linux-gnu -### -c %s \ +// RUN: %clang --target=mips-unknown-linux-gnu -### -c %s \ // RUN: -mno-virt -mvirt 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-VIRT %s // CHECK-VIRT: "-target-feature" "+virt" // // -mno-virt -// RUN: %clang -target mips-unknown-linux-gnu -### -c %s \ +// RUN: %clang --target=mips-unknown-linux-gnu -### -c %s \ // RUN: -mvirt -mno-virt 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-NO-VIRT %s // CHECK-NO-VIRT: "-target-feature" "-virt" // // -mginv -// RUN: %clang -target mips-unknown-linux-gnu -### -c %s \ +// RUN: %clang --target=mips-unknown-linux-gnu -### -c %s \ // RUN: -mno-ginv -mginv 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-GINV %s // CHECK-GINV: "-target-feature" "+ginv" // // -mno-ginv -// RUN: %clang -target mips-unknown-linux-gnu -### -c %s \ +// RUN: %clang --target=mips-unknown-linux-gnu -### -c %s \ // RUN: -mginv -mno-ginv 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-NO-GINV %s // CHECK-NO-GINV: "-target-feature" "-ginv" // // -mrelax-pic-calls -// RUN: %clang -target mips-unknown-linux-gnu -### -c %s \ +// RUN: %clang --target=mips-unknown-linux-gnu -### -c %s \ // RUN: -mno-relax-pic-calls -mrelax-pic-calls 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-RELAX-PIC-CALLS %s // CHECK-RELAX-PIC-CALLS-NOT: "-mllvm" "-mips-jalr-reloc=0" // // -mno-relax-pic-calls -// RUN: %clang -target mips-unknown-linux-gnu -### -c %s \ +// RUN: %clang --target=mips-unknown-linux-gnu -### -c %s \ // RUN: -mrelax-pic-calls -mno-relax-pic-calls 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-NO-RELAX-PIC-CALLS %s // CHECK-NO-RELAX-PIC-CALLS: "-mllvm" "-mips-jalr-reloc=0" // // -mno-unaligned-access -// RUN: %clang -target mips-unknown-linux-gnu -### -c %s \ +// RUN: %clang --target=mips-unknown-linux-gnu -### -c %s \ // RUN: -munaligned-access -mno-strict-align \ // RUN: -mno-unaligned-access 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-STRICT-ALIGN %s // CHECK-STRICT-ALIGN: "-target-feature" "+strict-align" // // -munaligned-access -// RUN: %clang -target mips-unknown-linux-gnu -### -c %s \ +// RUN: %clang --target=mips-unknown-linux-gnu -### -c %s \ // RUN: -mno-unaligned-access -mstrict-align \ // RUN: -munaligned-access 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-NO-STRICT-ALIGN %s // CHECK-NO-STRICT-ALIGN: "-target-feature" "-strict-align" // // -mstrict-align -// RUN: %clang -target mips-unknown-linux-gnu -### -c %s \ +// RUN: %clang --target=mips-unknown-linux-gnu -### -c %s \ // RUN: -munaligned-access -mno-strict-align \ // RUN: -mstrict-align 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-STRICT-ALIGN %s // // -mno-strict-align -// RUN: %clang -target mips-unknown-linux-gnu -### -c %s \ +// RUN: %clang --target=mips-unknown-linux-gnu -### -c %s \ // RUN: -mno-unaligned-access -mstrict-align \ // RUN: -mno-strict-align 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-NO-STRICT-ALIGN %s diff --git a/clang/test/Driver/mips-float.c b/clang/test/Driver/mips-float.c index 2f1b813a15322..e33400845b1d9 100644 --- a/clang/test/Driver/mips-float.c +++ b/clang/test/Driver/mips-float.c @@ -3,13 +3,13 @@ // // Default // RUN: %clang -c %s -### -o %t.o 2>&1 \ -// RUN: -target mips-linux-gnu \ +// RUN: --target=mips-linux-gnu \ // RUN: | FileCheck --check-prefix=CHECK-DEF %s // CHECK-DEF: "-mfloat-abi" "hard" // // Default on FreeBSD // RUN: %clang -c %s -### -o %t.o 2>&1 \ -// RUN: -target mips-freebsd12 \ +// RUN: --target=mips-freebsd12 \ // RUN: | FileCheck --check-prefix=DEF-FREEBSD %s // DEF-FREEBSD: "-target-feature" "+soft-float" // DEF-FREEBSD: "-msoft-float" @@ -17,13 +17,13 @@ // // -mhard-float // RUN: %clang -c %s -### -o %t.o 2>&1 \ -// RUN: -target mips-linux-gnu -mhard-float \ +// RUN: --target=mips-linux-gnu -mhard-float \ // RUN: | FileCheck --check-prefix=CHECK-HARD %s // CHECK-HARD: "-mfloat-abi" "hard" // // -msoft-float // RUN: %clang -c %s -### -o %t.o 2>&1 \ -// RUN: -target mips-linux-gnu -msoft-float \ +// RUN: --target=mips-linux-gnu -msoft-float \ // RUN: | FileCheck --check-prefix=CHECK-SOFT %s // CHECK-SOFT: "-target-feature" "+soft-float" // CHECK-SOFT: "-msoft-float" @@ -31,13 +31,13 @@ // // -mfloat-abi=hard // RUN: %clang -c %s -### -o %t.o 2>&1 \ -// RUN: -target mips-linux-gnu -mfloat-abi=hard \ +// RUN: --target=mips-linux-gnu -mfloat-abi=hard \ // RUN: | FileCheck --check-prefix=CHECK-ABI-HARD %s // CHECK-ABI-HARD: "-mfloat-abi" "hard" // // -mfloat-abi=soft // RUN: %clang -c %s -### -o %t.o 2>&1 \ -// RUN: -target mips-linux-gnu -mfloat-abi=soft \ +// RUN: --target=mips-linux-gnu -mfloat-abi=soft \ // RUN: | FileCheck --check-prefix=CHECK-ABI-SOFT %s // CHECK-ABI-SOFT: "-target-feature" "+soft-float" // CHECK-ABI-SOFT: "-msoft-float" @@ -45,42 +45,42 @@ // // -mdouble-float // RUN: %clang -c %s -### -o %t.o 2>&1 \ -// RUN: -target mips-linux-gnu -msingle-float -mdouble-float \ +// RUN: --target=mips-linux-gnu -msingle-float -mdouble-float \ // RUN: | FileCheck --check-prefix=CHECK-ABI-DOUBLE %s // CHECK-ABI-DOUBLE: "-mfloat-abi" "hard" // CHECK-ABI-DOUBLE-NOT: "+single-float" // // -msingle-float // RUN: %clang -c %s -### -o %t.o 2>&1 \ -// RUN: -target mips-linux-gnu -mdouble-float -msingle-float \ +// RUN: --target=mips-linux-gnu -mdouble-float -msingle-float \ // RUN: | FileCheck --check-prefix=CHECK-ABI-SINGLE %s // CHECK-ABI-SINGLE: "-target-feature" "+single-float" // CHECK-ABI-SINGLE: "-mfloat-abi" "hard" // // -msoft-float -msingle-float // RUN: %clang -c %s -### -o %t.o 2>&1 \ -// RUN: -target mips-linux-gnu -msoft-float -msingle-float \ +// RUN: --target=mips-linux-gnu -msoft-float -msingle-float \ // RUN: | FileCheck --check-prefix=CHECK-ABI-SOFT-SINGLE %s // CHECK-ABI-SOFT-SINGLE: "-target-feature" "+single-float" // CHECK-ABI-SOFT-SINGLE: "-mfloat-abi" "soft" // // Default -mips16 // RUN: %clang -c %s -### -o %t.o 2>&1 \ -// RUN: -target mips-linux-gnu -mips16 \ +// RUN: --target=mips-linux-gnu -mips16 \ // RUN: | FileCheck --check-prefix=CHECK-DEF-MIPS16 %s // CHECK-DEF-MIPS16: "-target-feature" "+mips16" // CHECK-DEF-MIPS16: "-mfloat-abi" "hard" // // -mhard-float -mips16 // RUN: %clang -c %s -### -o %t.o 2>&1 \ -// RUN: -target mips-linux-gnu -mhard-float -mips16 \ +// RUN: --target=mips-linux-gnu -mhard-float -mips16 \ // RUN: | FileCheck --check-prefix=CHECK-HARD-MIPS16 %s // CHECK-HARD-MIPS16: "-target-feature" "+mips16" // CHECK-HARD-MIPS16: "-mfloat-abi" "hard" // // -msoft-float -mips16 // RUN: %clang -c %s -### -o %t.o 2>&1 \ -// RUN: -target mips-linux-gnu -msoft-float -mips16 \ +// RUN: --target=mips-linux-gnu -msoft-float -mips16 \ // RUN: | FileCheck --check-prefix=CHECK-SOFT-MIPS16 %s // CHECK-SOFT-MIPS16: "-target-feature" "+soft-float" // CHECK-SOFT-MIPS16: "-target-feature" "+mips16" @@ -89,14 +89,14 @@ // // -mfloat-abi=hard -mips16 // RUN: %clang -c %s -### -o %t.o 2>&1 \ -// RUN: -target mips-linux-gnu -mfloat-abi=hard -mips16 \ +// RUN: --target=mips-linux-gnu -mfloat-abi=hard -mips16 \ // RUN: | FileCheck --check-prefix=CHECK-ABI-HARD-MIPS16 %s // CHECK-ABI-HARD-MIPS16: "-target-feature" "+mips16" // CHECK-ABI-HARD-MIPS16: "-mfloat-abi" "hard" // // -mfloat-abi=soft -mips16 // RUN: %clang -c %s -### -o %t.o 2>&1 \ -// RUN: -target mips-linux-gnu -mfloat-abi=soft -mips16 \ +// RUN: --target=mips-linux-gnu -mfloat-abi=soft -mips16 \ // RUN: | FileCheck --check-prefix=CHECK-ABI-SOFT-MIPS16 %s // CHECK-ABI-SOFT-MIPS16: "-target-feature" "+soft-float" // CHECK-ABI-SOFT-MIPS16: "-target-feature" "+mips16" diff --git a/clang/test/Driver/mips-gpopt-warning.c b/clang/test/Driver/mips-gpopt-warning.c index b6677413729f2..2bd63b4d6518c 100644 --- a/clang/test/Driver/mips-gpopt-warning.c +++ b/clang/test/Driver/mips-gpopt-warning.c @@ -1,6 +1,6 @@ // REQUIRES: mips-registered-target -// RUN: %clang -### -c -target mips-mti-elf %s -mgpopt 2>&1 | FileCheck -check-prefix=IMPLICIT %s +// RUN: %clang -### -c --target=mips-mti-elf %s -mgpopt 2>&1 | FileCheck -check-prefix=IMPLICIT %s // IMPLICIT: warning: ignoring '-mgpopt' option as it cannot be used with the implicit usage of -mabicalls -// RUN: %clang -### -c -target mips-mti-elf %s -mgpopt -mabicalls 2>&1 | FileCheck -check-prefix=EXPLICIT %s +// RUN: %clang -### -c --target=mips-mti-elf %s -mgpopt -mabicalls 2>&1 | FileCheck -check-prefix=EXPLICIT %s // EXPLICIT: warning: ignoring '-mgpopt' option as it cannot be used with -mabicalls diff --git a/clang/test/Driver/mips-ias-Wa.s b/clang/test/Driver/mips-ias-Wa.s index bc65872d99c78..88846af606902 100644 --- a/clang/test/Driver/mips-ias-Wa.s +++ b/clang/test/Driver/mips-ias-Wa.s @@ -1,136 +1,136 @@ -// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s 2>&1 | \ +// RUN: %clang --target=mips-linux-gnu -### -fintegrated-as -c %s 2>&1 | \ // RUN: FileCheck -check-prefix=TRAP-DEFAULT %s // TRAP-DEFAULT: -cc1as // TRAP-DEFAULT-NOT: "-target-feature" "-use-tcc-in-div" -// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -Wa,--trap 2>&1 | \ +// RUN: %clang --target=mips-linux-gnu -### -fintegrated-as -c %s -Wa,--trap 2>&1 | \ // RUN: FileCheck -check-prefix=TRAP-ON %s // TRAP-ON: -cc1as // TRAP-ON: "-target-feature" "+use-tcc-in-div" -// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -Wa,--break 2>&1 | \ +// RUN: %clang --target=mips-linux-gnu -### -fintegrated-as -c %s -Wa,--break 2>&1 | \ // RUN: FileCheck -check-prefix=TRAP-OFF %s // TRAP-OFF: -cc1as // TRAP-OFF: "-target-feature" "-use-tcc-in-div" -// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -Wa,--trap,--break 2>&1 | \ +// RUN: %clang --target=mips-linux-gnu -### -fintegrated-as -c %s -Wa,--trap,--break 2>&1 | \ // RUN: FileCheck -check-prefix=TRAP-BOTH-TRAP-FIRST %s // TRAP-BOTH-TRAP-FIRST: -cc1as // TRAP-BOTH-TRAP-FIRST: "-target-feature" "+use-tcc-in-div" "-target-feature" "-use-tcc-in-div" -// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -Wa,--break,--trap 2>&1 | \ +// RUN: %clang --target=mips-linux-gnu -### -fintegrated-as -c %s -Wa,--break,--trap 2>&1 | \ // RUN: FileCheck -check-prefix=TRAP-BOTH-BREAK-FIRST %s // TRAP-BOTH-BREAK-FIRST: -cc1as // TRAP-BOTH-BREAK-FIRST: "-target-feature" "-use-tcc-in-div" "-target-feature" "+use-tcc-in-div" -// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s 2>&1 | \ +// RUN: %clang --target=mips-linux-gnu -### -fintegrated-as -c %s 2>&1 | \ // RUN: FileCheck -check-prefix=MSOFT-FLOAT-DEFAULT %s // MSOFT-FLOAT-DEFAULT: -cc1as // MSOFT-FLOAT-DEFAULT-NOT: "-target-feature" "-soft-float" -// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -Wa,-msoft-float 2>&1 | \ +// RUN: %clang --target=mips-linux-gnu -### -fintegrated-as -c %s -Wa,-msoft-float 2>&1 | \ // RUN: FileCheck -check-prefix=MSOFT-FLOAT-ON %s // MSOFT-FLOAT-ON: -cc1as // MSOFT-FLOAT-ON: "-target-feature" "+soft-float" -// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -Wa,-mhard-float 2>&1 | \ +// RUN: %clang --target=mips-linux-gnu -### -fintegrated-as -c %s -Wa,-mhard-float 2>&1 | \ // RUN: FileCheck -check-prefix=MSOFT-FLOAT-OFF %s // MSOFT-FLOAT-OFF: -cc1as // MSOFT-FLOAT-OFF: "-target-feature" "-soft-float" -// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -Wa,-msoft-float,-mhard-float 2>&1 | \ +// RUN: %clang --target=mips-linux-gnu -### -fintegrated-as -c %s -Wa,-msoft-float,-mhard-float 2>&1 | \ // RUN: FileCheck -check-prefix=MSOFT-FLOAT-BOTH-MSOFT-FLOAT-FIRST %s // MSOFT-FLOAT-BOTH-MSOFT-FLOAT-FIRST: -cc1as // MSOFT-FLOAT-BOTH-MSOFT-FLOAT-FIRST: "-target-feature" "+soft-float" "-target-feature" "-soft-float" -// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -Wa,-mhard-float,-msoft-float 2>&1 | \ +// RUN: %clang --target=mips-linux-gnu -### -fintegrated-as -c %s -Wa,-mhard-float,-msoft-float 2>&1 | \ // RUN: FileCheck -check-prefix=MSOFT-FLOAT-BOTH-MHARD-FLOAT-FIRST %s // MSOFT-FLOAT-BOTH-MHARD-FLOAT-FIRST: -cc1as // MSOFT-FLOAT-BOTH-MHARD-FLOAT-FIRST: "-target-feature" "-soft-float" "-target-feature" "+soft-float" -// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -Wa,-mips1 2>&1 | \ +// RUN: %clang --target=mips-linux-gnu -### -fintegrated-as -c %s -Wa,-mips1 2>&1 | \ // RUN: FileCheck -check-prefix=MIPS1 %s // MIPS1: -cc1as // MIPS1: "-target-feature" "+mips1" -// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -Wa,-mips2 2>&1 | \ +// RUN: %clang --target=mips-linux-gnu -### -fintegrated-as -c %s -Wa,-mips2 2>&1 | \ // RUN: FileCheck -check-prefix=MIPS2 %s // MIPS2: -cc1as // MIPS2: "-target-feature" "+mips2" -// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -Wa,-mips3 2>&1 | \ +// RUN: %clang --target=mips-linux-gnu -### -fintegrated-as -c %s -Wa,-mips3 2>&1 | \ // RUN: FileCheck -check-prefix=MIPS3 %s // MIPS3: -cc1as // MIPS3: "-target-feature" "+mips3" -// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -Wa,-mips4 2>&1 | \ +// RUN: %clang --target=mips-linux-gnu -### -fintegrated-as -c %s -Wa,-mips4 2>&1 | \ // RUN: FileCheck -check-prefix=MIPS4 %s // MIPS4: -cc1as // MIPS4: "-target-feature" "+mips4" -// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -Wa,-mips5 2>&1 | \ +// RUN: %clang --target=mips-linux-gnu -### -fintegrated-as -c %s -Wa,-mips5 2>&1 | \ // RUN: FileCheck -check-prefix=MIPS5 %s // MIPS5: -cc1as // MIPS5: "-target-feature" "+mips5" -// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -Wa,-mips32 2>&1 | \ +// RUN: %clang --target=mips-linux-gnu -### -fintegrated-as -c %s -Wa,-mips32 2>&1 | \ // RUN: FileCheck -check-prefix=MIPS32 %s // MIPS32: -cc1as // MIPS32: "-target-feature" "+mips32" -// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -Wa,-mips32r2 2>&1 | \ +// RUN: %clang --target=mips-linux-gnu -### -fintegrated-as -c %s -Wa,-mips32r2 2>&1 | \ // RUN: FileCheck -check-prefix=MIPS32R2 %s // MIPS32R2: -cc1as // MIPS32R2: "-target-feature" "+mips32r2" -// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -Wa,-mips32r3 2>&1 | \ +// RUN: %clang --target=mips-linux-gnu -### -fintegrated-as -c %s -Wa,-mips32r3 2>&1 | \ // RUN: FileCheck -check-prefix=MIPS32R3 %s // MIPS32R3: -cc1as // MIPS32R3: "-target-feature" "+mips32r3" -// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -Wa,-mips32r5 2>&1 | \ +// RUN: %clang --target=mips-linux-gnu -### -fintegrated-as -c %s -Wa,-mips32r5 2>&1 | \ // RUN: FileCheck -check-prefix=MIPS32R5 %s // MIPS32R5: -cc1as // MIPS32R5: "-target-feature" "+mips32r5" -// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -Wa,-mips32r6 2>&1 | \ +// RUN: %clang --target=mips-linux-gnu -### -fintegrated-as -c %s -Wa,-mips32r6 2>&1 | \ // RUN: FileCheck -check-prefix=MIPS32R6 %s // MIPS32R6: -cc1as // MIPS32R6: "-target-feature" "+mips32r6" -// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -Wa,-mips64 2>&1 | \ +// RUN: %clang --target=mips-linux-gnu -### -fintegrated-as -c %s -Wa,-mips64 2>&1 | \ // RUN: FileCheck -check-prefix=MIPS64 %s // MIPS64: -cc1as // MIPS64: "-target-feature" "+mips64" -// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -Wa,-mips64r2 2>&1 | \ +// RUN: %clang --target=mips-linux-gnu -### -fintegrated-as -c %s -Wa,-mips64r2 2>&1 | \ // RUN: FileCheck -check-prefix=MIPS64R2 %s // MIPS64R2: -cc1as // MIPS64R2: "-target-feature" "+mips64r2" -// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -Wa,-mips64r3 2>&1 | \ +// RUN: %clang --target=mips-linux-gnu -### -fintegrated-as -c %s -Wa,-mips64r3 2>&1 | \ // RUN: FileCheck -check-prefix=MIPS64R3 %s // MIPS64R3: -cc1as // MIPS64R3: "-target-feature" "+mips64r3" -// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -Wa,-mips64r5 2>&1 | \ +// RUN: %clang --target=mips-linux-gnu -### -fintegrated-as -c %s -Wa,-mips64r5 2>&1 | \ // RUN: FileCheck -check-prefix=MIPS64R5 %s // MIPS64R5: -cc1as // MIPS64R5: "-target-feature" "+mips64r5" -// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -Wa,-mips64r6 2>&1 | \ +// RUN: %clang --target=mips-linux-gnu -### -fintegrated-as -c %s -Wa,-mips64r6 2>&1 | \ // RUN: FileCheck -check-prefix=MIPS64R6 %s // MIPS64R6: -cc1as // MIPS64R6: "-target-feature" "+mips64r6" -// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -Wa,-mips64r2,-mips4 2>&1 | \ +// RUN: %clang --target=mips-linux-gnu -### -fintegrated-as -c %s -Wa,-mips64r2,-mips4 2>&1 | \ // RUN: FileCheck -check-prefix=MIPS64R2-MIPS4 %s // MIPS64R2-MIPS4: -cc1as // MIPS64R2-MIPS4-NOT: "-target-feature" "+mips64r2" // MIPS64R2-MIPS4: "-target-feature" "+mips4" // MIPS64R2-MIPS4-NOT: "-target-feature" "+mips64r2" -// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -Wa,-mips64,-mips32,-mips32r2 2>&1 | \ +// RUN: %clang --target=mips-linux-gnu -### -fintegrated-as -c %s -Wa,-mips64,-mips32,-mips32r2 2>&1 | \ // RUN: FileCheck -check-prefix=MIPS64-MIPS32-MIPS32R2 %s // MIPS64-MIPS32-MIPS32R2: -cc1as // MIPS64-MIPS32-MIPS32R2-NOT: "-target-feature" "+mips64" diff --git a/clang/test/Driver/mips-integrated-as.s b/clang/test/Driver/mips-integrated-as.s index e248ba7f77e91..1714596acca98 100644 --- a/clang/test/Driver/mips-integrated-as.s +++ b/clang/test/Driver/mips-integrated-as.s @@ -1,20 +1,20 @@ -// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s 2>&1 | \ +// RUN: %clang --target=mips-linux-gnu -### -fintegrated-as -c %s 2>&1 | \ // RUN: FileCheck -check-prefix=ABI-O32 %s -// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -mabi=32 2>&1 | \ +// RUN: %clang --target=mips-linux-gnu -### -fintegrated-as -c %s -mabi=32 2>&1 | \ // RUN: FileCheck -check-prefix=ABI-O32 %s -// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -mabi=o32 2>&1 | \ +// RUN: %clang --target=mips-linux-gnu -### -fintegrated-as -c %s -mabi=o32 2>&1 | \ // RUN: FileCheck -check-prefix=ABI-O32 %s // ABI-O32: -cc1as // ABI-O32: "-target-abi" "o32" -// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -mabi=eabi 2>&1 | \ +// RUN: %clang --target=mips-linux-gnu -### -fintegrated-as -c %s -mabi=eabi 2>&1 | \ // RUN: FileCheck -check-prefix=ABI-EABI32 %s // ABI-EABI32: -cc1as // ABI-EABI32: "-target-abi" "eabi" -// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -mips64 -mabi=n32 2>&1 | \ +// RUN: %clang --target=mips-linux-gnu -### -fintegrated-as -c %s -mips64 -mabi=n32 2>&1 | \ // RUN: FileCheck -check-prefix=ABI-N32 %s -// RUN: %clang -target mips64-linux-gnu -### -fintegrated-as -c %s -mabi=n32 2>&1 | \ +// RUN: %clang --target=mips64-linux-gnu -### -fintegrated-as -c %s -mabi=n32 2>&1 | \ // RUN: FileCheck -check-prefix=ABI-N32 %s // ABI-N32: -cc1as // ABI-N32: "-target-abi" "n32" @@ -22,284 +22,284 @@ // FIXME: We should also test '-target mips-linux-gnu -mips64' defaults to the // default 64-bit ABI (N64 but GCC uses N32). It currently selects O32 // because of the triple. -// RUN: %clang -target mips64-linux-gnu -### -fintegrated-as -c %s -mips64 2>&1 | \ +// RUN: %clang --target=mips64-linux-gnu -### -fintegrated-as -c %s -mips64 2>&1 | \ // RUN: FileCheck -check-prefix=ABI-N64 %s // -// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -mips64 -mabi=64 2>&1 | \ +// RUN: %clang --target=mips-linux-gnu -### -fintegrated-as -c %s -mips64 -mabi=64 2>&1 | \ // RUN: FileCheck -check-prefix=ABI-N64 %s -// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -mips64 -mabi=n64 2>&1 | \ +// RUN: %clang --target=mips-linux-gnu -### -fintegrated-as -c %s -mips64 -mabi=n64 2>&1 | \ // RUN: FileCheck -check-prefix=ABI-N64 %s -// RUN: %clang -target mips64-linux-gnu -### -fintegrated-as -c %s -mips64 -mabi=64 2>&1 | \ +// RUN: %clang --target=mips64-linux-gnu -### -fintegrated-as -c %s -mips64 -mabi=64 2>&1 | \ // RUN: FileCheck -check-prefix=ABI-N64 %s -// RUN: %clang -target mips64-linux-gnu -### -fintegrated-as -c %s -mips64 -mabi=n64 2>&1 | \ +// RUN: %clang --target=mips64-linux-gnu -### -fintegrated-as -c %s -mips64 -mabi=n64 2>&1 | \ // RUN: FileCheck -check-prefix=ABI-N64 %s // ABI-N64: -cc1as // ABI-N64: "-target-abi" "n64" -// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -msoft-float 2>&1 | \ +// RUN: %clang --target=mips-linux-gnu -### -fintegrated-as -c %s -msoft-float 2>&1 | \ // RUN: FileCheck -check-prefix=SOFTFLOAT %s // SOFTFLOAT: -cc1as // SOFTFLOAT: "-target-feature" "+soft-float" -// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s 2>&1 | \ +// RUN: %clang --target=mips-linux-gnu -### -fintegrated-as -c %s 2>&1 | \ // RUN: FileCheck -check-prefix=HARDFLOAT %s -// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -mhard-float 2>&1 | \ +// RUN: %clang --target=mips-linux-gnu -### -fintegrated-as -c %s -mhard-float 2>&1 | \ // RUN: FileCheck -check-prefix=HARDFLOAT %s // HARDFLOAT: -cc1as // HARDFLOAT-NOT: "-target-feature" "+soft-float" -// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s 2>&1 | \ +// RUN: %clang --target=mips-linux-gnu -### -fintegrated-as -c %s 2>&1 | \ // RUN: FileCheck -check-prefix=NAN-DEFAULT %s -// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -mips32r6 2>&1 | \ +// RUN: %clang --target=mips-linux-gnu -### -fintegrated-as -c %s -mips32r6 2>&1 | \ // RUN: FileCheck -check-prefix=NAN-DEFAULT %s -// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -mips64r6 2>&1 | \ +// RUN: %clang --target=mips-linux-gnu -### -fintegrated-as -c %s -mips64r6 2>&1 | \ // RUN: FileCheck -check-prefix=NAN-DEFAULT %s // NAN-DEFAULT: -cc1as // NAN-DEFAULT-NOT: "-target-feature" "{{[-+]}}nan2008" -// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -mnan=legacy 2>&1 | \ +// RUN: %clang --target=mips-linux-gnu -### -fintegrated-as -c %s -mnan=legacy 2>&1 | \ // RUN: FileCheck -check-prefix=NAN-LEGACY %s // NAN-LEGACY: -cc1as // NAN-LEGACY: "-target-feature" "-nan2008" -// RUN: %clang -target mips-linux-gnu -march=mips32r6 -### -fintegrated-as -c %s -mnan=2008 2>&1 | \ +// RUN: %clang --target=mips-linux-gnu -march=mips32r6 -### -fintegrated-as -c %s -mnan=2008 2>&1 | \ // RUN: FileCheck -check-prefix=NAN-2008 %s // NAN-2008: -cc1as // NAN-2008: "-target-feature" "+nan2008" -// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s 2>&1 | \ +// RUN: %clang --target=mips-linux-gnu -### -fintegrated-as -c %s 2>&1 | \ // RUN: FileCheck -check-prefix=DEFAULT-FLOAT %s // DEFAULT-FLOAT: -cc1as // DEFAULT-FLOAT-NOT: "-target-feature" "{{[+-]}}single-float" -// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -msingle-float 2>&1 | \ +// RUN: %clang --target=mips-linux-gnu -### -fintegrated-as -c %s -msingle-float 2>&1 | \ // RUN: FileCheck -check-prefix=SINGLE-FLOAT %s // SINGLE-FLOAT: -cc1as // SINGLE-FLOAT: "-target-feature" "+single-float" -// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -mdouble-float 2>&1 | \ +// RUN: %clang --target=mips-linux-gnu -### -fintegrated-as -c %s -mdouble-float 2>&1 | \ // RUN: FileCheck -check-prefix=DOUBLE-FLOAT %s // DOUBLE-FLOAT: -cc1as // DOUBLE-FLOAT: "-target-feature" "-single-float" -// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s 2>&1 | \ +// RUN: %clang --target=mips-linux-gnu -### -fintegrated-as -c %s 2>&1 | \ // RUN: FileCheck -check-prefix=MIPS16-DEFAULT %s // MIPS16-DEFAULT: -cc1as // MIPS16-DEFAULT-NOT: "-target-feature" "{{[+-]}}mips16" -// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -mips16 2>&1 | \ +// RUN: %clang --target=mips-linux-gnu -### -fintegrated-as -c %s -mips16 2>&1 | \ // RUN: FileCheck -check-prefix=MIPS16-ON %s // MIPS16-ON: -cc1as // MIPS16-ON: "-target-feature" "+mips16" -// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -mno-mips16 2>&1 | \ +// RUN: %clang --target=mips-linux-gnu -### -fintegrated-as -c %s -mno-mips16 2>&1 | \ // RUN: FileCheck -check-prefix=MIPS16-OFF %s // MIPS16-OFF: -cc1as // MIPS16-OFF: "-target-feature" "-mips16" -// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s 2>&1 | \ +// RUN: %clang --target=mips-linux-gnu -### -fintegrated-as -c %s 2>&1 | \ // RUN: FileCheck -check-prefix=MICROMIPS-DEFAULT %s // MICROMIPS-DEFAULT: -cc1as // MICROMIPS-DEFAULT-NOT: "-target-feature" "{{[+-]}}micromips" -// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -mmicromips 2>&1 | \ +// RUN: %clang --target=mips-linux-gnu -### -fintegrated-as -c %s -mmicromips 2>&1 | \ // RUN: FileCheck -check-prefix=MICROMIPS-ON %s // MICROMIPS-ON: -cc1as // MICROMIPS-ON: "-target-feature" "+micromips" -// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -mno-micromips 2>&1 | \ +// RUN: %clang --target=mips-linux-gnu -### -fintegrated-as -c %s -mno-micromips 2>&1 | \ // RUN: FileCheck -check-prefix=MICROMIPS-OFF %s // MICROMIPS-OFF: -cc1as // MICROMIPS-OFF: "-target-feature" "-micromips" -// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s 2>&1 | \ +// RUN: %clang --target=mips-linux-gnu -### -fintegrated-as -c %s 2>&1 | \ // RUN: FileCheck -check-prefix=DSP-DEFAULT %s // DSP-DEFAULT: -cc1as // DSP-DEFAULT-NOT: "-target-feature" "{{[+-]}}dsp" -// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -mdsp 2>&1 | \ +// RUN: %clang --target=mips-linux-gnu -### -fintegrated-as -c %s -mdsp 2>&1 | \ // RUN: FileCheck -check-prefix=DSP-ON %s // DSP-ON: -cc1as // DSP-ON: "-target-feature" "+dsp" -// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -mno-dsp 2>&1 | \ +// RUN: %clang --target=mips-linux-gnu -### -fintegrated-as -c %s -mno-dsp 2>&1 | \ // RUN: FileCheck -check-prefix=DSP-OFF %s // DSP-OFF: -cc1as // DSP-OFF: "-target-feature" "-dsp" -// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s 2>&1 | \ +// RUN: %clang --target=mips-linux-gnu -### -fintegrated-as -c %s 2>&1 | \ // RUN: FileCheck -check-prefix=DSPR2-DEFAULT %s // DSPR2-DEFAULT: -cc1as // DSPR2-DEFAULT-NOT: "-target-feature" "{{[+-]}}dspr2" -// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -mdspr2 2>&1 | \ +// RUN: %clang --target=mips-linux-gnu -### -fintegrated-as -c %s -mdspr2 2>&1 | \ // RUN: FileCheck -check-prefix=DSPR2-ON %s // DSPR2-ON: -cc1as // DSPR2-ON: "-target-feature" "+dspr2" -// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -mno-dspr2 2>&1 | \ +// RUN: %clang --target=mips-linux-gnu -### -fintegrated-as -c %s -mno-dspr2 2>&1 | \ // RUN: FileCheck -check-prefix=DSPR2-OFF %s // DSPR2-OFF: -cc1as // DSPR2-OFF: "-target-feature" "-dspr2" -// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s 2>&1 | \ +// RUN: %clang --target=mips-linux-gnu -### -fintegrated-as -c %s 2>&1 | \ // RUN: FileCheck -check-prefix=MSA-DEFAULT %s // MSA-DEFAULT: -cc1as // MSA-DEFAULT-NOT: "-target-feature" "{{[+-]}}msa" -// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -mmsa 2>&1 | \ +// RUN: %clang --target=mips-linux-gnu -### -fintegrated-as -c %s -mmsa 2>&1 | \ // RUN: FileCheck -check-prefix=MSA-ON %s // MSA-ON: -cc1as // MSA-ON: "-target-feature" "+msa" -// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -mno-msa 2>&1 | \ +// RUN: %clang --target=mips-linux-gnu -### -fintegrated-as -c %s -mno-msa 2>&1 | \ // RUN: FileCheck -check-prefix=MSA-OFF %s // MSA-OFF: -cc1as // MSA-OFF: "-target-feature" "-msa" -// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s 2>&1 | \ +// RUN: %clang --target=mips-linux-gnu -### -fintegrated-as -c %s 2>&1 | \ // RUN: FileCheck -check-prefix=FPXX-DEFAULT %s // FPXX-DEFAULT: -cc1as // FPXX-DEFAULT: "-target-feature" "+fpxx" // FPXX-DEFAULT: "-target-feature" "+nooddspreg" -// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -mfp32 2>&1 | \ +// RUN: %clang --target=mips-linux-gnu -### -fintegrated-as -c %s -mfp32 2>&1 | \ // RUN: FileCheck -check-prefix=FP32 %s // FP32: -cc1as // FP32: "-target-feature" "-fp64" -// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -mfpxx 2>&1 | \ +// RUN: %clang --target=mips-linux-gnu -### -fintegrated-as -c %s -mfpxx 2>&1 | \ // RUN: FileCheck -check-prefix=FPXX %s // FPXX: -cc1as // FPXX: "-target-feature" "+fpxx" // FPXX: "-target-feature" "+nooddspreg" -// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -mfp64 2>&1 | \ +// RUN: %clang --target=mips-linux-gnu -### -fintegrated-as -c %s -mfp64 2>&1 | \ // RUN: FileCheck -check-prefix=FP64 %s // FP64: -cc1as // FP64: "-target-feature" "+fp64" -// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s 2>&1 | \ +// RUN: %clang --target=mips-linux-gnu -### -fintegrated-as -c %s 2>&1 | \ // RUN: FileCheck -check-prefix=ODDSPREG-DEFAULT %s // ODDSPREG-DEFAULT: -cc1as // ODDSPREG-DEFAULT: "-target-feature" "+nooddspreg" -// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -modd-spreg 2>&1 | \ +// RUN: %clang --target=mips-linux-gnu -### -fintegrated-as -c %s -modd-spreg 2>&1 | \ // RUN: FileCheck -check-prefix=ODDSPREG-ON %s // ODDSPREG-ON: -cc1as // ODDSPREG-ON: "-target-feature" "-nooddspreg" -// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -mno-odd-spreg 2>&1 | \ +// RUN: %clang --target=mips-linux-gnu -### -fintegrated-as -c %s -mno-odd-spreg 2>&1 | \ // RUN: FileCheck -check-prefix=ODDSPREG-OFF %s // ODDSPREG-OFF: -cc1as // ODDSPREG-OFF: "-target-feature" "+nooddspreg" -// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -mfpxx -modd-spreg 2>&1 | \ +// RUN: %clang --target=mips-linux-gnu -### -fintegrated-as -c %s -mfpxx -modd-spreg 2>&1 | \ // RUN: FileCheck -check-prefix=FPXX-ODDSPREG %s // FPXX-ODDSPREG: -cc1as // FPXX-ODDSPREG: "-target-feature" "+fpxx" // FPXX-ODDSPREG: "-target-feature" "-nooddspreg" -// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -mabicalls 2>&1 | \ +// RUN: %clang --target=mips-linux-gnu -### -fintegrated-as -c %s -mabicalls 2>&1 | \ // RUN: FileCheck -check-prefix=ABICALLS-ON %s // ABICALLS-ON: -cc1as // ABICALLS-ON: "-target-feature" "-noabicalls" -// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -c %s -mno-abicalls 2>&1 | \ +// RUN: %clang --target=mips-linux-gnu -### -fintegrated-as -c %s -mno-abicalls 2>&1 | \ // RUN: FileCheck -check-prefix=ABICALLS-OFF %s // ABICALLS-OFF: -cc1as // ABICALLS-OFF: "-target-feature" "+noabicalls" -// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -msoft-float -c %s 2>&1 | \ +// RUN: %clang --target=mips-linux-gnu -### -fintegrated-as -msoft-float -c %s 2>&1 | \ // RUN: FileCheck -check-prefix=SOFTFLOAT-IMPLICIT-FPXX --implicit-check-not=-mfpxx %s // SOFTFLOAT-IMPLICIT-FPXX: -cc1as // SOFTFLOAT-IMPLICIT-FPXX: "-target-feature" "+soft-float" // SOFTFLOAT-IMPLICIT-FPXX-NOT: "-target-feature" "+fpxx" // SOFTFLOAT-IMPLICIT-FPXX-NOT: "-target-feature" "+nooddspreg" -// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -msoft-float -mfpxx -c %s 2>&1 | \ +// RUN: %clang --target=mips-linux-gnu -### -fintegrated-as -msoft-float -mfpxx -c %s 2>&1 | \ // RUN: FileCheck -check-prefix=SOFTFLOAT-EXPLICIT-FPXX %s // SOFTFLOAT-EXPLICIT-FPXX: -cc1as // SOFTFLOAT-EXPLICIT-FPXX: "-target-feature" "+soft-float" // SOFTFLOAT-EXPLICIT-FPXX: "-target-feature" "+fpxx" // SOFTFLOAT-EXPLICIT-FPXX: "-target-feature" "+nooddspreg" -// RUN: %clang -target mips-mti-linux-gnu -### -fintegrated-as -msoft-float -c %s 2>&1 | \ +// RUN: %clang --target=mips-mti-linux-gnu -### -fintegrated-as -msoft-float -c %s 2>&1 | \ // RUN: FileCheck -check-prefix=MTI-SOFTFLOAT-IMPLICIT-FPXX --implicit-check-not=-mfpxx %s // MTI-SOFTFLOAT-IMPLICIT-FPXX: -cc1as // MTI-SOFTFLOAT-IMPLICIT-FPXX: "-target-feature" "+soft-float" // MTI-SOFTFLOAT-IMPLICIT-FPXX-NOT: "-target-feature" "+fpxx" // MTI-SOFTFLOAT-IMPLICIT-FPXX-NOT: "-target-feature" "+nooddspreg" -// RUN: %clang -target mips-mti-linux-gnu -### -fintegrated-as -msoft-float -mfpxx -c %s 2>&1 | \ +// RUN: %clang --target=mips-mti-linux-gnu -### -fintegrated-as -msoft-float -mfpxx -c %s 2>&1 | \ // RUN: FileCheck -check-prefix=MTI-SOFTFLOAT-EXPLICIT-FPXX %s // MTI-SOFTFLOAT-EXPLICIT-FPXX: -cc1as // MTI-SOFTFLOAT-EXPLICIT-FPXX: "-target-feature" "+soft-float" // MTI-SOFTFLOAT-EXPLICIT-FPXX: "-target-feature" "+fpxx" // MTI-SOFTFLOAT-EXPLICIT-FPXX: "-target-feature" "+nooddspreg" -// RUN: %clang -target mips-img-linux-gnu -### -fintegrated-as -msoft-float -c %s 2>&1 | \ +// RUN: %clang --target=mips-img-linux-gnu -### -fintegrated-as -msoft-float -c %s 2>&1 | \ // RUN: FileCheck -check-prefix=IMG-SOFTFLOAT-IMPLICIT-FPXX --implicit-check-not=-mfpxx %s // IMG-SOFTFLOAT-IMPLICIT-FPXX: -cc1as // IMG-SOFTFLOAT-IMPLICIT-FPXX: "-target-feature" "+soft-float" // IMG-SOFTFLOAT-IMPLICIT-FPXX-NOT: "-target-feature" "+fpxx" // IMG-SOFTFLOAT-IMPLICIT-FPXX-NOT: "-target-feature" "+nooddspreg" -// RUN: %clang -target mips-img-linux-gnu -### -fintegrated-as -msoft-float -mfpxx -c %s 2>&1 | \ +// RUN: %clang --target=mips-img-linux-gnu -### -fintegrated-as -msoft-float -mfpxx -c %s 2>&1 | \ // RUN: FileCheck -check-prefix=IMG-SOFTFLOAT-EXPLICIT-FPXX %s // IMG-SOFTFLOAT-EXPLICIT-FPXX: -cc1as // IMG-SOFTFLOAT-EXPLICIT-FPXX: "-target-feature" "+soft-float" // IMG-SOFTFLOAT-EXPLICIT-FPXX: "-target-feature" "+fpxx" // IMG-SOFTFLOAT-EXPLICIT-FPXX: "-target-feature" "+nooddspreg" -// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -msingle-float -c %s 2>&1 | \ +// RUN: %clang --target=mips-linux-gnu -### -fintegrated-as -msingle-float -c %s 2>&1 | \ // RUN: FileCheck -check-prefix=SINGLEFLOAT-IMPLICIT-FPXX --implicit-check-not=-mfpxx %s // SINGLEFLOAT-IMPLICIT-FPXX: -cc1as // SINGLEFLOAT-IMPLICIT-FPXX: "-target-feature" "+single-float" // SINGLEFLOAT-IMPLICIT-FPXX-NOT: "-target-feature" "+fpxx" // SINGLEFLOAT-IMPLICIT-FPXX-NOT: "-target-feature" "+nooddspreg" -// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -msingle-float -mfpxx -c %s 2>&1 | \ +// RUN: %clang --target=mips-linux-gnu -### -fintegrated-as -msingle-float -mfpxx -c %s 2>&1 | \ // RUN: FileCheck -check-prefix=SINGLEFLOAT-EXPLICIT-FPXX %s // SINGLEFLOAT-EXPLICIT-FPXX: -cc1as // SINGLEFLOAT-EXPLICIT-FPXX: "-target-feature" "+single-float" // SINGLEFLOAT-EXPLICIT-FPXX: "-target-feature" "+fpxx" // SINGLEFLOAT-EXPLICIT-FPXX: "-target-feature" "+nooddspreg" -// RUN: %clang -target mips-mti-linux-gnu -### -fintegrated-as -msingle-float -c %s 2>&1 | \ +// RUN: %clang --target=mips-mti-linux-gnu -### -fintegrated-as -msingle-float -c %s 2>&1 | \ // RUN: FileCheck -check-prefix=MTI-SINGLEFLOAT-IMPLICIT-FPXX --implicit-check-not=-mfpxx %s // MTI-SINGLEFLOAT-IMPLICIT-FPXX: -cc1as // MTI-SINGLEFLOAT-IMPLICIT-FPXX: "-target-feature" "+single-float" // MTI-SINGLEFLOAT-IMPLICIT-FPXX-NOT: "-target-feature" "+fpxx" // MTI-SINGLEFLOAT-IMPLICIT-FPXX-NOT: "-target-feature" "+nooddspreg" -// RUN: %clang -target mips-mti-linux-gnu -### -fintegrated-as -msingle-float -mfpxx -c %s 2>&1 | \ +// RUN: %clang --target=mips-mti-linux-gnu -### -fintegrated-as -msingle-float -mfpxx -c %s 2>&1 | \ // RUN: FileCheck -check-prefix=MTI-SINGLEFLOAT-EXPLICIT-FPXX %s // MTI-SINGLEFLOAT-EXPLICIT-FPXX: -cc1as // MTI-SINGLEFLOAT-EXPLICIT-FPXX: "-target-feature" "+single-float" // MTI-SINGLEFLOAT-EXPLICIT-FPXX: "-target-feature" "+fpxx" // MTI-SINGLEFLOAT-EXPLICIT-FPXX: "-target-feature" "+nooddspreg" -// RUN: %clang -target mips-img-linux-gnu -### -fintegrated-as -msingle-float -c %s 2>&1 | \ +// RUN: %clang --target=mips-img-linux-gnu -### -fintegrated-as -msingle-float -c %s 2>&1 | \ // RUN: FileCheck -check-prefix=IMG-SINGLEFLOAT-IMPLICIT-FPXX --implicit-check-not=-mfpxx %s // IMG-SINGLEFLOAT-IMPLICIT-FPXX: -cc1as // IMG-SINGLEFLOAT-IMPLICIT-FPXX: "-target-feature" "+single-float" // IMG-SINGLEFLOAT-IMPLICIT-FPXX-NOT: "-target-feature" "+fpxx" // IMG-SINGLEFLOAT-IMPLICIT-FPXX-NOT: "-target-feature" "+nooddspreg" -// RUN: %clang -target mips-img-linux-gnu -### -fintegrated-as -msingle-float -mfpxx -c %s 2>&1 | \ +// RUN: %clang --target=mips-img-linux-gnu -### -fintegrated-as -msingle-float -mfpxx -c %s 2>&1 | \ // RUN: FileCheck -check-prefix=IMG-SINGLEFLOAT-EXPLICIT-FPXX %s // IMG-SINGLEFLOAT-EXPLICIT-FPXX: -cc1as // IMG-SINGLEFLOAT-EXPLICIT-FPXX: "-target-feature" "+single-float" // IMG-SINGLEFLOAT-EXPLICIT-FPXX: "-target-feature" "+fpxx" // IMG-SINGLEFLOAT-EXPLICIT-FPXX: "-target-feature" "+nooddspreg" -// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -mxgot -c %s 2>&1 | \ +// RUN: %clang --target=mips-linux-gnu -### -fintegrated-as -mxgot -c %s 2>&1 | \ // RUN: FileCheck -check-prefix=XGOT %s // XGOT: -cc1as // XGOT: "-target-feature" "+xgot" -// RUN: %clang -target mips-linux-gnu -### -fintegrated-as -mno-xgot -c %s 2>&1 | \ +// RUN: %clang --target=mips-linux-gnu -### -fintegrated-as -mno-xgot -c %s 2>&1 | \ // RUN: FileCheck -check-prefix=NOXGOT %s // NOXGOT: -cc1as // NOXGOT: "-target-feature" "-xgot" diff --git a/clang/test/Driver/mips-mabs-warning.c b/clang/test/Driver/mips-mabs-warning.c index 93175be4ccb8d..866393fbc4851 100644 --- a/clang/test/Driver/mips-mabs-warning.c +++ b/clang/test/Driver/mips-mabs-warning.c @@ -1,6 +1,6 @@ // REQUIRES: mips-registered-target -// RUN: %clang -c -target mips-unknown-gnu -mcpu=mips32 -mabs=2008 %s 2>&1 | FileCheck -check-prefix=NO2008 %s +// RUN: %clang -c --target=mips-unknown-gnu -mcpu=mips32 -mabs=2008 %s 2>&1 | FileCheck -check-prefix=NO2008 %s // NO2008: warning: ignoring '-mabs=2008' option because the 'mips32' architecture does not support it [-Wunsupported-abs] -// RUN: %clang -c -target mips-unknown-gnu -mcpu=mips32r6 -mabs=legacy %s 2>&1 | FileCheck -check-prefix=NOLEGACY %s +// RUN: %clang -c --target=mips-unknown-gnu -mcpu=mips32r6 -mabs=legacy %s 2>&1 | FileCheck -check-prefix=NOLEGACY %s // NOLEGACY: warning: ignoring '-mabs=legacy' option because the 'mips32r6' architecture does not support it [-Wunsupported-abs] diff --git a/clang/test/Driver/mlong-double-128.c b/clang/test/Driver/mlong-double-128.c index db5a03d292ec5..af038fc6a4075 100644 --- a/clang/test/Driver/mlong-double-128.c +++ b/clang/test/Driver/mlong-double-128.c @@ -1,17 +1,17 @@ -// RUN: %clang -target powerpc-linux-musl -c -### %s -mlong-double-128 2>&1 | FileCheck %s -// RUN: %clang -target powerpc64-pc-freebsd12 -c -### %s -mlong-double-128 2>&1 | FileCheck %s -// RUN: %clang -target powerpc64le-linux-musl -c -### %s -mlong-double-128 2>&1 | FileCheck %s -// RUN: %clang -target i686-linux-gnu -c -### %s -mlong-double-128 2>&1 | FileCheck %s +// RUN: %clang --target=powerpc-linux-musl -c -### %s -mlong-double-128 2>&1 | FileCheck %s +// RUN: %clang --target=powerpc64-pc-freebsd12 -c -### %s -mlong-double-128 2>&1 | FileCheck %s +// RUN: %clang --target=powerpc64le-linux-musl -c -### %s -mlong-double-128 2>&1 | FileCheck %s +// RUN: %clang --target=i686-linux-gnu -c -### %s -mlong-double-128 2>&1 | FileCheck %s -// RUN: %clang -target x86_64-linux-musl -c -### %s -mlong-double-128 -mlong-double-80 2>&1 | FileCheck --implicit-check-not=-mlong-double-128 /dev/null -// RUN: %clang -target x86_64-linux-musl -c -### %s -mlong-double-80 -mlong-double-128 2>&1 | FileCheck %s +// RUN: %clang --target=x86_64-linux-musl -c -### %s -mlong-double-128 -mlong-double-80 2>&1 | FileCheck --implicit-check-not=-mlong-double-128 /dev/null +// RUN: %clang --target=x86_64-linux-musl -c -### %s -mlong-double-80 -mlong-double-128 2>&1 | FileCheck %s // CHECK: "-mlong-double-128" -// RUN: not %clang -target aarch64 -c -### %s -mlong-double-128 2>&1 | FileCheck --check-prefix=ERR %s -// RUN: not %clang -target powerpc -c -### %s -mlong-double-80 2>&1 | FileCheck --check-prefix=ERR2 %s -// RUN: not %clang -target spir64-unknown-unknown -c -### %s -mlong-double-128 2>&1 | FileCheck --check-prefix=ERR3 %s -// RUN: not %clang -target spir64-unknown-unknown -c -### %s -mlong-double-80 2>&1 | FileCheck --check-prefix=ERR4 %s +// RUN: not %clang --target=aarch64 -c -### %s -mlong-double-128 2>&1 | FileCheck --check-prefix=ERR %s +// RUN: not %clang --target=powerpc -c -### %s -mlong-double-80 2>&1 | FileCheck --check-prefix=ERR2 %s +// RUN: not %clang --target=spir64-unknown-unknown -c -### %s -mlong-double-128 2>&1 | FileCheck --check-prefix=ERR3 %s +// RUN: not %clang --target=spir64-unknown-unknown -c -### %s -mlong-double-80 2>&1 | FileCheck --check-prefix=ERR4 %s // ERR: error: unsupported option '-mlong-double-128' for target 'aarch64' // ERR2: error: unsupported option '-mlong-double-80' for target 'powerpc' diff --git a/clang/test/Driver/mlong-double-64.c b/clang/test/Driver/mlong-double-64.c index 811e747cc9a00..1feef6df57191 100644 --- a/clang/test/Driver/mlong-double-64.c +++ b/clang/test/Driver/mlong-double-64.c @@ -1,9 +1,9 @@ -// RUN: %clang -target powerpc-linux-musl -c -### %s -mlong-double-64 2>&1 | FileCheck %s -// RUN: %clang -target powerpc64-pc-freebsd12 -c -### %s -mlong-double-64 2>&1 | FileCheck %s -// RUN: %clang -target powerpc64le-linux-musl -c -### %s -mlong-double-64 2>&1 | FileCheck %s -// RUN: %clang -target i686-linux-gnu -c -### %s -mlong-double-64 2>&1 | FileCheck %s -// RUN: %clang -target x86_64-linux-musl -c -### %s -mlong-double-64 2>&1 | FileCheck %s -// RUN: %clang -target spir64-unknown-unknown -c -### %s -mlong-double-64 2>&1 | FileCheck %s +// RUN: %clang --target=powerpc-linux-musl -c -### %s -mlong-double-64 2>&1 | FileCheck %s +// RUN: %clang --target=powerpc64-pc-freebsd12 -c -### %s -mlong-double-64 2>&1 | FileCheck %s +// RUN: %clang --target=powerpc64le-linux-musl -c -### %s -mlong-double-64 2>&1 | FileCheck %s +// RUN: %clang --target=i686-linux-gnu -c -### %s -mlong-double-64 2>&1 | FileCheck %s +// RUN: %clang --target=x86_64-linux-musl -c -### %s -mlong-double-64 2>&1 | FileCheck %s +// RUN: %clang --target=spir64-unknown-unknown -c -### %s -mlong-double-64 2>&1 | FileCheck %s // CHECK: "-mlong-double-64" diff --git a/clang/test/Driver/module-output.cppm b/clang/test/Driver/module-output.cppm index dea9cf998a540..bf7bfbf3cb574 100644 --- a/clang/test/Driver/module-output.cppm +++ b/clang/test/Driver/module-output.cppm @@ -22,8 +22,8 @@ // // Tests that clang will reject the command line if it specifies -fmodule-output with // multiple archs. -// RUN: not %clang %t/Hello.cppm -fmodule-output -arch i386 -arch x86_64 -### -target \ -// RUN: x86_64-apple-darwin 2>&1 | FileCheck %t/Hello.cppm -check-prefix=MULTIPLE-ARCH +// RUN: not %clang %t/Hello.cppm -fmodule-output -arch i386 -arch x86_64 -### \ +// RUN: --target=x86_64-apple-darwin 2>&1 | FileCheck %t/Hello.cppm -check-prefix=MULTIPLE-ARCH // Tests that the .pcm file will be generated in the same path with the specified one // in the comamnd line. diff --git a/clang/test/Driver/ms-bitfields.c b/clang/test/Driver/ms-bitfields.c index 031ed41e2aad6..d5a3656b3d110 100644 --- a/clang/test/Driver/ms-bitfields.c +++ b/clang/test/Driver/ms-bitfields.c @@ -1,5 +1,5 @@ -// RUN: %clang -### -target x86_64-linux-gnu %s 2>&1 | FileCheck %s -check-prefix=NO-MSBITFIELDS -// RUN: %clang -### -target x86_64-windows-gnu %s 2>&1 | FileCheck %s -check-prefix=MSBITFIELDS +// RUN: %clang -### --target=x86_64-linux-gnu %s 2>&1 | FileCheck %s -check-prefix=NO-MSBITFIELDS +// RUN: %clang -### --target=x86_64-windows-gnu %s 2>&1 | FileCheck %s -check-prefix=MSBITFIELDS // RUN: %clang -### -mno-ms-bitfields -mms-bitfields %s 2>&1 | FileCheck %s -check-prefix=MSBITFIELDS // RUN: %clang -### -mms-bitfields -mno-ms-bitfields %s 2>&1 | FileCheck %s -check-prefix=NO-MSBITFIELDS diff --git a/clang/test/Driver/ms-define-stdc.c b/clang/test/Driver/ms-define-stdc.c new file mode 100644 index 0000000000000..d5e873d21a76b --- /dev/null +++ b/clang/test/Driver/ms-define-stdc.c @@ -0,0 +1,11 @@ +// Note: %s must be preceded by --, otherwise it may be interpreted as a +// command-line option, e.g. on Mac where %s is commonly under /Users. +// +// Note: see also cl-zc.cpp + +// RUN: %clang_cl /TC /dev/null /E -Xclang -dM /Zc:__STDC__- 2>&1 | FileCheck %s --check-prefix=ZCSTDCIGNORED +// ZCSTDCIGNORED-NOT: #define __STDC__ 1 +// ZCSTDCIGNORED: argument unused during compilation + +// RUN: not %clang -Xclang -fno-ms-define-stdc %s 2>&1 | FileCheck %s --check-prefix="NOARG" +// NOARG: error: unknown argument: '-fno-ms-define-stdc' diff --git a/clang/test/Driver/msan.c b/clang/test/Driver/msan.c index 339840a7a9605..7ee196cd969c4 100644 --- a/clang/test/Driver/msan.c +++ b/clang/test/Driver/msan.c @@ -1,29 +1,29 @@ // REQUIRES: x86-registered-target -// RUN: %clang -target mips64-linux-gnu -fsanitize=memory %s -S -emit-llvm -o - | FileCheck %s --check-prefixes=CHECK0 -// RUN: %clang -target mips64el-unknown-linux-gnu -fsanitize=memory %s -S -emit-llvm -o - | FileCheck %s --check-prefixes=CHECK0 -// RUN: %clang -target powerpc64-unknown-linux-gnu -fsanitize=memory %s -S -emit-llvm -o - | FileCheck %s --check-prefixes=CHECK0 -// RUN: %clang -target powerpc64le-unknown-linux-gnu -fsanitize=memory %s -S -emit-llvm -o - | FileCheck %s --check-prefixes=CHECK0 +// RUN: %clang --target=mips64-linux-gnu -fsanitize=memory %s -S -emit-llvm -o - | FileCheck %s --check-prefixes=CHECK0 +// RUN: %clang --target=mips64el-unknown-linux-gnu -fsanitize=memory %s -S -emit-llvm -o - | FileCheck %s --check-prefixes=CHECK0 +// RUN: %clang --target=powerpc64-unknown-linux-gnu -fsanitize=memory %s -S -emit-llvm -o - | FileCheck %s --check-prefixes=CHECK0 +// RUN: %clang --target=powerpc64le-unknown-linux-gnu -fsanitize=memory %s -S -emit-llvm -o - | FileCheck %s --check-prefixes=CHECK0 // Verify that -fsanitize=memory and -fsanitize=kernel-memory invoke MSan/KMSAN instrumentation. -// RUN: %clang -target x86_64-unknown-linux -fsanitize=memory %s -S -emit-llvm -o - | FileCheck %s --check-prefixes=CHECK0 -// RUN: %clang -O1 -target x86_64-unknown-linux -fsanitize=memory %s -S -emit-llvm -o - | FileCheck %s -// RUN: %clang -O2 -target x86_64-unknown-linux -fsanitize=memory %s -S -emit-llvm -o - | FileCheck %s -// RUN: %clang -O3 -target x86_64-unknown-linux -fsanitize=memory %s -S -emit-llvm -o - | FileCheck %s -// RUN: %clang -target x86_64-unknown-linux -fsanitize=memory %s -S -emit-llvm -flto=thin -o - | FileCheck %s --check-prefixes=CHECK0 -// RUN: %clang -O2 -target x86_64-unknown-linux -fsanitize=memory %s -S -emit-llvm -flto=thin -o - | FileCheck %s -// RUN: %clang -target x86_64-unknown-linux -fsanitize=memory %s -S -emit-llvm -flto -o - | FileCheck %s --check-prefixes=CHECK0 -// RUN: %clang -O2 -target x86_64-unknown-linux -fsanitize=memory %s -S -emit-llvm -flto -o - | FileCheck %s +// RUN: %clang --target=x86_64-unknown-linux -fsanitize=memory %s -S -emit-llvm -o - | FileCheck %s --check-prefixes=CHECK0 +// RUN: %clang -O1 --target=x86_64-unknown-linux -fsanitize=memory %s -S -emit-llvm -o - | FileCheck %s +// RUN: %clang -O2 --target=x86_64-unknown-linux -fsanitize=memory %s -S -emit-llvm -o - | FileCheck %s +// RUN: %clang -O3 --target=x86_64-unknown-linux -fsanitize=memory %s -S -emit-llvm -o - | FileCheck %s +// RUN: %clang --target=x86_64-unknown-linux -fsanitize=memory %s -S -emit-llvm -flto=thin -o - | FileCheck %s --check-prefixes=CHECK0 +// RUN: %clang -O2 --target=x86_64-unknown-linux -fsanitize=memory %s -S -emit-llvm -flto=thin -o - | FileCheck %s +// RUN: %clang --target=x86_64-unknown-linux -fsanitize=memory %s -S -emit-llvm -flto -o - | FileCheck %s --check-prefixes=CHECK0 +// RUN: %clang -O2 --target=x86_64-unknown-linux -fsanitize=memory %s -S -emit-llvm -flto -o - | FileCheck %s -// RUN: %clang -target x86_64-unknown-linux -fsanitize=kernel-memory %s -S -emit-llvm -o - | FileCheck %s --check-prefixes=CHECK0 -// RUN: %clang -O1 -target x86_64-unknown-linux -fsanitize=kernel-memory %s -S -emit-llvm -o - | FileCheck %s -// RUN: %clang -O2 -target x86_64-unknown-linux -fsanitize=kernel-memory %s -S -emit-llvm -o - | FileCheck %s -// RUN: %clang -O3 -target x86_64-unknown-linux -fsanitize=kernel-memory %s -S -emit-llvm -o - | FileCheck %s -// RUN: %clang -target x86_64-unknown-linux -fsanitize=kernel-memory %s -S -emit-llvm -flto=thin -o - | FileCheck %s --check-prefixes=CHECK0 -// RUN: %clang -O2 -target x86_64-unknown-linux -fsanitize=kernel-memory %s -S -emit-llvm -flto=thin -o - | FileCheck %s -// RUN: %clang -target x86_64-unknown-linux -fsanitize=kernel-memory %s -S -emit-llvm -flto -o - | FileCheck %s --check-prefixes=CHECK0 -// RUN: %clang -O2 -target x86_64-unknown-linux -fsanitize=kernel-memory %s -S -emit-llvm -flto -o - | FileCheck %s +// RUN: %clang --target=x86_64-unknown-linux -fsanitize=kernel-memory %s -S -emit-llvm -o - | FileCheck %s --check-prefixes=CHECK0 +// RUN: %clang -O1 --target=x86_64-unknown-linux -fsanitize=kernel-memory %s -S -emit-llvm -o - | FileCheck %s +// RUN: %clang -O2 --target=x86_64-unknown-linux -fsanitize=kernel-memory %s -S -emit-llvm -o - | FileCheck %s +// RUN: %clang -O3 --target=x86_64-unknown-linux -fsanitize=kernel-memory %s -S -emit-llvm -o - | FileCheck %s +// RUN: %clang --target=x86_64-unknown-linux -fsanitize=kernel-memory %s -S -emit-llvm -flto=thin -o - | FileCheck %s --check-prefixes=CHECK0 +// RUN: %clang -O2 --target=x86_64-unknown-linux -fsanitize=kernel-memory %s -S -emit-llvm -flto=thin -o - | FileCheck %s +// RUN: %clang --target=x86_64-unknown-linux -fsanitize=kernel-memory %s -S -emit-llvm -flto -o - | FileCheck %s --check-prefixes=CHECK0 +// RUN: %clang -O2 --target=x86_64-unknown-linux -fsanitize=kernel-memory %s -S -emit-llvm -flto -o - | FileCheck %s int foo(int *a) { return *a; } // CHECK0: = alloca diff --git a/clang/test/Driver/msc-version.c b/clang/test/Driver/msc-version.c index ec87e4d41eb4d..80dd5b0eafd48 100644 --- a/clang/test/Driver/msc-version.c +++ b/clang/test/Driver/msc-version.c @@ -2,25 +2,25 @@ // Verify -fms-compatibility-version parsing // -// RUN: %clang -target i686-windows -fms-compatibility -fms-compatibility-version=14 -dM -E - &1 | FileCheck %s -check-prefix CHECK-BASIC-EXTENDED-DIAGNOSTIC +// RUN: not %clang --target=i686-windows -fms-compatibility -fmsc-version=1700 -fms-compatibility-version=17.00.50727.1 -E - &1 | FileCheck %s --check-prefix=CHECK-BASIC-EXTENDED-DIAGNOSTIC // CHECK-BASIC-EXTENDED-DIAGNOSTIC: invalid argument '-fmsc-version={{.*}}' not allowed with '-fms-compatibility-version={{.*}}' @@ -40,17 +40,17 @@ // Verify -fmsc-version to -fms-compatibility-version conversion // -// RUN: %clang -### -target i686-windows -fms-compatibility -fmsc-version=17 -E - &1 | FileCheck %s -check-prefix CHECK-MSC-17 +// RUN: %clang -### --target=i686-windows -fms-compatibility -fmsc-version=17 -E - &1 | FileCheck %s --check-prefix=CHECK-MSC-17 // CHECK-MSC-17-NOT: "-fmsc-version=1700" // CHECK-MSC-17: "-fms-compatibility-version=17" -// RUN: %clang -### -target i686-windows -fms-compatibility -fmsc-version=1600 -E - &1 | FileCheck %s -check-prefix CHECK-MSC-16 +// RUN: %clang -### --target=i686-windows -fms-compatibility -fmsc-version=1600 -E - &1 | FileCheck %s --check-prefix=CHECK-MSC-16 // CHECK-MSC-16-NOT: "-fmsc-version=1600" // CHECK-MSC-16: "-fms-compatibility-version=16.0" -// RUN: %clang -### -target i686-windows -fms-compatibility -fmsc-version=150020706 -E - &1 | FileCheck %s -check-prefix CHECK-MSC-15 +// RUN: %clang -### --target=i686-windows -fms-compatibility -fmsc-version=150020706 -E - &1 | FileCheck %s --check-prefix=CHECK-MSC-15 // CHECK-MSC-15-NOT: "-fmsc-version=150020706" // CHECK-MSC-15: "-fms-compatibility-version=15.0.20706" @@ -59,7 +59,7 @@ // Verify default version with -fms-extensions // -// RUN: %clang -target i686-windows -fms-extensions -dM -E - &1 | FileCheck %s -// RUN: %clang -### -target msp430 %s -mhwmult=auto 2>&1 | FileCheck %s +// RUN: %clang -### --target=msp430 %s 2>&1 | FileCheck %s +// RUN: %clang -### --target=msp430 %s -mhwmult=auto 2>&1 | FileCheck %s // CHECK-NOT: "-target-feature" "+hwmult16" // CHECK-NOT: "-target-feature" "+hwmult32" // CHECK-NOT: "-target-feature" "+hwmultf5" -// RUN: %clang -### -target msp430 %s -mhwmult=none 2>&1 | FileCheck --check-prefix=CHECK-NONE %s -// RUN: %clang -### -target msp430 %s -mhwmult=none -mmcu=msp430f147 2>&1 | FileCheck --check-prefix=CHECK-NONE %s -// RUN: %clang -### -target msp430 %s -mhwmult=none -mmcu=msp430f4783 2>&1 | FileCheck --check-prefix=CHECK-NONE %s +// RUN: %clang -### --target=msp430 %s -mhwmult=none 2>&1 | FileCheck --check-prefix=CHECK-NONE %s +// RUN: %clang -### --target=msp430 %s -mhwmult=none -mmcu=msp430f147 2>&1 | FileCheck --check-prefix=CHECK-NONE %s +// RUN: %clang -### --target=msp430 %s -mhwmult=none -mmcu=msp430f4783 2>&1 | FileCheck --check-prefix=CHECK-NONE %s // CHECK-NONE: "-target-feature" "-hwmult16" // CHECK-NONE: "-target-feature" "-hwmult32" // CHECK-NONE: "-target-feature" "-hwmultf5" -// RUN: %clang -### -target msp430 %s -mhwmult=16bit 2>&1 | FileCheck --check-prefix=CHECK-16 %s +// RUN: %clang -### --target=msp430 %s -mhwmult=16bit 2>&1 | FileCheck --check-prefix=CHECK-16 %s // CHECK-16: "-target-feature" "+hwmult16" -// RUN: %clang -### -target msp430 %s -mhwmult=32bit 2>&1 | FileCheck --check-prefix=CHECK-32 %s +// RUN: %clang -### --target=msp430 %s -mhwmult=32bit 2>&1 | FileCheck --check-prefix=CHECK-32 %s // CHECK-32: "-target-feature" "+hwmult32" -// RUN: %clang -### -target msp430 %s -mhwmult=f5series 2>&1 | FileCheck --check-prefix=CHECK-F5 %s +// RUN: %clang -### --target=msp430 %s -mhwmult=f5series 2>&1 | FileCheck --check-prefix=CHECK-F5 %s // CHECK-F5: "-target-feature" "+hwmultf5" // RUN: not %clang -### --target=msp430 %s -mhwmult=rrr 2>&1 | FileCheck --check-prefix=INVL-ARG %s // INVL-ARG: error: unsupported argument 'rrr' to option '-mhwmult=' -// RUN: %clang -### -target msp430 %s -mhwmult=auto 2>&1 | FileCheck --check-prefix=WRN-NODEV %s +// RUN: %clang -### --target=msp430 %s -mhwmult=auto 2>&1 | FileCheck --check-prefix=WRN-NODEV %s // WRN-NODEV: warning: no MCU device specified, but '-mhwmult' is set to 'auto', // assuming no hardware multiply; use '-mmcu' to specify a MSP430 device, // or '-mhwmult' to set hardware multiply type explicitly. -// RUN: %clang -### -target msp430 %s -mhwmult=16bit -mmcu=msp430c111 2>&1 | FileCheck --check-prefix=WRN-UNSUP %s -// RUN: %clang -### -target msp430 %s -mhwmult=32bit -mmcu=msp430c111 2>&1 | FileCheck --check-prefix=WRN-UNSUP %s -// RUN: %clang -### -target msp430 %s -mhwmult=f5series -mmcu=msp430c111 2>&1 | FileCheck --check-prefix=WRN-UNSUP %s +// RUN: %clang -### --target=msp430 %s -mhwmult=16bit -mmcu=msp430c111 2>&1 | FileCheck --check-prefix=WRN-UNSUP %s +// RUN: %clang -### --target=msp430 %s -mhwmult=32bit -mmcu=msp430c111 2>&1 | FileCheck --check-prefix=WRN-UNSUP %s +// RUN: %clang -### --target=msp430 %s -mhwmult=f5series -mmcu=msp430c111 2>&1 | FileCheck --check-prefix=WRN-UNSUP %s // WRN-UNSUP: warning: the given MCU does not support hardware multiply, but '-mhwmult' is set to -// RUN: %clang -### -target msp430 %s -mhwmult=16bit -mmcu=msp430f4783 2>&1 | FileCheck --check-prefix=WRN-MISMCH %s -// RUN: %clang -### -target msp430 %s -mhwmult=32bit -mmcu=msp430f147 2>&1 | FileCheck --check-prefix=WRN-MISMCH %s -// RUN: %clang -### -target msp430 %s -mhwmult=f5series -mmcu=msp430f4783 2>&1 | FileCheck --check-prefix=WRN-MISMCH %s +// RUN: %clang -### --target=msp430 %s -mhwmult=16bit -mmcu=msp430f4783 2>&1 | FileCheck --check-prefix=WRN-MISMCH %s +// RUN: %clang -### --target=msp430 %s -mhwmult=32bit -mmcu=msp430f147 2>&1 | FileCheck --check-prefix=WRN-MISMCH %s +// RUN: %clang -### --target=msp430 %s -mhwmult=f5series -mmcu=msp430f4783 2>&1 | FileCheck --check-prefix=WRN-MISMCH %s // WRN-MISMCH: warning: the given MCU supports {{.*}} hardware multiply, but '-mhwmult' is set to {{.*}} diff --git a/clang/test/Driver/msvc-compiler-rt.c b/clang/test/Driver/msvc-compiler-rt.c index 9651662aa703e..33fa8c829579c 100644 --- a/clang/test/Driver/msvc-compiler-rt.c +++ b/clang/test/Driver/msvc-compiler-rt.c @@ -1,6 +1,6 @@ -// RUN: %clang -target x86_64-pc-windows-msvc --rtlib=compiler-rt -### %s 2>&1 | FileCheck %s -check-prefix MSVC-COMPILER-RT -// RUN: %clang -target x86_64-pc-windows-msvc --rtlib=compiler-rt --rtlib=platform -### %s 2>&1 | FileCheck %s -check-prefix MSVC-DEFAULT -// RUN: not %clang %s -target x86_64-pc-windows-msvc --rtlib=libgcc 2>&1 | FileCheck %s -check-prefix CHECK-ERROR +// RUN: %clang --target=x86_64-pc-windows-msvc --rtlib=compiler-rt -### %s 2>&1 | FileCheck %s --check-prefix=MSVC-COMPILER-RT +// RUN: %clang --target=x86_64-pc-windows-msvc --rtlib=compiler-rt --rtlib=platform -### %s 2>&1 | FileCheck %s --check-prefix=MSVC-DEFAULT +// RUN: not %clang %s --target=x86_64-pc-windows-msvc --rtlib=libgcc 2>&1 | FileCheck %s --check-prefix=CHECK-ERROR // MSVC-COMPILER-RT: "{{.*}}clang_rt.builtins{{.*}}" // MSVC-DEFAULT-NOT: "{{.*}}clang_rt.builtins{{.*}}" diff --git a/clang/test/Driver/msvc-static-rtti.cpp b/clang/test/Driver/msvc-static-rtti.cpp index 680c5f8518b2d..c29c7f4c40cab 100644 --- a/clang/test/Driver/msvc-static-rtti.cpp +++ b/clang/test/Driver/msvc-static-rtti.cpp @@ -1,5 +1,5 @@ -// RUN: %clang -target x86_64-pc-windows-msvc -fno-rtti -### %s 2>&1 | FileCheck %s -check-prefix NO-RTTI -// RUN: %clang -target x86_64-pc-windows-msvc -frtti -### %s 2>&1 | FileCheck %s -check-prefix RTTI +// RUN: %clang --target=x86_64-pc-windows-msvc -fno-rtti -### %s 2>&1 | FileCheck %s --check-prefix=NO-RTTI +// RUN: %clang --target=x86_64-pc-windows-msvc -frtti -### %s 2>&1 | FileCheck %s --check-prefix=RTTI // RTTI-NOT: -D_HAS_STATIC_RTTI=0 // NO-RTTI: -D_HAS_STATIC_RTTI=0 diff --git a/clang/test/Driver/msvc-triple.c b/clang/test/Driver/msvc-triple.c index 42bd02a158ea8..c546c1a405d4a 100644 --- a/clang/test/Driver/msvc-triple.c +++ b/clang/test/Driver/msvc-triple.c @@ -1,7 +1,7 @@ -// RUN: %clang -target i686-pc-windows-msvc19 -S -emit-llvm %s -o - | FileCheck %s --check-prefix=TARGET-19 -// RUN: %clang -target i686-pc-windows-msvc -S -emit-llvm %s -o - -fms-compatibility-version=19 | FileCheck %s --check-prefix=OVERRIDE-19 -// RUN: %clang -target i686-pc-windows-msvc-elf -S -emit-llvm %s -o - | FileCheck %s --check-prefix=ELF-DEFAULT -// RUN: %clang -target i686-pc-windows-msvc -S -emit-llvm %s -o - | FileCheck %s --check-prefix=DEFAULT +// RUN: %clang --target=i686-pc-windows-msvc19 -S -emit-llvm %s -o - | FileCheck %s --check-prefix=TARGET-19 +// RUN: %clang --target=i686-pc-windows-msvc -S -emit-llvm %s -o - -fms-compatibility-version=19 | FileCheck %s --check-prefix=OVERRIDE-19 +// RUN: %clang --target=i686-pc-windows-msvc-elf -S -emit-llvm %s -o - | FileCheck %s --check-prefix=ELF-DEFAULT +// RUN: %clang --target=i686-pc-windows-msvc -S -emit-llvm %s -o - | FileCheck %s --check-prefix=DEFAULT // TARGET-19: target triple = "i686-pc-windows-msvc19.0.0" // OVERRIDE-19: target triple = "i686-pc-windows-msvc19.0.0" diff --git a/clang/test/Driver/msvc_forward.c b/clang/test/Driver/msvc_forward.c index 15f941ef95de8..5e6bdca2491f4 100644 --- a/clang/test/Driver/msvc_forward.c +++ b/clang/test/Driver/msvc_forward.c @@ -1,4 +1,4 @@ -// RUN: %clang -target i686-pc-win32 -loldnames -lkernel32.lib -luser32.lib -### %s 2>&1 | FileCheck %s +// RUN: %clang --target=i686-pc-win32 -loldnames -lkernel32.lib -luser32.lib -### %s 2>&1 | FileCheck %s // CHECK-NOT: "-loldnames.lib" // CHECK-NOT: "-lkernel32.lib" // CHECK-NOT: "-luser32.lib" diff --git a/clang/test/Driver/objc-encode-cxx-class-template-spec.m b/clang/test/Driver/objc-encode-cxx-class-template-spec.m index 23d114f1a4fa6..174bbe0fe6b29 100644 --- a/clang/test/Driver/objc-encode-cxx-class-template-spec.m +++ b/clang/test/Driver/objc-encode-cxx-class-template-spec.m @@ -1,7 +1,7 @@ // RUN: %clang -target arm64-apple-ios11 -### %s -o - 2>&1 | FileCheck -check-prefix=DISABLE-ENC %s // RUN: %clang -target arm64-apple-ios11 -fobjc-encode-cxx-class-template-spec -### %s -o - 2>&1 | FileCheck -check-prefix=ENABLE-ENC %s -// RUN: %clang -target x86_64-linux-gnu -fobjc-runtime=gnustep -### %s -o - 2>&1 | FileCheck -check-prefix=ENABLE-ENC %s -// RUN: %clang -target x86_64-linux-gnu -fobjc-runtime=gnustep -fno-objc-encode-cxx-class-template-spec -### %s -o - 2>&1 | FileCheck -check-prefix=DISABLE-ENC %s +// RUN: %clang --target=x86_64-linux-gnu -fobjc-runtime=gnustep -### %s -o - 2>&1 | FileCheck -check-prefix=ENABLE-ENC %s +// RUN: %clang --target=x86_64-linux-gnu -fobjc-runtime=gnustep -fno-objc-encode-cxx-class-template-spec -### %s -o - 2>&1 | FileCheck -check-prefix=DISABLE-ENC %s // DISABLE-ENC-NOT: -fobjc-encode-cxx-class-template-spec // ENABLE-ENC: -fobjc-encode-cxx-class-template-spec diff --git a/clang/test/Driver/openbsd.cpp b/clang/test/Driver/openbsd.cpp index 906b0d22242d2..01aa09b75f27f 100644 --- a/clang/test/Driver/openbsd.cpp +++ b/clang/test/Driver/openbsd.cpp @@ -1,22 +1,22 @@ // Check libraries used when linking C++ -// RUN: %clangxx %s -### -o %t.o -target amd64-pc-openbsd 2>&1 \ +// RUN: %clangxx %s -### -o %t.o --target=amd64-pc-openbsd 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-CXX %s -// RUN: %clangxx %s -### -o %t.o -target i686-pc-openbsd 2>&1 \ +// RUN: %clangxx %s -### -o %t.o --target=i686-pc-openbsd 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-CXX %s -// RUN: %clangxx %s -### -o %t.o -target aarch64-unknown-openbsd 2>&1 \ +// RUN: %clangxx %s -### -o %t.o --target=aarch64-unknown-openbsd 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-CXX %s -// RUN: %clangxx %s -### -o %t.o -target arm-unknown-openbsd 2>&1 \ +// RUN: %clangxx %s -### -o %t.o --target=arm-unknown-openbsd 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-CXX %s // CHECK-CXX: "-lc++" "-lc++abi" "-lpthread" "-lm" // Check for profiling variants of libraries when linking C++ -// RUN: %clangxx %s -### -pg -o %t.o -target amd64-pc-openbsd 2>&1 \ +// RUN: %clangxx %s -### -pg -o %t.o --target=amd64-pc-openbsd 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-PG-CXX %s -// RUN: %clangxx %s -### -pg -o %t.o -target i686-pc-openbsd 2>&1 \ +// RUN: %clangxx %s -### -pg -o %t.o --target=i686-pc-openbsd 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-PG-CXX %s -// RUN: %clangxx %s -### -pg -o %t.o -target aarch64-unknown-openbsd 2>&1 \ +// RUN: %clangxx %s -### -pg -o %t.o --target=aarch64-unknown-openbsd 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-PG-CXX %s -// RUN: %clangxx %s -### -pg -o %t.o -target arm-unknown-openbsd 2>&1 \ +// RUN: %clangxx %s -### -pg -o %t.o --target=arm-unknown-openbsd 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-PG-CXX %s // CHECK-PG-CXX: "-lc++_p" "-lc++abi_p" "-lpthread_p" "-lm_p" diff --git a/clang/test/Driver/opencl.cl b/clang/test/Driver/opencl.cl index b9f52e07f3b1a..aba37fc328fbb 100644 --- a/clang/test/Driver/opencl.cl +++ b/clang/test/Driver/opencl.cl @@ -21,7 +21,7 @@ // RUN: %clang -S -### -fno-offload-uniform-block -cl-uniform-work-group-size %s 2>&1 | FileCheck --check-prefix=CHECK-UNIFORM-WG %s // RUN: not %clang -cl-std=c99 -DOPENCL %s 2>&1 | FileCheck --check-prefix=CHECK-C99 %s // RUN: not %clang -cl-std=invalid -DOPENCL %s 2>&1 | FileCheck --check-prefix=CHECK-INVALID %s -// RUN: %clang -S -### -target spir-unknown-unknown %s 2>&1 | FileCheck --check-prefix=CHECK-W-SPIR-COMPAT %s +// RUN: %clang -S -### --target=spir %s 2>&1 | FileCheck --check-prefix=CHECK-W-SPIR-COMPAT %s // RUN: %clang -S -### --target=amdgcn-amd-amdhsa-opencl -nogpuinc -nogpulib %s 2>&1 | FileCheck --check-prefix=CHECK-NO-W-SPIR-COMPAT %s // RUN: %clang -S -### -cl-ext="+test_ext" %s 2>&1 | FileCheck --check-prefix=CHECK-EXT %s diff --git a/clang/test/Driver/openmp-offload-infer.c b/clang/test/Driver/openmp-offload-infer.c index 50333293eb7db..388860abc01ad 100644 --- a/clang/test/Driver/openmp-offload-infer.c +++ b/clang/test/Driver/openmp-offload-infer.c @@ -43,7 +43,7 @@ // RUN: --offload-arch=sm_70 --offload-arch=gfx908 --offload-arch=skylake \ // RUN: -nogpulib %s 2>&1 | FileCheck %s --check-prefix=CHECK-FAILED -// CHECK-FAILED: error: failed to deduce triple for target architecture 'skylake'; specify the triple using '-fopenmp-targets' and '-Xopenmp-target' instead. +// CHECK-FAILED: error: failed to deduce triple for target architecture 'skylake'; specify the triple using '-fopenmp-targets' and '-Xopenmp-target' instead // RUN: %clang -### --target=x86_64-unknown-linux-gnu -ccc-print-bindings -fopenmp=libomp \ // RUN: --offload-arch=sm_70 --offload-arch=gfx908 -fno-openmp \ diff --git a/clang/test/Driver/openmp-system-arch.c b/clang/test/Driver/openmp-system-arch.c index 4e024e6b11d1b..a48c1e76fa758 100644 --- a/clang/test/Driver/openmp-system-arch.c +++ b/clang/test/Driver/openmp-system-arch.c @@ -31,7 +31,7 @@ // RUN: not %clang -### --target=x86_64-unknown-linux-gnu -nogpulib -fopenmp=libomp --offload-arch= \ // RUN: --nvptx-arch-tool=%t/nvptx_arch_empty --amdgpu-arch-tool=%t/amdgpu_arch_empty %s 2>&1 \ // RUN: | FileCheck %s --check-prefix=NO-OUTPUT-ERROR -// NO-OUTPUT-ERROR: error: failed to deduce triple for target architecture 'native'; specify the triple using '-fopenmp-targets' and '-Xopenmp-target' instead. +// NO-OUTPUT-ERROR: error: failed to deduce triple for target architecture 'native'; specify the triple using '-fopenmp-targets' and '-Xopenmp-target' instead // case when amdgpu-arch succeeds. // RUN: %clang -### --target=x86_64-unknown-linux-gnu -nogpulib -fopenmp=libomp --offload-arch=native \ diff --git a/clang/test/Driver/pch-fsycl-error.cpp b/clang/test/Driver/pch-fsycl-error.cpp index 9c0faf2d07d9c..42ce1718b4164 100644 --- a/clang/test/Driver/pch-fsycl-error.cpp +++ b/clang/test/Driver/pch-fsycl-error.cpp @@ -6,14 +6,14 @@ // Linux // RUN: not %clang -c -fsycl -x c++-header %t.h -### %s 2> %t1.txt // RUN: FileCheck %s -input-file=%t1.txt -// CHECK: Precompiled header generation is not supported with '-fsycl' +// CHECK: precompiled header generation is not supported with '-fsycl' // Windows // RUN: not %clang_cl -c -fsycl -x c++-header %t.h -### -- %s 2>&1 \ // RUN: | FileCheck -check-prefix=CHECK-ERROR %s -// CHECK-ERROR: Precompiled header generation is not supported with '-fsycl' +// CHECK-ERROR: precompiled header generation is not supported with '-fsycl' // /Yc // RUN: not %clang_cl -fsycl /Ycpchfile.h /FIpchfile.h /c -### -- %s 2>&1 \ // RUN: | FileCheck -check-prefix=CHECK-YC %s -// CHECK-YC: Precompiled header generation is not supported with '-fsycl' +// CHECK-YC: precompiled header generation is not supported with '-fsycl' diff --git a/clang/test/Driver/sycl-add-default-spec-consts-image.cpp b/clang/test/Driver/sycl-add-default-spec-consts-image.cpp index 0fd1d0cdbc515..d10e6f7f7cd0e 100644 --- a/clang/test/Driver/sycl-add-default-spec-consts-image.cpp +++ b/clang/test/Driver/sycl-add-default-spec-consts-image.cpp @@ -4,7 +4,7 @@ // RUN: %clang -### -fsycl -fsycl-add-default-spec-consts-image 2>&1 %s | FileCheck %s -check-prefix=CHECK-NON-AOT // RUN: %clang_cl -### -fsycl -fsycl-add-default-spec-consts-image 2>&1 %s | FileCheck %s -check-prefix=CHECK-NON-AOT // RUN: %clang -### -fsycl -fsycl-add-default-spec-consts-image -fsycl-targets=spir64 2>&1 %s | FileCheck %s -check-prefix=CHECK-NON-AOT -// CHECK-NON-AOT: warning: -fsycl-add-default-spec-consts-image flag has an effect only in Ahead of Time Compilation mode (AOT). +// CHECK-NON-AOT: warning: -fsycl-add-default-spec-consts-image flag has an effect only in Ahead of Time Compilation mode (AOT) // Check that non-AOT target doesn't add command line option into sycl-post-link invocation // CHECK-NON-AOT-NOT: {{.*}}sycl-post-link{{.*}} "-generate-device-image-default-spec-consts" @@ -16,7 +16,7 @@ // RUN: %clang -### -fsycl -fsycl-add-default-spec-consts-image -fsycl-targets=intel_gpu_pvc 2>&1 %s | FileCheck %s -check-prefix=CHECK-AOT // RUN: %clang -### -fsycl -fsycl-add-default-spec-consts-image -fsycl-targets=nvidia_gpu_sm_90 -nocudalib 2>&1 %s | FileCheck %s -check-prefix=CHECK-AOT // RUN: %clang -### -fsycl -fsycl-add-default-spec-consts-image -fsycl-targets=amd_gpu_gfx1034 -fno-sycl-libspirv -nogpulib 2>&1 %s | FileCheck %s -check-prefix=CHECK-AOT -// CHECK-AOT-NOT: warning: -fsycl-add-default-spec-consts-image flag has an effect only in Ahead of Time Compilation mode (AOT). +// CHECK-AOT-NOT: warning: -fsycl-add-default-spec-consts-image flag has an effect only in Ahead of Time Compilation mode (AOT) // CHECK-AOT: {{.*}}sycl-post-link{{.*}} "-generate-device-image-default-spec-consts" diff --git a/clang/test/Driver/sycl-offload-aot.cpp b/clang/test/Driver/sycl-offload-aot.cpp index 40bf8266a6b61..295c4dd7eb137 100644 --- a/clang/test/Driver/sycl-offload-aot.cpp +++ b/clang/test/Driver/sycl-offload-aot.cpp @@ -13,7 +13,7 @@ // RUN: | FileCheck -check-prefix=CHK-SYCL-FPGA-CONFLICT %s // RUN: not %clang_cl -### -fsycl-targets=spir64-unknown-unknown -fintelfpga %s 2>&1 \ // RUN: | FileCheck -check-prefix=CHK-SYCL-FPGA-CONFLICT %s -// CHK-SYCL-FPGA-CONFLICT: error: The option -fsycl-targets= conflicts with -fintelfpga +// CHK-SYCL-FPGA-CONFLICT: error: the option -fsycl-targets= conflicts with -fintelfpga /// Check that -aux-triple is passed with -fintelfpga // RUN: %clang -### -fintelfpga %s 2>&1 \ diff --git a/clang/test/Driver/x-args.c b/clang/test/Driver/x-args.c index 17bb5d99404da..06c9c7a461565 100644 --- a/clang/test/Driver/x-args.c +++ b/clang/test/Driver/x-args.c @@ -6,6 +6,4 @@ // RUN: %clang -fsyntax-only %s -xc %s -xc++ -fsyntax-only 2>&1 | FileCheck %s // CHECK: '-x c++' after last input file has no effect -// RUN: not %clang_cl /WX /clang:-xc /clang:-E /clang:-dM -- %s 2>&1 | FileCheck --implicit-check-not="error:" -check-prefix=CL %s -// RUN: not %clang_cl /TC /WX /clang:-xc /clang:-E /clang:-dM -- %s 2>&1 | FileCheck --implicit-check-not="error:" -check-prefix=CL %s -// CL: error: unsupported option '-x c'; did you mean '/TC' or '/TP'? +// RUN: %clang_cl -fsyntax-only /WX -xc++ -- %s diff --git a/clang/test/Driver/x86-target-features.c b/clang/test/Driver/x86-target-features.c index 25f8f66bc3213..1d5f001c23fcc 100644 --- a/clang/test/Driver/x86-target-features.c +++ b/clang/test/Driver/x86-target-features.c @@ -21,10 +21,10 @@ // SSE4-AES: "-target-feature" "+sse4.2" "-target-feature" "+aes" // NO-SSE4-AES: "-target-feature" "-sse4.1" "-target-feature" "-aes" -// RUN: %clang --target=i386 -march=i386 -mavx -mavx2 -mavx512f -mavx512cd -mavx512er -mavx512pf -mavx512dq -mavx512bw -mavx512vl -mavx512vbmi -mavx512vbmi2 -mavx512ifma %s -### 2>&1 | FileCheck -check-prefix=AVX %s -// RUN: %clang --target=i386 -march=i386 -mno-avx -mno-avx2 -mno-avx512f -mno-avx512cd -mno-avx512er -mno-avx512pf -mno-avx512dq -mno-avx512bw -mno-avx512vl -mno-avx512vbmi -mno-avx512vbmi2 -mno-avx512ifma %s -### 2>&1 | FileCheck -check-prefix=NO-AVX %s -// AVX: "-target-feature" "+avx" "-target-feature" "+avx2" "-target-feature" "+avx512f" "-target-feature" "+avx512cd" "-target-feature" "+avx512er" "-target-feature" "+avx512pf" "-target-feature" "+avx512dq" "-target-feature" "+avx512bw" "-target-feature" "+avx512vl" "-target-feature" "+avx512vbmi" "-target-feature" "+avx512vbmi2" "-target-feature" "+avx512ifma" -// NO-AVX: "-target-feature" "-avx" "-target-feature" "-avx2" "-target-feature" "-avx512f" "-target-feature" "-avx512cd" "-target-feature" "-avx512er" "-target-feature" "-avx512pf" "-target-feature" "-avx512dq" "-target-feature" "-avx512bw" "-target-feature" "-avx512vl" "-target-feature" "-avx512vbmi" "-target-feature" "-avx512vbmi2" "-target-feature" "-avx512ifma" +// RUN: %clang --target=i386 -march=i386 -mavx -mavx2 -mavx512f -mavx512cd -mavx512dq -mavx512bw -mavx512vl -mavx512vbmi -mavx512vbmi2 -mavx512ifma %s -### 2>&1 | FileCheck -check-prefix=AVX %s +// RUN: %clang --target=i386 -march=i386 -mno-avx -mno-avx2 -mno-avx512f -mno-avx512cd -mno-avx512dq -mno-avx512bw -mno-avx512vl -mno-avx512vbmi -mno-avx512vbmi2 -mno-avx512ifma %s -### 2>&1 | FileCheck -check-prefix=NO-AVX %s +// AVX: "-target-feature" "+avx" "-target-feature" "+avx2" "-target-feature" "+avx512f" "-target-feature" "+avx512cd" "-target-feature" "+avx512dq" "-target-feature" "+avx512bw" "-target-feature" "+avx512vl" "-target-feature" "+avx512vbmi" "-target-feature" "+avx512vbmi2" "-target-feature" "+avx512ifma" +// NO-AVX: "-target-feature" "-avx" "-target-feature" "-avx2" "-target-feature" "-avx512f" "-target-feature" "-avx512cd" "-target-feature" "-avx512dq" "-target-feature" "-avx512bw" "-target-feature" "-avx512vl" "-target-feature" "-avx512vbmi" "-target-feature" "-avx512vbmi2" "-target-feature" "-avx512ifma" // RUN: %clang --target=i386 -march=i386 -mpclmul -mrdrnd -mfsgsbase -mbmi -mbmi2 %s -### 2>&1 | FileCheck -check-prefix=BMI %s // RUN: %clang --target=i386 -march=i386 -mno-pclmul -mno-rdrnd -mno-fsgsbase -mno-bmi -mno-bmi2 %s -### 2>&1 | FileCheck -check-prefix=NO-BMI %s @@ -86,11 +86,6 @@ // SGX: "-target-feature" "+sgx" // NO-SGX: "-target-feature" "-sgx" -// RUN: %clang --target=i386 -march=i386 -mprefetchwt1 %s -### 2>&1 | FileCheck -check-prefix=PREFETCHWT1 %s -// RUN: %clang --target=i386 -march=i386 -mno-prefetchwt1 %s -### 2>&1 | FileCheck -check-prefix=NO-PREFETCHWT1 %s -// PREFETCHWT1: "-target-feature" "+prefetchwt1" -// NO-PREFETCHWT1: "-target-feature" "-prefetchwt1" - // RUN: %clang --target=i386 -march=i386 -mprefetchi %s -### -o %t.o 2>&1 | FileCheck -check-prefix=PREFETCHI %s // RUN: %clang --target=i386 -march=i386 -mno-prefetchi %s -### -o %t.o 2>&1 | FileCheck -check-prefix=NO-PREFETCHI %s // PREFETCHI: "-target-feature" "+prefetchi" diff --git a/clang/test/ExtractAPI/non_type_template.cpp b/clang/test/ExtractAPI/non_type_template.cpp index 4e65eb790ca11..85f38e39c82bc 100644 --- a/clang/test/ExtractAPI/non_type_template.cpp +++ b/clang/test/ExtractAPI/non_type_template.cpp @@ -310,4 +310,48 @@ NestedTemplateTemplateParamPack var; // VAR-NEXT: } // VAR-NEXT: ] +template +class TypeContainer { + public: + // RUN: FileCheck %s --input-file %t/output.symbols.json --check-prefix TYPE + typedef Foo Type; +// TYPE-LABEL: "!testLabel": "c:non_type_template.cpp@ST>1#T@TypeContainer@T@Type", +// TYPE: "declarationFragments": [ +// TYPE-NEXT: { +// TYPE-NEXT: "kind": "keyword", +// TYPE-NEXT: "spelling": "typedef" +// TYPE-NEXT: }, +// TYPE-NEXT: { +// TYPE-NEXT: "kind": "text", +// TYPE-NEXT: "spelling": " " +// TYPE-NEXT: }, +// TYPE-NEXT: { +// TYPE-NEXT: "kind": "typeIdentifier", +// TYPE-NEXT: "preciseIdentifier": "c:@ST>2#T#NI@Foo", +// TYPE-NEXT: "spelling": "Foo" +// TYPE-NEXT: }, +// TYPE-NEXT: { +// TYPE-NEXT: "kind": "text", +// TYPE-NEXT: "spelling": "<" +// TYPE-NEXT: }, +// TYPE-NEXT: { +// TYPE-NEXT: "kind": "typeIdentifier", +// TYPE-NEXT: "preciseIdentifier": "c:t0.0", +// TYPE-NEXT: "spelling": "T" +// TYPE-NEXT: }, +// TYPE-NEXT: { +// TYPE-NEXT: "kind": "text", +// TYPE-NEXT: "spelling": "> " +// TYPE-NEXT: }, +// TYPE-NEXT: { +// TYPE-NEXT: "kind": "identifier", +// TYPE-NEXT: "spelling": "Type" +// TYPE-NEXT: }, +// TYPE-NEXT: { +// TYPE-NEXT: "kind": "text", +// TYPE-NEXT: "spelling": ";" +// TYPE-NEXT: } +// TYPE-NEXT: ] +}; + // expected-no-diagnostics diff --git a/clang/test/Frontend/optimization-remark-options.c b/clang/test/Frontend/optimization-remark-options.c index 96e480d140be8..357273a650635 100644 --- a/clang/test/Frontend/optimization-remark-options.c +++ b/clang/test/Frontend/optimization-remark-options.c @@ -1,7 +1,7 @@ // REQUIRES: x86-registered-target // RUN: %clang -O1 -fvectorize -target x86_64-unknown-unknown -mllvm -vectorize-memory-check-threshold=8 -Rpass-analysis=loop-vectorize -emit-llvm -S %s -o - 2>&1 | FileCheck %s -// CHECK: {{.*}}:10:11: remark: loop not vectorized: cannot prove it is safe to reorder floating-point operations; allow reordering by specifying '#pragma clang loop vectorize(enable)' before the loop or by providing the compiler option '-ffast-math'. +// CHECK: {{.*}}:10:11: remark: loop not vectorized: cannot prove it is safe to reorder floating-point operations; allow reordering by specifying '#pragma clang loop vectorize(enable)' before the loop or by providing the compiler option '-ffast-math' double foo(int N) { double v = 0.0; @@ -12,7 +12,7 @@ double foo(int N) { return v; } -// CHECK: {{.*}}:18:3: remark: loop not vectorized: cannot prove it is safe to reorder memory operations; allow reordering by specifying '#pragma clang loop vectorize(enable)' before the loop. If the arrays will always be independent specify '#pragma clang loop vectorize(assume_safety)' before the loop or provide the '__restrict__' qualifier with the independent array arguments. Erroneous results will occur if these options are incorrectly applied! +// CHECK: {{.*}}:18:3: remark: loop not vectorized: cannot prove it is safe to reorder memory operations; allow reordering by specifying '#pragma clang loop vectorize(enable)' before the loop; if the arrays will always be independent, specify '#pragma clang loop vectorize(assume_safety)' before the loop or provide the '__restrict__' qualifier with the independent array arguments -- erroneous results will occur if these options are incorrectly applied void foo2(int *dw, int *uw, int *A, int *B, int *C, int *D, int N) { for (long i = 0; i < N; i++) { diff --git a/clang/test/Frontend/x86-target-cpu.c b/clang/test/Frontend/x86-target-cpu.c index 6b99b2c8574ae..6c8502ac2c21e 100644 --- a/clang/test/Frontend/x86-target-cpu.c +++ b/clang/test/Frontend/x86-target-cpu.c @@ -15,14 +15,8 @@ // RUN: %clang_cc1 -triple x86_64-unknown-unknown -target-cpu cannonlake -verify %s // RUN: %clang_cc1 -triple x86_64-unknown-unknown -target-cpu icelake-client -verify %s // RUN: %clang_cc1 -triple x86_64-unknown-unknown -target-cpu icelake-server -verify %s -// RUN: %clang_cc1 -triple x86_64-unknown-unknown -target-cpu knl -verify=knl %s -// knl-warning@*:* {{KNL, KNM related Intel Xeon Phi CPU's specific ISA's supports will be removed in LLVM 19.}} -// knl-warning@*:* {{KNL, KNM related Intel Xeon Phi CPU's specific ISA's supports will be removed in LLVM 19.}} -// knl-warning@*:* {{KNL, KNM related Intel Xeon Phi CPU's specific ISA's supports will be removed in LLVM 19.}} -// RUN: %clang_cc1 -triple x86_64-unknown-unknown -target-cpu knm -verify=knm %s -// knm-warning@*:* {{KNL, KNM related Intel Xeon Phi CPU's specific ISA's supports will be removed in LLVM 19.}} -// knm-warning@*:* {{KNL, KNM related Intel Xeon Phi CPU's specific ISA's supports will be removed in LLVM 19.}} -// knm-warning@*:* {{KNL, KNM related Intel Xeon Phi CPU's specific ISA's supports will be removed in LLVM 19.}} +// RUN: %clang_cc1 -triple x86_64-unknown-unknown -target-cpu knl -verify %s +// RUN: %clang_cc1 -triple x86_64-unknown-unknown -target-cpu knm -verify %s // RUN: %clang_cc1 -triple x86_64-unknown-unknown -target-cpu bonnell -verify %s // RUN: %clang_cc1 -triple x86_64-unknown-unknown -target-cpu silvermont -verify %s // RUN: %clang_cc1 -triple x86_64-unknown-unknown -target-cpu k8 -verify %s diff --git a/clang/test/InstallAPI/binary-attributes.test b/clang/test/InstallAPI/binary-attributes.test index b28e99f644546..fd9ff12998a34 100644 --- a/clang/test/InstallAPI/binary-attributes.test +++ b/clang/test/InstallAPI/binary-attributes.test @@ -30,13 +30,13 @@ ; RUN: -install_name /System/Library/Frameworks/Simple.framework/Versions/A/Simple \ ; RUN: -current_version 1.2.3 -compatibility_version 1 -fapplication-extension \ ; RUN: -o tmp.tbd --verify-against=%t/Simple 2>&1 | FileCheck -check-prefix=APPEXTSAFE %s -; APPEXTSAFE: error: ApplicationExtensionSafe flag does not match: 'true' (provided) vs 'false' (found) +; APPEXTSAFE: error: the ApplicationExtensionSafe flag does not match: 'true' (provided) vs 'false' (found) ; RUN: not clang-installapi -target x86_64-apple-macos10.12 \ ; RUN: -install_name /System/Library/Frameworks/Simple.framework/Versions/A/Simple \ ; RUN: -current_version 1.2.3 -compatibility_version 1 -not_for_dyld_shared_cache \ ; RUN: -o tmp.tbd --verify-against=%t/Simple 2>&1 | FileCheck -check-prefix=SHARED_CACHE %s -; SHARED_CACHE: error: NotForDyldSharedCache flag does not match: 'true' (provided) vs 'false' (found) +; SHARED_CACHE: error: the NotForDyldSharedCache flag does not match: 'true' (provided) vs 'false' (found) ; RUN: not clang-installapi -target x86_64-apple-macos10.12 \ ; RUN: -install_name /System/Library/Frameworks/Simple.framework/Versions/A/Simple \ diff --git a/clang/test/Interpreter/execute.cpp b/clang/test/Interpreter/execute.cpp index 6e73ed3927e81..534a54ed94fba 100644 --- a/clang/test/Interpreter/execute.cpp +++ b/clang/test/Interpreter/execute.cpp @@ -7,6 +7,8 @@ // RUN: cat %s | clang-repl | FileCheck %s // RUN: cat %s | clang-repl -Xcc -O2 | FileCheck %s +// RUN: clang-repl -Xcc -include -Xcc %s | FileCheck %s +// RUN: clang-repl -Xcc -fsyntax-only -Xcc -include -Xcc %s extern "C" int printf(const char *, ...); int i = 42; auto r1 = printf("i = %d\n", i); @@ -19,5 +21,3 @@ auto r2 = printf("S[f=%f, m=0x%llx]\n", s.f, reinterpret_cast struct A {}; // #A + + namespace t1 { + // notree-error@#1 {{no viable conversion from 'A<0>' to 'A'}} + + /* tree-error@#1 {{no viable conversion + A< + [0 != n + 1]>}}*/ + + A v1 = A<0>(); // #1 + // expected-note@#A {{no known conversion from 'A<0>' to 'const A<&n[1]> &' for 1st argument}} + // expected-note@#A {{no known conversion from 'A<0>' to 'A<&n[1]> &&' for 1st argument}} + + // notree-error@#2 {{no viable conversion from 'A' to 'A'}} + /* tree-error@#2 {{no viable conversion + A< + [n != n + 1]>}}*/ + + A v2 = A(); // #2 + // expected-note@#A {{no known conversion from 'A' to 'const A<&n[1]> &' for 1st argument}} + // expected-note@#A {{no known conversion from 'A' to 'A<&n[1]> &&' for 1st argument}} + } // namespace t1 + + namespace t2 { + A v1; + A v2; + + // notree-note@#A {{no known conversion from 'A' to 'const A<(no argument)>' for 1st argument}} + // notree-note@#A {{no known conversion from 'A' to 'A<(no argument)>' for 1st argument}} + + /* tree-note@#A {{no known conversion from argument type to parameter type for 1st argument + [(no qualifiers) != const] A< + [n != (no argument)]>}}*/ + + /* tree-note@#A {{no known conversion from argument type to parameter type for 1st argument + A< + [n != (no argument)]>}}*/ + + void f() { v2 = v1; } // expected-error {{no viable overloaded '='}} + } // namespace t2 +} // namespace GH93068 diff --git a/clang/test/Misc/pragma-attribute-supported-attributes-list.test b/clang/test/Misc/pragma-attribute-supported-attributes-list.test index dc2275b84a1a8..3336669ff4759 100644 --- a/clang/test/Misc/pragma-attribute-supported-attributes-list.test +++ b/clang/test/Misc/pragma-attribute-supported-attributes-list.test @@ -63,7 +63,6 @@ // CHECK-NEXT: CoroOnlyDestroyWhenComplete (SubjectMatchRule_record) // CHECK-NEXT: CoroReturnType (SubjectMatchRule_record) // CHECK-NEXT: CoroWrapper (SubjectMatchRule_function) -// CHECK-NEXT: CountedBy (SubjectMatchRule_field) // CHECK-NEXT: DLLExport (SubjectMatchRule_function, SubjectMatchRule_variable, SubjectMatchRule_record, SubjectMatchRule_objc_interface) // CHECK-NEXT: DLLImport (SubjectMatchRule_function, SubjectMatchRule_variable, SubjectMatchRule_record, SubjectMatchRule_objc_interface) // CHECK-NEXT: Destructor (SubjectMatchRule_function) diff --git a/clang/test/Modules/no-implicit-declarations.cppm b/clang/test/Modules/no-implicit-declarations.cppm new file mode 100644 index 0000000000000..79c3c5e76f63e --- /dev/null +++ b/clang/test/Modules/no-implicit-declarations.cppm @@ -0,0 +1,26 @@ +// RUN: rm -rf %t +// RUN: mkdir %t +// +// RUN: %clang_cc1 -std=c++20 %s -emit-module-interface -o %t/a.pcm +// RUN: llvm-bcanalyzer --dump --disable-histogram --show-binary-blobs %t/a.pcm > %t/a.dump +// RUN: cat %t/a.dump | FileCheck %s +// +// RUN: %clang_cc1 -std=c++20 %s -emit-reduced-module-interface -o %t/a.pcm +// RUN: llvm-bcanalyzer --dump --disable-histogram --show-binary-blobs %t/a.pcm > %t/a.dump +// RUN: cat %t/a.dump | FileCheck %s + +export module a; +// Contain something at least to make sure the compiler won't +// optimize this out. +export int a = 43; + +// CHECK: diff --git a/clang/test/OpenMP/atomic_messages.c b/clang/test/OpenMP/atomic_messages.c index 9f6662a9e136a..f4e7db52494af 100644 --- a/clang/test/OpenMP/atomic_messages.c +++ b/clang/test/OpenMP/atomic_messages.c @@ -405,67 +405,67 @@ void compare(void) { int x = 0; int d = 0; int e = 0; -// omp51-error@+3 {{the statement for 'atomic compare' must be a compound statement of form '{x = expr ordop x ? expr : x;}', '{x = x ordop expr? expr : x;}', '{x = x == e ? d : x;}', '{x = e == x ? d : x;}', or 'if(expr ordop x) {x = expr;}', 'if(x ordop expr) {x = expr;}', 'if(x == e) {x = d;}', 'if(e == x) {x = d;}' where 'x' is an lvalue expression with scalar type, 'expr', 'e', and 'd' are expressions with scalar type, and 'ordop' is one of '<' or '>'.}} +// omp51-error@+3 {{the statement for 'atomic compare' must be a compound statement of form '{x = expr ordop x ? expr : x;}', '{x = x ordop expr? expr : x;}', '{x = x == e ? d : x;}', '{x = e == x ? d : x;}', or 'if(expr ordop x) {x = expr;}', 'if(x ordop expr) {x = expr;}', 'if(x == e) {x = d;}', 'if(e == x) {x = d;}' where 'x' is an lvalue expression with scalar type, 'expr', 'e', and 'd' are expressions with scalar type, and 'ordop' is one of '<' or '>'}} // omp51-note@+2 {{expected compound statement}} #pragma omp atomic compare {} -// omp51-error@+3 {{the statement for 'atomic compare' must be a compound statement of form '{x = expr ordop x ? expr : x;}', '{x = x ordop expr? expr : x;}', '{x = x == e ? d : x;}', '{x = e == x ? d : x;}', or 'if(expr ordop x) {x = expr;}', 'if(x ordop expr) {x = expr;}', 'if(x == e) {x = d;}', 'if(e == x) {x = d;}' where 'x' is an lvalue expression with scalar type, 'expr', 'e', and 'd' are expressions with scalar type, and 'ordop' is one of '<' or '>'.}} +// omp51-error@+3 {{the statement for 'atomic compare' must be a compound statement of form '{x = expr ordop x ? expr : x;}', '{x = x ordop expr? expr : x;}', '{x = x == e ? d : x;}', '{x = e == x ? d : x;}', or 'if(expr ordop x) {x = expr;}', 'if(x ordop expr) {x = expr;}', 'if(x == e) {x = d;}', 'if(e == x) {x = d;}' where 'x' is an lvalue expression with scalar type, 'expr', 'e', and 'd' are expressions with scalar type, and 'ordop' is one of '<' or '>'}} // omp51-note@+2 {{expected exactly one expression statement}} #pragma omp atomic compare { x = d; x = e; } -// omp51-error@+3 {{the statement for 'atomic compare' must be a compound statement of form '{x = expr ordop x ? expr : x;}', '{x = x ordop expr? expr : x;}', '{x = x == e ? d : x;}', '{x = e == x ? d : x;}', or 'if(expr ordop x) {x = expr;}', 'if(x ordop expr) {x = expr;}', 'if(x == e) {x = d;}', 'if(e == x) {x = d;}' where 'x' is an lvalue expression with scalar type, 'expr', 'e', and 'd' are expressions with scalar type, and 'ordop' is one of '<' or '>'.}} +// omp51-error@+3 {{the statement for 'atomic compare' must be a compound statement of form '{x = expr ordop x ? expr : x;}', '{x = x ordop expr? expr : x;}', '{x = x == e ? d : x;}', '{x = e == x ? d : x;}', or 'if(expr ordop x) {x = expr;}', 'if(x ordop expr) {x = expr;}', 'if(x == e) {x = d;}', 'if(e == x) {x = d;}' where 'x' is an lvalue expression with scalar type, 'expr', 'e', and 'd' are expressions with scalar type, and 'ordop' is one of '<' or '>'}} // omp51-note@+2 {{expected assignment statement}} #pragma omp atomic compare { x += d; } -// omp51-error@+3 {{the statement for 'atomic compare' must be a compound statement of form '{x = expr ordop x ? expr : x;}', '{x = x ordop expr? expr : x;}', '{x = x == e ? d : x;}', '{x = e == x ? d : x;}', or 'if(expr ordop x) {x = expr;}', 'if(x ordop expr) {x = expr;}', 'if(x == e) {x = d;}', 'if(e == x) {x = d;}' where 'x' is an lvalue expression with scalar type, 'expr', 'e', and 'd' are expressions with scalar type, and 'ordop' is one of '<' or '>'.}} +// omp51-error@+3 {{the statement for 'atomic compare' must be a compound statement of form '{x = expr ordop x ? expr : x;}', '{x = x ordop expr? expr : x;}', '{x = x == e ? d : x;}', '{x = e == x ? d : x;}', or 'if(expr ordop x) {x = expr;}', 'if(x ordop expr) {x = expr;}', 'if(x == e) {x = d;}', 'if(e == x) {x = d;}' where 'x' is an lvalue expression with scalar type, 'expr', 'e', and 'd' are expressions with scalar type, and 'ordop' is one of '<' or '>'}} // omp51-note@+2 {{expected assignment statement}} #pragma omp atomic compare { bbar(); } -// omp51-error@+3 {{the statement for 'atomic compare' must be a compound statement of form '{x = expr ordop x ? expr : x;}', '{x = x ordop expr? expr : x;}', '{x = x == e ? d : x;}', '{x = e == x ? d : x;}', or 'if(expr ordop x) {x = expr;}', 'if(x ordop expr) {x = expr;}', 'if(x == e) {x = d;}', 'if(e == x) {x = d;}' where 'x' is an lvalue expression with scalar type, 'expr', 'e', and 'd' are expressions with scalar type, and 'ordop' is one of '<' or '>'.}} +// omp51-error@+3 {{the statement for 'atomic compare' must be a compound statement of form '{x = expr ordop x ? expr : x;}', '{x = x ordop expr? expr : x;}', '{x = x == e ? d : x;}', '{x = e == x ? d : x;}', or 'if(expr ordop x) {x = expr;}', 'if(x ordop expr) {x = expr;}', 'if(x == e) {x = d;}', 'if(e == x) {x = d;}' where 'x' is an lvalue expression with scalar type, 'expr', 'e', and 'd' are expressions with scalar type, and 'ordop' is one of '<' or '>'}} // omp51-note@+2 {{expected conditional operator}} #pragma omp atomic compare { x = d; } -// omp51-error@+3 {{the statement for 'atomic compare' must be a compound statement of form '{x = expr ordop x ? expr : x;}', '{x = x ordop expr? expr : x;}', '{x = x == e ? d : x;}', '{x = e == x ? d : x;}', or 'if(expr ordop x) {x = expr;}', 'if(x ordop expr) {x = expr;}', 'if(x == e) {x = d;}', 'if(e == x) {x = d;}' where 'x' is an lvalue expression with scalar type, 'expr', 'e', and 'd' are expressions with scalar type, and 'ordop' is one of '<' or '>'.}} +// omp51-error@+3 {{the statement for 'atomic compare' must be a compound statement of form '{x = expr ordop x ? expr : x;}', '{x = x ordop expr? expr : x;}', '{x = x == e ? d : x;}', '{x = e == x ? d : x;}', or 'if(expr ordop x) {x = expr;}', 'if(x ordop expr) {x = expr;}', 'if(x == e) {x = d;}', 'if(e == x) {x = d;}' where 'x' is an lvalue expression with scalar type, 'expr', 'e', and 'd' are expressions with scalar type, and 'ordop' is one of '<' or '>'}} // omp51-note@+2 {{expect binary operator in conditional expression}} #pragma omp atomic compare { x = ffoo() ? e : x; } -// omp51-error@+3 {{the statement for 'atomic compare' must be a compound statement of form '{x = expr ordop x ? expr : x;}', '{x = x ordop expr? expr : x;}', '{x = x == e ? d : x;}', '{x = e == x ? d : x;}', or 'if(expr ordop x) {x = expr;}', 'if(x ordop expr) {x = expr;}', 'if(x == e) {x = d;}', 'if(e == x) {x = d;}' where 'x' is an lvalue expression with scalar type, 'expr', 'e', and 'd' are expressions with scalar type, and 'ordop' is one of '<' or '>'.}} +// omp51-error@+3 {{the statement for 'atomic compare' must be a compound statement of form '{x = expr ordop x ? expr : x;}', '{x = x ordop expr? expr : x;}', '{x = x == e ? d : x;}', '{x = e == x ? d : x;}', or 'if(expr ordop x) {x = expr;}', 'if(x ordop expr) {x = expr;}', 'if(x == e) {x = d;}', 'if(e == x) {x = d;}' where 'x' is an lvalue expression with scalar type, 'expr', 'e', and 'd' are expressions with scalar type, and 'ordop' is one of '<' or '>'}} // omp51-note@+2 {{expect '<', '>' or '==' as order operator}} #pragma omp atomic compare { x = x >= e ? e : x; } -// omp51-error@+3 {{the statement for 'atomic compare' must be a compound statement of form '{x = expr ordop x ? expr : x;}', '{x = x ordop expr? expr : x;}', '{x = x == e ? d : x;}', '{x = e == x ? d : x;}', or 'if(expr ordop x) {x = expr;}', 'if(x ordop expr) {x = expr;}', 'if(x == e) {x = d;}', 'if(e == x) {x = d;}' where 'x' is an lvalue expression with scalar type, 'expr', 'e', and 'd' are expressions with scalar type, and 'ordop' is one of '<' or '>'.}} +// omp51-error@+3 {{the statement for 'atomic compare' must be a compound statement of form '{x = expr ordop x ? expr : x;}', '{x = x ordop expr? expr : x;}', '{x = x == e ? d : x;}', '{x = e == x ? d : x;}', or 'if(expr ordop x) {x = expr;}', 'if(x ordop expr) {x = expr;}', 'if(x == e) {x = d;}', 'if(e == x) {x = d;}' where 'x' is an lvalue expression with scalar type, 'expr', 'e', and 'd' are expressions with scalar type, and 'ordop' is one of '<' or '>'}} // omp51-note@+2 {{expect comparison in a form of 'x == e', 'e == x', 'x ordop expr', or 'expr ordop x'}} #pragma omp atomic compare { x = d > e ? e : x; } -// omp51-error@+3 {{the statement for 'atomic compare' must be a compound statement of form '{x = expr ordop x ? expr : x;}', '{x = x ordop expr? expr : x;}', '{x = x == e ? d : x;}', '{x = e == x ? d : x;}', or 'if(expr ordop x) {x = expr;}', 'if(x ordop expr) {x = expr;}', 'if(x == e) {x = d;}', 'if(e == x) {x = d;}' where 'x' is an lvalue expression with scalar type, 'expr', 'e', and 'd' are expressions with scalar type, and 'ordop' is one of '<' or '>'.}} +// omp51-error@+3 {{the statement for 'atomic compare' must be a compound statement of form '{x = expr ordop x ? expr : x;}', '{x = x ordop expr? expr : x;}', '{x = x == e ? d : x;}', '{x = e == x ? d : x;}', or 'if(expr ordop x) {x = expr;}', 'if(x ordop expr) {x = expr;}', 'if(x == e) {x = d;}', 'if(e == x) {x = d;}' where 'x' is an lvalue expression with scalar type, 'expr', 'e', and 'd' are expressions with scalar type, and 'ordop' is one of '<' or '>'}} // omp51-note@+2 {{expect result value to be at false expression}} #pragma omp atomic compare { x = d > x ? e : d; } -// omp51-error@+4 {{the statement for 'atomic compare' must be a compound statement of form '{x = expr ordop x ? expr : x;}', '{x = x ordop expr? expr : x;}', '{x = x == e ? d : x;}', '{x = e == x ? d : x;}', or 'if(expr ordop x) {x = expr;}', 'if(x ordop expr) {x = expr;}', 'if(x == e) {x = d;}', 'if(e == x) {x = d;}' where 'x' is an lvalue expression with scalar type, 'expr', 'e', and 'd' are expressions with scalar type, and 'ordop' is one of '<' or '>'.}} +// omp51-error@+4 {{the statement for 'atomic compare' must be a compound statement of form '{x = expr ordop x ? expr : x;}', '{x = x ordop expr? expr : x;}', '{x = x == e ? d : x;}', '{x = e == x ? d : x;}', or 'if(expr ordop x) {x = expr;}', 'if(x ordop expr) {x = expr;}', 'if(x == e) {x = d;}', 'if(e == x) {x = d;}' where 'x' is an lvalue expression with scalar type, 'expr', 'e', and 'd' are expressions with scalar type, and 'ordop' is one of '<' or '>'}} // omp51-note@+3 {{expect binary operator in conditional expression}} #pragma omp atomic compare { if (foo()) x = d; } -// omp51-error@+4 {{the statement for 'atomic compare' must be a compound statement of form '{x = expr ordop x ? expr : x;}', '{x = x ordop expr? expr : x;}', '{x = x == e ? d : x;}', '{x = e == x ? d : x;}', or 'if(expr ordop x) {x = expr;}', 'if(x ordop expr) {x = expr;}', 'if(x == e) {x = d;}', 'if(e == x) {x = d;}' where 'x' is an lvalue expression with scalar type, 'expr', 'e', and 'd' are expressions with scalar type, and 'ordop' is one of '<' or '>'.}} +// omp51-error@+4 {{the statement for 'atomic compare' must be a compound statement of form '{x = expr ordop x ? expr : x;}', '{x = x ordop expr? expr : x;}', '{x = x == e ? d : x;}', '{x = e == x ? d : x;}', or 'if(expr ordop x) {x = expr;}', 'if(x ordop expr) {x = expr;}', 'if(x == e) {x = d;}', 'if(e == x) {x = d;}' where 'x' is an lvalue expression with scalar type, 'expr', 'e', and 'd' are expressions with scalar type, and 'ordop' is one of '<' or '>'}} // omp51-note@+3 {{expect '<', '>' or '==' as order operator}} #pragma omp atomic compare { if (x >= d) x = d; } -// omp51-error@+4 {{the statement for 'atomic compare' must be a compound statement of form '{x = expr ordop x ? expr : x;}', '{x = x ordop expr? expr : x;}', '{x = x == e ? d : x;}', '{x = e == x ? d : x;}', or 'if(expr ordop x) {x = expr;}', 'if(x ordop expr) {x = expr;}', 'if(x == e) {x = d;}', 'if(e == x) {x = d;}' where 'x' is an lvalue expression with scalar type, 'expr', 'e', and 'd' are expressions with scalar type, and 'ordop' is one of '<' or '>'.}} +// omp51-error@+4 {{the statement for 'atomic compare' must be a compound statement of form '{x = expr ordop x ? expr : x;}', '{x = x ordop expr? expr : x;}', '{x = x == e ? d : x;}', '{x = e == x ? d : x;}', or 'if(expr ordop x) {x = expr;}', 'if(x ordop expr) {x = expr;}', 'if(x == e) {x = d;}', 'if(e == x) {x = d;}' where 'x' is an lvalue expression with scalar type, 'expr', 'e', and 'd' are expressions with scalar type, and 'ordop' is one of '<' or '>'}} // omp51-note@+3 {{expect comparison in a form of 'x == e', 'e == x', 'x ordop expr', or 'expr ordop x'}} #pragma omp atomic compare { if (e > d) x = d; } -// omp51-error@+3 {{the statement for 'atomic compare' must be a compound statement of form '{x = expr ordop x ? expr : x;}', '{x = x ordop expr? expr : x;}', '{x = x == e ? d : x;}', '{x = e == x ? d : x;}', or 'if(expr ordop x) {x = expr;}', 'if(x ordop expr) {x = expr;}', 'if(x == e) {x = d;}', 'if(e == x) {x = d;}' where 'x' is an lvalue expression with scalar type, 'expr', 'e', and 'd' are expressions with scalar type, and 'ordop' is one of '<' or '>'.}} +// omp51-error@+3 {{the statement for 'atomic compare' must be a compound statement of form '{x = expr ordop x ? expr : x;}', '{x = x ordop expr? expr : x;}', '{x = x == e ? d : x;}', '{x = e == x ? d : x;}', or 'if(expr ordop x) {x = expr;}', 'if(x ordop expr) {x = expr;}', 'if(x == e) {x = d;}', 'if(e == x) {x = d;}' where 'x' is an lvalue expression with scalar type, 'expr', 'e', and 'd' are expressions with scalar type, and 'ordop' is one of '<' or '>'}} // omp51-note@+2 {{expected exactly one expression statement}} #pragma omp atomic compare { @@ -473,7 +473,7 @@ void compare(void) { x = e; d = e; } -// omp51-error@+7 {{the statement for 'atomic compare' must be a compound statement of form '{x = expr ordop x ? expr : x;}', '{x = x ordop expr? expr : x;}', '{x = x == e ? d : x;}', '{x = e == x ? d : x;}', or 'if(expr ordop x) {x = expr;}', 'if(x ordop expr) {x = expr;}', 'if(x == e) {x = d;}', 'if(e == x) {x = d;}' where 'x' is an lvalue expression with scalar type, 'expr', 'e', and 'd' are expressions with scalar type, and 'ordop' is one of '<' or '>'.}} +// omp51-error@+7 {{the statement for 'atomic compare' must be a compound statement of form '{x = expr ordop x ? expr : x;}', '{x = x ordop expr? expr : x;}', '{x = x == e ? d : x;}', '{x = e == x ? d : x;}', or 'if(expr ordop x) {x = expr;}', 'if(x ordop expr) {x = expr;}', 'if(x == e) {x = d;}', 'if(e == x) {x = d;}' where 'x' is an lvalue expression with scalar type, 'expr', 'e', and 'd' are expressions with scalar type, and 'ordop' is one of '<' or '>'}} // omp51-note@+6 {{unexpected 'else' statement}} #pragma omp atomic compare { @@ -491,61 +491,61 @@ void compare_capture(void) { int v = 0; int r = 0; float dr = 0.0; -// omp51-error@+3 {{the statement for 'atomic compare capture' must be a compound statement of form '{v = x; cond-up-stmt}', ''{cond-up-stmt v = x;}', '{if(x == e) {x = d;} else {v = x;}}', '{r = x == e; if(r) {x = d;}}', or '{r = x == e; if(r) {x = d;} else {v = x;}}', where 'cond-update-stmt' can have one of the following forms: 'if(expr ordop x) {x = expr;}', 'if(x ordop expr) {x = expr;}', 'if(x == e) {x = d;}', or 'if(e == x) {x = d;}' where 'x' is an lvalue expression with scalar type, 'expr', 'e', and 'd' are expressions with scalar type, and 'ordop' is one of '<' or '>'.}} +// omp51-error@+3 {{the statement for 'atomic compare capture' must be a compound statement of form '{v = x; cond-up-stmt}', ''{cond-up-stmt v = x;}', '{if(x == e) {x = d;} else {v = x;}}', '{r = x == e; if(r) {x = d;}}', or '{r = x == e; if(r) {x = d;} else {v = x;}}', where 'cond-update-stmt' can have one of the following forms: 'if(expr ordop x) {x = expr;}', 'if(x ordop expr) {x = expr;}', 'if(x == e) {x = d;}', or 'if(e == x) {x = d;}' where 'x' is an lvalue expression with scalar type, 'expr', 'e', and 'd' are expressions with scalar type, and 'ordop' is one of '<' or '>'}} // omp51-note@+2 {{expected compound statement}} #pragma omp atomic compare capture if (x == e) {} -// omp51-error@+3 {{the statement for 'atomic compare capture' must be a compound statement of form '{v = x; cond-up-stmt}', ''{cond-up-stmt v = x;}', '{if(x == e) {x = d;} else {v = x;}}', '{r = x == e; if(r) {x = d;}}', or '{r = x == e; if(r) {x = d;} else {v = x;}}', where 'cond-update-stmt' can have one of the following forms: 'if(expr ordop x) {x = expr;}', 'if(x ordop expr) {x = expr;}', 'if(x == e) {x = d;}', or 'if(e == x) {x = d;}' where 'x' is an lvalue expression with scalar type, 'expr', 'e', and 'd' are expressions with scalar type, and 'ordop' is one of '<' or '>'.}} +// omp51-error@+3 {{the statement for 'atomic compare capture' must be a compound statement of form '{v = x; cond-up-stmt}', ''{cond-up-stmt v = x;}', '{if(x == e) {x = d;} else {v = x;}}', '{r = x == e; if(r) {x = d;}}', or '{r = x == e; if(r) {x = d;} else {v = x;}}', where 'cond-update-stmt' can have one of the following forms: 'if(expr ordop x) {x = expr;}', 'if(x ordop expr) {x = expr;}', 'if(x == e) {x = d;}', or 'if(e == x) {x = d;}' where 'x' is an lvalue expression with scalar type, 'expr', 'e', and 'd' are expressions with scalar type, and 'ordop' is one of '<' or '>'}} // omp51-note@+2 {{expected exactly one expression statement}} #pragma omp atomic compare capture if (x == e) { x = d; v = x; } -// omp51-error@+4 {{the statement for 'atomic compare capture' must be a compound statement of form '{v = x; cond-up-stmt}', ''{cond-up-stmt v = x;}', '{if(x == e) {x = d;} else {v = x;}}', '{r = x == e; if(r) {x = d;}}', or '{r = x == e; if(r) {x = d;} else {v = x;}}', where 'cond-update-stmt' can have one of the following forms: 'if(expr ordop x) {x = expr;}', 'if(x ordop expr) {x = expr;}', 'if(x == e) {x = d;}', or 'if(e == x) {x = d;}' where 'x' is an lvalue expression with scalar type, 'expr', 'e', and 'd' are expressions with scalar type, and 'ordop' is one of '<' or '>'.}} +// omp51-error@+4 {{the statement for 'atomic compare capture' must be a compound statement of form '{v = x; cond-up-stmt}', ''{cond-up-stmt v = x;}', '{if(x == e) {x = d;} else {v = x;}}', '{r = x == e; if(r) {x = d;}}', or '{r = x == e; if(r) {x = d;} else {v = x;}}', where 'cond-update-stmt' can have one of the following forms: 'if(expr ordop x) {x = expr;}', 'if(x ordop expr) {x = expr;}', 'if(x == e) {x = d;}', or 'if(e == x) {x = d;}' where 'x' is an lvalue expression with scalar type, 'expr', 'e', and 'd' are expressions with scalar type, and 'ordop' is one of '<' or '>'}} // omp51-note@+3 {{expected assignment statement}} #pragma omp atomic compare capture if (x == e) { bbar(); } -// omp51-error@+4 {{the statement for 'atomic compare capture' must be a compound statement of form '{v = x; cond-up-stmt}', ''{cond-up-stmt v = x;}', '{if(x == e) {x = d;} else {v = x;}}', '{r = x == e; if(r) {x = d;}}', or '{r = x == e; if(r) {x = d;} else {v = x;}}', where 'cond-update-stmt' can have one of the following forms: 'if(expr ordop x) {x = expr;}', 'if(x ordop expr) {x = expr;}', 'if(x == e) {x = d;}', or 'if(e == x) {x = d;}' where 'x' is an lvalue expression with scalar type, 'expr', 'e', and 'd' are expressions with scalar type, and 'ordop' is one of '<' or '>'.}} +// omp51-error@+4 {{the statement for 'atomic compare capture' must be a compound statement of form '{v = x; cond-up-stmt}', ''{cond-up-stmt v = x;}', '{if(x == e) {x = d;} else {v = x;}}', '{r = x == e; if(r) {x = d;}}', or '{r = x == e; if(r) {x = d;} else {v = x;}}', where 'cond-update-stmt' can have one of the following forms: 'if(expr ordop x) {x = expr;}', 'if(x ordop expr) {x = expr;}', 'if(x == e) {x = d;}', or 'if(e == x) {x = d;}' where 'x' is an lvalue expression with scalar type, 'expr', 'e', and 'd' are expressions with scalar type, and 'ordop' is one of '<' or '>'}} // omp51-note@+3 {{expected assignment statement}} #pragma omp atomic compare capture if (x == e) { x += d; } -// omp51-error@+3 {{the statement for 'atomic compare capture' must be a compound statement of form '{v = x; cond-up-stmt}', ''{cond-up-stmt v = x;}', '{if(x == e) {x = d;} else {v = x;}}', '{r = x == e; if(r) {x = d;}}', or '{r = x == e; if(r) {x = d;} else {v = x;}}', where 'cond-update-stmt' can have one of the following forms: 'if(expr ordop x) {x = expr;}', 'if(x ordop expr) {x = expr;}', 'if(x == e) {x = d;}', or 'if(e == x) {x = d;}' where 'x' is an lvalue expression with scalar type, 'expr', 'e', and 'd' are expressions with scalar type, and 'ordop' is one of '<' or '>'.}} +// omp51-error@+3 {{the statement for 'atomic compare capture' must be a compound statement of form '{v = x; cond-up-stmt}', ''{cond-up-stmt v = x;}', '{if(x == e) {x = d;} else {v = x;}}', '{r = x == e; if(r) {x = d;}}', or '{r = x == e; if(r) {x = d;} else {v = x;}}', where 'cond-update-stmt' can have one of the following forms: 'if(expr ordop x) {x = expr;}', 'if(x ordop expr) {x = expr;}', 'if(x == e) {x = d;}', or 'if(e == x) {x = d;}' where 'x' is an lvalue expression with scalar type, 'expr', 'e', and 'd' are expressions with scalar type, and 'ordop' is one of '<' or '>'}} // omp51-note@+2 {{expect binary operator in conditional expression}} #pragma omp atomic compare capture if (ffoo()) { x = d; } -// omp51-error@+3 {{the statement for 'atomic compare capture' must be a compound statement of form '{v = x; cond-up-stmt}', ''{cond-up-stmt v = x;}', '{if(x == e) {x = d;} else {v = x;}}', '{r = x == e; if(r) {x = d;}}', or '{r = x == e; if(r) {x = d;} else {v = x;}}', where 'cond-update-stmt' can have one of the following forms: 'if(expr ordop x) {x = expr;}', 'if(x ordop expr) {x = expr;}', 'if(x == e) {x = d;}', or 'if(e == x) {x = d;}' where 'x' is an lvalue expression with scalar type, 'expr', 'e', and 'd' are expressions with scalar type, and 'ordop' is one of '<' or '>'.}} +// omp51-error@+3 {{the statement for 'atomic compare capture' must be a compound statement of form '{v = x; cond-up-stmt}', ''{cond-up-stmt v = x;}', '{if(x == e) {x = d;} else {v = x;}}', '{r = x == e; if(r) {x = d;}}', or '{r = x == e; if(r) {x = d;} else {v = x;}}', where 'cond-update-stmt' can have one of the following forms: 'if(expr ordop x) {x = expr;}', 'if(x ordop expr) {x = expr;}', 'if(x == e) {x = d;}', or 'if(e == x) {x = d;}' where 'x' is an lvalue expression with scalar type, 'expr', 'e', and 'd' are expressions with scalar type, and 'ordop' is one of '<' or '>'}} // omp51-note@+2 {{expect '==' operator}} #pragma omp atomic compare capture if (x > e) { x = d; } -// omp51-error@+3 {{the statement for 'atomic compare capture' must be a compound statement of form '{v = x; cond-up-stmt}', ''{cond-up-stmt v = x;}', '{if(x == e) {x = d;} else {v = x;}}', '{r = x == e; if(r) {x = d;}}', or '{r = x == e; if(r) {x = d;} else {v = x;}}', where 'cond-update-stmt' can have one of the following forms: 'if(expr ordop x) {x = expr;}', 'if(x ordop expr) {x = expr;}', 'if(x == e) {x = d;}', or 'if(e == x) {x = d;}' where 'x' is an lvalue expression with scalar type, 'expr', 'e', and 'd' are expressions with scalar type, and 'ordop' is one of '<' or '>'.}} +// omp51-error@+3 {{the statement for 'atomic compare capture' must be a compound statement of form '{v = x; cond-up-stmt}', ''{cond-up-stmt v = x;}', '{if(x == e) {x = d;} else {v = x;}}', '{r = x == e; if(r) {x = d;}}', or '{r = x == e; if(r) {x = d;} else {v = x;}}', where 'cond-update-stmt' can have one of the following forms: 'if(expr ordop x) {x = expr;}', 'if(x ordop expr) {x = expr;}', 'if(x == e) {x = d;}', or 'if(e == x) {x = d;}' where 'x' is an lvalue expression with scalar type, 'expr', 'e', and 'd' are expressions with scalar type, and 'ordop' is one of '<' or '>'}} // omp51-note@+2 {{expect comparison in a form of 'x == e', 'e == x', 'x ordop expr', or 'expr ordop x'}} #pragma omp atomic compare capture if (d == e) { x = d; } -// omp51-error@+3 {{the statement for 'atomic compare capture' must be a compound statement of form '{v = x; cond-up-stmt}', ''{cond-up-stmt v = x;}', '{if(x == e) {x = d;} else {v = x;}}', '{r = x == e; if(r) {x = d;}}', or '{r = x == e; if(r) {x = d;} else {v = x;}}', where 'cond-update-stmt' can have one of the following forms: 'if(expr ordop x) {x = expr;}', 'if(x ordop expr) {x = expr;}', 'if(x == e) {x = d;}', or 'if(e == x) {x = d;}' where 'x' is an lvalue expression with scalar type, 'expr', 'e', and 'd' are expressions with scalar type, and 'ordop' is one of '<' or '>'.}} +// omp51-error@+3 {{the statement for 'atomic compare capture' must be a compound statement of form '{v = x; cond-up-stmt}', ''{cond-up-stmt v = x;}', '{if(x == e) {x = d;} else {v = x;}}', '{r = x == e; if(r) {x = d;}}', or '{r = x == e; if(r) {x = d;} else {v = x;}}', where 'cond-update-stmt' can have one of the following forms: 'if(expr ordop x) {x = expr;}', 'if(x ordop expr) {x = expr;}', 'if(x == e) {x = d;}', or 'if(e == x) {x = d;}' where 'x' is an lvalue expression with scalar type, 'expr', 'e', and 'd' are expressions with scalar type, and 'ordop' is one of '<' or '>'}} // omp51-note@+2 {{expect 'else' statement}} #pragma omp atomic compare capture if (x == e) { x = d; } -// omp51-error@+5 {{the statement for 'atomic compare capture' must be a compound statement of form '{v = x; cond-up-stmt}', ''{cond-up-stmt v = x;}', '{if(x == e) {x = d;} else {v = x;}}', '{r = x == e; if(r) {x = d;}}', or '{r = x == e; if(r) {x = d;} else {v = x;}}', where 'cond-update-stmt' can have one of the following forms: 'if(expr ordop x) {x = expr;}', 'if(x ordop expr) {x = expr;}', 'if(x == e) {x = d;}', or 'if(e == x) {x = d;}' where 'x' is an lvalue expression with scalar type, 'expr', 'e', and 'd' are expressions with scalar type, and 'ordop' is one of '<' or '>'.}} +// omp51-error@+5 {{the statement for 'atomic compare capture' must be a compound statement of form '{v = x; cond-up-stmt}', ''{cond-up-stmt v = x;}', '{if(x == e) {x = d;} else {v = x;}}', '{r = x == e; if(r) {x = d;}}', or '{r = x == e; if(r) {x = d;} else {v = x;}}', where 'cond-update-stmt' can have one of the following forms: 'if(expr ordop x) {x = expr;}', 'if(x ordop expr) {x = expr;}', 'if(x == e) {x = d;}', or 'if(e == x) {x = d;}' where 'x' is an lvalue expression with scalar type, 'expr', 'e', and 'd' are expressions with scalar type, and 'ordop' is one of '<' or '>'}} // omp51-note@+4 {{expected compound statement}} #pragma omp atomic compare capture if (x == e) { x = d; } else { } -// omp51-error@+5 {{the statement for 'atomic compare capture' must be a compound statement of form '{v = x; cond-up-stmt}', ''{cond-up-stmt v = x;}', '{if(x == e) {x = d;} else {v = x;}}', '{r = x == e; if(r) {x = d;}}', or '{r = x == e; if(r) {x = d;} else {v = x;}}', where 'cond-update-stmt' can have one of the following forms: 'if(expr ordop x) {x = expr;}', 'if(x ordop expr) {x = expr;}', 'if(x == e) {x = d;}', or 'if(e == x) {x = d;}' where 'x' is an lvalue expression with scalar type, 'expr', 'e', and 'd' are expressions with scalar type, and 'ordop' is one of '<' or '>'.}} +// omp51-error@+5 {{the statement for 'atomic compare capture' must be a compound statement of form '{v = x; cond-up-stmt}', ''{cond-up-stmt v = x;}', '{if(x == e) {x = d;} else {v = x;}}', '{r = x == e; if(r) {x = d;}}', or '{r = x == e; if(r) {x = d;} else {v = x;}}', where 'cond-update-stmt' can have one of the following forms: 'if(expr ordop x) {x = expr;}', 'if(x ordop expr) {x = expr;}', 'if(x == e) {x = d;}', or 'if(e == x) {x = d;}' where 'x' is an lvalue expression with scalar type, 'expr', 'e', and 'd' are expressions with scalar type, and 'ordop' is one of '<' or '>'}} // omp51-note@+4 {{expected exactly one expression statement}} #pragma omp atomic compare capture if (x == e) { @@ -554,7 +554,7 @@ void compare_capture(void) { v = x; d = e; } -// omp51-error@+6 {{the statement for 'atomic compare capture' must be a compound statement of form '{v = x; cond-up-stmt}', ''{cond-up-stmt v = x;}', '{if(x == e) {x = d;} else {v = x;}}', '{r = x == e; if(r) {x = d;}}', or '{r = x == e; if(r) {x = d;} else {v = x;}}', where 'cond-update-stmt' can have one of the following forms: 'if(expr ordop x) {x = expr;}', 'if(x ordop expr) {x = expr;}', 'if(x == e) {x = d;}', or 'if(e == x) {x = d;}' where 'x' is an lvalue expression with scalar type, 'expr', 'e', and 'd' are expressions with scalar type, and 'ordop' is one of '<' or '>'.}} +// omp51-error@+6 {{the statement for 'atomic compare capture' must be a compound statement of form '{v = x; cond-up-stmt}', ''{cond-up-stmt v = x;}', '{if(x == e) {x = d;} else {v = x;}}', '{r = x == e; if(r) {x = d;}}', or '{r = x == e; if(r) {x = d;} else {v = x;}}', where 'cond-update-stmt' can have one of the following forms: 'if(expr ordop x) {x = expr;}', 'if(x ordop expr) {x = expr;}', 'if(x == e) {x = d;}', or 'if(e == x) {x = d;}' where 'x' is an lvalue expression with scalar type, 'expr', 'e', and 'd' are expressions with scalar type, and 'ordop' is one of '<' or '>'}} // omp51-note@+5 {{expected assignment statement}} #pragma omp atomic compare capture if (x == e) { @@ -562,7 +562,7 @@ void compare_capture(void) { } else { bbar(); } -// omp51-error@+6 {{the statement for 'atomic compare capture' must be a compound statement of form '{v = x; cond-up-stmt}', ''{cond-up-stmt v = x;}', '{if(x == e) {x = d;} else {v = x;}}', '{r = x == e; if(r) {x = d;}}', or '{r = x == e; if(r) {x = d;} else {v = x;}}', where 'cond-update-stmt' can have one of the following forms: 'if(expr ordop x) {x = expr;}', 'if(x ordop expr) {x = expr;}', 'if(x == e) {x = d;}', or 'if(e == x) {x = d;}' where 'x' is an lvalue expression with scalar type, 'expr', 'e', and 'd' are expressions with scalar type, and 'ordop' is one of '<' or '>'.}} +// omp51-error@+6 {{the statement for 'atomic compare capture' must be a compound statement of form '{v = x; cond-up-stmt}', ''{cond-up-stmt v = x;}', '{if(x == e) {x = d;} else {v = x;}}', '{r = x == e; if(r) {x = d;}}', or '{r = x == e; if(r) {x = d;} else {v = x;}}', where 'cond-update-stmt' can have one of the following forms: 'if(expr ordop x) {x = expr;}', 'if(x ordop expr) {x = expr;}', 'if(x == e) {x = d;}', or 'if(e == x) {x = d;}' where 'x' is an lvalue expression with scalar type, 'expr', 'e', and 'd' are expressions with scalar type, and 'ordop' is one of '<' or '>'}} // omp51-note@+5 {{expected assignment statement}} #pragma omp atomic compare capture if (x == e) { @@ -570,7 +570,7 @@ void compare_capture(void) { } else { v += x; } -// omp51-error@+6 {{the statement for 'atomic compare capture' must be a compound statement of form '{v = x; cond-up-stmt}', ''{cond-up-stmt v = x;}', '{if(x == e) {x = d;} else {v = x;}}', '{r = x == e; if(r) {x = d;}}', or '{r = x == e; if(r) {x = d;} else {v = x;}}', where 'cond-update-stmt' can have one of the following forms: 'if(expr ordop x) {x = expr;}', 'if(x ordop expr) {x = expr;}', 'if(x == e) {x = d;}', or 'if(e == x) {x = d;}' where 'x' is an lvalue expression with scalar type, 'expr', 'e', and 'd' are expressions with scalar type, and 'ordop' is one of '<' or '>'.}} +// omp51-error@+6 {{the statement for 'atomic compare capture' must be a compound statement of form '{v = x; cond-up-stmt}', ''{cond-up-stmt v = x;}', '{if(x == e) {x = d;} else {v = x;}}', '{r = x == e; if(r) {x = d;}}', or '{r = x == e; if(r) {x = d;} else {v = x;}}', where 'cond-update-stmt' can have one of the following forms: 'if(expr ordop x) {x = expr;}', 'if(x ordop expr) {x = expr;}', 'if(x == e) {x = d;}', or 'if(e == x) {x = d;}' where 'x' is an lvalue expression with scalar type, 'expr', 'e', and 'd' are expressions with scalar type, and 'ordop' is one of '<' or '>'}} // omp51-note@+5 {{expect an assignment statement 'v = x'}} #pragma omp atomic compare capture if (x == e) { @@ -578,35 +578,35 @@ void compare_capture(void) { } else { v = d; } -// omp51-error@+3 {{the statement for 'atomic compare capture' must be a compound statement of form '{v = x; cond-up-stmt}', ''{cond-up-stmt v = x;}', '{if(x == e) {x = d;} else {v = x;}}', '{r = x == e; if(r) {x = d;}}', or '{r = x == e; if(r) {x = d;} else {v = x;}}', where 'cond-update-stmt' can have one of the following forms: 'if(expr ordop x) {x = expr;}', 'if(x ordop expr) {x = expr;}', 'if(x == e) {x = d;}', or 'if(e == x) {x = d;}' where 'x' is an lvalue expression with scalar type, 'expr', 'e', and 'd' are expressions with scalar type, and 'ordop' is one of '<' or '>'.}} +// omp51-error@+3 {{the statement for 'atomic compare capture' must be a compound statement of form '{v = x; cond-up-stmt}', ''{cond-up-stmt v = x;}', '{if(x == e) {x = d;} else {v = x;}}', '{r = x == e; if(r) {x = d;}}', or '{r = x == e; if(r) {x = d;} else {v = x;}}', where 'cond-update-stmt' can have one of the following forms: 'if(expr ordop x) {x = expr;}', 'if(x ordop expr) {x = expr;}', 'if(x == e) {x = d;}', or 'if(e == x) {x = d;}' where 'x' is an lvalue expression with scalar type, 'expr', 'e', and 'd' are expressions with scalar type, and 'ordop' is one of '<' or '>'}} // omp51-note@+2 {{expected compound statement}} #pragma omp atomic compare capture {} -// omp51-error@+3 {{the statement for 'atomic compare capture' must be a compound statement of form '{v = x; cond-up-stmt}', ''{cond-up-stmt v = x;}', '{if(x == e) {x = d;} else {v = x;}}', '{r = x == e; if(r) {x = d;}}', or '{r = x == e; if(r) {x = d;} else {v = x;}}', where 'cond-update-stmt' can have one of the following forms: 'if(expr ordop x) {x = expr;}', 'if(x ordop expr) {x = expr;}', 'if(x == e) {x = d;}', or 'if(e == x) {x = d;}' where 'x' is an lvalue expression with scalar type, 'expr', 'e', and 'd' are expressions with scalar type, and 'ordop' is one of '<' or '>'.}} +// omp51-error@+3 {{the statement for 'atomic compare capture' must be a compound statement of form '{v = x; cond-up-stmt}', ''{cond-up-stmt v = x;}', '{if(x == e) {x = d;} else {v = x;}}', '{r = x == e; if(r) {x = d;}}', or '{r = x == e; if(r) {x = d;} else {v = x;}}', where 'cond-update-stmt' can have one of the following forms: 'if(expr ordop x) {x = expr;}', 'if(x ordop expr) {x = expr;}', 'if(x == e) {x = d;}', or 'if(e == x) {x = d;}' where 'x' is an lvalue expression with scalar type, 'expr', 'e', and 'd' are expressions with scalar type, and 'ordop' is one of '<' or '>'}} // omp51-note@+2 {{expect a compound statement}} #pragma omp atomic compare capture x = x > e ? e : x; -// omp51-error@+3 {{the statement for 'atomic compare capture' must be a compound statement of form '{v = x; cond-up-stmt}', ''{cond-up-stmt v = x;}', '{if(x == e) {x = d;} else {v = x;}}', '{r = x == e; if(r) {x = d;}}', or '{r = x == e; if(r) {x = d;} else {v = x;}}', where 'cond-update-stmt' can have one of the following forms: 'if(expr ordop x) {x = expr;}', 'if(x ordop expr) {x = expr;}', 'if(x == e) {x = d;}', or 'if(e == x) {x = d;}' where 'x' is an lvalue expression with scalar type, 'expr', 'e', and 'd' are expressions with scalar type, and 'ordop' is one of '<' or '>'.}} +// omp51-error@+3 {{the statement for 'atomic compare capture' must be a compound statement of form '{v = x; cond-up-stmt}', ''{cond-up-stmt v = x;}', '{if(x == e) {x = d;} else {v = x;}}', '{r = x == e; if(r) {x = d;}}', or '{r = x == e; if(r) {x = d;} else {v = x;}}', where 'cond-update-stmt' can have one of the following forms: 'if(expr ordop x) {x = expr;}', 'if(x ordop expr) {x = expr;}', 'if(x == e) {x = d;}', or 'if(e == x) {x = d;}' where 'x' is an lvalue expression with scalar type, 'expr', 'e', and 'd' are expressions with scalar type, and 'ordop' is one of '<' or '>'}} // omp51-note@+2 {{expect a 'if' statement}} #pragma omp atomic compare capture { x = x > e ? e : x; } -// omp51-error@+3 {{the statement for 'atomic compare capture' must be a compound statement of form '{v = x; cond-up-stmt}', ''{cond-up-stmt v = x;}', '{if(x == e) {x = d;} else {v = x;}}', '{r = x == e; if(r) {x = d;}}', or '{r = x == e; if(r) {x = d;} else {v = x;}}', where 'cond-update-stmt' can have one of the following forms: 'if(expr ordop x) {x = expr;}', 'if(x ordop expr) {x = expr;}', 'if(x == e) {x = d;}', or 'if(e == x) {x = d;}' where 'x' is an lvalue expression with scalar type, 'expr', 'e', and 'd' are expressions with scalar type, and 'ordop' is one of '<' or '>'.}} +// omp51-error@+3 {{the statement for 'atomic compare capture' must be a compound statement of form '{v = x; cond-up-stmt}', ''{cond-up-stmt v = x;}', '{if(x == e) {x = d;} else {v = x;}}', '{r = x == e; if(r) {x = d;}}', or '{r = x == e; if(r) {x = d;} else {v = x;}}', where 'cond-update-stmt' can have one of the following forms: 'if(expr ordop x) {x = expr;}', 'if(x ordop expr) {x = expr;}', 'if(x == e) {x = d;}', or 'if(e == x) {x = d;}' where 'x' is an lvalue expression with scalar type, 'expr', 'e', and 'd' are expressions with scalar type, and 'ordop' is one of '<' or '>'}} // omp51-note@+2 {{expect a form 'r = x == e; if (r) ...'}} #pragma omp atomic compare capture { r = x == e; if (x == d) { x = e; } } -// omp51-error@+3 {{the statement for 'atomic compare capture' must be a compound statement of form '{v = x; cond-up-stmt}', ''{cond-up-stmt v = x;}', '{if(x == e) {x = d;} else {v = x;}}', '{r = x == e; if(r) {x = d;}}', or '{r = x == e; if(r) {x = d;} else {v = x;}}', where 'cond-update-stmt' can have one of the following forms: 'if(expr ordop x) {x = expr;}', 'if(x ordop expr) {x = expr;}', 'if(x == e) {x = d;}', or 'if(e == x) {x = d;}' where 'x' is an lvalue expression with scalar type, 'expr', 'e', and 'd' are expressions with scalar type, and 'ordop' is one of '<' or '>'.}} +// omp51-error@+3 {{the statement for 'atomic compare capture' must be a compound statement of form '{v = x; cond-up-stmt}', ''{cond-up-stmt v = x;}', '{if(x == e) {x = d;} else {v = x;}}', '{r = x == e; if(r) {x = d;}}', or '{r = x == e; if(r) {x = d;} else {v = x;}}', where 'cond-update-stmt' can have one of the following forms: 'if(expr ordop x) {x = expr;}', 'if(x ordop expr) {x = expr;}', 'if(x == e) {x = d;}', or 'if(e == x) {x = d;}' where 'x' is an lvalue expression with scalar type, 'expr', 'e', and 'd' are expressions with scalar type, and 'ordop' is one of '<' or '>'}} // omp51-note@+2 {{expected assignment statement}} #pragma omp atomic compare capture { r = x == e; if (r) { bbar(); } } -// omp51-error@+3 {{the statement for 'atomic compare capture' must be a compound statement of form '{v = x; cond-up-stmt}', ''{cond-up-stmt v = x;}', '{if(x == e) {x = d;} else {v = x;}}', '{r = x == e; if(r) {x = d;}}', or '{r = x == e; if(r) {x = d;} else {v = x;}}', where 'cond-update-stmt' can have one of the following forms: 'if(expr ordop x) {x = expr;}', 'if(x ordop expr) {x = expr;}', 'if(x == e) {x = d;}', or 'if(e == x) {x = d;}' where 'x' is an lvalue expression with scalar type, 'expr', 'e', and 'd' are expressions with scalar type, and 'ordop' is one of '<' or '>'.}} +// omp51-error@+3 {{the statement for 'atomic compare capture' must be a compound statement of form '{v = x; cond-up-stmt}', ''{cond-up-stmt v = x;}', '{if(x == e) {x = d;} else {v = x;}}', '{r = x == e; if(r) {x = d;}}', or '{r = x == e; if(r) {x = d;} else {v = x;}}', where 'cond-update-stmt' can have one of the following forms: 'if(expr ordop x) {x = expr;}', 'if(x ordop expr) {x = expr;}', 'if(x == e) {x = d;}', or 'if(e == x) {x = d;}' where 'x' is an lvalue expression with scalar type, 'expr', 'e', and 'd' are expressions with scalar type, and 'ordop' is one of '<' or '>'}} // omp51-note@+2 {{expected assignment statement}} #pragma omp atomic compare capture { r = x == e; if (r) { x += d; } } -// omp51-error@+3 {{the statement for 'atomic compare capture' must be a compound statement of form '{v = x; cond-up-stmt}', ''{cond-up-stmt v = x;}', '{if(x == e) {x = d;} else {v = x;}}', '{r = x == e; if(r) {x = d;}}', or '{r = x == e; if(r) {x = d;} else {v = x;}}', where 'cond-update-stmt' can have one of the following forms: 'if(expr ordop x) {x = expr;}', 'if(x ordop expr) {x = expr;}', 'if(x == e) {x = d;}', or 'if(e == x) {x = d;}' where 'x' is an lvalue expression with scalar type, 'expr', 'e', and 'd' are expressions with scalar type, and 'ordop' is one of '<' or '>'.}} +// omp51-error@+3 {{the statement for 'atomic compare capture' must be a compound statement of form '{v = x; cond-up-stmt}', ''{cond-up-stmt v = x;}', '{if(x == e) {x = d;} else {v = x;}}', '{r = x == e; if(r) {x = d;}}', or '{r = x == e; if(r) {x = d;} else {v = x;}}', where 'cond-update-stmt' can have one of the following forms: 'if(expr ordop x) {x = expr;}', 'if(x ordop expr) {x = expr;}', 'if(x == e) {x = d;}', or 'if(e == x) {x = d;}' where 'x' is an lvalue expression with scalar type, 'expr', 'e', and 'd' are expressions with scalar type, and 'ordop' is one of '<' or '>'}} // omp51-note@+2 {{expected compound statement}} #pragma omp atomic compare capture { r = x == e; if (r) {} } -// omp51-error@+5 {{the statement for 'atomic compare capture' must be a compound statement of form '{v = x; cond-up-stmt}', ''{cond-up-stmt v = x;}', '{if(x == e) {x = d;} else {v = x;}}', '{r = x == e; if(r) {x = d;}}', or '{r = x == e; if(r) {x = d;} else {v = x;}}', where 'cond-update-stmt' can have one of the following forms: 'if(expr ordop x) {x = expr;}', 'if(x ordop expr) {x = expr;}', 'if(x == e) {x = d;}', or 'if(e == x) {x = d;}' where 'x' is an lvalue expression with scalar type, 'expr', 'e', and 'd' are expressions with scalar type, and 'ordop' is one of '<' or '>'.}} +// omp51-error@+5 {{the statement for 'atomic compare capture' must be a compound statement of form '{v = x; cond-up-stmt}', ''{cond-up-stmt v = x;}', '{if(x == e) {x = d;} else {v = x;}}', '{r = x == e; if(r) {x = d;}}', or '{r = x == e; if(r) {x = d;} else {v = x;}}', where 'cond-update-stmt' can have one of the following forms: 'if(expr ordop x) {x = expr;}', 'if(x ordop expr) {x = expr;}', 'if(x == e) {x = d;}', or 'if(e == x) {x = d;}' where 'x' is an lvalue expression with scalar type, 'expr', 'e', and 'd' are expressions with scalar type, and 'ordop' is one of '<' or '>'}} // omp51-note@+4 {{expected exactly one expression statement}} #pragma omp atomic compare capture { @@ -616,19 +616,19 @@ void compare_capture(void) { v = x; } } -// omp51-error@+3 {{the statement for 'atomic compare capture' must be a compound statement of form '{v = x; cond-up-stmt}', ''{cond-up-stmt v = x;}', '{if(x == e) {x = d;} else {v = x;}}', '{r = x == e; if(r) {x = d;}}', or '{r = x == e; if(r) {x = d;} else {v = x;}}', where 'cond-update-stmt' can have one of the following forms: 'if(expr ordop x) {x = expr;}', 'if(x ordop expr) {x = expr;}', 'if(x == e) {x = d;}', or 'if(e == x) {x = d;}' where 'x' is an lvalue expression with scalar type, 'expr', 'e', and 'd' are expressions with scalar type, and 'ordop' is one of '<' or '>'.}} +// omp51-error@+3 {{the statement for 'atomic compare capture' must be a compound statement of form '{v = x; cond-up-stmt}', ''{cond-up-stmt v = x;}', '{if(x == e) {x = d;} else {v = x;}}', '{r = x == e; if(r) {x = d;}}', or '{r = x == e; if(r) {x = d;} else {v = x;}}', where 'cond-update-stmt' can have one of the following forms: 'if(expr ordop x) {x = expr;}', 'if(x ordop expr) {x = expr;}', 'if(x == e) {x = d;}', or 'if(e == x) {x = d;}' where 'x' is an lvalue expression with scalar type, 'expr', 'e', and 'd' are expressions with scalar type, and 'ordop' is one of '<' or '>'}} // omp51-note@+2 {{expect '==' operator}} #pragma omp atomic compare capture { r = x > e; if (r) { x = d; } } -// omp51-error@+3 {{the statement for 'atomic compare capture' must be a compound statement of form '{v = x; cond-up-stmt}', ''{cond-up-stmt v = x;}', '{if(x == e) {x = d;} else {v = x;}}', '{r = x == e; if(r) {x = d;}}', or '{r = x == e; if(r) {x = d;} else {v = x;}}', where 'cond-update-stmt' can have one of the following forms: 'if(expr ordop x) {x = expr;}', 'if(x ordop expr) {x = expr;}', 'if(x == e) {x = d;}', or 'if(e == x) {x = d;}' where 'x' is an lvalue expression with scalar type, 'expr', 'e', and 'd' are expressions with scalar type, and 'ordop' is one of '<' or '>'.}} +// omp51-error@+3 {{the statement for 'atomic compare capture' must be a compound statement of form '{v = x; cond-up-stmt}', ''{cond-up-stmt v = x;}', '{if(x == e) {x = d;} else {v = x;}}', '{r = x == e; if(r) {x = d;}}', or '{r = x == e; if(r) {x = d;} else {v = x;}}', where 'cond-update-stmt' can have one of the following forms: 'if(expr ordop x) {x = expr;}', 'if(x ordop expr) {x = expr;}', 'if(x == e) {x = d;}', or 'if(e == x) {x = d;}' where 'x' is an lvalue expression with scalar type, 'expr', 'e', and 'd' are expressions with scalar type, and 'ordop' is one of '<' or '>'}} // omp51-note@+2 {{expect comparison in a form of 'x == e', 'e == x', 'x ordop expr', or 'expr ordop x'}} #pragma omp atomic compare capture { r = d == e; if (r) { x = d; } } -// omp51-error@+3 {{the statement for 'atomic compare capture' must be a compound statement of form '{v = x; cond-up-stmt}', ''{cond-up-stmt v = x;}', '{if(x == e) {x = d;} else {v = x;}}', '{r = x == e; if(r) {x = d;}}', or '{r = x == e; if(r) {x = d;} else {v = x;}}', where 'cond-update-stmt' can have one of the following forms: 'if(expr ordop x) {x = expr;}', 'if(x ordop expr) {x = expr;}', 'if(x == e) {x = d;}', or 'if(e == x) {x = d;}' where 'x' is an lvalue expression with scalar type, 'expr', 'e', and 'd' are expressions with scalar type, and 'ordop' is one of '<' or '>'.}} +// omp51-error@+3 {{the statement for 'atomic compare capture' must be a compound statement of form '{v = x; cond-up-stmt}', ''{cond-up-stmt v = x;}', '{if(x == e) {x = d;} else {v = x;}}', '{r = x == e; if(r) {x = d;}}', or '{r = x == e; if(r) {x = d;} else {v = x;}}', where 'cond-update-stmt' can have one of the following forms: 'if(expr ordop x) {x = expr;}', 'if(x ordop expr) {x = expr;}', 'if(x == e) {x = d;}', or 'if(e == x) {x = d;}' where 'x' is an lvalue expression with scalar type, 'expr', 'e', and 'd' are expressions with scalar type, and 'ordop' is one of '<' or '>'}} // omp51-note@+2 {{expected compound statement}} #pragma omp atomic compare capture { r = x == e; if (r) { x = d; } else {} } -// omp51-error@+7 {{the statement for 'atomic compare capture' must be a compound statement of form '{v = x; cond-up-stmt}', ''{cond-up-stmt v = x;}', '{if(x == e) {x = d;} else {v = x;}}', '{r = x == e; if(r) {x = d;}}', or '{r = x == e; if(r) {x = d;} else {v = x;}}', where 'cond-update-stmt' can have one of the following forms: 'if(expr ordop x) {x = expr;}', 'if(x ordop expr) {x = expr;}', 'if(x == e) {x = d;}', or 'if(e == x) {x = d;}' where 'x' is an lvalue expression with scalar type, 'expr', 'e', and 'd' are expressions with scalar type, and 'ordop' is one of '<' or '>'.}} +// omp51-error@+7 {{the statement for 'atomic compare capture' must be a compound statement of form '{v = x; cond-up-stmt}', ''{cond-up-stmt v = x;}', '{if(x == e) {x = d;} else {v = x;}}', '{r = x == e; if(r) {x = d;}}', or '{r = x == e; if(r) {x = d;} else {v = x;}}', where 'cond-update-stmt' can have one of the following forms: 'if(expr ordop x) {x = expr;}', 'if(x ordop expr) {x = expr;}', 'if(x == e) {x = d;}', or 'if(e == x) {x = d;}' where 'x' is an lvalue expression with scalar type, 'expr', 'e', and 'd' are expressions with scalar type, and 'ordop' is one of '<' or '>'}} // omp51-note@+6 {{expected exactly one expression statement}} #pragma omp atomic compare capture { @@ -640,40 +640,40 @@ void compare_capture(void) { d = e; } } -// omp51-error@+3 {{the statement for 'atomic compare capture' must be a compound statement of form '{v = x; cond-up-stmt}', ''{cond-up-stmt v = x;}', '{if(x == e) {x = d;} else {v = x;}}', '{r = x == e; if(r) {x = d;}}', or '{r = x == e; if(r) {x = d;} else {v = x;}}', where 'cond-update-stmt' can have one of the following forms: 'if(expr ordop x) {x = expr;}', 'if(x ordop expr) {x = expr;}', 'if(x == e) {x = d;}', or 'if(e == x) {x = d;}' where 'x' is an lvalue expression with scalar type, 'expr', 'e', and 'd' are expressions with scalar type, and 'ordop' is one of '<' or '>'.}} +// omp51-error@+3 {{the statement for 'atomic compare capture' must be a compound statement of form '{v = x; cond-up-stmt}', ''{cond-up-stmt v = x;}', '{if(x == e) {x = d;} else {v = x;}}', '{r = x == e; if(r) {x = d;}}', or '{r = x == e; if(r) {x = d;} else {v = x;}}', where 'cond-update-stmt' can have one of the following forms: 'if(expr ordop x) {x = expr;}', 'if(x ordop expr) {x = expr;}', 'if(x == e) {x = d;}', or 'if(e == x) {x = d;}' where 'x' is an lvalue expression with scalar type, 'expr', 'e', and 'd' are expressions with scalar type, and 'ordop' is one of '<' or '>'}} // omp51-note@+2 {{expected assignment statement}} #pragma omp atomic compare capture { r = x == e; if (r) { x = d; } else { bbar(); } } -// omp51-error@+3 {{the statement for 'atomic compare capture' must be a compound statement of form '{v = x; cond-up-stmt}', ''{cond-up-stmt v = x;}', '{if(x == e) {x = d;} else {v = x;}}', '{r = x == e; if(r) {x = d;}}', or '{r = x == e; if(r) {x = d;} else {v = x;}}', where 'cond-update-stmt' can have one of the following forms: 'if(expr ordop x) {x = expr;}', 'if(x ordop expr) {x = expr;}', 'if(x == e) {x = d;}', or 'if(e == x) {x = d;}' where 'x' is an lvalue expression with scalar type, 'expr', 'e', and 'd' are expressions with scalar type, and 'ordop' is one of '<' or '>'.}} +// omp51-error@+3 {{the statement for 'atomic compare capture' must be a compound statement of form '{v = x; cond-up-stmt}', ''{cond-up-stmt v = x;}', '{if(x == e) {x = d;} else {v = x;}}', '{r = x == e; if(r) {x = d;}}', or '{r = x == e; if(r) {x = d;} else {v = x;}}', where 'cond-update-stmt' can have one of the following forms: 'if(expr ordop x) {x = expr;}', 'if(x ordop expr) {x = expr;}', 'if(x == e) {x = d;}', or 'if(e == x) {x = d;}' where 'x' is an lvalue expression with scalar type, 'expr', 'e', and 'd' are expressions with scalar type, and 'ordop' is one of '<' or '>'}} // omp51-note@+2 {{expected assignment statement}} #pragma omp atomic compare capture { r = x == e; if (r) { x = d; } else { v += x; } } -// omp51-error@+3 {{the statement for 'atomic compare capture' must be a compound statement of form '{v = x; cond-up-stmt}', ''{cond-up-stmt v = x;}', '{if(x == e) {x = d;} else {v = x;}}', '{r = x == e; if(r) {x = d;}}', or '{r = x == e; if(r) {x = d;} else {v = x;}}', where 'cond-update-stmt' can have one of the following forms: 'if(expr ordop x) {x = expr;}', 'if(x ordop expr) {x = expr;}', 'if(x == e) {x = d;}', or 'if(e == x) {x = d;}' where 'x' is an lvalue expression with scalar type, 'expr', 'e', and 'd' are expressions with scalar type, and 'ordop' is one of '<' or '>'.}} +// omp51-error@+3 {{the statement for 'atomic compare capture' must be a compound statement of form '{v = x; cond-up-stmt}', ''{cond-up-stmt v = x;}', '{if(x == e) {x = d;} else {v = x;}}', '{r = x == e; if(r) {x = d;}}', or '{r = x == e; if(r) {x = d;} else {v = x;}}', where 'cond-update-stmt' can have one of the following forms: 'if(expr ordop x) {x = expr;}', 'if(x ordop expr) {x = expr;}', 'if(x == e) {x = d;}', or 'if(e == x) {x = d;}' where 'x' is an lvalue expression with scalar type, 'expr', 'e', and 'd' are expressions with scalar type, and 'ordop' is one of '<' or '>'}} // omp51-note@+2 {{expect an assignment statement 'v = x'}} #pragma omp atomic compare capture { r = x == e; if (r) { x = d; } else { v = d; } } -// omp51-error@+3 {{the statement for 'atomic compare capture' must be a compound statement of form '{v = x; cond-up-stmt}', ''{cond-up-stmt v = x;}', '{if(x == e) {x = d;} else {v = x;}}', '{r = x == e; if(r) {x = d;}}', or '{r = x == e; if(r) {x = d;} else {v = x;}}', where 'cond-update-stmt' can have one of the following forms: 'if(expr ordop x) {x = expr;}', 'if(x ordop expr) {x = expr;}', 'if(x == e) {x = d;}', or 'if(e == x) {x = d;}' where 'x' is an lvalue expression with scalar type, 'expr', 'e', and 'd' are expressions with scalar type, and 'ordop' is one of '<' or '>'.}} +// omp51-error@+3 {{the statement for 'atomic compare capture' must be a compound statement of form '{v = x; cond-up-stmt}', ''{cond-up-stmt v = x;}', '{if(x == e) {x = d;} else {v = x;}}', '{r = x == e; if(r) {x = d;}}', or '{r = x == e; if(r) {x = d;} else {v = x;}}', where 'cond-update-stmt' can have one of the following forms: 'if(expr ordop x) {x = expr;}', 'if(x ordop expr) {x = expr;}', 'if(x == e) {x = d;}', or 'if(e == x) {x = d;}' where 'x' is an lvalue expression with scalar type, 'expr', 'e', and 'd' are expressions with scalar type, and 'ordop' is one of '<' or '>'}} // omp51-note@+2 {{expected assignment statement}} #pragma omp atomic compare capture { v += x; if (x == e) { x = d; } } -// omp51-error@+3 {{the statement for 'atomic compare capture' must be a compound statement of form '{v = x; cond-up-stmt}', ''{cond-up-stmt v = x;}', '{if(x == e) {x = d;} else {v = x;}}', '{r = x == e; if(r) {x = d;}}', or '{r = x == e; if(r) {x = d;} else {v = x;}}', where 'cond-update-stmt' can have one of the following forms: 'if(expr ordop x) {x = expr;}', 'if(x ordop expr) {x = expr;}', 'if(x == e) {x = d;}', or 'if(e == x) {x = d;}' where 'x' is an lvalue expression with scalar type, 'expr', 'e', and 'd' are expressions with scalar type, and 'ordop' is one of '<' or '>'.}} +// omp51-error@+3 {{the statement for 'atomic compare capture' must be a compound statement of form '{v = x; cond-up-stmt}', ''{cond-up-stmt v = x;}', '{if(x == e) {x = d;} else {v = x;}}', '{r = x == e; if(r) {x = d;}}', or '{r = x == e; if(r) {x = d;} else {v = x;}}', where 'cond-update-stmt' can have one of the following forms: 'if(expr ordop x) {x = expr;}', 'if(x ordop expr) {x = expr;}', 'if(x == e) {x = d;}', or 'if(e == x) {x = d;}' where 'x' is an lvalue expression with scalar type, 'expr', 'e', and 'd' are expressions with scalar type, and 'ordop' is one of '<' or '>'}} // omp51-note@+2 {{expected assignment statement}} #pragma omp atomic compare capture { if (x == e) { x = d; } v += x; } -// omp51-error@+3 {{the statement for 'atomic compare capture' must be a compound statement of form '{v = x; cond-up-stmt}', ''{cond-up-stmt v = x;}', '{if(x == e) {x = d;} else {v = x;}}', '{r = x == e; if(r) {x = d;}}', or '{r = x == e; if(r) {x = d;} else {v = x;}}', where 'cond-update-stmt' can have one of the following forms: 'if(expr ordop x) {x = expr;}', 'if(x ordop expr) {x = expr;}', 'if(x == e) {x = d;}', or 'if(e == x) {x = d;}' where 'x' is an lvalue expression with scalar type, 'expr', 'e', and 'd' are expressions with scalar type, and 'ordop' is one of '<' or '>'.}} +// omp51-error@+3 {{the statement for 'atomic compare capture' must be a compound statement of form '{v = x; cond-up-stmt}', ''{cond-up-stmt v = x;}', '{if(x == e) {x = d;} else {v = x;}}', '{r = x == e; if(r) {x = d;}}', or '{r = x == e; if(r) {x = d;} else {v = x;}}', where 'cond-update-stmt' can have one of the following forms: 'if(expr ordop x) {x = expr;}', 'if(x ordop expr) {x = expr;}', 'if(x == e) {x = d;}', or 'if(e == x) {x = d;}' where 'x' is an lvalue expression with scalar type, 'expr', 'e', and 'd' are expressions with scalar type, and 'ordop' is one of '<' or '>'}} // omp51-note@+2 {{expect an assignment statement 'v = x'}} #pragma omp atomic compare capture { v = d; if (x == e) { x = d; } } -// omp51-error@+3 {{the statement for 'atomic compare capture' must be a compound statement of form '{v = x; cond-up-stmt}', ''{cond-up-stmt v = x;}', '{if(x == e) {x = d;} else {v = x;}}', '{r = x == e; if(r) {x = d;}}', or '{r = x == e; if(r) {x = d;} else {v = x;}}', where 'cond-update-stmt' can have one of the following forms: 'if(expr ordop x) {x = expr;}', 'if(x ordop expr) {x = expr;}', 'if(x == e) {x = d;}', or 'if(e == x) {x = d;}' where 'x' is an lvalue expression with scalar type, 'expr', 'e', and 'd' are expressions with scalar type, and 'ordop' is one of '<' or '>'.}} +// omp51-error@+3 {{the statement for 'atomic compare capture' must be a compound statement of form '{v = x; cond-up-stmt}', ''{cond-up-stmt v = x;}', '{if(x == e) {x = d;} else {v = x;}}', '{r = x == e; if(r) {x = d;}}', or '{r = x == e; if(r) {x = d;} else {v = x;}}', where 'cond-update-stmt' can have one of the following forms: 'if(expr ordop x) {x = expr;}', 'if(x ordop expr) {x = expr;}', 'if(x == e) {x = d;}', or 'if(e == x) {x = d;}' where 'x' is an lvalue expression with scalar type, 'expr', 'e', and 'd' are expressions with scalar type, and 'ordop' is one of '<' or '>'}} // omp51-note@+2 {{expect an assignment statement 'v = x'}} #pragma omp atomic compare capture { if (x == e) { x = d; } v = d; } -// omp51-error@+3 {{the statement for 'atomic compare capture' must be a compound statement of form '{v = x; cond-up-stmt}', ''{cond-up-stmt v = x;}', '{if(x == e) {x = d;} else {v = x;}}', '{r = x == e; if(r) {x = d;}}', or '{r = x == e; if(r) {x = d;} else {v = x;}}', where 'cond-update-stmt' can have one of the following forms: 'if(expr ordop x) {x = expr;}', 'if(x ordop expr) {x = expr;}', 'if(x == e) {x = d;}', or 'if(e == x) {x = d;}' where 'x' is an lvalue expression with scalar type, 'expr', 'e', and 'd' are expressions with scalar type, and 'ordop' is one of '<' or '>'.}} +// omp51-error@+3 {{the statement for 'atomic compare capture' must be a compound statement of form '{v = x; cond-up-stmt}', ''{cond-up-stmt v = x;}', '{if(x == e) {x = d;} else {v = x;}}', '{r = x == e; if(r) {x = d;}}', or '{r = x == e; if(r) {x = d;} else {v = x;}}', where 'cond-update-stmt' can have one of the following forms: 'if(expr ordop x) {x = expr;}', 'if(x ordop expr) {x = expr;}', 'if(x == e) {x = d;}', or 'if(e == x) {x = d;}' where 'x' is an lvalue expression with scalar type, 'expr', 'e', and 'd' are expressions with scalar type, and 'ordop' is one of '<' or '>'}} // omp51-note@+2 {{expected assignment statement}} #pragma omp atomic compare capture { v = x; bbar(); } -// omp51-error@+3 {{the statement for 'atomic compare capture' must be a compound statement of form '{v = x; cond-up-stmt}', ''{cond-up-stmt v = x;}', '{if(x == e) {x = d;} else {v = x;}}', '{r = x == e; if(r) {x = d;}}', or '{r = x == e; if(r) {x = d;} else {v = x;}}', where 'cond-update-stmt' can have one of the following forms: 'if(expr ordop x) {x = expr;}', 'if(x ordop expr) {x = expr;}', 'if(x == e) {x = d;}', or 'if(e == x) {x = d;}' where 'x' is an lvalue expression with scalar type, 'expr', 'e', and 'd' are expressions with scalar type, and 'ordop' is one of '<' or '>'.}} +// omp51-error@+3 {{the statement for 'atomic compare capture' must be a compound statement of form '{v = x; cond-up-stmt}', ''{cond-up-stmt v = x;}', '{if(x == e) {x = d;} else {v = x;}}', '{r = x == e; if(r) {x = d;}}', or '{r = x == e; if(r) {x = d;} else {v = x;}}', where 'cond-update-stmt' can have one of the following forms: 'if(expr ordop x) {x = expr;}', 'if(x ordop expr) {x = expr;}', 'if(x == e) {x = d;}', or 'if(e == x) {x = d;}' where 'x' is an lvalue expression with scalar type, 'expr', 'e', and 'd' are expressions with scalar type, and 'ordop' is one of '<' or '>'}} // omp51-note@+2 {{expect integer value}} #pragma omp atomic compare capture { dr = x == e; if (dr) { x = d; } } diff --git a/clang/test/OpenMP/target_update_messages.cpp b/clang/test/OpenMP/target_update_messages.cpp index 2bf0ade9fe919..83191059202ca 100644 --- a/clang/test/OpenMP/target_update_messages.cpp +++ b/clang/test/OpenMP/target_update_messages.cpp @@ -18,14 +18,14 @@ static int y; #pragma omp declare target(y) void yyy() { -#pragma omp target update to(y) // expected-error {{the host cannot update a declare target variable that is not externally visible.}} +#pragma omp target update to(y) // expected-error {{the host cannot update a declare target variable that is not externally visible}} } int __attribute__((visibility("hidden"))) z; #pragma omp declare target(z) void zzz() { -#pragma omp target update from(z) // expected-error {{the host cannot update a declare target variable that is not externally visible.}} +#pragma omp target update from(z) // expected-error {{the host cannot update a declare target variable that is not externally visible}} } void foo() { diff --git a/clang/test/Parser/MicrosoftExtensions.cpp b/clang/test/Parser/MicrosoftExtensions.cpp index 6bf802a29ace3..9102bca8f6bb2 100644 --- a/clang/test/Parser/MicrosoftExtensions.cpp +++ b/clang/test/Parser/MicrosoftExtensions.cpp @@ -426,7 +426,7 @@ bool f(int); template struct A { constexpr A(T t) { - __assume(f(t)); // expected-warning{{the argument to '__assume' has side effects that will be discarded}} + __assume(f(t)); // expected-warning{{assumption is ignored because it contains (potential) side-effects}} } constexpr bool g() { return false; } }; diff --git a/clang/test/Parser/objcbridge-related-attribute.m b/clang/test/Parser/objcbridge-related-attribute.m index 246afeef5198e..e76d5e3881414 100644 --- a/clang/test/Parser/objcbridge-related-attribute.m +++ b/clang/test/Parser/objcbridge-related-attribute.m @@ -5,10 +5,10 @@ typedef struct __attribute__((objc_bridge_related(NSColor,,))) CGColor *CGColorRef2Ok; typedef struct __attribute__((objc_bridge_related(NSColor,colorWithCGColor:,))) CGColor *CGColorRef3Ok; -typedef struct __attribute__((objc_bridge_related(,colorWithCGColor:,CGColor))) CGColor *CGColorRef1NotOk; // expected-error {{expected a related ObjectiveC class name, e.g., 'NSColor'}} +typedef struct __attribute__((objc_bridge_related(,colorWithCGColor:,CGColor))) CGColor *CGColorRef1NotOk; // expected-error {{expected a related Objective-C class name, e.g., 'NSColor'}} typedef struct __attribute__((objc_bridge_related(NSColor,colorWithCGColor,CGColor))) CGColor *CGColorRef2NotOk; // expected-error {{expected a class method selector with single argument, e.g., 'colorWithCGColor:'}} typedef struct __attribute__((objc_bridge_related(NSColor,colorWithCGColor::,CGColor))) CGColor *CGColorRef3NotOk; // expected-error {{expected a class method selector with single argument, e.g., 'colorWithCGColor:'}} -typedef struct __attribute__((objc_bridge_related(12,colorWithCGColor:,CGColor))) CGColor *CGColorRef4NotOk; // expected-error {{expected a related ObjectiveC class name, e.g., 'NSColor'}} +typedef struct __attribute__((objc_bridge_related(12,colorWithCGColor:,CGColor))) CGColor *CGColorRef4NotOk; // expected-error {{expected a related Objective-C class name, e.g., 'NSColor'}} typedef struct __attribute__((objc_bridge_related(NSColor,+:,CGColor))) CGColor *CGColorRef5NotOk; // expected-error {{expected ','}} typedef struct __attribute__((objc_bridge_related(NSColor,colorWithCGColor:,+))) CGColor *CGColorRef6NotOk; // expected-error {{expected ')'}} diff --git a/clang/test/Parser/pragma-attribute.cpp b/clang/test/Parser/pragma-attribute.cpp index bc8e7b9e78c6f..6377fc754352e 100644 --- a/clang/test/Parser/pragma-attribute.cpp +++ b/clang/test/Parser/pragma-attribute.cpp @@ -127,7 +127,7 @@ void function(); // expected-error@-1 {{attribute 'objc_bridge_related' can't be applied to 'function'}} #pragma clang attribute pop -#pragma clang attribute push (__attribute__((objc_bridge_related(1))), apply_to=function) // expected-error {{expected a related ObjectiveC class name, e.g., 'NSColor'}} +#pragma clang attribute push (__attribute__((objc_bridge_related(1))), apply_to=function) // expected-error {{expected a related Objective-C class name, e.g., 'NSColor'}} #pragma clang attribute push (__attribute__((used)), apply_to=function) // expected-error {{attribute 'used' is not supported by '#pragma clang attribute'}} diff --git a/clang/test/Preprocessor/predefined-arch-macros.c b/clang/test/Preprocessor/predefined-arch-macros.c index ca51f2fc22c51..f0a2ef851287f 100644 --- a/clang/test/Preprocessor/predefined-arch-macros.c +++ b/clang/test/Preprocessor/predefined-arch-macros.c @@ -793,9 +793,7 @@ // CHECK_KNL_M32: #define __AES__ 1 // CHECK_KNL_M32: #define __AVX2__ 1 // CHECK_KNL_M32: #define __AVX512CD__ 1 -// CHECK_KNL_M32: #define __AVX512ER__ 1 // CHECK_KNL_M32: #define __AVX512F__ 1 -// CHECK_KNL_M32: #define __AVX512PF__ 1 // CHECK_KNL_M32: #define __AVX__ 1 // CHECK_KNL_M32: #define __BMI2__ 1 // CHECK_KNL_M32: #define __BMI__ 1 @@ -808,7 +806,6 @@ // CHECK_KNL_M32: #define __MOVBE__ 1 // CHECK_KNL_M32: #define __PCLMUL__ 1 // CHECK_KNL_M32: #define __POPCNT__ 1 -// CHECK_KNL_M32: #define __PREFETCHWT1__ 1 // CHECK_KNL_M32: #define __PRFCHW__ 1 // CHECK_KNL_M32: #define __RDRND__ 1 // CHECK_KNL_M32: #define __SSE2__ 1 @@ -832,9 +829,7 @@ // CHECK_KNL_M64: #define __AES__ 1 // CHECK_KNL_M64: #define __AVX2__ 1 // CHECK_KNL_M64: #define __AVX512CD__ 1 -// CHECK_KNL_M64: #define __AVX512ER__ 1 // CHECK_KNL_M64: #define __AVX512F__ 1 -// CHECK_KNL_M64: #define __AVX512PF__ 1 // CHECK_KNL_M64: #define __AVX__ 1 // CHECK_KNL_M64: #define __BMI2__ 1 // CHECK_KNL_M64: #define __BMI__ 1 @@ -847,7 +842,6 @@ // CHECK_KNL_M64: #define __MOVBE__ 1 // CHECK_KNL_M64: #define __PCLMUL__ 1 // CHECK_KNL_M64: #define __POPCNT__ 1 -// CHECK_KNL_M64: #define __PREFETCHWT1__ 1 // CHECK_KNL_M64: #define __PRFCHW__ 1 // CHECK_KNL_M64: #define __RDRND__ 1 // CHECK_KNL_M64: #define __SSE2_MATH__ 1 @@ -874,9 +868,7 @@ // CHECK_KNM_M32: #define __AES__ 1 // CHECK_KNM_M32: #define __AVX2__ 1 // CHECK_KNM_M32: #define __AVX512CD__ 1 -// CHECK_KNM_M32: #define __AVX512ER__ 1 // CHECK_KNM_M32: #define __AVX512F__ 1 -// CHECK_KNM_M32: #define __AVX512PF__ 1 // CHECK_KNM_M32: #define __AVX512VPOPCNTDQ__ 1 // CHECK_KNM_M32: #define __AVX__ 1 // CHECK_KNM_M32: #define __BMI2__ 1 @@ -890,7 +882,6 @@ // CHECK_KNM_M32: #define __MOVBE__ 1 // CHECK_KNM_M32: #define __PCLMUL__ 1 // CHECK_KNM_M32: #define __POPCNT__ 1 -// CHECK_KNM_M32: #define __PREFETCHWT1__ 1 // CHECK_KNM_M32: #define __PRFCHW__ 1 // CHECK_KNM_M32: #define __RDRND__ 1 // CHECK_KNM_M32: #define __SSE2__ 1 @@ -911,9 +902,7 @@ // CHECK_KNM_M64: #define __AES__ 1 // CHECK_KNM_M64: #define __AVX2__ 1 // CHECK_KNM_M64: #define __AVX512CD__ 1 -// CHECK_KNM_M64: #define __AVX512ER__ 1 // CHECK_KNM_M64: #define __AVX512F__ 1 -// CHECK_KNM_M64: #define __AVX512PF__ 1 // CHECK_KNM_M64: #define __AVX512VPOPCNTDQ__ 1 // CHECK_KNM_M64: #define __AVX__ 1 // CHECK_KNM_M64: #define __BMI2__ 1 @@ -927,7 +916,6 @@ // CHECK_KNM_M64: #define __MOVBE__ 1 // CHECK_KNM_M64: #define __PCLMUL__ 1 // CHECK_KNM_M64: #define __POPCNT__ 1 -// CHECK_KNM_M64: #define __PREFETCHWT1__ 1 // CHECK_KNM_M64: #define __PRFCHW__ 1 // CHECK_KNM_M64: #define __RDRND__ 1 // CHECK_KNM_M64: #define __SSE2_MATH__ 1 diff --git a/clang/test/Preprocessor/stdc-ms-extension.cpp b/clang/test/Preprocessor/stdc-ms-extension.cpp new file mode 100644 index 0000000000000..6e9fa6055306e --- /dev/null +++ b/clang/test/Preprocessor/stdc-ms-extension.cpp @@ -0,0 +1,9 @@ +// RUN: %clang_cl /TC /dev/null /E -Xclang -dM 2> /dev/null | FileCheck -match-full-lines %s --check-prefix=NOSTDC +// RUN: %clang_cl /TC /dev/null /E -Xclang -dM /Zc:__STDC__ 2> /dev/null | FileCheck -match-full-lines %s --check-prefix=YESSTDC +// __STDC__ should never be defined in C++ mode with fms-compatibility. +// RUN: %clang_cl /dev/null /E -Xclang -dM 2>&1 | FileCheck %s --check-prefix=NOSTDC +// RUN: %clang_cl /dev/null /E -Xclang -dM /Zc:__STDC__ 2>&1 | FileCheck %s --check-prefix=ZCSTDCIGNORED +// YESSTDC: #define __STDC__ 1 +// NOSTDC-NOT: #define __STDC__ 1 +// ZCSTDCIGNORED-NOT: #define __STDC__ 1 +// ZCSTDCIGNORED: argument unused during compilation diff --git a/clang/test/Preprocessor/x86_target_features.c b/clang/test/Preprocessor/x86_target_features.c index 57104c9e7a500..7567267be26b4 100644 --- a/clang/test/Preprocessor/x86_target_features.c +++ b/clang/test/Preprocessor/x86_target_features.c @@ -90,38 +90,6 @@ // AVX512CD: #define __SSE__ 1 // AVX512CD: #define __SSSE3__ 1 -// RUN: %clang -target i386-unknown-unknown -march=atom -mavx512er -x c -E -dM -o - %s | FileCheck -match-full-lines --check-prefix=AVX512ER %s - -// AVX512ER: #define __AVX2__ 1 -// AVX512ER: #define __AVX512ER__ 1 -// AVX512ER: #define __AVX512F__ 1 -// AVX512ER: #define __AVX__ 1 -// AVX512ER: #define __EVEX512__ 1 -// AVX512ER: #define __SSE2_MATH__ 1 -// AVX512ER: #define __SSE2__ 1 -// AVX512ER: #define __SSE3__ 1 -// AVX512ER: #define __SSE4_1__ 1 -// AVX512ER: #define __SSE4_2__ 1 -// AVX512ER: #define __SSE_MATH__ 1 -// AVX512ER: #define __SSE__ 1 -// AVX512ER: #define __SSSE3__ 1 - -// RUN: %clang -target i386-unknown-unknown -march=atom -mavx512pf -x c -E -dM -o - %s | FileCheck -match-full-lines --check-prefix=AVX512PF %s - -// AVX512PF: #define __AVX2__ 1 -// AVX512PF: #define __AVX512F__ 1 -// AVX512PF: #define __AVX512PF__ 1 -// AVX512PF: #define __AVX__ 1 -// AVX512PF: #define __EVEX512__ 1 -// AVX512PF: #define __SSE2_MATH__ 1 -// AVX512PF: #define __SSE2__ 1 -// AVX512PF: #define __SSE3__ 1 -// AVX512PF: #define __SSE4_1__ 1 -// AVX512PF: #define __SSE4_2__ 1 -// AVX512PF: #define __SSE_MATH__ 1 -// AVX512PF: #define __SSE__ 1 -// AVX512PF: #define __SSSE3__ 1 - // RUN: %clang -target i386-unknown-unknown -march=atom -mavx512dq -x c -E -dM -o - %s | FileCheck -match-full-lines --check-prefix=AVX512DQ %s // AVX512DQ: #define __AVX2__ 1 @@ -171,22 +139,6 @@ // AVX512VL: #define __SSE__ 1 // AVX512VL: #define __SSSE3__ 1 -// RUN: %clang -target i386-unknown-unknown -march=atom -mavx512pf -mno-avx512f -x c -E -dM -o - %s | FileCheck -match-full-lines --check-prefix=AVX512F2 %s - -// AVX512F2: #define __AVX2__ 1 -// AVX512F2-NOT: #define __AVX512F__ 1 -// AVX512F2-NOT: #define __AVX512PF__ 1 -// AVX512F2-NOT: #define __EVEX512__ 1 -// AVX512F2: #define __AVX__ 1 -// AVX512F2: #define __SSE2_MATH__ 1 -// AVX512F2: #define __SSE2__ 1 -// AVX512F2: #define __SSE3__ 1 -// AVX512F2: #define __SSE4_1__ 1 -// AVX512F2: #define __SSE4_2__ 1 -// AVX512F2: #define __SSE_MATH__ 1 -// AVX512F2: #define __SSE__ 1 -// AVX512F2: #define __SSSE3__ 1 - // RUN: %clang -target i386-unknown-unknown -march=atom -mavx512ifma -x c -E -dM -o - %s | FileCheck -match-full-lines --check-prefix=AVX512IFMA %s // AVX512IFMA: #define __AVX2__ 1 @@ -640,14 +592,12 @@ // RUN: %clang -target i386-unknown-unknown -march=atom -mavx512f -mno-avx512f -x c -E -dM -o - %s | FileCheck -match-full-lines --check-prefix=NOEVEX512 %s // RUN: %clang -target i386-unknown-unknown -march=atom -mavx512cd -mno-avx512f -x c -E -dM -o - %s | FileCheck -match-full-lines --check-prefix=NOEVEX512 %s -// RUN: %clang -target i386-unknown-unknown -march=atom -mavx512er -mno-avx512f -x c -E -dM -o - %s | FileCheck -match-full-lines --check-prefix=NOEVEX512 %s // NOEVEX512-NOT: #define __AVX512F__ 1 // NOEVEX512-NOT: #define __EVEX256__ 1 // NOEVEX512-NOT: #define __EVEX512__ 1 // RUN: %clang -target i386-unknown-unknown -march=atom -mavx512f -mno-evex512 -x c -E -dM -o - %s | FileCheck -match-full-lines --check-prefix=AVX512NOEVEX512 %s // RUN: %clang -target i386-unknown-unknown -march=atom -mavx512cd -mno-evex512 -x c -E -dM -o - %s | FileCheck -match-full-lines --check-prefix=AVX512NOEVEX512 %s -// RUN: %clang -target i386-unknown-unknown -march=atom -mavx512er -mno-evex512 -x c -E -dM -o - %s | FileCheck -match-full-lines --check-prefix=AVX512NOEVEX512 %s // AVX512NOEVEX512: #define __AVX512F__ 1 // AVX512NOEVEX512-NOT: #define __EVEX256__ 1 // AVX512NOEVEX512-NOT: #define __EVEX512__ 1 diff --git a/clang/test/Profile/misexpect-branch.c b/clang/test/Profile/misexpect-branch.c index ce46b46880611..5c4394405e178 100644 --- a/clang/test/Profile/misexpect-branch.c +++ b/clang/test/Profile/misexpect-branch.c @@ -26,10 +26,10 @@ int buzz(); const int inner_loop = 100; const int outer_loop = 2000; -int bar() { // imprecise-warning-re {{Potential performance regression from use of __builtin_expect(): Annotation was correct on {{.+}}% ({{[0-9]+ / [0-9]+}}) of profiled executions.}} +int bar() { // imprecise-warning-re {{potential performance regression from use of __builtin_expect(): annotation was correct on {{.+}}% ({{[0-9]+ / [0-9]+}}) of profiled executions}} int rando = buzz(); int x = 0; - if (likely(rando % (outer_loop * inner_loop) == 0)) { // exact-warning-re {{Potential performance regression from use of __builtin_expect(): Annotation was correct on {{.+}}% ({{[0-9]+ / [0-9]+}}) of profiled executions.}} + if (likely(rando % (outer_loop * inner_loop) == 0)) { // exact-warning-re {{potential performance regression from use of __builtin_expect(): annotation was correct on {{.+}}% ({{[0-9]+ / [0-9]+}}) of profiled executions}} x = baz(rando); } else { x = foo(50); @@ -37,10 +37,10 @@ int bar() { // imprecise-warning-re {{Potential performance regression from use return x; } -int fizz() { // imprecise-warning-re {{Potential performance regression from use of __builtin_expect(): Annotation was correct on {{.+}}% ({{[0-9]+ / [0-9]+}}) of profiled executions.}} +int fizz() { // imprecise-warning-re {{potential performance regression from use of __builtin_expect(): annotation was correct on {{.+}}% ({{[0-9]+ / [0-9]+}}) of profiled executions}} int rando = buzz(); int x = 0; - if (unlikely(rando % (outer_loop * inner_loop) == 0)) { // exact-warning-re {{Potential performance regression from use of __builtin_expect(): Annotation was correct on {{.+}}% ({{[0-9]+ / [0-9]+}}) of profiled executions.}} + if (unlikely(rando % (outer_loop * inner_loop) == 0)) { // exact-warning-re {{potential performance regression from use of __builtin_expect(): annotation was correct on {{.+}}% ({{[0-9]+ / [0-9]+}}) of profiled executions}} x = baz(rando); } else { x = foo(50); diff --git a/clang/test/Profile/misexpect-switch-default.c b/clang/test/Profile/misexpect-switch-default.c index 033490e558e6a..cd337b9430171 100644 --- a/clang/test/Profile/misexpect-switch-default.c +++ b/clang/test/Profile/misexpect-switch-default.c @@ -20,7 +20,7 @@ int main() { int j; for (j = 0; j < outer_loop * inner_loop; ++j) { unsigned condition = rand() % 5; - switch (__builtin_expect(condition, 6)) { // expected-warning-re {{Potential performance regression from use of __builtin_expect(): Annotation was correct on {{.+}}% ({{[0-9]+ / [0-9]+}}) of profiled executions.}} + switch (__builtin_expect(condition, 6)) { // expected-warning-re {{potential performance regression from use of __builtin_expect(): annotation was correct on {{.+}}% ({{[0-9]+ / [0-9]+}}) of profiled executions}} case 0: val += sum(arry, arry_size); break; diff --git a/clang/test/Profile/misexpect-switch.c b/clang/test/Profile/misexpect-switch.c index 8ca8a155c74a7..84a7174f635fd 100644 --- a/clang/test/Profile/misexpect-switch.c +++ b/clang/test/Profile/misexpect-switch.c @@ -20,7 +20,7 @@ int main() { for (j = 0; j < outer_loop; ++j) { for (k = 0; k < inner_loop; ++k) { unsigned condition = rand() % 10000; - switch (__builtin_expect(condition, 0)) { // expected-warning-re {{Potential performance regression from use of __builtin_expect(): Annotation was correct on {{.+}}% ({{[0-9]+ / [0-9]+}}) of profiled executions.}} + switch (__builtin_expect(condition, 0)) { // expected-warning-re {{potential performance regression from use of __builtin_expect(): annotation was correct on {{.+}}% ({{[0-9]+ / [0-9]+}}) of profiled executions}} case 0: val += sum(arry, arry_size); break; diff --git a/clang/test/Sema/atomic-ops.c b/clang/test/Sema/atomic-ops.c index 1d36667d6cf40..2024b81ce6aec 100644 --- a/clang/test/Sema/atomic-ops.c +++ b/clang/test/Sema/atomic-ops.c @@ -639,6 +639,38 @@ void memory_checks(_Atomic(int) *Ap, int *p, int val) { (void)__atomic_compare_exchange_n(p, p, val, 0, memory_order_seq_cst, -1); // expected-warning {{memory order argument to atomic operation is invalid}} } +struct Z { + char z[]; +}; + +void zeroSizeArgError(struct Z *a, struct Z *b, struct Z *c) { + __atomic_exchange(b, b, c, memory_order_relaxed); // expected-error {{address argument to atomic builtin must be a pointer to a non-zero-sized object}} + __atomic_exchange(b, b, c, memory_order_acq_rel); // expected-error {{address argument to atomic builtin must be a pointer to a non-zero-sized object}} + __atomic_exchange(b, b, c, memory_order_acquire); // expected-error {{address argument to atomic builtin must be a pointer to a non-zero-sized object}} + __atomic_exchange(b, b, c, memory_order_consume); // expected-error {{address argument to atomic builtin must be a pointer to a non-zero-sized object}} + __atomic_exchange(b, b, c, memory_order_release); // expected-error {{address argument to atomic builtin must be a pointer to a non-zero-sized object}} + __atomic_exchange(b, b, c, memory_order_seq_cst); // expected-error {{address argument to atomic builtin must be a pointer to a non-zero-sized object}} + __atomic_load(a, b, memory_order_relaxed); // expected-error {{address argument to atomic builtin must be a pointer to a non-zero-sized object}} + __atomic_load(a, b, memory_order_acq_rel); // expected-error {{address argument to atomic builtin must be a pointer to a non-zero-sized object}} + __atomic_load(a, b, memory_order_acquire); // expected-error {{address argument to atomic builtin must be a pointer to a non-zero-sized object}} + __atomic_load(a, b, memory_order_consume); // expected-error {{address argument to atomic builtin must be a pointer to a non-zero-sized object}} + __atomic_load(a, b, memory_order_release); // expected-error {{address argument to atomic builtin must be a pointer to a non-zero-sized object}} + __atomic_load(a, b, memory_order_seq_cst); // expected-error {{address argument to atomic builtin must be a pointer to a non-zero-sized object}} + __atomic_store(a, b, memory_order_relaxed); // expected-error {{address argument to atomic builtin must be a pointer to a non-zero-sized object}} + __atomic_store(a, b, memory_order_acq_rel); // expected-error {{address argument to atomic builtin must be a pointer to a non-zero-sized object}} + __atomic_store(a, b, memory_order_acquire); // expected-error {{address argument to atomic builtin must be a pointer to a non-zero-sized object}} + __atomic_store(a, b, memory_order_consume); // expected-error {{address argument to atomic builtin must be a pointer to a non-zero-sized object}} + __atomic_store(a, b, memory_order_release); // expected-error {{address argument to atomic builtin must be a pointer to a non-zero-sized object}} + __atomic_store(a, b, memory_order_seq_cst); // expected-error {{address argument to atomic builtin must be a pointer to a non-zero-sized object}} + __atomic_compare_exchange(a, b, c, 0, memory_order_relaxed, memory_order_relaxed); // expected-error {{address argument to atomic builtin must be a pointer to a non-zero-sized object}} + __atomic_compare_exchange(a, b, c, 0, memory_order_acq_rel, memory_order_acq_rel); // expected-error {{address argument to atomic builtin must be a pointer to a non-zero-sized object}} + __atomic_compare_exchange(a, b, c, 0, memory_order_acquire, memory_order_acquire); // expected-error {{address argument to atomic builtin must be a pointer to a non-zero-sized object}} + __atomic_compare_exchange(a, b, c, 0, memory_order_consume, memory_order_consume); // expected-error {{address argument to atomic builtin must be a pointer to a non-zero-sized object}} + __atomic_compare_exchange(a, b, c, 0, memory_order_release, memory_order_release); // expected-error {{address argument to atomic builtin must be a pointer to a non-zero-sized object}} + __atomic_compare_exchange(a, b, c, 0, memory_order_seq_cst, memory_order_seq_cst); // expected-error {{address argument to atomic builtin must be a pointer to a non-zero-sized object}} + +} + void nullPointerWarning(void) { volatile _Atomic(int) vai; _Atomic(int) ai; diff --git a/clang/test/Sema/attr-counted-by-late-parsed-off.c b/clang/test/Sema/attr-counted-by-late-parsed-off.c new file mode 100644 index 0000000000000..34f51d10c0838 --- /dev/null +++ b/clang/test/Sema/attr-counted-by-late-parsed-off.c @@ -0,0 +1,26 @@ +// RUN: %clang_cc1 -DNEEDS_LATE_PARSING -fno-experimental-late-parse-attributes -fsyntax-only -verify %s +// RUN: %clang_cc1 -DNEEDS_LATE_PARSING -fsyntax-only -verify %s + +// RUN: %clang_cc1 -UNEEDS_LATE_PARSING -fno-experimental-late-parse-attributes -fsyntax-only -verify=ok %s +// RUN: %clang_cc1 -UNEEDS_LATE_PARSING -fsyntax-only -verify=ok %s + +#define __counted_by(f) __attribute__((counted_by(f))) + +struct size_known { int dummy; }; + +#ifdef NEEDS_LATE_PARSING +struct on_decl { + // expected-error@+1{{use of undeclared identifier 'count'}} + struct size_known *buf __counted_by(count); + int count; +}; + +#else + +// ok-no-diagnostics +struct on_decl { + int count; + struct size_known *buf __counted_by(count); +}; + +#endif diff --git a/clang/test/Sema/attr-counted-by-late-parsed-struct-ptrs.c b/clang/test/Sema/attr-counted-by-late-parsed-struct-ptrs.c new file mode 100644 index 0000000000000..9ff3b080f6576 --- /dev/null +++ b/clang/test/Sema/attr-counted-by-late-parsed-struct-ptrs.c @@ -0,0 +1,254 @@ +// RUN: %clang_cc1 -fexperimental-late-parse-attributes -fsyntax-only -verify %s + +#define __counted_by(f) __attribute__((counted_by(f))) + +struct size_unknown; +struct size_known { + int field; +}; + +typedef void(*fn_ptr_ty)(void); + +//============================================================================== +// __counted_by on struct member pointer in decl attribute position +//============================================================================== + +struct on_member_pointer_complete_ty { + struct size_known * buf __counted_by(count); + int count; +}; + +struct on_member_pointer_incomplete_ty { + struct size_unknown * buf __counted_by(count); // expected-error{{'counted_by' cannot be applied to a pointer with pointee of unknown size because 'struct size_unknown' is an incomplete type}} + int count; +}; + +struct on_member_pointer_const_incomplete_ty { + // expected-error@+1{{'counted_by' cannot be applied to a pointer with pointee of unknown size because 'const struct size_unknown' is an incomplete type}} + const struct size_unknown * buf __counted_by(count); + int count; +}; + +struct on_member_pointer_void_ty { + void* buf __counted_by(count); // expected-error{{'counted_by' cannot be applied to a pointer with pointee of unknown size because 'void' is an incomplete type}} + int count; +}; + +struct on_member_pointer_fn_ptr_ty { + // buffer of `count` function pointers is allowed + void (**fn_ptr)(void) __counted_by(count); + int count; +}; + + +struct on_member_pointer_fn_ptr_ty_ptr_ty { + // buffer of `count` function pointers is allowed + fn_ptr_ty* fn_ptr __counted_by(count); + int count; +}; + +struct on_member_pointer_fn_ty { + // buffer of `count` functions is not allowed + // expected-error@+1{{'counted_by' cannot be applied to a pointer with pointee of unknown size because 'void (void)' is a function type}} + void (*fn_ptr)(void) __counted_by(count); + int count; +}; + +struct on_member_pointer_fn_ptr_ty_ty { + // buffer of `count` functions is not allowed + // expected-error@+1{{'counted_by' cannot be applied to a pointer with pointee of unknown size because 'void (void)' is a function type}} + fn_ptr_ty fn_ptr __counted_by(count); + int count; +}; + +struct has_unannotated_vla { + int count; + int buffer[]; +}; + +struct on_member_pointer_struct_with_vla { + // expected-error@+1{{'counted_by' cannot be applied to a pointer with pointee of unknown size because 'struct has_unannotated_vla' is a struct type with a flexible array member}} + struct has_unannotated_vla* objects __counted_by(count); + int count; +}; + +struct has_annotated_vla { + int count; + int buffer[] __counted_by(count); +}; + +// Currently prevented because computing the size of `objects` at runtime would +// require an O(N) walk of `objects` to take into account the length of the VLA +// in each struct instance. +struct on_member_pointer_struct_with_annotated_vla { + // expected-error@+1{{'counted_by' cannot be applied to a pointer with pointee of unknown size because 'struct has_annotated_vla' is a struct type with a flexible array member}} + struct has_annotated_vla* objects __counted_by(count); + int count; +}; + +struct on_pointer_anon_buf { + // TODO: Support referring to parent scope + struct { + // expected-error@+1{{use of undeclared identifier 'count'}} + struct size_known *buf __counted_by(count); + }; + int count; +}; + +struct on_pointer_anon_count { + struct size_known *buf __counted_by(count); + struct { + int count; + }; +}; + +//============================================================================== +// __counted_by on struct member pointer in type attribute position +//============================================================================== +// TODO: Correctly parse counted_by as a type attribute. Currently it is parsed +// as a declaration attribute and is **not** late parsed resulting in the `count` +// field being unavailable. + +struct on_member_pointer_complete_ty_ty_pos { + // TODO: Allow this + // expected-error@+1{{use of undeclared identifier 'count'}} + struct size_known *__counted_by(count) buf; + int count; +}; + +struct on_member_pointer_incomplete_ty_ty_pos { + // TODO: Allow this + // expected-error@+1{{use of undeclared identifier 'count'}} + struct size_unknown * __counted_by(count) buf; + int count; +}; + +struct on_member_pointer_const_incomplete_ty_ty_pos { + // TODO: Allow this + // expected-error@+1{{use of undeclared identifier 'count'}} + const struct size_unknown * __counted_by(count) buf; + int count; +}; + +struct on_member_pointer_void_ty_ty_pos { + // TODO: This should fail because the attribute is + // on a pointer with the pointee being an incomplete type. + // expected-error@+1{{use of undeclared identifier 'count'}} + void *__counted_by(count) buf; + int count; +}; + +// - + +struct on_member_pointer_fn_ptr_ty_pos { + // TODO: buffer of `count` function pointers should be allowed + // but fails because this isn't late parsed. + // expected-error@+1{{use of undeclared identifier 'count'}} + void (** __counted_by(count) fn_ptr)(void); + int count; +}; + +struct on_member_pointer_fn_ptr_ty_ptr_ty_pos { + // TODO: buffer of `count` function pointers should be allowed + // but fails because this isn't late parsed. + // expected-error@+1{{use of undeclared identifier 'count'}} + fn_ptr_ty* __counted_by(count) fn_ptr; + int count; +}; + +struct on_member_pointer_fn_ty_ty_pos { + // TODO: This should fail because the attribute is + // on a pointer with the pointee being a function type. + // expected-error@+1{{use of undeclared identifier 'count'}} + void (* __counted_by(count) fn_ptr)(void); + int count; +}; + +struct on_member_pointer_fn_ptr_ty_ty_pos { + // TODO: buffer of `count` function pointers should be allowed + // expected-error@+1{{use of undeclared identifier 'count'}} + void (** __counted_by(count) fn_ptr)(void); + int count; +}; + +struct on_member_pointer_fn_ptr_ty_typedef_ty_pos { + // TODO: This should fail because the attribute is + // on a pointer with the pointee being a function type. + // expected-error@+1{{use of undeclared identifier 'count'}} + fn_ptr_ty __counted_by(count) fn_ptr; + int count; +}; + +struct on_member_pointer_fn_ptr_ty_ty_pos_inner { + // TODO: This should fail because the attribute is + // on a pointer with the pointee being a function type. + // expected-error@+1{{use of undeclared identifier 'count'}} + void (* __counted_by(count) * fn_ptr)(void); + int count; +}; + +struct on_member_pointer_struct_with_vla_ty_pos { + // TODO: This should fail because the attribute is + // on a pointer with the pointee being a struct type with a VLA. + // expected-error@+1{{use of undeclared identifier 'count'}} + struct has_unannotated_vla *__counted_by(count) objects; + int count; +}; + +struct on_member_pointer_struct_with_annotated_vla_ty_pos { + // TODO: This should fail because the attribute is + // on a pointer with the pointee being a struct type with a VLA. + // expected-error@+1{{use of undeclared identifier 'count'}} + struct has_annotated_vla* __counted_by(count) objects; + int count; +}; + +struct on_nested_pointer_inner { + // TODO: This should be disallowed because in the `-fbounds-safety` model + // `__counted_by` can only be nested when used in function parameters. + // expected-error@+1{{use of undeclared identifier 'count'}} + struct size_known *__counted_by(count) *buf; + int count; +}; + +struct on_nested_pointer_outer { + // TODO: Allow this + // expected-error@+1{{use of undeclared identifier 'count'}} + struct size_known **__counted_by(count) buf; + int count; +}; + +struct on_pointer_anon_buf_ty_pos { + struct { + // TODO: Support referring to parent scope + // expected-error@+1{{use of undeclared identifier 'count'}} + struct size_known * __counted_by(count) buf; + }; + int count; +}; + +struct on_pointer_anon_count_ty_pos { + // TODO: Allow this + // expected-error@+1{{use of undeclared identifier 'count'}} + struct size_known *__counted_by(count) buf; + struct { + int count; + }; +}; + +//============================================================================== +// __counted_by on struct non-pointer members +//============================================================================== + +struct on_pod_ty { + // expected-error@+1{{'counted_by' only applies to pointers or C99 flexible array members}} + int wrong_ty __counted_by(count); + int count; +}; + +struct on_void_ty { + // expected-error@+2{{'counted_by' only applies to pointers or C99 flexible array members}} + // expected-error@+1{{field has incomplete type 'void'}} + void wrong_ty __counted_by(count); + int count; +}; diff --git a/clang/test/Sema/attr-counted-by-struct-ptrs-sizeless-types.c b/clang/test/Sema/attr-counted-by-struct-ptrs-sizeless-types.c new file mode 100644 index 0000000000000..9b0f2eafb13c2 --- /dev/null +++ b/clang/test/Sema/attr-counted-by-struct-ptrs-sizeless-types.c @@ -0,0 +1,17 @@ +// __SVInt8_t is specific to ARM64 so specify that in the target triple +// RUN: %clang_cc1 -triple arm64-apple-darwin -fsyntax-only -verify %s + +#define __counted_by(f) __attribute__((counted_by(f))) + +struct on_sizeless_pointee_ty { + int count; + // expected-error@+1{{'counted_by' cannot be applied to a pointer with pointee of unknown size because '__SVInt8_t' is a sizeless type}} + __SVInt8_t* member __counted_by(count); +}; + +struct on_sizeless_ty { + int count; + // expected-error@+2{{'counted_by' only applies to pointers or C99 flexible array members}} + // expected-error@+1{{field has sizeless type '__SVInt8_t'}} + __SVInt8_t member __counted_by(count); +}; diff --git a/clang/test/Sema/attr-counted-by-struct-ptrs.c b/clang/test/Sema/attr-counted-by-struct-ptrs.c new file mode 100644 index 0000000000000..cd2bfe36938b2 --- /dev/null +++ b/clang/test/Sema/attr-counted-by-struct-ptrs.c @@ -0,0 +1,224 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s + +#define __counted_by(f) __attribute__((counted_by(f))) + +struct size_unknown; +struct size_known { + int field; +}; + +typedef void(*fn_ptr_ty)(void); + +//============================================================================== +// __counted_by on struct member pointer in decl attribute position +//============================================================================== + +struct on_member_pointer_complete_ty { + int count; + struct size_known * buf __counted_by(count); +}; + +struct on_member_pointer_incomplete_ty { + int count; + // expected-error@+1{{'counted_by' cannot be applied to a pointer with pointee of unknown size because 'struct size_unknown' is an incomplete type}} + struct size_unknown * buf __counted_by(count); +}; + +struct on_member_pointer_const_incomplete_ty { + int count; + // expected-error@+1{{'counted_by' cannot be applied to a pointer with pointee of unknown size because 'const struct size_unknown' is an incomplete type}} + const struct size_unknown * buf __counted_by(count); +}; + +struct on_member_pointer_void_ty { + int count; + // expected-error@+1{{'counted_by' cannot be applied to a pointer with pointee of unknown size because 'void' is an incomplete type}} + void* buf __counted_by(count); +}; + +struct on_member_pointer_fn_ptr_ty { + int count; + // buffer of `count` function pointers is allowed + void (**fn_ptr)(void) __counted_by(count); +}; + +struct on_member_pointer_fn_ptr_ty_ptr_ty { + int count; + // buffer of `count` function pointers is allowed + fn_ptr_ty* fn_ptr __counted_by(count); +}; + +struct on_member_pointer_fn_ty { + int count; + // buffer of `count` functions is not allowed + // expected-error@+1{{'counted_by' cannot be applied to a pointer with pointee of unknown size because 'void (void)' is a function type}} + void (*fn_ptr)(void) __counted_by(count); +}; + +struct on_member_pointer_fn_ptr_ty_ty { + int count; + // buffer of `count` functions is not allowed + // expected-error@+1{{'counted_by' cannot be applied to a pointer with pointee of unknown size because 'void (void)' is a function type}} + fn_ptr_ty fn_ptr __counted_by(count); +}; + +struct has_unannotated_vla { + int count; + int buffer[]; +}; + +struct on_member_pointer_struct_with_vla { + int count; + // expected-error@+1{{'counted_by' cannot be applied to a pointer with pointee of unknown size because 'struct has_unannotated_vla' is a struct type with a flexible array member}} + struct has_unannotated_vla* objects __counted_by(count); +}; + +struct has_annotated_vla { + int count; + int buffer[] __counted_by(count); +}; + +// Currently prevented because computing the size of `objects` at runtime would +// require an O(N) walk of `objects` to take into account the length of the VLA +// in each struct instance. +struct on_member_pointer_struct_with_annotated_vla { + int count; + // expected-error@+1{{'counted_by' cannot be applied to a pointer with pointee of unknown size because 'struct has_annotated_vla' is a struct type with a flexible array member}} + struct has_annotated_vla* objects __counted_by(count); +}; + +struct on_pointer_anon_buf { + int count; + struct { + struct size_known *buf __counted_by(count); + }; +}; + +struct on_pointer_anon_count { + struct { + int count; + }; + struct size_known *buf __counted_by(count); +}; + +//============================================================================== +// __counted_by on struct member pointer in type attribute position +//============================================================================== +// TODO: Correctly parse counted_by as a type attribute. Currently it is parsed +// as a declaration attribute + +struct on_member_pointer_complete_ty_ty_pos { + int count; + struct size_known *__counted_by(count) buf; +}; + +struct on_member_pointer_incomplete_ty_ty_pos { + int count; + // expected-error@+1{{'counted_by' cannot be applied to a pointer with pointee of unknown size because 'struct size_unknown' is an incomplete type}} + struct size_unknown * __counted_by(count) buf; +}; + +struct on_member_pointer_const_incomplete_ty_ty_pos { + int count; + // expected-error@+1{{'counted_by' cannot be applied to a pointer with pointee of unknown size because 'const struct size_unknown' is an incomplete type}} + const struct size_unknown * __counted_by(count) buf; +}; + +struct on_member_pointer_void_ty_ty_pos { + int count; + // expected-error@+1{{'counted_by' cannot be applied to a pointer with pointee of unknown size because 'void' is an incomplete type}} + void *__counted_by(count) buf; +}; + +// - + +struct on_member_pointer_fn_ptr_ty_pos { + int count; + // buffer of `count` function pointers is allowed + void (** __counted_by(count) fn_ptr)(void); +}; + +struct on_member_pointer_fn_ptr_ty_ptr_ty_pos { + int count; + // buffer of `count` function pointers is allowed + fn_ptr_ty* __counted_by(count) fn_ptr; +}; + +struct on_member_pointer_fn_ty_ty_pos { + int count; + // buffer of `count` functions is not allowed + // expected-error@+1{{'counted_by' cannot be applied to a pointer with pointee of unknown size because 'void (void)' is a function type}} + void (* __counted_by(count) fn_ptr)(void); +}; + +struct on_member_pointer_fn_ptr_ty_ty_pos { + int count; + // buffer of `count` functions is not allowed + // expected-error@+1{{'counted_by' cannot be applied to a pointer with pointee of unknown size because 'void (void)' is a function type}} + fn_ptr_ty __counted_by(count) fn_ptr; +}; + +// TODO: This should be forbidden but isn't due to counted_by being treated +// as a declaration attribute. +struct on_member_pointer_fn_ptr_ty_ty_pos_inner { + int count; + void (* __counted_by(count) * fn_ptr)(void); +}; + +struct on_member_pointer_struct_with_vla_ty_pos { + int count; + // expected-error@+1{{'counted_by' cannot be applied to a pointer with pointee of unknown size because 'struct has_unannotated_vla' is a struct type with a flexible array member}} + struct has_unannotated_vla *__counted_by(count) objects; +}; + +// Currently prevented because computing the size of `objects` at runtime would +// require an O(N) walk of `objects` to take into account the length of the VLA +// in each struct instance. +struct on_member_pointer_struct_with_annotated_vla_ty_pos { + int count; + // expected-error@+1{{counted_by' cannot be applied to a pointer with pointee of unknown size because 'struct has_annotated_vla' is a struct type with a flexible array member}} + struct has_annotated_vla* __counted_by(count) objects; +}; + +struct on_nested_pointer_inner { + // TODO: This should be disallowed because in the `-fbounds-safety` model + // `__counted_by` can only be nested when used in function parameters. + int count; + struct size_known *__counted_by(count) *buf; +}; + +struct on_nested_pointer_outer { + int count; + struct size_known **__counted_by(count) buf; +}; + +struct on_pointer_anon_buf_ty_pos { + int count; + struct { + struct size_known * __counted_by(count) buf; + }; +}; + +struct on_pointer_anon_count_ty_pos { + struct { + int count; + }; + struct size_known *__counted_by(count) buf; +}; + +//============================================================================== +// __counted_by on struct non-pointer members +//============================================================================== + +struct on_pod_ty { + int count; + // expected-error@+1{{'counted_by' only applies to pointers or C99 flexible array members}} + int wrong_ty __counted_by(count); +}; + +struct on_void_ty { + int count; + // expected-error@+2{{'counted_by' only applies to pointers or C99 flexible array members}} + // expected-error@+1{{field has incomplete type 'void'}} + void wrong_ty __counted_by(count); +}; diff --git a/clang/test/Sema/attr-counted-by-vla-sizeless-types.c b/clang/test/Sema/attr-counted-by-vla-sizeless-types.c new file mode 100644 index 0000000000000..31c0007501c48 --- /dev/null +++ b/clang/test/Sema/attr-counted-by-vla-sizeless-types.c @@ -0,0 +1,11 @@ +// __SVInt8_t is specific to ARM64 so specify that in the target triple +// RUN: %clang_cc1 -triple arm64-apple-darwin -fsyntax-only -verify %s + +#define __counted_by(f) __attribute__((counted_by(f))) + +struct on_sizeless_elt_ty { + int count; + // expected-error@+2{{'counted_by' only applies to pointers or C99 flexible array members}} + // expected-error@+1{{array has sizeless element type '__SVInt8_t'}} + __SVInt8_t arr[] __counted_by(count); +}; diff --git a/clang/test/Sema/attr-counted-by-vla.c b/clang/test/Sema/attr-counted-by-vla.c new file mode 100644 index 0000000000000..b25f719f3b95a --- /dev/null +++ b/clang/test/Sema/attr-counted-by-vla.c @@ -0,0 +1,196 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s + +#define __counted_by(f) __attribute__((counted_by(f))) + +struct bar; + +struct not_found { + int count; + struct bar *fam[] __counted_by(bork); // expected-error {{use of undeclared identifier 'bork'}} +}; + +struct no_found_count_not_in_substruct { + unsigned long flags; + unsigned char count; // expected-note {{'count' declared here}} + struct A { + int dummy; + int array[] __counted_by(count); // expected-error {{'counted_by' field 'count' isn't within the same struct as the flexible array}} + } a; +}; + +struct not_found_count_not_in_unnamed_substruct { + unsigned char count; // expected-note {{'count' declared here}} + struct { + int dummy; + int array[] __counted_by(count); // expected-error {{'counted_by' field 'count' isn't within the same struct as the flexible array}} + } a; +}; + +struct not_found_count_not_in_unnamed_substruct_2 { + struct { + unsigned char count; // expected-note {{'count' declared here}} + }; + struct { + int dummy; + int array[] __counted_by(count); // expected-error {{'counted_by' field 'count' isn't within the same struct as the flexible array}} + } a; +}; + +struct not_found_count_in_other_unnamed_substruct { + struct { + unsigned char count; + } a1; + + struct { + int dummy; + int array[] __counted_by(count); // expected-error {{use of undeclared identifier 'count'}} + }; +}; + +struct not_found_count_in_other_substruct { + struct _a1 { + unsigned char count; + } a1; + + struct { + int dummy; + int array[] __counted_by(count); // expected-error {{use of undeclared identifier 'count'}} + }; +}; + +struct not_found_count_in_other_substruct_2 { + struct _a2 { + unsigned char count; + } a2; + + int array[] __counted_by(count); // expected-error {{use of undeclared identifier 'count'}} +}; + +struct not_found_suggest { + int bork; + struct bar *fam[] __counted_by(blork); // expected-error {{use of undeclared identifier 'blork'}} +}; + +int global; // expected-note {{'global' declared here}} + +struct found_outside_of_struct { + int bork; + struct bar *fam[] __counted_by(global); // expected-error {{field 'global' in 'counted_by' not inside structure}} +}; + +struct self_referrential { + int bork; + struct bar *self[] __counted_by(self); // expected-error {{use of undeclared identifier 'self'}} +}; + +struct non_int_count { + double dbl_count; + struct bar *fam[] __counted_by(dbl_count); // expected-error {{'counted_by' requires a non-boolean integer type argument}} +}; + +struct array_of_ints_count { + int integers[2]; + struct bar *fam[] __counted_by(integers); // expected-error {{'counted_by' requires a non-boolean integer type argument}} +}; + +struct not_a_fam { + int count; + // expected-error@+1{{'counted_by' cannot be applied to a pointer with pointee of unknown size because 'struct bar' is an incomplete type}} + struct bar *non_fam __counted_by(count); +}; + +struct not_a_c99_fam { + int count; + struct bar *non_c99_fam[0] __counted_by(count); // expected-error {{'counted_by' on arrays only applies to C99 flexible array members}} +}; + +struct annotated_with_anon_struct { + unsigned long flags; + struct { + unsigned char count; + int array[] __counted_by(crount); // expected-error {{use of undeclared identifier 'crount'}} + }; +}; + +//============================================================================== +// __counted_by on a struct VLA with element type that has unknown size +//============================================================================== + +struct size_unknown; // expected-note 2{{forward declaration of 'struct size_unknown'}} +struct on_member_arr_incomplete_ty_ty_pos { + int count; + // expected-error@+2{{'counted_by' only applies to pointers or C99 flexible array members}} + // expected-error@+1{{array has incomplete element type 'struct size_unknown'}} + struct size_unknown buf[] __counted_by(count); +}; + +struct on_member_arr_incomplete_const_ty_ty_pos { + int count; + // expected-error@+2{{'counted_by' only applies to pointers or C99 flexible array members}} + // expected-error@+1{{array has incomplete element type 'const struct size_unknown'}} + const struct size_unknown buf[] __counted_by(count); +}; + +struct on_member_arr_void_ty_ty_pos { + int count; + // expected-error@+2{{'counted_by' only applies to pointers or C99 flexible array members}} + // expected-error@+1{{array has incomplete element type 'void'}} + void buf[] __counted_by(count); +}; + +typedef void(fn_ty)(int); + +struct on_member_arr_fn_ptr_ty { + int count; + // An Array of function pointers is allowed + fn_ty* buf[] __counted_by(count); +}; + +struct on_member_arr_fn_ty { + int count; + // An array of functions is not allowed. + // expected-error@+2{{'counted_by' only applies to pointers or C99 flexible array members}} + // expected-error@+1{{'buf' declared as array of functions of type 'fn_ty' (aka 'void (int)')}} + fn_ty buf[] __counted_by(count); +}; + + +// `buffer_of_structs_with_unnannotated_vla`, +// `buffer_of_structs_with_annotated_vla`, and +// `buffer_of_const_structs_with_annotated_vla` are currently prevented because +// computing the size of `Arr` at runtime would require an O(N) walk of `Arr` +// elements to take into account the length of the VLA in each struct instance. + +struct has_unannotated_VLA { + int count; + char buffer[]; +}; + +struct has_annotated_VLA { + int count; + char buffer[] __counted_by(count); +}; + +struct buffer_of_structs_with_unnannotated_vla { + int count; + // Treating this as a warning is a temporary fix for existing attribute adopters. It **SHOULD BE AN ERROR**. + // expected-warning@+1{{'counted_by' should not be applied to an array with element of unknown size because 'struct has_unannotated_VLA' is a struct type with a flexible array member. This will be an error in a future compiler version}} + struct has_unannotated_VLA Arr[] __counted_by(count); +}; + + +struct buffer_of_structs_with_annotated_vla { + int count; + // Treating this as a warning is a temporary fix for existing attribute adopters. It **SHOULD BE AN ERROR**. + // expected-warning@+1{{'counted_by' should not be applied to an array with element of unknown size because 'struct has_annotated_VLA' is a struct type with a flexible array member. This will be an error in a future compiler version}} + struct has_annotated_VLA Arr[] __counted_by(count); +}; + +struct buffer_of_const_structs_with_annotated_vla { + int count; + // Treating this as a warning is a temporary fix for existing attribute adopters. It **SHOULD BE AN ERROR**. + // Make sure the `const` qualifier is printed when printing the element type. + // expected-warning@+1{{'counted_by' should not be applied to an array with element of unknown size because 'const struct has_annotated_VLA' is a struct type with a flexible array member. This will be an error in a future compiler version}} + const struct has_annotated_VLA Arr[] __counted_by(count); +}; + diff --git a/clang/test/Sema/attr-counted-by.c b/clang/test/Sema/attr-counted-by.c deleted file mode 100644 index d5d4ebf557392..0000000000000 --- a/clang/test/Sema/attr-counted-by.c +++ /dev/null @@ -1,112 +0,0 @@ -// RUN: %clang_cc1 -fsyntax-only -verify %s - -#define __counted_by(f) __attribute__((counted_by(f))) - -struct bar; - -struct not_found { - int count; - struct bar *fam[] __counted_by(bork); // expected-error {{use of undeclared identifier 'bork'}} -}; - -struct no_found_count_not_in_substruct { - unsigned long flags; - unsigned char count; // expected-note {{'count' declared here}} - struct A { - int dummy; - int array[] __counted_by(count); // expected-error {{'counted_by' field 'count' isn't within the same struct as the flexible array}} - } a; -}; - -struct not_found_count_not_in_unnamed_substruct { - unsigned char count; // expected-note {{'count' declared here}} - struct { - int dummy; - int array[] __counted_by(count); // expected-error {{'counted_by' field 'count' isn't within the same struct as the flexible array}} - } a; -}; - -struct not_found_count_not_in_unnamed_substruct_2 { - struct { - unsigned char count; // expected-note {{'count' declared here}} - }; - struct { - int dummy; - int array[] __counted_by(count); // expected-error {{'counted_by' field 'count' isn't within the same struct as the flexible array}} - } a; -}; - -struct not_found_count_in_other_unnamed_substruct { - struct { - unsigned char count; - } a1; - - struct { - int dummy; - int array[] __counted_by(count); // expected-error {{use of undeclared identifier 'count'}} - }; -}; - -struct not_found_count_in_other_substruct { - struct _a1 { - unsigned char count; - } a1; - - struct { - int dummy; - int array[] __counted_by(count); // expected-error {{use of undeclared identifier 'count'}} - }; -}; - -struct not_found_count_in_other_substruct_2 { - struct _a2 { - unsigned char count; - } a2; - - int array[] __counted_by(count); // expected-error {{use of undeclared identifier 'count'}} -}; - -struct not_found_suggest { - int bork; - struct bar *fam[] __counted_by(blork); // expected-error {{use of undeclared identifier 'blork'}} -}; - -int global; // expected-note {{'global' declared here}} - -struct found_outside_of_struct { - int bork; - struct bar *fam[] __counted_by(global); // expected-error {{field 'global' in 'counted_by' not inside structure}} -}; - -struct self_referrential { - int bork; - struct bar *self[] __counted_by(self); // expected-error {{use of undeclared identifier 'self'}} -}; - -struct non_int_count { - double dbl_count; - struct bar *fam[] __counted_by(dbl_count); // expected-error {{'counted_by' requires a non-boolean integer type argument}} -}; - -struct array_of_ints_count { - int integers[2]; - struct bar *fam[] __counted_by(integers); // expected-error {{'counted_by' requires a non-boolean integer type argument}} -}; - -struct not_a_fam { - int count; - struct bar *non_fam __counted_by(count); // expected-error {{'counted_by' only applies to C99 flexible array members}} -}; - -struct not_a_c99_fam { - int count; - struct bar *non_c99_fam[0] __counted_by(count); // expected-error {{'counted_by' only applies to C99 flexible array members}} -}; - -struct annotated_with_anon_struct { - unsigned long flags; - struct { - unsigned char count; - int array[] __counted_by(crount); // expected-error {{use of undeclared identifier 'crount'}} - }; -}; diff --git a/clang/test/Sema/attr-noinline.cpp b/clang/test/Sema/attr-noinline.cpp index bd6505b9fe98e..6da0e873af1b6 100644 --- a/clang/test/Sema/attr-noinline.cpp +++ b/clang/test/Sema/attr-noinline.cpp @@ -2,9 +2,9 @@ int bar(); -// expected-note@+1{{conflicting attribute is here}} +// expected-note@+1 2 {{conflicting attribute is here}} [[gnu::always_inline]] void always_inline_fn(void) { } -// expected-note@+1{{conflicting attribute is here}} +// expected-note@+1 2 {{conflicting attribute is here}} [[gnu::flatten]] void flatten_fn(void) { } [[gnu::noinline]] void noinline_fn(void) { } @@ -25,7 +25,21 @@ void foo() { __attribute__((noinline)) bar(); // expected-warning {{attribute is ignored on this statement as it only applies to functions; use '[[clang::noinline]]' on statements}} } +void ms_noi_check() { + [[msvc::noinline]] bar(); + [[msvc::noinline(0)]] bar(); // expected-error {{'noinline' attribute takes no arguments}} + int x; + [[msvc::noinline]] x = 0; // expected-warning {{'noinline' attribute is ignored because there exists no call expression inside the statement}} + [[msvc::noinline]] { asm("nop"); } // expected-warning {{'noinline' attribute is ignored because there exists no call expression inside the statement}} + [[msvc::noinline]] label: x = 1; // expected-warning {{'noinline' attribute only applies to functions and statements}} + + [[msvc::noinline]] always_inline_fn(); // expected-warning {{statement attribute 'noinline' has higher precedence than function attribute 'always_inline'}} + [[msvc::noinline]] flatten_fn(); // expected-warning {{statement attribute 'noinline' has higher precedence than function attribute 'flatten'}} + [[msvc::noinline]] noinline_fn(); +} + [[clang::noinline]] static int i = bar(); // expected-warning {{'noinline' attribute only applies to functions and statements}} +[[msvc::noinline]] static int j = bar(); // expected-warning {{'noinline' attribute only applies to functions and statements}} // This used to crash the compiler. template @@ -69,7 +83,39 @@ int variadic_baz(int x) { [[clang::noinline]] return non_dependent(x) + (dependent(x) + ...); } +template [[clang::always_inline]] +int qux(int x) { // #QUX + // expected-warning@+2{{statement attribute 'noinline' has higher precedence than function attribute 'always_inline'}} + // expected-note@#NO_DEP{{conflicting attribute is here}} + [[msvc::noinline]] non_dependent(x); + if constexpr (D>0) { + // expected-warning@+6{{statement attribute 'noinline' has higher precedence than function attribute 'always_inline'}} + // expected-note@#NO_DEP{{conflicting attribute is here}} + // expected-warning@+4 3{{statement attribute 'noinline' has higher precedence than function attribute 'always_inline'}} + // expected-note@#QUX 3{{conflicting attribute is here}} + // expected-note@#QUX_INST 3{{in instantiation}} + // expected-note@+1 3{{in instantiation}} + [[msvc::noinline]] return non_dependent(x), qux(x + 1); + } + return x; +} + +// We can't suppress if there is a variadic involved. +template +int variadic_qux(int x) { + // Diagnoses NO_DEP 2x, once during phase 1, the second during instantiation. + // Dianoses DEP 3x, once per variadic expansion. + // expected-warning@+5 2{{statement attribute 'noinline' has higher precedence than function attribute 'always_inline'}} + // expected-note@#NO_DEP 2{{conflicting attribute is here}} + // expected-warning@+3 3{{statement attribute 'noinline' has higher precedence than function attribute 'always_inline'}} + // expected-note@#DEP 3{{conflicting attribute is here}} + // expected-note@#QUX_VARIADIC_INST{{in instantiation}} + [[msvc::noinline]] return non_dependent(x) + (dependent(x) + ...); +} + void use() { baz<3>(0); // #BAZ_INST variadic_baz<0, 1, 2>(0); // #VARIADIC_INST + qux<3>(0); // #QUX_INST + variadic_qux<0, 1, 2>(0); // #QUX_VARIADIC_INST } diff --git a/clang/test/Sema/attr-objc-bridge-related.m b/clang/test/Sema/attr-objc-bridge-related.m index 7b2e3e5df3fe5..6c7fb2588dbc9 100644 --- a/clang/test/Sema/attr-objc-bridge-related.m +++ b/clang/test/Sema/attr-objc-bridge-related.m @@ -3,5 +3,5 @@ struct [[clang::objc_bridge_related(NSParagraphStyle,,)]] TestBridgedRef; struct [[clang::objc_bridge_related(NSColor,colorWithCGColor:,CGColor)]] CGColorRefOk; -struct [[clang::objc_bridge_related(,colorWithCGColor:,CGColor)]] CGColorRef1NotOk; // expected-error {{expected a related ObjectiveC class name, e.g., 'NSColor'}} +struct [[clang::objc_bridge_related(,colorWithCGColor:,CGColor)]] CGColorRef1NotOk; // expected-error {{expected a related Objective-C class name, e.g., 'NSColor'}} struct [[clang::objc_bridge_related(NSColor,colorWithCGColor::,CGColor)]] CGColorRef3NotOk; // expected-error {{expected a class method selector with single argument, e.g., 'colorWithCGColor:'}} diff --git a/clang/test/Sema/builtin-assume.c b/clang/test/Sema/builtin-assume.c index 932fb5c973eb0..21d62d8fd06c1 100644 --- a/clang/test/Sema/builtin-assume.c +++ b/clang/test/Sema/builtin-assume.c @@ -8,20 +8,20 @@ int ispure(int) __attribute__((pure)); int foo(int *a, int i) { #ifdef _MSC_VER __assume(i != 4); - __assume(++i > 2); //expected-warning {{the argument to '__assume' has side effects that will be discarded}} - __assume(nonconst() > 2); //expected-warning {{the argument to '__assume' has side effects that will be discarded}} + __assume(++i > 2); //expected-warning {{assumption is ignored because it contains (potential) side-effects}} + __assume(nonconst() > 2); //expected-warning {{assumption is ignored because it contains (potential) side-effects}} __assume(isconst() > 2); __assume(ispure(i) > 2); - __assume(ispure(++i) > 2); //expected-warning {{the argument to '__assume' has side effects that will be discarded}} + __assume(ispure(++i) > 2); //expected-warning {{assumption is ignored because it contains (potential) side-effects}} int test = sizeof(struct{char qq[(__assume(i != 5), 7)];}); #else __builtin_assume(i != 4); - __builtin_assume(++i > 2); //expected-warning {{the argument to '__builtin_assume' has side effects that will be discarded}} - __builtin_assume(nonconst() > 2); //expected-warning {{the argument to '__builtin_assume' has side effects that will be discarded}} + __builtin_assume(++i > 2); //expected-warning {{assumption is ignored because it contains (potential) side-effects}} + __builtin_assume(nonconst() > 2); //expected-warning {{assumption is ignored because it contains (potential) side-effects}} __builtin_assume(isconst() > 2); __builtin_assume(ispure(i) > 2); - __builtin_assume(ispure(++i) > 2); //expected-warning {{the argument to '__builtin_assume' has side effects that will be discarded}} + __builtin_assume(ispure(++i) > 2); //expected-warning {{assumption is ignored because it contains (potential) side-effects}} int test = sizeof(struct{char qq[(__builtin_assume(i != 5), 7)];}); // expected-warning {{variable length array}} #endif diff --git a/clang/test/Sema/builtins-x86.c b/clang/test/Sema/builtins-x86.c index cbaf7bcde871e..7d9cdce3d7894 100644 --- a/clang/test/Sema/builtins-x86.c +++ b/clang/test/Sema/builtins-x86.c @@ -106,14 +106,6 @@ __m128i test_mm_mask_i32gather_epi32(__m128i a, int const *b, __m128i c, __m128i return __builtin_ia32_gatherd_d(a, b, c, mask, 5); // expected-error {{scale argument must be 1, 2, 4, or 8}} } -void _mm512_mask_prefetch_i32gather_ps(__m512i index, __mmask16 mask, int const *addr) { - __builtin_ia32_gatherpfdps(mask, index, addr, 5, 1); // expected-error {{scale argument must be 1, 2, 4, or 8}} -} - -void _mm512_mask_prefetch_i32gather_ps_2(__m512i index, __mmask16 mask, int const *addr) { - __builtin_ia32_gatherpfdps(mask, index, addr, 1, 1); // expected-error {{argument value 1 is outside the valid range [2, 3]}} -} - __m512i test_mm512_shldi_epi64(__m512i __A, __m512i __B) { return __builtin_ia32_vpshldq512(__A, __B, 1024); // expected-error {{argument value 1024 is outside the valid range [0, 255]}} } diff --git a/clang/test/Sema/constant_builtins_vector.cpp b/clang/test/Sema/constant_builtins_vector.cpp index ddb78696ce624..c6b1b37cef28b 100644 --- a/clang/test/Sema/constant_builtins_vector.cpp +++ b/clang/test/Sema/constant_builtins_vector.cpp @@ -719,7 +719,7 @@ constexpr vector4char vectorShuffleFail1 = // expected-error {{constexpr variable 'vectorShuffleFail1'\ must be initialized by a constant expression}} __builtin_shufflevector( // expected-error {{index for __builtin_shufflevector \ -not within the bounds of the input vectors; index of -1 found at position 0 not \ -permitted in a constexpr context.}} +not within the bounds of the input vectors; index of -1 found at position 0 is not \ +permitted in a constexpr context}} vector4charConst1, vector4charConst2, -1, -1, -1, -1); diff --git a/clang/test/Sema/fmv-namespace.cpp b/clang/test/Sema/fmv-namespace.cpp new file mode 100644 index 0000000000000..1c12fd66cf243 --- /dev/null +++ b/clang/test/Sema/fmv-namespace.cpp @@ -0,0 +1,12 @@ +// RUN: %clang_cc1 -triple aarch64-linux-gnu -fsyntax-only -verify %s +// expected-no-diagnostics + +namespace Name { +int __attribute((target_version("default"))) foo() { return 0; } +} + +namespace Name { +int __attribute((target_version("sve"))) foo() { return 1; } +} + +int bar() { return Name::foo(); } diff --git a/clang/test/Sema/stmtexprs.c b/clang/test/Sema/stmtexprs.c index 708fc9abb75c0..7493bbcef363d 100644 --- a/clang/test/Sema/stmtexprs.c +++ b/clang/test/Sema/stmtexprs.c @@ -4,6 +4,6 @@ int stmtexpr_fn(void); void stmtexprs(int i) { __builtin_assume( ({ 1; }) ); // no warning about "side effects" __builtin_assume( ({ if (i) { (void)0; }; 42; }) ); // no warning about "side effects" - // expected-warning@+1 {{the argument to '__builtin_assume' has side effects that will be discarded}} + // expected-warning@+1 {{assumption is ignored because it contains (potential) side-effects}} __builtin_assume( ({ if (i) ({ stmtexpr_fn(); }); 1; }) ); } diff --git a/clang/test/SemaCUDA/device-var-init.cu b/clang/test/SemaCUDA/device-var-init.cu index ee7a9e2276f2d..1555d151c2590 100644 --- a/clang/test/SemaCUDA/device-var-init.cu +++ b/clang/test/SemaCUDA/device-var-init.cu @@ -13,17 +13,17 @@ #include "Inputs/cuda-initializers.h" __shared__ int s_v_i = 1; -// expected-error@-1 {{initialization is not supported for __shared__ variables.}} +// expected-error@-1 {{initialization is not supported for __shared__ variables}} __device__ int d_v_f = f(); -// expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables.}} +// expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables}} __shared__ int s_v_f = f(); -// expected-error@-1 {{initialization is not supported for __shared__ variables.}} +// expected-error@-1 {{initialization is not supported for __shared__ variables}} __constant__ int c_v_f = f(); -// expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables.}} +// expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables}} __shared__ T s_t_i = {2}; -// expected-error@-1 {{initialization is not supported for __shared__ variables.}} +// expected-error@-1 {{initialization is not supported for __shared__ variables}} __device__ T d_t_i = {2}; __constant__ T c_t_i = {2}; @@ -40,175 +40,175 @@ __shared__ CGTC s_cgtc; __constant__ CGTC c_cgtc; __device__ EC d_ec_i(3); -// expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables.}} +// expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables}} __shared__ EC s_ec_i(3); -// expected-error@-1 {{initialization is not supported for __shared__ variables.}} +// expected-error@-1 {{initialization is not supported for __shared__ variables}} __constant__ EC c_ec_i(3); -// expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables.}} +// expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables}} __device__ EC d_ec_i2 = {3}; -// expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables.}} +// expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables}} __shared__ EC s_ec_i2 = {3}; -// expected-error@-1 {{initialization is not supported for __shared__ variables.}} +// expected-error@-1 {{initialization is not supported for __shared__ variables}} __constant__ EC c_ec_i2 = {3}; -// expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables.}} +// expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables}} __device__ ETC d_etc_i(3); -// expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables.}} +// expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables}} __shared__ ETC s_etc_i(3); -// expected-error@-1 {{initialization is not supported for __shared__ variables.}} +// expected-error@-1 {{initialization is not supported for __shared__ variables}} __constant__ ETC c_etc_i(3); -// expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables.}} +// expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables}} __device__ ETC d_etc_i2 = {3}; -// expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables.}} +// expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables}} __shared__ ETC s_etc_i2 = {3}; -// expected-error@-1 {{initialization is not supported for __shared__ variables.}} +// expected-error@-1 {{initialization is not supported for __shared__ variables}} __constant__ ETC c_etc_i2 = {3}; -// expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables.}} +// expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables}} __device__ UC d_uc; -// expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables.}} +// expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables}} __shared__ UC s_uc; -// expected-error@-1 {{initialization is not supported for __shared__ variables.}} +// expected-error@-1 {{initialization is not supported for __shared__ variables}} __constant__ UC c_uc; -// expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables.}} +// expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables}} __device__ UD d_ud; -// expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables.}} +// expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables}} __shared__ UD s_ud; -// expected-error@-1 {{initialization is not supported for __shared__ variables.}} +// expected-error@-1 {{initialization is not supported for __shared__ variables}} __constant__ UD c_ud; -// expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables.}} +// expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables}} __device__ ECI d_eci; -// expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables.}} +// expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables}} __shared__ ECI s_eci; -// expected-error@-1 {{initialization is not supported for __shared__ variables.}} +// expected-error@-1 {{initialization is not supported for __shared__ variables}} __constant__ ECI c_eci; -// expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables.}} +// expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables}} __device__ NEC d_nec; -// expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables.}} +// expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables}} __shared__ NEC s_nec; -// expected-error@-1 {{initialization is not supported for __shared__ variables.}} +// expected-error@-1 {{initialization is not supported for __shared__ variables}} __constant__ NEC c_nec; -// expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables.}} +// expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables}} __device__ NED d_ned; -// expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables.}} +// expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables}} __shared__ NED s_ned; -// expected-error@-1 {{initialization is not supported for __shared__ variables.}} +// expected-error@-1 {{initialization is not supported for __shared__ variables}} __constant__ NED c_ned; -// expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables.}} +// expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables}} __device__ NCV d_ncv; -// expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables.}} +// expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables}} __shared__ NCV s_ncv; -// expected-error@-1 {{initialization is not supported for __shared__ variables.}} +// expected-error@-1 {{initialization is not supported for __shared__ variables}} __constant__ NCV c_ncv; -// expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables.}} +// expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables}} __device__ VD d_vd; -// expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables.}} +// expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables}} __shared__ VD s_vd; -// expected-error@-1 {{initialization is not supported for __shared__ variables.}} +// expected-error@-1 {{initialization is not supported for __shared__ variables}} __constant__ VD c_vd; -// expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables.}} +// expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables}} __device__ NCF d_ncf; -// expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables.}} +// expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables}} __shared__ NCF s_ncf; -// expected-error@-1 {{initialization is not supported for __shared__ variables.}} +// expected-error@-1 {{initialization is not supported for __shared__ variables}} __constant__ NCF c_ncf; -// expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables.}} +// expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables}} __shared__ NCFS s_ncfs; -// expected-error@-1 {{initialization is not supported for __shared__ variables.}} +// expected-error@-1 {{initialization is not supported for __shared__ variables}} __device__ UTC d_utc; -// expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables.}} +// expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables}} __shared__ UTC s_utc; -// expected-error@-1 {{initialization is not supported for __shared__ variables.}} +// expected-error@-1 {{initialization is not supported for __shared__ variables}} __constant__ UTC c_utc; -// expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables.}} +// expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables}} __device__ UTC d_utc_i(3); -// expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables.}} +// expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables}} __shared__ UTC s_utc_i(3); -// expected-error@-1 {{initialization is not supported for __shared__ variables.}} +// expected-error@-1 {{initialization is not supported for __shared__ variables}} __constant__ UTC c_utc_i(3); -// expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables.}} +// expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables}} __device__ NETC d_netc; -// expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables.}} +// expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables}} __shared__ NETC s_netc; -// expected-error@-1 {{initialization is not supported for __shared__ variables.}} +// expected-error@-1 {{initialization is not supported for __shared__ variables}} __constant__ NETC c_netc; -// expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables.}} +// expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables}} __device__ NETC d_netc_i(3); -// expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables.}} +// expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables}} __shared__ NETC s_netc_i(3); -// expected-error@-1 {{initialization is not supported for __shared__ variables.}} +// expected-error@-1 {{initialization is not supported for __shared__ variables}} __constant__ NETC c_netc_i(3); -// expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables.}} +// expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables}} __device__ EC_I_EC1 d_ec_i_ec1; -// expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables.}} +// expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables}} __shared__ EC_I_EC1 s_ec_i_ec1; -// expected-error@-1 {{initialization is not supported for __shared__ variables.}} +// expected-error@-1 {{initialization is not supported for __shared__ variables}} __constant__ EC_I_EC1 c_ec_i_ec1; -// expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables.}} +// expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables}} __device__ T_V_T d_t_v_t; -// expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables.}} +// expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables}} __shared__ T_V_T s_t_v_t; -// expected-error@-1 {{initialization is not supported for __shared__ variables.}} +// expected-error@-1 {{initialization is not supported for __shared__ variables}} __constant__ T_V_T c_t_v_t; -// expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables.}} +// expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables}} __device__ T_B_NEC d_t_b_nec; -// expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables.}} +// expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables}} __shared__ T_B_NEC s_t_b_nec; -// expected-error@-1 {{initialization is not supported for __shared__ variables.}} +// expected-error@-1 {{initialization is not supported for __shared__ variables}} __constant__ T_B_NEC c_t_b_nec; -// expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables.}} +// expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables}} __device__ T_F_NEC d_t_f_nec; -// expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables.}} +// expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables}} __shared__ T_F_NEC s_t_f_nec; -// expected-error@-1 {{initialization is not supported for __shared__ variables.}} +// expected-error@-1 {{initialization is not supported for __shared__ variables}} __constant__ T_F_NEC c_t_f_nec; -// expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables.}} +// expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables}} __device__ T_FA_NEC d_t_fa_nec; -// expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables.}} +// expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables}} __shared__ T_FA_NEC s_t_fa_nec; -// expected-error@-1 {{initialization is not supported for __shared__ variables.}} +// expected-error@-1 {{initialization is not supported for __shared__ variables}} __constant__ T_FA_NEC c_t_fa_nec; -// expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables.}} +// expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables}} __device__ T_B_NED d_t_b_ned; -// expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables.}} +// expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables}} __shared__ T_B_NED s_t_b_ned; -// expected-error@-1 {{initialization is not supported for __shared__ variables.}} +// expected-error@-1 {{initialization is not supported for __shared__ variables}} __constant__ T_B_NED c_t_b_ned; -// expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables.}} +// expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables}} __device__ T_F_NED d_t_f_ned; -// expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables.}} +// expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables}} __shared__ T_F_NED s_t_f_ned; -// expected-error@-1 {{initialization is not supported for __shared__ variables.}} +// expected-error@-1 {{initialization is not supported for __shared__ variables}} __constant__ T_F_NED c_t_f_ned; -// expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables.}} +// expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables}} __device__ T_FA_NED d_t_fa_ned; -// expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables.}} +// expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables}} __shared__ T_FA_NED s_t_fa_ned; -// expected-error@-1 {{initialization is not supported for __shared__ variables.}} +// expected-error@-1 {{initialization is not supported for __shared__ variables}} __constant__ T_FA_NED c_t_fa_ned; -// expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables.}} +// expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables}} // Verify that local variables may be static on device // side and that they conform to the initialization constraints. @@ -244,14 +244,14 @@ __device__ void df_sema() { // Same test cases as for the globals above. static __device__ int d_v_f = f(); - // expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables.}} + // expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables}} static __shared__ int s_v_f = f(); - // expected-error@-1 {{initialization is not supported for __shared__ variables.}} + // expected-error@-1 {{initialization is not supported for __shared__ variables}} static __constant__ int c_v_f = f(); - // expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables.}} + // expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables}} static __shared__ T s_t_i = {2}; - // expected-error@-1 {{initialization is not supported for __shared__ variables.}} + // expected-error@-1 {{initialization is not supported for __shared__ variables}} static __device__ T d_t_i = {2}; static __constant__ T c_t_i = {2}; @@ -260,175 +260,175 @@ __device__ void df_sema() { static __constant__ ECD c_ecd_i; static __device__ EC d_ec_i(3); - // expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables.}} + // expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables}} static __shared__ EC s_ec_i(3); - // expected-error@-1 {{initialization is not supported for __shared__ variables.}} + // expected-error@-1 {{initialization is not supported for __shared__ variables}} static __constant__ EC c_ec_i(3); - // expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables.}} + // expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables}} static __device__ EC d_ec_i2 = {3}; - // expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables.}} + // expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables}} static __shared__ EC s_ec_i2 = {3}; - // expected-error@-1 {{initialization is not supported for __shared__ variables.}} + // expected-error@-1 {{initialization is not supported for __shared__ variables}} static __constant__ EC c_ec_i2 = {3}; - // expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables.}} + // expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables}} static __device__ ETC d_etc_i(3); - // expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables.}} + // expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables}} static __shared__ ETC s_etc_i(3); - // expected-error@-1 {{initialization is not supported for __shared__ variables.}} + // expected-error@-1 {{initialization is not supported for __shared__ variables}} static __constant__ ETC c_etc_i(3); - // expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables.}} + // expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables}} static __device__ ETC d_etc_i2 = {3}; - // expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables.}} + // expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables}} static __shared__ ETC s_etc_i2 = {3}; - // expected-error@-1 {{initialization is not supported for __shared__ variables.}} + // expected-error@-1 {{initialization is not supported for __shared__ variables}} static __constant__ ETC c_etc_i2 = {3}; - // expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables.}} + // expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables}} static __device__ UC d_uc; - // expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables.}} + // expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables}} static __shared__ UC s_uc; - // expected-error@-1 {{initialization is not supported for __shared__ variables.}} + // expected-error@-1 {{initialization is not supported for __shared__ variables}} static __constant__ UC c_uc; - // expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables.}} + // expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables}} static __device__ UD d_ud; - // expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables.}} + // expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables}} static __shared__ UD s_ud; - // expected-error@-1 {{initialization is not supported for __shared__ variables.}} + // expected-error@-1 {{initialization is not supported for __shared__ variables}} static __constant__ UD c_ud; - // expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables.}} + // expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables}} static __device__ ECI d_eci; - // expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables.}} + // expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables}} static __shared__ ECI s_eci; - // expected-error@-1 {{initialization is not supported for __shared__ variables.}} + // expected-error@-1 {{initialization is not supported for __shared__ variables}} static __constant__ ECI c_eci; - // expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables.}} + // expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables}} static __device__ NEC d_nec; - // expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables.}} + // expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables}} static __shared__ NEC s_nec; - // expected-error@-1 {{initialization is not supported for __shared__ variables.}} + // expected-error@-1 {{initialization is not supported for __shared__ variables}} static __constant__ NEC c_nec; - // expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables.}} + // expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables}} static __device__ NED d_ned; - // expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables.}} + // expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables}} static __shared__ NED s_ned; - // expected-error@-1 {{initialization is not supported for __shared__ variables.}} + // expected-error@-1 {{initialization is not supported for __shared__ variables}} static __constant__ NED c_ned; - // expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables.}} + // expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables}} static __device__ NCV d_ncv; - // expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables.}} + // expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables}} static __shared__ NCV s_ncv; - // expected-error@-1 {{initialization is not supported for __shared__ variables.}} + // expected-error@-1 {{initialization is not supported for __shared__ variables}} static __constant__ NCV c_ncv; - // expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables.}} + // expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables}} static __device__ VD d_vd; - // expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables.}} + // expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables}} static __shared__ VD s_vd; - // expected-error@-1 {{initialization is not supported for __shared__ variables.}} + // expected-error@-1 {{initialization is not supported for __shared__ variables}} static __constant__ VD c_vd; - // expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables.}} + // expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables}} static __device__ NCF d_ncf; - // expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables.}} + // expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables}} static __shared__ NCF s_ncf; - // expected-error@-1 {{initialization is not supported for __shared__ variables.}} + // expected-error@-1 {{initialization is not supported for __shared__ variables}} static __constant__ NCF c_ncf; - // expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables.}} + // expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables}} static __shared__ NCFS s_ncfs; - // expected-error@-1 {{initialization is not supported for __shared__ variables.}} + // expected-error@-1 {{initialization is not supported for __shared__ variables}} static __device__ UTC d_utc; - // expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables.}} + // expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables}} static __shared__ UTC s_utc; - // expected-error@-1 {{initialization is not supported for __shared__ variables.}} + // expected-error@-1 {{initialization is not supported for __shared__ variables}} static __constant__ UTC c_utc; - // expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables.}} + // expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables}} static __device__ UTC d_utc_i(3); - // expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables.}} + // expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables}} static __shared__ UTC s_utc_i(3); - // expected-error@-1 {{initialization is not supported for __shared__ variables.}} + // expected-error@-1 {{initialization is not supported for __shared__ variables}} static __constant__ UTC c_utc_i(3); - // expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables.}} + // expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables}} static __device__ NETC d_netc; - // expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables.}} + // expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables}} static __shared__ NETC s_netc; - // expected-error@-1 {{initialization is not supported for __shared__ variables.}} + // expected-error@-1 {{initialization is not supported for __shared__ variables}} static __constant__ NETC c_netc; - // expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables.}} + // expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables}} static __device__ NETC d_netc_i(3); - // expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables.}} + // expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables}} static __shared__ NETC s_netc_i(3); - // expected-error@-1 {{initialization is not supported for __shared__ variables.}} + // expected-error@-1 {{initialization is not supported for __shared__ variables}} static __constant__ NETC c_netc_i(3); - // expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables.}} + // expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables}} static __device__ EC_I_EC1 d_ec_i_ec1; - // expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables.}} + // expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables}} static __shared__ EC_I_EC1 s_ec_i_ec1; - // expected-error@-1 {{initialization is not supported for __shared__ variables.}} + // expected-error@-1 {{initialization is not supported for __shared__ variables}} static __constant__ EC_I_EC1 c_ec_i_ec1; - // expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables.}} + // expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables}} static __device__ T_V_T d_t_v_t; - // expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables.}} + // expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables}} static __shared__ T_V_T s_t_v_t; - // expected-error@-1 {{initialization is not supported for __shared__ variables.}} + // expected-error@-1 {{initialization is not supported for __shared__ variables}} static __constant__ T_V_T c_t_v_t; - // expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables.}} + // expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables}} static __device__ T_B_NEC d_t_b_nec; - // expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables.}} + // expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables}} static __shared__ T_B_NEC s_t_b_nec; - // expected-error@-1 {{initialization is not supported for __shared__ variables.}} + // expected-error@-1 {{initialization is not supported for __shared__ variables}} static __constant__ T_B_NEC c_t_b_nec; - // expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables.}} + // expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables}} static __device__ T_F_NEC d_t_f_nec; - // expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables.}} + // expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables}} static __shared__ T_F_NEC s_t_f_nec; - // expected-error@-1 {{initialization is not supported for __shared__ variables.}} + // expected-error@-1 {{initialization is not supported for __shared__ variables}} static __constant__ T_F_NEC c_t_f_nec; - // expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables.}} + // expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables}} static __device__ T_FA_NEC d_t_fa_nec; - // expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables.}} + // expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables}} static __shared__ T_FA_NEC s_t_fa_nec; - // expected-error@-1 {{initialization is not supported for __shared__ variables.}} + // expected-error@-1 {{initialization is not supported for __shared__ variables}} static __constant__ T_FA_NEC c_t_fa_nec; - // expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables.}} + // expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables}} static __device__ T_B_NED d_t_b_ned; - // expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables.}} + // expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables}} static __shared__ T_B_NED s_t_b_ned; - // expected-error@-1 {{initialization is not supported for __shared__ variables.}} + // expected-error@-1 {{initialization is not supported for __shared__ variables}} static __constant__ T_B_NED c_t_b_ned; - // expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables.}} + // expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables}} static __device__ T_F_NED d_t_f_ned; - // expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables.}} + // expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables}} static __shared__ T_F_NED s_t_f_ned; - // expected-error@-1 {{initialization is not supported for __shared__ variables.}} + // expected-error@-1 {{initialization is not supported for __shared__ variables}} static __constant__ T_F_NED c_t_f_ned; - // expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables.}} + // expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables}} static __device__ T_FA_NED d_t_fa_ned; - // expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables.}} + // expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables}} static __shared__ T_FA_NED s_t_fa_ned; - // expected-error@-1 {{initialization is not supported for __shared__ variables.}} + // expected-error@-1 {{initialization is not supported for __shared__ variables}} static __constant__ T_FA_NED c_t_fa_ned; - // expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables.}} + // expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables}} } __host__ __device__ void hd_sema() { @@ -449,7 +449,7 @@ struct NontrivialInitializer { template __global__ void bar() { __shared__ T bad; -// expected-error@-1 {{initialization is not supported for __shared__ variables.}} +// expected-error@-1 {{initialization is not supported for __shared__ variables}} for (int i = 0; i < 10; i++) { static __device__ CEEC sd_ceec; static __shared__ CEEC ss_ceec; @@ -467,7 +467,7 @@ __global__ void bar() { template <> __global__ void bar() { __shared__ NontrivialInitializer bad; -// expected-error@-1 {{initialization is not supported for __shared__ variables.}} +// expected-error@-1 {{initialization is not supported for __shared__ variables}} for (int i = 0; i < 10; i++) { static __device__ CEEC sd_ceec; static __shared__ CEEC ss_ceec; diff --git a/clang/test/SemaCUDA/function-overload.cu b/clang/test/SemaCUDA/function-overload.cu index 163648cd9a87a..4710c81763adf 100644 --- a/clang/test/SemaCUDA/function-overload.cu +++ b/clang/test/SemaCUDA/function-overload.cu @@ -469,7 +469,7 @@ int test_constexpr_overload(C2 &x, C2 &y) { // Verify no ambiguity for new operator. void *a = new int; __device__ void *b = new int; -// expected-error@-1{{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables.}} +// expected-error@-1{{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables}} // Verify no ambiguity for new operator. template _Tp&& f(); diff --git a/clang/test/SemaCUDA/union-init.cu b/clang/test/SemaCUDA/union-init.cu index 9e4d14a71069d..dd4b1296b713e 100644 --- a/clang/test/SemaCUDA/union-init.cu +++ b/clang/test/SemaCUDA/union-init.cu @@ -31,14 +31,14 @@ union D { __device__ B b; __device__ C c; -// expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables.}} +// expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables}} __device__ D d; -// expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables.}} +// expected-error@-1 {{dynamic initialization is not supported for __device__, __constant__, __shared__, and __managed__ variables}} __device__ void foo() { __shared__ B b; __shared__ C c; - // expected-error@-1 {{initialization is not supported for __shared__ variables.}} + // expected-error@-1 {{initialization is not supported for __shared__ variables}} __shared__ D d; - // expected-error@-1 {{initialization is not supported for __shared__ variables.}} + // expected-error@-1 {{initialization is not supported for __shared__ variables}} } diff --git a/clang/test/SemaCXX/addr-label-in-coroutines.cpp b/clang/test/SemaCXX/addr-label-in-coroutines.cpp index e37ee64134378..65d78636e5cdd 100644 --- a/clang/test/SemaCXX/addr-label-in-coroutines.cpp +++ b/clang/test/SemaCXX/addr-label-in-coroutines.cpp @@ -13,9 +13,9 @@ struct resumable { }; resumable f1(int &out, int *inst) { - static void* dispatch_table[] = {&&inc, // expected-error {{the GNU address of label extension is not allowed in coroutines.}} - &&suspend, // expected-error {{the GNU address of label extension is not allowed in coroutines.}} - &&stop}; // expected-error {{the GNU address of label extension is not allowed in coroutines.}} + static void* dispatch_table[] = {&&inc, // expected-error {{the GNU address of label extension is not allowed in coroutines}} + &&suspend, // expected-error {{the GNU address of label extension is not allowed in coroutines}} + &&stop}; // expected-error {{the GNU address of label extension is not allowed in coroutines}} #define DISPATCH() goto *dispatch_table[*inst++] inc: out++; @@ -31,9 +31,9 @@ resumable f1(int &out, int *inst) { resumable f2(int &out, int *inst) { void* dispatch_table[] = {nullptr, nullptr, nullptr}; - dispatch_table[0] = &&inc; // expected-error {{the GNU address of label extension is not allowed in coroutines.}} - dispatch_table[1] = &&suspend; // expected-error {{the GNU address of label extension is not allowed in coroutines.}} - dispatch_table[2] = &&stop; // expected-error {{the GNU address of label extension is not allowed in coroutines.}} + dispatch_table[0] = &&inc; // expected-error {{the GNU address of label extension is not allowed in coroutines}} + dispatch_table[1] = &&suspend; // expected-error {{the GNU address of label extension is not allowed in coroutines}} + dispatch_table[2] = &&stop; // expected-error {{the GNU address of label extension is not allowed in coroutines}} #define DISPATCH() goto *dispatch_table[*inst++] inc: out++; @@ -50,9 +50,9 @@ resumable f2(int &out, int *inst) { resumable f3(int &out, int *inst) { void* dispatch_table[] = {nullptr, nullptr, nullptr}; [&]() -> resumable { - dispatch_table[0] = &&inc; // expected-error {{the GNU address of label extension is not allowed in coroutines.}} - dispatch_table[1] = &&suspend; // expected-error {{the GNU address of label extension is not allowed in coroutines.}} - dispatch_table[2] = &&stop; // expected-error {{the GNU address of label extension is not allowed in coroutines.}} + dispatch_table[0] = &&inc; // expected-error {{the GNU address of label extension is not allowed in coroutines}} + dispatch_table[1] = &&suspend; // expected-error {{the GNU address of label extension is not allowed in coroutines}} + dispatch_table[2] = &&stop; // expected-error {{the GNU address of label extension is not allowed in coroutines}} #define DISPATCH() goto *dispatch_table[*inst++] inc: out++; diff --git a/clang/test/SemaCXX/attribute-pack-expansion.cpp b/clang/test/SemaCXX/attribute-pack-expansion.cpp new file mode 100644 index 0000000000000..a339e68c09648 --- /dev/null +++ b/clang/test/SemaCXX/attribute-pack-expansion.cpp @@ -0,0 +1,20 @@ +// RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify %s + +template +void f() __attribute((diagnose_if(vals, "message", "error"))) { // expected-error {{expression contains unexpanded parameter pack 'vals'}} + [] () __attribute((diagnose_if(vals, "message", "error"))) {}(); // expected-error {{expression contains unexpanded parameter pack 'vals'}} + [] () __attribute((diagnose_if(vals..., "message", "error"))) {}(); // expected-error {{attribute 'diagnose_if' does not support argument pack expansion}} + [] () __attribute((diagnose_if(inner, "message", "error"))) {}(); // expected-error {{expression contains unexpanded parameter pack 'inner'}} + ([] () __attribute((diagnose_if(inner, "message", "error"))) {}(), ...); // expected-error {{expression contains unexpanded parameter pack 'inner'}} \ + // expected-error {{pack expansion does not contain any unexpanded parameter packs}} + + // This is fine, so check that we're actually emitting an error + // due to the 'diagnose_if'. + ([] () __attribute((diagnose_if(vals, "foobar", "error"))) {}(), ...); // expected-error {{foobar}} expected-note {{from 'diagnose_if'}} +} + +void g() { + f<>(); + f(); + f(); // expected-note {{in instantiation of}} +} diff --git a/clang/test/SemaCXX/cxx20-ctad-type-alias.cpp b/clang/test/SemaCXX/cxx20-ctad-type-alias.cpp index 4c6ef5adae7d2..b71dfc6ccaf4f 100644 --- a/clang/test/SemaCXX/cxx20-ctad-type-alias.cpp +++ b/clang/test/SemaCXX/cxx20-ctad-type-alias.cpp @@ -284,7 +284,7 @@ class Foo {}; // Verify that template template type parameter TTP is referenced/used in the // template arguments of the RHS. template typename TTP> -using Bar = Foo>; // expected-note {{candidate template ignored: could not match 'Foo>' against 'int'}} +using Bar = Foo>; // expected-note {{candidate template ignored: could not match 'Foo>' against 'int'}} template class Container {}; diff --git a/clang/test/SemaCXX/cxx23-assume-disabled.cpp b/clang/test/SemaCXX/cxx23-assume-disabled.cpp index 4233a2f7f4338..674e16f5ae9b3 100644 --- a/clang/test/SemaCXX/cxx23-assume-disabled.cpp +++ b/clang/test/SemaCXX/cxx23-assume-disabled.cpp @@ -1,5 +1,8 @@ // RUN: %clang_cc1 -std=c++23 -x c++ %s -fno-assumptions -verify // RUN: %clang_cc1 -std=c++23 -x c++ %s -fms-compatibility -verify +// RUN: %clang_cc1 -std=c++23 -x c++ %s -fno-assumptions -fexperimental-new-constant-interpreter -verify +// RUN: %clang_cc1 -std=c++23 -x c++ %s -fms-compatibility -fexperimental-new-constant-interpreter -verify + // expected-no-diagnostics // We don't check assumptions at compile time if '-fno-assumptions' is passed, diff --git a/clang/test/SemaCXX/cxx23-assume.cpp b/clang/test/SemaCXX/cxx23-assume.cpp index ea71e7b251823..9138501d726dd 100644 --- a/clang/test/SemaCXX/cxx23-assume.cpp +++ b/clang/test/SemaCXX/cxx23-assume.cpp @@ -28,7 +28,7 @@ bool f2(); template constexpr void f3() { - [[assume(T{})]]; // expected-error {{not contextually convertible to 'bool'}} expected-warning {{has side effects that will be discarded}} ext-warning {{C++23 extension}} + [[assume(T{})]]; // expected-error {{not contextually convertible to 'bool'}} expected-warning {{assumption is ignored because it contains (potential) side-effects}} ext-warning {{C++23 extension}} } void g(int x) { @@ -38,13 +38,13 @@ void g(int x) { S{}.f(); S{}.g(); S{}.g(); - [[assume(f2())]]; // expected-warning {{side effects that will be discarded}} ext-warning {{C++23 extension}} + [[assume(f2())]]; // expected-warning {{assumption is ignored because it contains (potential) side-effects}} ext-warning {{C++23 extension}} - [[assume((x = 3))]]; // expected-warning {{has side effects that will be discarded}} // ext-warning {{C++23 extension}} - [[assume(x++)]]; // expected-warning {{has side effects that will be discarded}} // ext-warning {{C++23 extension}} - [[assume(++x)]]; // expected-warning {{has side effects that will be discarded}} // ext-warning {{C++23 extension}} - [[assume([]{ return true; }())]]; // expected-warning {{has side effects that will be discarded}} // ext-warning {{C++23 extension}} - [[assume(B{})]]; // expected-warning {{has side effects that will be discarded}} // ext-warning {{C++23 extension}} + [[assume((x = 3))]]; // expected-warning {{assumption is ignored because it contains (potential) side-effects}} // ext-warning {{C++23 extension}} + [[assume(x++)]]; // expected-warning {{assumption is ignored because it contains (potential) side-effects}} // ext-warning {{C++23 extension}} + [[assume(++x)]]; // expected-warning {{assumption is ignored because it contains (potential) side-effects}} // ext-warning {{C++23 extension}} + [[assume([]{ return true; }())]]; // expected-warning {{assumption is ignored because it contains (potential) side-effects}} // ext-warning {{C++23 extension}} + [[assume(B{})]]; // expected-warning {{assumption is ignored because it contains (potential) side-effects}} // ext-warning {{C++23 extension}} [[assume((1, 2))]]; // expected-warning {{has no effect}} // ext-warning {{C++23 extension}} f3(); // expected-note {{in instantiation of}} @@ -91,7 +91,7 @@ static_assert(S{}.g()); // expected-error {{not an integral constant e template constexpr bool f4() { - [[assume(!T{})]]; // expected-error {{invalid argument type 'D'}} // expected-warning 2 {{side effects}} ext-warning {{C++23 extension}} + [[assume(!T{})]]; // expected-error {{invalid argument type 'D'}} // expected-warning 2 {{assumption is ignored because it contains (potential) side-effects}} ext-warning {{C++23 extension}} return sizeof(T) == sizeof(int); } @@ -137,8 +137,8 @@ static_assert(f5() == 2); // expected-note {{while checking constraint satisf // Do not validate assumptions whose evaluation would have side-effects. constexpr int foo() { int a = 0; - [[assume(a++)]] [[assume(++a)]]; // expected-warning 2 {{has side effects that will be discarded}} ext-warning 2 {{C++23 extension}} - [[assume((a+=1))]]; // expected-warning {{has side effects that will be discarded}} ext-warning {{C++23 extension}} + [[assume(a++)]] [[assume(++a)]]; // expected-warning 2 {{assumption is ignored because it contains (potential) side-effects}} ext-warning 2 {{C++23 extension}} + [[assume((a+=1))]]; // expected-warning {{assumption is ignored because it contains (potential) side-effects}} ext-warning {{C++23 extension}} return a; } @@ -154,7 +154,7 @@ int foo (int x, int y) { __attribute__((assume(x == 42))); - __attribute__((assume(++y == 43))); // expected-warning {{has side effects that will be discarded}} + __attribute__((assume(++y == 43))); // expected-warning {{assumption is ignored because it contains (potential) side-effects}} return x + y; } } diff --git a/clang/test/SemaCXX/cxx2b-consteval-propagate.cpp b/clang/test/SemaCXX/cxx2b-consteval-propagate.cpp index 07937deb66738..b70c02201ac3c 100644 --- a/clang/test/SemaCXX/cxx2b-consteval-propagate.cpp +++ b/clang/test/SemaCXX/cxx2b-consteval-propagate.cpp @@ -446,3 +446,11 @@ int h(int x) { } #endif + + +namespace GH91308 { + constexpr void f(auto) { + static_assert(false); + } + using R1 = decltype(&f); +} diff --git a/clang/test/SemaCXX/invalid-if-constexpr.cpp b/clang/test/SemaCXX/invalid-if-constexpr.cpp index 7643c47488f05..0007f2739cbbd 100644 --- a/clang/test/SemaCXX/invalid-if-constexpr.cpp +++ b/clang/test/SemaCXX/invalid-if-constexpr.cpp @@ -4,8 +4,7 @@ namespace GH61885 { void similar() { // expected-note {{'similar' declared here}} if constexpr (similer<>) {} // expected-error {{use of undeclared identifier 'similer'; did you mean 'similar'?}} } -void a() { if constexpr (__adl_swap<>) {}} // expected-error{{use of undeclared identifier '__adl_swap'; did you mean '__sync_swap'?}} \ - // expected-note {{'__sync_swap' declared here}} +void a() { if constexpr (__adl_swap<>) {}} // expected-error{{use of undeclared identifier '__adl_swap'; did you mean '__sync_swap'?}} int AA() { return true;} // expected-note {{'AA' declared here}} diff --git a/clang/test/SemaCXX/invalid-this-in-lambda.cpp b/clang/test/SemaCXX/invalid-this-in-lambda.cpp new file mode 100644 index 0000000000000..ae65bda025e23 --- /dev/null +++ b/clang/test/SemaCXX/invalid-this-in-lambda.cpp @@ -0,0 +1,4 @@ +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s + +decltype([]()->decltype(this) { }) a; // expected-error {{invalid use of 'this' outside of a non-static member function}} + diff --git a/clang/test/SemaCXX/overload-decl.cpp b/clang/test/SemaCXX/overload-decl.cpp index 1201396996e75..5d1df89a0da7b 100644 --- a/clang/test/SemaCXX/overload-decl.cpp +++ b/clang/test/SemaCXX/overload-decl.cpp @@ -36,3 +36,20 @@ class X { int main() {} // expected-note {{previous definition is here}} int main(int,char**) {} // expected-error {{conflicting types for 'main'}} + + +namespace GH93456 { + +struct X { + static void f(); // expected-note {{previous declaration is here}} + void f() const; + // expected-error@-1 {{static and non-static member functions with the same parameter types cannot be overloaded}} +}; + +struct Y { + void f() const; // expected-note {{previous declaration is here}} + static void f(); + // expected-error@-1 {{static and non-static member functions with the same parameter types cannot be overloaded}} +}; + +} diff --git a/clang/test/SemaCXX/overload-template.cpp b/clang/test/SemaCXX/overload-template.cpp index 0fe13c479cce2..3277a17e5e450 100644 --- a/clang/test/SemaCXX/overload-template.cpp +++ b/clang/test/SemaCXX/overload-template.cpp @@ -58,3 +58,13 @@ namespace overloadCheck{ } } #endif + +namespace GH93076 { +template int b(a..., int); // expected-note-re 3 {{candidate function template not viable: no known conversion from 'int ()' to 'int' for {{.*}} argument}} +int d() { + (void)b(0, 0, d); // expected-error {{no matching function for call to 'b'}} + (void)b(0, d, 0); // expected-error {{no matching function for call to 'b'}} + (void)b(d, 0, 0); // expected-error {{no matching function for call to 'b'}} + return 0; + } +} diff --git a/clang/test/SemaCXX/overloaded-operator.cpp b/clang/test/SemaCXX/overloaded-operator.cpp index cab21d67a002f..0701a96d5d0ce 100644 --- a/clang/test/SemaCXX/overloaded-operator.cpp +++ b/clang/test/SemaCXX/overloaded-operator.cpp @@ -691,4 +691,15 @@ template A<*T> operator *() { return {}; } // expected-error@-1 {{overloaded 'operator*' must have at least one parameter of class or enumeration type}} } +namespace GH92275 { + +template +struct constant{}; + +template +auto operator *(constant) +{ return constant<(*x)>{}; } + +} + #endif diff --git a/clang/test/SemaCXX/recovery-expr-type.cpp b/clang/test/SemaCXX/recovery-expr-type.cpp index 479039f284799..5a42a11b82da5 100644 --- a/clang/test/SemaCXX/recovery-expr-type.cpp +++ b/clang/test/SemaCXX/recovery-expr-type.cpp @@ -1,3 +1,5 @@ +// RUN: %clang_cc1 -triple=x86_64-unknown-unknown -o - %s -std=gnu++17 -fsyntax-only -verify -fexperimental-new-constant-interpreter +// RUN: %clang_cc1 -triple=x86_64-unknown-unknown -o - %s -std=gnu++20 -fsyntax-only -verify -fexperimental-new-constant-interpreter // RUN: %clang_cc1 -triple=x86_64-unknown-unknown -o - %s -std=gnu++17 -fsyntax-only -verify // RUN: %clang_cc1 -triple=x86_64-unknown-unknown -o - %s -std=gnu++20 -fsyntax-only -verify diff --git a/clang/test/SemaCXX/source_location.cpp b/clang/test/SemaCXX/source_location.cpp index e87d95577ebea..fcc9e0786b43c 100644 --- a/clang/test/SemaCXX/source_location.cpp +++ b/clang/test/SemaCXX/source_location.cpp @@ -885,3 +885,20 @@ auto g() { } } + +namespace GH92680 { + +struct IntConstuctible { + IntConstuctible(std::source_location = std::source_location::current()); +}; + +template +auto construct_at(IntConstuctible) -> decltype(IntConstuctible()) { + return {}; +} + +void test() { + construct_at({}); +} + +} diff --git a/clang/test/SemaCXX/typo-correction-builtin-func.cpp b/clang/test/SemaCXX/typo-correction-builtin-func.cpp new file mode 100644 index 0000000000000..8d369034d1be3 --- /dev/null +++ b/clang/test/SemaCXX/typo-correction-builtin-func.cpp @@ -0,0 +1,8 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s + +// Test that clang does not emit 'declared here' note for builtin functions that don't have a declaration in source. + +void t0() { + constexpr float A = __builtin_isinfinity(); // expected-error {{use of undeclared identifier '__builtin_isinfinity'; did you mean '__builtin_isfinite'?}} + // expected-error@-1 {{too few arguments to function call, expected 1, have 0}} +} diff --git a/clang/test/SemaCXX/warn-unsafe-buffer-usage-pragma-misuse.cpp b/clang/test/SemaCXX/warn-unsafe-buffer-usage-pragma-misuse.cpp index 126257e0fc477..106661491800b 100644 --- a/clang/test/SemaCXX/warn-unsafe-buffer-usage-pragma-misuse.cpp +++ b/clang/test/SemaCXX/warn-unsafe-buffer-usage-pragma-misuse.cpp @@ -18,8 +18,8 @@ void endUnopened(int *x) { } void wrongOption() { -#pragma clang unsafe_buffer_usage start // expected-error{{Expected 'begin' or 'end'}} -#pragma clang unsafe_buffer_usage close // expected-error{{Expected 'begin' or 'end'}} +#pragma clang unsafe_buffer_usage start // expected-error{{expected 'begin' or 'end'}} +#pragma clang unsafe_buffer_usage close // expected-error{{expected 'begin' or 'end'}} } void unclosed(int * p1) { diff --git a/clang/test/SemaObjC/unguarded-availability.m b/clang/test/SemaObjC/unguarded-availability.m index d0e23eabcb598..ecd91990174ae 100644 --- a/clang/test/SemaObjC/unguarded-availability.m +++ b/clang/test/SemaObjC/unguarded-availability.m @@ -177,16 +177,28 @@ void justAtAvailable(void) { #ifdef OBJCPP -int f(char) AVAILABLE_10_12; +int f(char) AVAILABLE_10_12; // #f_char_def int f(int); template int use_f() { - // FIXME: We should warn here! - return f(T()); + if (@available(macos 10.12, *)) { + return f(T()); // no warning expected + } else { + // expected-warning@#f_call {{'f' is only available on macOS 10.12 or newer}} + // expected-note@#f_char_inst {{in instantiation of function template specialization 'use_f' requested here}} + // expected-note@#f_char_def {{'f' has been marked as being introduced in macOS 10.12 here, but the deployment target is macOS 10.9}} + // expected-note@#f_call {{enclose 'f' in an @available check to silence this warning}} + return f(T()); // #f_call + } } int a = use_f(); -int b = use_f(); +int b = use_f(); // #f_char_inst + +int use_f2() AVAILABLE_10_12 { + int c = use_f(); + int d = use_f(); // no warning expected +} template int use_at_available() { if (@available(macos 10.12, *)) diff --git a/clang/test/SemaOpenCL/builtins-amdgcn-error.cl b/clang/test/SemaOpenCL/builtins-amdgcn-error.cl index b044763edcf00..7a550f026bc1b 100644 --- a/clang/test/SemaOpenCL/builtins-amdgcn-error.cl +++ b/clang/test/SemaOpenCL/builtins-amdgcn-error.cl @@ -155,8 +155,8 @@ void test_ds_fmaxf(local float *out, float src, int a) { void test_fence() { __builtin_amdgcn_fence(__ATOMIC_SEQ_CST + 1, "workgroup"); // expected-warning {{memory order argument to atomic operation is invalid}} __builtin_amdgcn_fence(__ATOMIC_ACQUIRE - 1, "workgroup"); // expected-warning {{memory order argument to atomic operation is invalid}} - __builtin_amdgcn_fence(4); // expected-error {{too few arguments to function call, expected 2}} - __builtin_amdgcn_fence(4, 4, 4); // expected-error {{too many arguments to function call, expected 2}} + __builtin_amdgcn_fence(4); // expected-error {{too few arguments to function call, expected at least 2, have 1}} + __builtin_amdgcn_fence(4, 4, 4); // expected-error {{incompatible integer to pointer conversion passing 'int' to parameter of type 'const char *'}} __builtin_amdgcn_fence(3.14, ""); // expected-warning {{implicit conversion from 'double' to 'unsigned int' changes value from 3.14 to 3}} __builtin_amdgcn_fence(__ATOMIC_ACQUIRE, 5); // expected-error {{incompatible integer to pointer conversion passing 'int' to parameter of type 'const char *'}} const char ptr[] = "workgroup"; diff --git a/clang/test/SemaOpenCL/builtins-amdgcn-gfx940-err.cl b/clang/test/SemaOpenCL/builtins-amdgcn-gfx940-err.cl new file mode 100644 index 0000000000000..487cc53e8ad8a --- /dev/null +++ b/clang/test/SemaOpenCL/builtins-amdgcn-gfx940-err.cl @@ -0,0 +1,14 @@ +// RUN: %clang_cc1 -cl-std=CL2.0 -O0 -triple amdgcn-unknown-unknown -target-cpu gfx940 -S -verify -o - %s +// REQUIRES: amdgpu-registered-target + +typedef unsigned int u32; + +void test_global_load_lds_unsupported_size(global u32* src, local u32 *dst, u32 size) { + __builtin_amdgcn_global_load_lds(src, dst, size, /*offset=*/0, /*aux=*/0); // expected-error{{expression is not an integer constant expression}} + __builtin_amdgcn_global_load_lds(src, dst, /*size=*/5, /*offset=*/0, /*aux=*/0); // expected-error{{invalid size value}} expected-note {{size must be 1, 2, or 4}} + __builtin_amdgcn_global_load_lds(src, dst, /*size=*/0, /*offset=*/0, /*aux=*/0); // expected-error{{invalid size value}} expected-note {{size must be 1, 2, or 4}} + __builtin_amdgcn_global_load_lds(src, dst, /*size=*/3, /*offset=*/0, /*aux=*/0); // expected-error{{invalid size value}} expected-note {{size must be 1, 2, or 4}} + __builtin_amdgcn_global_load_lds(src, dst, /*size=*/12, /*offset=*/0, /*aux=*/0); // expected-error{{invalid size value}} expected-note {{size must be 1, 2, or 4}} + __builtin_amdgcn_global_load_lds(src, dst, /*size=*/16, /*offset=*/0, /*aux=*/0); // expected-error{{invalid size value}} expected-note {{size must be 1, 2, or 4}} + __builtin_amdgcn_global_load_lds(src, dst, /*size=*/-1, /*offset=*/0, /*aux=*/0); // expected-error{{invalid size value}} expected-note {{size must be 1, 2, or 4}} +} diff --git a/clang/test/SemaOpenCL/vector_swizzle_length.cl b/clang/test/SemaOpenCL/vector_swizzle_length.cl index f36ae201205e0..b06cc126c3eca 100644 --- a/clang/test/SemaOpenCL/vector_swizzle_length.cl +++ b/clang/test/SemaOpenCL/vector_swizzle_length.cl @@ -5,6 +5,6 @@ typedef float float8 __attribute__((ext_vector_type(8))); void foo(void) { float8 f2 = (float8)(0, 0, 0, 0, 0, 0, 0, 0); - f2.s01234; // expected-error {{vector component access has invalid length 5. Supported: 1,2,3,4,8,16}} - f2.xyzxy; // expected-error {{vector component access has invalid length 5. Supported: 1,2,3,4,8,16}} + f2.s01234; // expected-error {{vector component access has invalid length 5; supported lengths are: 1,2,3,4,8,16}} + f2.xyzxy; // expected-error {{vector component access has invalid length 5; supported lengths are: 1,2,3,4,8,16}} } diff --git a/clang/test/SemaTemplate/cwg2398.cpp b/clang/test/SemaTemplate/cwg2398.cpp index 4cc946735a1e2..e3b5e575374d3 100644 --- a/clang/test/SemaTemplate/cwg2398.cpp +++ b/clang/test/SemaTemplate/cwg2398.cpp @@ -65,10 +65,13 @@ namespace class_template { template struct B; template