2 changes: 1 addition & 1 deletion bolt/test/X86/dwarf5-df-types-debug-names.test
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
; RUN: llvm-mc -dwarf-version=5 -filetype=obj -triple x86_64-unknown-linux %p/Inputs/dwarf5-df-types-debug-names-helper.s \
; RUN: -split-dwarf-file=helper.dwo -o helper.o
; RUN: %clang %cflags -gdwarf-5 -gsplit-dwarf=split main.o helper.o -o main.exe
; RUN: llvm-bolt main.exe -o main.exe.bolt --update-debug-sections
; RUN: llvm-bolt main.exe -o main.exe.bolt --update-debug-sections --debug-thread-count=4 --cu-processing-batch-size=4
; RUN: llvm-dwarfdump --debug-info -r 0 main.dwo.dwo > log.txt
; RUN: llvm-dwarfdump --debug-info -r 0 helper.dwo.dwo >> log.txt
; RUN: llvm-dwarfdump --debug-info --debug-names main.exe.bolt >> log.txt
Expand Down
2 changes: 1 addition & 1 deletion bolt/test/X86/dwarf5-df-types-modify-dwo-name-mixed.test
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
; RUN: llvm-mc -dwarf-version=5 -filetype=obj -triple x86_64-unknown-linux %p/Inputs/dwarf5-df-types-dup-helper.s \
; RUN: -split-dwarf-file=helper.dwo -o helper.o
; RUN: %clang %cflags -gdwarf-5 -gsplit-dwarf=split main.o helper.o -o main.exe
; RUN: llvm-bolt main.exe -o main.exe.bolt --update-debug-sections
; RUN: llvm-bolt main.exe -o main.exe.bolt --update-debug-sections --debug-thread-count=4 --cu-processing-batch-size=4
; RUN: llvm-dwarfdump --debug-info -r 0 main.exe.bolt > log.txt
; RUN: llvm-dwarfdump --debug-info -r 0 main.dwo.dwo >> log.txt
; RUN: llvm-dwarfdump --debug-info -r 0 helper.dwo.dwo >> log.txt
Expand Down
2 changes: 1 addition & 1 deletion bolt/test/X86/dwarf5-df-types-modify-dwo-name.test
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
; RUN: llvm-mc -dwarf-version=5 -filetype=obj -triple x86_64-unknown-linux %p/Inputs/dwarf5-df-types-debug-names-helper.s \
; RUN: -split-dwarf-file=helper.dwo -o helper.o
; RUN: %clang %cflags -gdwarf-5 -gsplit-dwarf=split main.o helper.o -o main.exe
; RUN: llvm-bolt main.exe -o main.exe.bolt --update-debug-sections
; RUN: llvm-bolt main.exe -o main.exe.bolt --update-debug-sections --debug-thread-count=4 --cu-processing-batch-size=4
; RUN: llvm-dwarfdump --debug-info -r 0 main.exe.bolt > log.txt
; RUN: llvm-dwarfdump --debug-info -r 0 main.dwo.dwo >> log.txt
; RUN: llvm-dwarfdump --debug-info -r 0 helper.dwo.dwo >> log.txt
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# RUN: llvm-mc -dwarf-version=4 -filetype=obj -triple x86_64-unknown-linux %p/Inputs/dwarf4-gdb-index-types-helper.s -o %thelpergdb.o
# RUN: %clang %cflags %tmaingdb.o %thelpergdb.o -o %tgdb.exe -Wl,-q
# RUN: llvm-objcopy %tgdb.exe --add-section=.gdb_index=%p/Inputs/dwarf5-dwarf4-gdb-index-types-v8.generted-gdb11.gdb-index
# RUN: llvm-bolt %tgdb.exe -o %tgdb.bolt --update-debug-sections
# RUN: llvm-bolt %tgdb.exe -o %tgdb.bolt --update-debug-sections --debug-thread-count=4 --cu-processing-batch-size=4
# RUN: llvm-dwarfdump --gdb-index %tgdb.bolt | FileCheck --check-prefix=POSTCHECK %s

## Tests that BOLT correctly handles gdb-index generated by GDB.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# RUN: llvm-mc -dwarf-version=4 -filetype=obj -triple x86_64-unknown-linux %p/Inputs/dwarf4-gdb-index-types-helper.s -o %thelpergdb.o
# RUN: %clang %cflags %tmaingdb.o %thelpergdb.o -o %tgdb.exe -Wl,-q
# RUN: llvm-objcopy %tgdb.exe --add-section=.gdb_index=%p/Inputs/dwarf5-dwarf4-gdb-index-types-v8.generted-gdb9.gdb-index
# RUN: llvm-bolt %tgdb.exe -o %tgdb.bolt --update-debug-sections
# RUN: llvm-bolt %tgdb.exe -o %tgdb.bolt --update-debug-sections --debug-thread-count=4 --cu-processing-batch-size=4
# RUN: llvm-dwarfdump --gdb-index %tgdb.bolt | FileCheck --check-prefix=POSTCHECK %s

## Tests that BOLT correctly handles gdb-index generated by GDB.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# RUN: llvm-mc -dwarf-version=5 -filetype=obj -triple x86_64-unknown-linux %p/Inputs/dwarf5-gdb-index-types-main.s -o %tmain.o
# RUN: llvm-mc -dwarf-version=4 -filetype=obj -triple x86_64-unknown-linux %p/Inputs/dwarf4-gdb-index-types-helper.s -o %thelper.o
# RUN: %clang %cflags %tmain.o %thelper.o -o %t.exe -Wl,-q -Wl,--gdb-index
# RUN: llvm-bolt %t.exe -o %t.bolt --update-debug-sections
# RUN: llvm-bolt %t.exe -o %t.bolt --update-debug-sections --debug-thread-count=4 --cu-processing-batch-size=4
# RUN: llvm-dwarfdump --gdb-index %t.bolt | FileCheck --check-prefix=POSTCHECK %s

## Tests that BOLT correctly handles gdb-index generated by LLD.
Expand Down
2 changes: 1 addition & 1 deletion bolt/test/X86/dwarf5-dwarf4-monolithic.test
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# RUN: llvm-mc -dwarf-version=5 -filetype=obj -triple x86_64-unknown-linux %p/Inputs/dwarf5-dwarf4-monolithic-helper1.s -o %t1.o
# RUN: llvm-mc -dwarf-version=4 -filetype=obj -triple x86_64-unknown-linux %p/Inputs/dwarf5-dwarf4-monolithic-helper2.s -o %t2.o
# RUN: %clang %cflags -dwarf-5 %tmain.o %t0.o %t1.o %t2.o -o %t.exe -Wl,-q
# RUN: llvm-bolt --always-convert-to-ranges %t.exe -o %t.bolt --update-debug-sections
# RUN: llvm-bolt --always-convert-to-ranges %t.exe -o %t.bolt --update-debug-sections --debug-thread-count=4 --cu-processing-batch-size=4
# RUN: llvm-dwarfdump --show-form --verbose --debug-info %t.exe | FileCheck --check-prefix=PRECHECK %s
# RUN: llvm-dwarfdump --show-form --verbose --debug-line %t.exe > %t_line.txt
# RUN: llvm-dwarfdump --show-form --verbose --debug-addr %t.bolt > %t.txt
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# RUN: llvm-mc -dwarf-version=5 -filetype=obj -triple x86_64-unknown-linux %p/Inputs/dwarf5-dwarf4-types-backward-forward-cross-reference-main.s -o %tmain.o
# RUN: llvm-mc -dwarf-version=4 -filetype=obj -triple x86_64-unknown-linux %p/Inputs/dwarf5-dwarf4-types-backward-forward-cross-reference-helper.s -o %thelper.o
# RUN: %clang %cflags %tmain.o %thelper.o -o %t.exe
# RUN: llvm-bolt %t.exe -o %t.bolt --update-debug-sections
# RUN: llvm-bolt %t.exe -o %t.bolt --update-debug-sections --debug-thread-count=4 --cu-processing-batch-size=4
# RUN: llvm-dwarfdump --show-form --verbose --debug-info %t.bolt | FileCheck --check-prefix=POSTCHECK %s
# RUN: llvm-dwarfdump --show-form --verbose --debug-addr %t.bolt | FileCheck --check-prefix=POSTCHECKADDR %s
# RUN: llvm-dwarfdump --show-form --verbose --debug-types %t.bolt | FileCheck --check-prefix=POSTCHECKTU %s
Expand Down
2 changes: 1 addition & 1 deletion bolt/test/X86/dwarf5-empty-arange.test
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# RUN: llvm-mc -dwarf-version=5 -filetype=obj -triple x86_64-unknown-linux %p/Inputs/dwarf5-empty-arange-main.s -o %tmain.o
# RUN: llvm-mc -dwarf-version=5 -filetype=obj -triple x86_64-unknown-linux %p/Inputs/dwarf5-empty-arange-helper.s -o %thelper.o
# RUN: %clang %cflags -dwarf-5 %tmain.o %thelper.o -o %t.exe -Wl,--entry=main -Wl,-q -Wl,-gc-sections
# RUN: llvm-bolt %t.exe -o %t.bolt --update-debug-sections
# RUN: llvm-bolt %t.exe -o %t.bolt --update-debug-sections --debug-thread-count=4 --cu-processing-batch-size=4
# RUN: llvm-dwarfdump --debug-aranges %t.bolt > %t.txt
# RUN: llvm-dwarfdump --debug-info -r 0 %t.bolt >> %t.txt
# RUN: cat %t.txt | FileCheck --check-prefix=POSTCHECK %s
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# RUN: llvm-mc -dwarf-version=5 -filetype=obj -triple x86_64-unknown-linux %p/Inputs/dwarf5-gdb-index-types-helper.s -o %thelpergdb.o
# RUN: %clang %cflags %tmaingdb.o %thelpergdb.o -o %tgdb.exe -Wl,-q
# RUN: llvm-objcopy %tgdb.exe --add-section=.gdb_index=%p/Inputs/dwarf5-gdb-index-types-v8.generted-gdb11.gdb-index
# RUN: llvm-bolt %tgdb.exe -o %tgdb.bolt --update-debug-sections
# RUN: llvm-bolt %tgdb.exe -o %tgdb.bolt --update-debug-sections --debug-thread-count=4 --cu-processing-batch-size=4
# RUN: llvm-dwarfdump --gdb-index %tgdb.bolt | FileCheck --check-prefix=POSTCHECK %s

## Tests that BOLT correctly handles gdb-index generated by GDB.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# RUN: llvm-mc -dwarf-version=5 -filetype=obj -triple x86_64-unknown-linux %p/Inputs/dwarf5-gdb-index-types-helper.s -o %thelpergdb.o
# RUN: %clang %cflags %tmaingdb.o %thelpergdb.o -o %tgdb.exe -Wl,-q
# RUN: llvm-objcopy %tgdb.exe --add-section=.gdb_index=%p/Inputs/dwarf5-gdb-index-types-v8.generted-gdb9.gdb-index
# RUN: llvm-bolt %tgdb.exe -o %tgdb.bolt --update-debug-sections
# RUN: llvm-bolt %tgdb.exe -o %tgdb.bolt --update-debug-sections --debug-thread-count=4 --cu-processing-batch-size=4
# RUN: llvm-dwarfdump --gdb-index %tgdb.bolt | FileCheck --check-prefix=POSTCHECK %s

## Tests that BOLT correctly handles gdb-index generated by GDB.
Expand Down
2 changes: 1 addition & 1 deletion bolt/test/X86/dwarf5-gdb-index-types-lld-generated.test
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# RUN: llvm-mc -dwarf-version=5 -filetype=obj -triple x86_64-unknown-linux %p/Inputs/dwarf5-gdb-index-types-main.s -o %tmain.o
# RUN: llvm-mc -dwarf-version=5 -filetype=obj -triple x86_64-unknown-linux %p/Inputs/dwarf5-gdb-index-types-helper.s -o %thelper.o
# RUN: %clang %cflags %tmain.o %thelper.o -o %t.exe -Wl,-q -Wl,--gdb-index
# RUN: llvm-bolt %t.exe -o %t.bolt --update-debug-sections
# RUN: llvm-bolt %t.exe -o %t.bolt --update-debug-sections --debug-thread-count=4 --cu-processing-batch-size=4
# RUN: llvm-dwarfdump --gdb-index %t.bolt | FileCheck --check-prefix=POSTCHECK %s

## Tests that BOLT correctly handles gdb-index generated by LLD.
Expand Down
2 changes: 1 addition & 1 deletion bolt/test/X86/dwarf5-locexpr-referrence.test
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# RUN: llvm-mc -dwarf-version=5 -filetype=obj -triple x86_64-unknown-linux %p/Inputs/dwarf5-locexpr-referrence-main.s -o %tmain.o
# RUN: llvm-mc -dwarf-version=5 -filetype=obj -triple x86_64-unknown-linux %p/Inputs/dwarf5-locexpr-referrence-helper.s -o %thelper.o
# RUN: %clang %cflags -dwarf-5 %tmain.o %thelper.o -o %t.exe -Wl,-q
# RUN: llvm-bolt %t.exe -o %t.bolt --update-debug-sections
# RUN: llvm-bolt %t.exe -o %t.bolt --update-debug-sections --debug-thread-count=4 --cu-processing-batch-size=4
# RUN: llvm-dwarfdump --show-form --verbose --debug-info %t.bolt | FileCheck --check-prefix=CHECK %s
# RUN: llvm-dwarfdump --show-form --verbose --debug-addr %t.bolt | FileCheck --check-prefix=CHECKADDR %s

Expand Down
2 changes: 1 addition & 1 deletion bolt/test/X86/dwarf5-loclist-offset-form.test
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# RUN: llvm-mc -dwarf-version=5 -filetype=obj -triple x86_64-unknown-linux %p/Inputs/dwarf5-loclist-offset-form-main.s -o %tmain.o
# RUN: llvm-mc -dwarf-version=5 -filetype=obj -triple x86_64-unknown-linux %p/Inputs/dwarf5-loclist-offset-form-helper.s -o %thelper.o
# RUN: %clang %cflags -dwarf-5 %tmain.o %thelper.o -o %t.exe -Wl,-q
# RUN: llvm-bolt %t.exe -o %t.bolt --update-debug-sections
# RUN: llvm-bolt %t.exe -o %t.bolt --update-debug-sections --debug-thread-count=4 --cu-processing-batch-size=4
# RUN: llvm-dwarfdump --show-form --verbose --debug-info %t.exe | FileCheck --check-prefix=PRECHECK %s
# RUN: llvm-dwarfdump --show-form --verbose --debug-addr %t.bolt > %t.txt
# RUN: llvm-dwarfdump --show-form --verbose --debug-info %t.bolt >> %t.txt
Expand Down
2 changes: 1 addition & 1 deletion bolt/test/X86/dwarf5-one-loclists-two-bases.test
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# RUN: llvm-mc -dwarf-version=5 -filetype=obj -triple x86_64-unknown-linux %p/Inputs/dwarf5_main.s -o %tmain.o
# RUN: llvm-mc -dwarf-version=5 -filetype=obj -triple x86_64-unknown-linux %p/Inputs/dwarf5-loc-base-no-loc-accesshelper.s -o %thelper.o
# RUN: %clang %cflags -dwarf-5 %tmain.o %thelper.o -o %t.exe -Wl,-q
# RUN: llvm-bolt %t.exe -o %t.bolt --update-debug-sections
# RUN: llvm-bolt %t.exe -o %t.bolt --update-debug-sections --debug-thread-count=4 --cu-processing-batch-size=4
# RUN: llvm-dwarfdump --show-form --verbose --debug-info %t.exe | FileCheck --check-prefix=PRECHECK %s
# RUN: llvm-dwarfdump --show-form --verbose --debug-addr %t.bolt > %t.txt
# RUN: llvm-dwarfdump --show-form --verbose --debug-info %t.bolt >> %t.txt
Expand Down
2 changes: 1 addition & 1 deletion bolt/test/X86/dwarf5-return-pc-form-addr.test
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# RUN: llvm-mc -dwarf-version=5 -filetype=obj -triple x86_64-unknown-linux %p/Inputs/dwarf5-return-pc-form-addr-main.s -o %tmain.o
# RUN: llvm-mc -dwarf-version=5 -filetype=obj -triple x86_64-unknown-linux %p/Inputs/dwarf5-return-pc-helper.s -o %thelper.o
# RUN: %clang %cflags -dwarf-5 %tmain.o %thelper.o -o %t.exe -Wl,-q
# RUN: llvm-bolt %t.exe -o %t.exe.bolt --update-debug-sections -reorder-blocks=reverse
# RUN: llvm-bolt %t.exe -o %t.exe.bolt --update-debug-sections -reorder-blocks=reverse --debug-thread-count=4 --cu-processing-batch-size=4
# RUN: llvm-dwarfdump --show-form --verbose --debug-info %t.exe > %tmain.txt
# RUN: llvm-objdump %t.exe --disassemble >> %tmain.txt
# RUN: llvm-dwarfdump --show-form --verbose --debug-info %t.exe.bolt > %tmainbolt.txt
Expand Down
2 changes: 1 addition & 1 deletion bolt/test/X86/dwarf5-return-pc.test
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# RUN: llvm-mc -dwarf-version=5 -filetype=obj -triple x86_64-unknown-linux %p/Inputs/dwarf5-return-pc-main.s -o %tmain.o
# RUN: llvm-mc -dwarf-version=5 -filetype=obj -triple x86_64-unknown-linux %p/Inputs/dwarf5-return-pc-helper.s -o %thelper.o
# RUN: %clang %cflags -dwarf-5 %tmain.o %thelper.o -o %t.exe -Wl,-q
# RUN: llvm-bolt %t.exe -o %t.exe.bolt --update-debug-sections -reorder-blocks=reverse
# RUN: llvm-bolt %t.exe -o %t.exe.bolt --update-debug-sections -reorder-blocks=reverse --debug-thread-count=4 --cu-processing-batch-size=4
# RUN: llvm-dwarfdump --show-form --verbose --debug-info %t.exe > %tmain.txt
# RUN: llvm-objdump %t.exe --disassemble >> %tmain.txt
# RUN: llvm-dwarfdump --show-form --verbose --debug-info %t.exe.bolt > %tmainbolt.txt
Expand Down
2 changes: 1 addition & 1 deletion bolt/test/X86/dwarf5-shared-str-offset-base.s
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# RUN: llvm-mc --filetype=obj --triple x86_64 %s -o %tmain.o --defsym MAIN=0
# RUN: llvm-mc --filetype=obj --triple x86_64 %s -o %thelper.o
# RUN: %clang %cflags %tmain.o %thelper.o -o %tmain.exe
# RUN: llvm-bolt %tmain.exe -o %tmain.exe.bolt --update-debug-sections
# RUN: llvm-bolt %tmain.exe -o %tmain.exe.bolt --update-debug-sections --debug-thread-count=4 --cu-processing-batch-size=4
# RUN: llvm-dwarfdump --debug-info %tmain.exe.bolt > %tout.text
# RUN: llvm-dwarfdump --show-section-sizes %tmain.exe >> %tout.text
# RUN: llvm-dwarfdump --show-section-sizes %tmain.exe.bolt >> %tout.text
Expand Down
2 changes: 1 addition & 1 deletion bolt/test/X86/dwarf5-split-dwarf4-monolithic.test
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# RUN: llvm-mc -dwarf-version=5 -filetype=obj -triple x86_64-unknown-linux -split-dwarf-file=helper1.dwo %p/Inputs/dwarf5-split-dwarf4-monolithic-helper1.s -o helper1.o
# RUN: llvm-mc -dwarf-version=4 -filetype=obj -triple x86_64-unknown-linux %p/Inputs/dwarf5-dwarf4-monolithic-helper2.s -o helper2.o
# RUN: %clang %cflags -dwarf-5 main.o helper0.o helper1.o helper2.o -o main.exe -Wl,-q
# RUN: llvm-bolt --always-convert-to-ranges main.exe -o main.bolt --update-debug-sections
# RUN: llvm-bolt --always-convert-to-ranges main.exe -o main.bolt --update-debug-sections --debug-thread-count=4 --cu-processing-batch-size=4
# RUN: llvm-dwarfdump --show-form --verbose --debug-info main.exe | FileCheck --check-prefix=PRECHECK %s
# RUN: llvm-dwarfdump --show-form --verbose --debug-line main.exe | FileCheck --check-prefix=PRECHECK-LINE %s
# RUN: llvm-dwarfdump --show-form --verbose --debug-addr main.bolt > boltout.txt
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# RUN: llvm-mc --split-dwarf-file=helper.dwo -dwarf-version=5 -filetype=obj -triple x86_64-unknown-linux %p/Inputs/dwarf5-split-gdb-index-types-helper.s -o helpergdb.o
# RUN: %clang %cflags maingdb.o helpergdb.o -o maingdb.exe -Wl,-q
# RUN: llvm-objcopy maingdb.exe --add-section=.gdb_index=%p/Inputs/dwarf5-split-gdb-index-types-v8.gdb-index
# RUN: llvm-bolt maingdb.exe -o maingdb.exe.bolt --update-debug-sections
# RUN: llvm-bolt maingdb.exe -o maingdb.exe.bolt --update-debug-sections --debug-thread-count=4 --cu-processing-batch-size=4
# RUN: llvm-dwarfdump --gdb-index maingdb.exe.bolt | FileCheck --check-prefix=POSTCHECK %s

## Tests that BOLT correctly handles gdb-index generated by GDB with split-dwarf DWARF4.
Expand Down
2 changes: 1 addition & 1 deletion bolt/test/X86/dwarf5-subprogram-multiple-ranges-cus.test
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# RUN: llvm-mc -dwarf-version=5 -filetype=obj -triple x86_64-unknown-linux %p/Inputs/dwarf5-subprogram-multiple-ranges-main.s -o %t1.o
# RUN: llvm-mc -dwarf-version=5 -filetype=obj -triple x86_64-unknown-linux %p/Inputs/dwarf5-subprogram-multiple-ranges-other.s -o %t2.o
# RUN: %clang %cflags %t1.o %t2.o -o %t.exe -Wl,-q
# RUN: llvm-bolt %t.exe -o %t.bolt --update-debug-sections
# RUN: llvm-bolt %t.exe -o %t.bolt --update-debug-sections --debug-thread-count=4 --cu-processing-batch-size=4
# RUN: llvm-objdump %t.bolt --disassemble > %t1.txt
# RUN: llvm-dwarfdump --show-form --verbose --debug-info %t.bolt >> %t1.txt
# RUN: cat %t1.txt | FileCheck --check-prefix=POSTCHECK %s
Expand Down
2 changes: 1 addition & 1 deletion bolt/test/X86/dwarf5-two-cu-str-offset-table.test
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# RUN: llvm-mc -dwarf-version=5 -filetype=obj -triple x86_64-unknown-linux %p/Inputs/dwarf5_main.s -o %tmain.o
# RUN: llvm-mc -dwarf-version=5 -filetype=obj -triple x86_64-unknown-linux %p/Inputs/dwarf5_helper.s -o %thelper.o
# RUN: %clang %cflags -dwarf-5 %tmain.o %thelper.o -o %t.exe -Wl,-q
# RUN: llvm-bolt %t.exe -o %t.bolt --update-debug-sections
# RUN: llvm-bolt %t.exe -o %t.bolt --update-debug-sections --debug-thread-count=4 --cu-processing-batch-size=4
# RUN: llvm-dwarfdump --show-form --verbose --debug-str-offsets %t.exe > %t.txt
# RUN: llvm-dwarfdump --show-form --verbose --debug-str-offsets %t.bolt >> %t.txt
# RUN: cat %t.txt | FileCheck --check-prefix=CHECK %s
Expand Down
2 changes: 1 addition & 1 deletion bolt/test/X86/dwarf5-two-loclists.test
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# RUN: llvm-mc -dwarf-version=5 -filetype=obj -triple x86_64-unknown-linux %p/Inputs/dwarf5_main.s -o %tmain.o
# RUN: llvm-mc -dwarf-version=5 -filetype=obj -triple x86_64-unknown-linux %p/Inputs/dwarf5_helper.s -o %thelper.o
# RUN: %clang %cflags -dwarf-5 %tmain.o %thelper.o -o %t.exe -Wl,-q
# RUN: llvm-bolt %t.exe -o %t.bolt --update-debug-sections
# RUN: llvm-bolt %t.exe -o %t.bolt --update-debug-sections --debug-thread-count=4 --cu-processing-batch-size=4
# RUN: llvm-dwarfdump --show-form --verbose --debug-info %t.exe | FileCheck --check-prefix=PRECHECK %s
# RUN: llvm-dwarfdump --show-form --verbose --debug-addr %t.bolt > %t.txt
# RUN: llvm-dwarfdump --show-form --verbose --debug-info %t.bolt >> %t.txt
Expand Down
2 changes: 1 addition & 1 deletion bolt/test/X86/dwarf5-two-rnglists.test
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# RUN: llvm-mc -dwarf-version=5 -filetype=obj -triple x86_64-unknown-linux %p/Inputs/dwarf5_main.s -o %tmain.o
# RUN: llvm-mc -dwarf-version=5 -filetype=obj -triple x86_64-unknown-linux %p/Inputs/dwarf5_helper.s -o %thelper.o
# RUN: %clang %cflags -dwarf-5 %tmain.o %thelper.o -o %t.exe -Wl,-q
# RUN: llvm-bolt --always-convert-to-ranges %t.exe -o %t.bolt --update-debug-sections
# RUN: llvm-bolt --always-convert-to-ranges %t.exe -o %t.bolt --update-debug-sections --debug-thread-count=4 --cu-processing-batch-size=4
# RUN: llvm-dwarfdump --show-form --verbose --debug-info %t.exe | FileCheck --check-prefix=PRECHECK %s
# RUN: llvm-dwarfdump --show-form --verbose --debug-addr %t.bolt > %t.txt
# RUN: llvm-dwarfdump --show-form --verbose --debug-info %t.bolt >> %t.txt
Expand Down
2 changes: 1 addition & 1 deletion bolt/test/X86/dwarf5-type-unit-no-cu-str-offset-table.test
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# RUN: llvm-mc -dwarf-version=5 -filetype=obj -triple x86_64-unknown-linux %p/Inputs/dwarf5-basic-cu.s -o %tmain.o
# RUN: llvm-mc -dwarf-version=5 -filetype=obj -triple x86_64-unknown-linux %p/Inputs/dwarf5-types-no-cu.s -o %thelper.o
# RUN: %clang %cflags %tmain.o %thelper.o -o %t.exe -Wl,-q
# RUN: llvm-bolt %t.exe -o %t.bolt --update-debug-sections
# RUN: llvm-bolt %t.exe -o %t.bolt --update-debug-sections --debug-thread-count=4 --cu-processing-batch-size=4
# RUN: llvm-dwarfdump --show-form --verbose --debug-str-offsets %t.exe | FileCheck -check-prefix=PRE-BOLT %s
# RUN: llvm-dwarfdump --show-form --verbose --debug-str-offsets %t.bolt | FileCheck -check-prefix=POST-BOLT %s

Expand Down
2 changes: 1 addition & 1 deletion bolt/test/X86/dwarf5-types-backward-cross-reference.s
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# RUN: llvm-mc -dwarf-version=5 -filetype=obj -triple x86_64-unknown-linux %s -o %t.o
# RUN: %clang %cflags -gdwarf-5 %t.o -o %t.exe
# RUN: llvm-bolt %t.exe -o %t.bolt --update-debug-sections
# RUN: llvm-bolt %t.exe -o %t.bolt --update-debug-sections --debug-thread-count=4 --cu-processing-batch-size=4
# RUN: llvm-dwarfdump --show-form --verbose --debug-info %t.bolt | FileCheck --check-prefix=POSTCHECK %s

## This test checks that BOLT handles backward cross CU references for dwarf5
Expand Down
2 changes: 1 addition & 1 deletion bolt/test/X86/dwarf5-types-debug-names.test
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
; RUN: llvm-mc -dwarf-version=5 -filetype=obj -triple x86_64-unknown-linux %p/Inputs/dwarf5-types-debug-names-main.s -o %tmain.o
; RUN: llvm-mc -dwarf-version=5 -filetype=obj -triple x86_64-unknown-linux %p/Inputs/dwarf5-types-debug-names-helper.s -o %thelper.o
; RUN: %clang %cflags -gdwarf-5 %tmain.o %thelper.o -o %tmain.exe
; RUN: llvm-bolt %tmain.exe -o %tmain.exe.bolt --update-debug-sections
; RUN: llvm-bolt %tmain.exe -o %tmain.exe.bolt --update-debug-sections --debug-thread-count=4 --cu-processing-batch-size=4
; RUN: llvm-dwarfdump --debug-info --debug-names %tmain.exe.bolt > %tlog.txt
; RUN: cat %tlog.txt | FileCheck -check-prefix=BOLT %s

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,10 @@ void RedundantSmartptrGetCheck::check(const MatchFinder::MatchResult &Result) {
StringRef SmartptrText = Lexer::getSourceText(
CharSourceRange::getTokenRange(Smartptr->getSourceRange()),
*Result.SourceManager, getLangOpts());
// Check if the last two characters are "->" and remove them
if (SmartptrText.ends_with("->")) {
SmartptrText = SmartptrText.drop_back(2);
}
// Replace foo->get() with *foo, and foo.get() with foo.
std::string Replacement = Twine(IsPtrToPtr ? "*" : "", SmartptrText).str();
diag(GetCall->getBeginLoc(), "redundant get() call on smart pointer")
Expand Down
4 changes: 4 additions & 0 deletions clang-tools-extra/docs/ReleaseNotes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,10 @@ New check aliases
Changes in existing checks
^^^^^^^^^^^^^^^^^^^^^^^^^^

- Improved :doc:`readability-redundant-smartptr-get
<clang-tidy/checks/readability/redundant-smartptr-get>` check to
remove `->`, when reduntant `get()` is removed.

Removed checks
^^^^^^^^^^^^^^

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,23 @@ struct shared_ptr {
explicit operator bool() const noexcept;
};

template <typename T>
struct vector {
vector();
bool operator==(const vector<T>& other) const;
bool operator!=(const vector<T>& other) const;
unsigned long size() const;
bool empty() const;

using iterator = T*;

iterator begin();
iterator end();

T* data;
unsigned long sz;
};

} // namespace std

struct Bar {
Expand Down Expand Up @@ -235,3 +252,34 @@ void Negative() {
if (MACRO(x) == nullptr)
;
}

void test_redundant_get() {
std::vector<std::shared_ptr<int>> v;
auto f = [](int) {};
for (auto i = v.begin(); i != v.end(); ++i) {
f(*i->get());
// CHECK-MESSAGES: :[[@LINE-1]]:8: warning: redundant get() call
// CHECK-FIXES: f(**i);
}
}

struct Inner {
int a;
int *getValue() { return &a; }
};

struct Example {
Inner inner;
Inner* get() { return &inner; }
int *getValue() { return inner.getValue(); }
};

void test_redundant_get_with_member() {
std::vector<std::shared_ptr<Example>> v;
auto f = [](int) {};
for (auto i = v.begin(); i != v.end(); ++i) {
f(*(*i).get()->get()->getValue());
// CHECK-MESSAGES: :[[@LINE-1]]:8: warning: redundant get() call
// CHECK-FIXES: f(**i->get()->getValue());
}
}
15 changes: 12 additions & 3 deletions clang/docs/ReleaseNotes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ sections with improvements to Clang's support for those languages.

C++ Language Changes
--------------------
- Allow single element access of GCC vector/ext_vector_type object to be
constant expression. Supports the `V.xyzw` syntax and other tidbits
- Allow single element access of GCC vector/ext_vector_type object to be
constant expression. Supports the `V.xyzw` syntax and other tidbits
as seen in OpenCL. Selecting multiple elements is left as a future work.

C++17 Feature Support
Expand All @@ -101,6 +101,16 @@ C++2c Feature Support
Resolutions to C++ Defect Reports
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

- Allow calling initializer list constructors from initializer lists with
a single element of the same type instead of always copying.
(`CWG2137: List-initialization from object of same type <https://cplusplus.github.io/CWG/issues/2137.html>`)

- Speculative resolution for CWG2311 implemented so that the implementation of CWG2137 doesn't remove
previous cases where guaranteed copy elision was done. Given a prvalue ``e`` of class type
``T``, ``T{e}`` will try to resolve an initializer list constructor and will use it if successful.
Otherwise, if there is no initializer list constructor, the copy will be elided as if it was ``T(e)``.
(`CWG2311: Missed case for guaranteed copy elision <https://cplusplus.github.io/CWG/issues/2311.html>`)

C Language Changes
------------------

Expand Down Expand Up @@ -156,7 +166,6 @@ Improvements to Clang's diagnostics
- Clang now diagnoses undefined behavior in constant expressions more consistently. This includes invalid shifts, and signed overflow in arithmetic.

- -Wdangling-assignment-gsl is enabled by default.
- Clang now does a better job preserving the template arguments as written when specializing concepts.
- Clang now always preserves the template arguments as written used
to specialize template type aliases.

Expand Down
72 changes: 34 additions & 38 deletions clang/include/clang/AST/Type.h
Original file line number Diff line number Diff line change
Expand Up @@ -2134,6 +2134,23 @@ class alignas(TypeAlignment) Type : public ExtQualsTypeCommonBase {
unsigned hasTypeDifferentFromDecl : 1;
};

class TemplateTypeParmTypeBitfields {
friend class TemplateTypeParmType;

LLVM_PREFERRED_TYPE(TypeBitfields)
unsigned : NumTypeBits;

/// The depth of the template parameter.
unsigned Depth : 15;

/// Whether this is a template parameter pack.
LLVM_PREFERRED_TYPE(bool)
unsigned ParameterPack : 1;

/// The index of the template parameter.
unsigned Index : 16;
};

class SubstTemplateTypeParmTypeBitfields {
friend class SubstTemplateTypeParmType;

Expand Down Expand Up @@ -2257,6 +2274,7 @@ class alignas(TypeAlignment) Type : public ExtQualsTypeCommonBase {
TypeWithKeywordBitfields TypeWithKeywordBits;
ElaboratedTypeBitfields ElaboratedTypeBits;
VectorTypeBitfields VectorTypeBits;
TemplateTypeParmTypeBitfields TemplateTypeParmTypeBits;
SubstTemplateTypeParmTypeBitfields SubstTemplateTypeParmTypeBits;
SubstTemplateTypeParmPackTypeBitfields SubstTemplateTypeParmPackTypeBits;
TemplateSpecializationTypeBitfields TemplateSpecializationTypeBits;
Expand Down Expand Up @@ -6135,52 +6153,30 @@ class BTFTagAttributedType : public Type, public llvm::FoldingSetNode {
class TemplateTypeParmType : public Type, public llvm::FoldingSetNode {
friend class ASTContext; // ASTContext creates these

// Helper data collector for canonical types.
struct CanonicalTTPTInfo {
unsigned Depth : 15;
unsigned ParameterPack : 1;
unsigned Index : 16;
};

union {
// Info for the canonical type.
CanonicalTTPTInfo CanTTPTInfo;

// Info for the non-canonical type.
TemplateTypeParmDecl *TTPDecl;
};
// The associated TemplateTypeParmDecl for the non-canonical type.
TemplateTypeParmDecl *TTPDecl;

/// Build a non-canonical type.
TemplateTypeParmType(TemplateTypeParmDecl *TTPDecl, QualType Canon)
TemplateTypeParmType(unsigned D, unsigned I, bool PP,
TemplateTypeParmDecl *TTPDecl, QualType Canon)
: Type(TemplateTypeParm, Canon,
TypeDependence::DependentInstantiation |
(Canon->getDependence() & TypeDependence::UnexpandedPack)),
TTPDecl(TTPDecl) {}

/// Build the canonical type.
TemplateTypeParmType(unsigned D, unsigned I, bool PP)
: Type(TemplateTypeParm, QualType(this, 0),
TypeDependence::DependentInstantiation |
(PP ? TypeDependence::UnexpandedPack : TypeDependence::None)) {
CanTTPTInfo.Depth = D;
CanTTPTInfo.Index = I;
CanTTPTInfo.ParameterPack = PP;
}

const CanonicalTTPTInfo& getCanTTPTInfo() const {
QualType Can = getCanonicalTypeInternal();
return Can->castAs<TemplateTypeParmType>()->CanTTPTInfo;
(PP ? TypeDependence::UnexpandedPack : TypeDependence::None)),
TTPDecl(TTPDecl) {
assert(!TTPDecl == Canon.isNull());
TemplateTypeParmTypeBits.Depth = D;
TemplateTypeParmTypeBits.Index = I;
TemplateTypeParmTypeBits.ParameterPack = PP;
}

public:
unsigned getDepth() const { return getCanTTPTInfo().Depth; }
unsigned getIndex() const { return getCanTTPTInfo().Index; }
bool isParameterPack() const { return getCanTTPTInfo().ParameterPack; }

TemplateTypeParmDecl *getDecl() const {
return isCanonicalUnqualified() ? nullptr : TTPDecl;
unsigned getDepth() const { return TemplateTypeParmTypeBits.Depth; }
unsigned getIndex() const { return TemplateTypeParmTypeBits.Index; }
bool isParameterPack() const {
return TemplateTypeParmTypeBits.ParameterPack;
}

TemplateTypeParmDecl *getDecl() const { return TTPDecl; }

IdentifierInfo *getIdentifier() const;

bool isSugared() const { return false; }
Expand Down
2 changes: 2 additions & 0 deletions clang/include/clang/Basic/DiagnosticSemaKinds.td
Original file line number Diff line number Diff line change
Expand Up @@ -11693,6 +11693,8 @@ def err_module_not_defined : Error<
def err_module_redeclaration : Error<
"translation unit contains multiple module declarations">;
def note_prev_module_declaration : Note<"previous module declaration is here">;
def err_module_declaration_missing : Error<
"missing 'export module' declaration in module interface unit">;
def err_module_declaration_missing_after_global_module_introducer : Error<
"missing 'module' declaration at end of global module fragment "
"introduced here">;
Expand Down
46 changes: 23 additions & 23 deletions clang/include/clang/Basic/DiagnosticSerializationKinds.td
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,20 @@ def note_pch_rebuild_required : Note<"please rebuild precompiled header '%0'">;
def note_module_cache_path : Note<
"after modifying system headers, please delete the module cache at '%0'">;

def err_pch_targetopt_mismatch : Error<
"PCH file was compiled for the %0 '%1' but the current translation "
"unit is being compiled for target '%2'">;
def err_pch_targetopt_feature_mismatch : Error<
"%select{AST file was|current translation unit is}0 compiled with the target "
"feature '%1' but the %select{current translation unit is|AST file was}0 "
def err_ast_file_targetopt_mismatch : Error<
"AST file '%0' was compiled for the %1 '%2' but the current translation "
"unit is being compiled for target '%3'">;
def err_ast_file_targetopt_feature_mismatch : Error<
"%select{AST file '%1' was|current translation unit is}0 compiled with the target "
"feature '%2' but the %select{current translation unit is|AST file '%1' was}0 "
"not">;
def err_pch_langopt_mismatch : Error<"%0 was %select{disabled|enabled}1 in "
"PCH file but is currently %select{disabled|enabled}2">;
def err_pch_langopt_value_mismatch : Error<
"%0 differs in PCH file vs. current file">;
def err_pch_diagopt_mismatch : Error<"%0 is currently enabled, but was not in "
"the PCH file">;
def err_pch_modulecache_mismatch : Error<"PCH was compiled with module cache "
def err_ast_file_langopt_mismatch : Error<"%0 was %select{disabled|enabled}1 in "
"AST file '%3' but is currently %select{disabled|enabled}2">;
def err_ast_file_langopt_value_mismatch : Error<
"%0 differs in AST file '%1' vs. current file">;
def err_ast_file_diagopt_mismatch : Error<"%0 is currently enabled, but was not in "
"the AST file '%1'">;
def err_ast_file_modulecache_mismatch : Error<"AST file '%2' was compiled with module cache "
"path '%0', but the path is currently '%1'">;
def warn_pch_vfsoverlay_mismatch : Warning<
"PCH was compiled with different VFS overlay files than are currently in use">,
Expand Down Expand Up @@ -99,19 +99,19 @@ def err_module_different_modmap : Error<
"module '%0' %select{uses|does not use}1 additional module map '%2'"
"%select{| not}1 used when the module was built">;

def err_pch_macro_def_undef : Error<
"macro '%0' was %select{defined|undef'd}1 in the precompiled header but "
def err_ast_file_macro_def_undef : Error<
"macro '%0' was %select{defined|undef'd}1 in the AST file '%2' but "
"%select{undef'd|defined}1 on the command line">;
def err_pch_macro_def_conflict : Error<
"definition of macro '%0' differs between the precompiled header ('%1') "
def err_ast_file_macro_def_conflict : Error<
"definition of macro '%0' differs between the AST file '%3' ('%1') "
"and the command line ('%2')">;
def err_pch_undef : Error<
"%select{command line contains|precompiled header was built with}0 "
"'-undef' but %select{precompiled header was not built with it|"
def err_ast_file_undef : Error<
"%select{command line contains|AST file '%1' was built with}0 "
"'-undef' but %select{AST file '%1' was not built with it|"
"it is not present on the command line}0">;
def err_pch_pp_detailed_record : Error<
"%select{command line contains|precompiled header was built with}0 "
"'-detailed-preprocessing-record' but %select{precompiled header was not "
def err_ast_file_pp_detailed_record : Error<
"%select{command line contains|AST file '%1' was built with}0 "
"'-detailed-preprocessing-record' but %select{AST file '%1' was not "
"built with it|it is not present on the command line}0">;

def err_module_odr_violation_missing_decl : Error<
Expand Down
6 changes: 3 additions & 3 deletions clang/include/clang/Sema/Template.h
Original file line number Diff line number Diff line change
Expand Up @@ -234,8 +234,7 @@ enum class TemplateSubstitutionKind : char {
/// Replaces the current 'innermost' level with the provided argument list.
/// This is useful for type deduction cases where we need to get the entire
/// list from the AST, but then add the deduced innermost list.
void replaceInnermostTemplateArguments(Decl *AssociatedDecl, ArgList Args,
bool Final = false) {
void replaceInnermostTemplateArguments(Decl *AssociatedDecl, ArgList Args) {
assert((!TemplateArgumentLists.empty() || NumRetainedOuterLevels) &&
"Replacing in an empty list?");

Expand All @@ -247,7 +246,8 @@ enum class TemplateSubstitutionKind : char {
TemplateArgumentLists[0].Args = Args;
} else {
--NumRetainedOuterLevels;
TemplateArgumentLists.push_back({{AssociatedDecl, Final}, Args});
TemplateArgumentLists.push_back(
{{AssociatedDecl, /*Final=*/false}, Args});
}
}

Expand Down
72 changes: 45 additions & 27 deletions clang/include/clang/Serialization/ASTReader.h
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ class ASTReaderListener {
///
/// \returns true to indicate the options are invalid or false otherwise.
virtual bool ReadLanguageOptions(const LangOptions &LangOpts,
bool Complain,
StringRef ModuleFilename, bool Complain,
bool AllowCompatibleDifferences) {
return false;
}
Expand All @@ -139,7 +139,8 @@ class ASTReaderListener {
///
/// \returns true to indicate the target options are invalid, or false
/// otherwise.
virtual bool ReadTargetOptions(const TargetOptions &TargetOpts, bool Complain,
virtual bool ReadTargetOptions(const TargetOptions &TargetOpts,
StringRef ModuleFilename, bool Complain,
bool AllowCompatibleDifferences) {
return false;
}
Expand All @@ -150,7 +151,7 @@ class ASTReaderListener {
/// otherwise.
virtual bool
ReadDiagnosticOptions(IntrusiveRefCntPtr<DiagnosticOptions> DiagOpts,
bool Complain) {
StringRef ModuleFilename, bool Complain) {
return false;
}

Expand All @@ -172,6 +173,7 @@ class ASTReaderListener {
/// \returns true to indicate the header search options are invalid, or false
/// otherwise.
virtual bool ReadHeaderSearchOptions(const HeaderSearchOptions &HSOpts,
StringRef ModuleFilename,
StringRef SpecificModuleCachePath,
bool Complain) {
return false;
Expand Down Expand Up @@ -200,6 +202,7 @@ class ASTReaderListener {
/// \returns true to indicate the preprocessor options are invalid, or false
/// otherwise.
virtual bool ReadPreprocessorOptions(const PreprocessorOptions &PPOpts,
StringRef ModuleFilename,
bool ReadMacros, bool Complain,
std::string &SuggestedPredefines) {
return false;
Expand Down Expand Up @@ -262,20 +265,24 @@ class ChainedASTReaderListener : public ASTReaderListener {
bool ReadFullVersionInformation(StringRef FullVersion) override;
void ReadModuleName(StringRef ModuleName) override;
void ReadModuleMapFile(StringRef ModuleMapPath) override;
bool ReadLanguageOptions(const LangOptions &LangOpts, bool Complain,
bool ReadLanguageOptions(const LangOptions &LangOpts,
StringRef ModuleFilename, bool Complain,
bool AllowCompatibleDifferences) override;
bool ReadTargetOptions(const TargetOptions &TargetOpts, bool Complain,
bool ReadTargetOptions(const TargetOptions &TargetOpts,
StringRef ModuleFilename, bool Complain,
bool AllowCompatibleDifferences) override;
bool ReadDiagnosticOptions(IntrusiveRefCntPtr<DiagnosticOptions> DiagOpts,
bool Complain) override;
StringRef ModuleFilename, bool Complain) override;
bool ReadFileSystemOptions(const FileSystemOptions &FSOpts,
bool Complain) override;

bool ReadHeaderSearchOptions(const HeaderSearchOptions &HSOpts,
StringRef ModuleFilename,
StringRef SpecificModuleCachePath,
bool Complain) override;
bool ReadPreprocessorOptions(const PreprocessorOptions &PPOpts,
bool ReadMacros, bool Complain,
StringRef ModuleFilename, bool ReadMacros,
bool Complain,
std::string &SuggestedPredefines) override;

void ReadCounter(const serialization::ModuleFile &M, unsigned Value) override;
Expand All @@ -299,16 +306,20 @@ class PCHValidator : public ASTReaderListener {
PCHValidator(Preprocessor &PP, ASTReader &Reader)
: PP(PP), Reader(Reader) {}

bool ReadLanguageOptions(const LangOptions &LangOpts, bool Complain,
bool ReadLanguageOptions(const LangOptions &LangOpts,
StringRef ModuleFilename, bool Complain,
bool AllowCompatibleDifferences) override;
bool ReadTargetOptions(const TargetOptions &TargetOpts, bool Complain,
bool ReadTargetOptions(const TargetOptions &TargetOpts,
StringRef ModuleFilename, bool Complain,
bool AllowCompatibleDifferences) override;
bool ReadDiagnosticOptions(IntrusiveRefCntPtr<DiagnosticOptions> DiagOpts,
bool Complain) override;
StringRef ModuleFilename, bool Complain) override;
bool ReadPreprocessorOptions(const PreprocessorOptions &PPOpts,
bool ReadMacros, bool Complain,
StringRef ModuleFilename, bool ReadMacros,
bool Complain,
std::string &SuggestedPredefines) override;
bool ReadHeaderSearchOptions(const HeaderSearchOptions &HSOpts,
StringRef ModuleFilename,
StringRef SpecificModuleCachePath,
bool Complain) override;
void ReadCounter(const serialization::ModuleFile &M, unsigned Value) override;
Expand All @@ -325,7 +336,8 @@ class SimpleASTReaderListener : public ASTReaderListener {
SimpleASTReaderListener(Preprocessor &PP) : PP(PP) {}

bool ReadPreprocessorOptions(const PreprocessorOptions &PPOpts,
bool ReadMacros, bool Complain,
StringRef ModuleFilename, bool ReadMacros,
bool Complain,
std::string &SuggestedPredefines) override;
};

Expand Down Expand Up @@ -1366,10 +1378,12 @@ class ASTReader
SmallVectorImpl<ImportedModule> &Loaded,
const ModuleFile *ImportedBy,
unsigned ClientLoadCapabilities);
static ASTReadResult ReadOptionsBlock(
llvm::BitstreamCursor &Stream, unsigned ClientLoadCapabilities,
bool AllowCompatibleConfigurationMismatch, ASTReaderListener &Listener,
std::string &SuggestedPredefines);
static ASTReadResult
ReadOptionsBlock(llvm::BitstreamCursor &Stream, StringRef Filename,
unsigned ClientLoadCapabilities,
bool AllowCompatibleConfigurationMismatch,
ASTReaderListener &Listener,
std::string &SuggestedPredefines);

/// Read the unhashed control block.
///
Expand All @@ -1378,12 +1392,11 @@ class ASTReader
ASTReadResult readUnhashedControlBlock(ModuleFile &F, bool WasImportedBy,
unsigned ClientLoadCapabilities);

static ASTReadResult
readUnhashedControlBlockImpl(ModuleFile *F, llvm::StringRef StreamData,
unsigned ClientLoadCapabilities,
bool AllowCompatibleConfigurationMismatch,
ASTReaderListener *Listener,
bool ValidateDiagnosticOptions);
static ASTReadResult readUnhashedControlBlockImpl(
ModuleFile *F, llvm::StringRef StreamData, StringRef Filename,
unsigned ClientLoadCapabilities,
bool AllowCompatibleConfigurationMismatch, ASTReaderListener *Listener,
bool ValidateDiagnosticOptions);

llvm::Error ReadASTBlock(ModuleFile &F, unsigned ClientLoadCapabilities);
llvm::Error ReadExtensionBlock(ModuleFile &F);
Expand All @@ -1396,21 +1409,26 @@ class ASTReader
unsigned ClientLoadCapabilities);
llvm::Error ReadSubmoduleBlock(ModuleFile &F,
unsigned ClientLoadCapabilities);
static bool ParseLanguageOptions(const RecordData &Record, bool Complain,
static bool ParseLanguageOptions(const RecordData &Record,
StringRef ModuleFilename, bool Complain,
ASTReaderListener &Listener,
bool AllowCompatibleDifferences);
static bool ParseTargetOptions(const RecordData &Record, bool Complain,
static bool ParseTargetOptions(const RecordData &Record,
StringRef ModuleFilename, bool Complain,
ASTReaderListener &Listener,
bool AllowCompatibleDifferences);
static bool ParseDiagnosticOptions(const RecordData &Record, bool Complain,
static bool ParseDiagnosticOptions(const RecordData &Record,
StringRef ModuleFilename, bool Complain,
ASTReaderListener &Listener);
static bool ParseFileSystemOptions(const RecordData &Record, bool Complain,
ASTReaderListener &Listener);
static bool ParseHeaderSearchOptions(const RecordData &Record, bool Complain,
static bool ParseHeaderSearchOptions(const RecordData &Record,
StringRef ModuleFilename, bool Complain,
ASTReaderListener &Listener);
static bool ParseHeaderSearchPaths(const RecordData &Record, bool Complain,
ASTReaderListener &Listener);
static bool ParsePreprocessorOptions(const RecordData &Record, bool Complain,
static bool ParsePreprocessorOptions(const RecordData &Record,
StringRef ModuleFilename, bool Complain,
ASTReaderListener &Listener,
std::string &SuggestedPredefines);

Expand Down
6 changes: 3 additions & 3 deletions clang/lib/AST/ASTContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5300,15 +5300,15 @@ QualType ASTContext::getTemplateTypeParmType(unsigned Depth, unsigned Index,
if (TTPDecl) {
QualType Canon = getTemplateTypeParmType(Depth, Index, ParameterPack);
TypeParm = new (*this, alignof(TemplateTypeParmType))
TemplateTypeParmType(TTPDecl, Canon);
TemplateTypeParmType(Depth, Index, ParameterPack, TTPDecl, Canon);

TemplateTypeParmType *TypeCheck
= TemplateTypeParmTypes.FindNodeOrInsertPos(ID, InsertPos);
assert(!TypeCheck && "Template type parameter canonical type broken");
(void)TypeCheck;
} else
TypeParm = new (*this, alignof(TemplateTypeParmType))
TemplateTypeParmType(Depth, Index, ParameterPack);
TypeParm = new (*this, alignof(TemplateTypeParmType)) TemplateTypeParmType(
Depth, Index, ParameterPack, /*TTPDecl=*/nullptr, /*Canon=*/QualType());

Types.push_back(TypeParm);
TemplateTypeParmTypes.InsertNode(TypeParm, InsertPos);
Expand Down
14 changes: 7 additions & 7 deletions clang/lib/AST/Decl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -583,12 +583,6 @@ static bool isSingleLineLanguageLinkage(const Decl &D) {
return false;
}

static bool isDeclaredInModuleInterfaceOrPartition(const NamedDecl *D) {
if (auto *M = D->getOwningModule())
return M->isInterfaceOrPartition();
return false;
}

static LinkageInfo getExternalLinkageFor(const NamedDecl *D) {
return LinkageInfo::external();
}
Expand Down Expand Up @@ -642,7 +636,13 @@ LinkageComputer::getLVForNamespaceScopeDecl(const NamedDecl *D,
// (There is no equivalent in C99.)
if (Context.getLangOpts().CPlusPlus && Var->getType().isConstQualified() &&
!Var->getType().isVolatileQualified() && !Var->isInline() &&
!isDeclaredInModuleInterfaceOrPartition(Var) &&
![Var]() {
// Check if it is module purview except private module fragment
// and implementation unit.
if (auto *M = Var->getOwningModule())
return M->isInterfaceOrPartition() || M->isImplicitGlobalModule();
return false;
}() &&
!isa<VarTemplateSpecializationDecl>(Var) &&
!Var->getDescribedVarTemplate()) {
const VarDecl *PrevVar = Var->getPreviousDecl();
Expand Down
4 changes: 1 addition & 3 deletions clang/lib/AST/ItaniumMangle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2727,8 +2727,6 @@ void CXXNameMangler::mangleQualifiers(Qualifiers Quals, const DependentAddressSp
// <type> ::= U <OpenCL-addrspace>
// <type> ::= U <CUDA-addrspace>

llvm::Triple Triple = getASTContext().getTargetInfo().getTriple();

SmallString<64> ASString;
LangAS AS = Quals.getAddressSpace();

Expand Down Expand Up @@ -2800,7 +2798,7 @@ void CXXNameMangler::mangleQualifiers(Qualifiers Quals, const DependentAddressSp
// For z/OS, there are no special mangling rules applied to the ptr32
// qualifier. Ex: void foo(int * __ptr32 p) -> _Z3f2Pi. The mangling for
// "p" is treated the same as a regular integer pointer.
if (!Triple.isOSzOS())
if (!getASTContext().getTargetInfo().getTriple().isOSzOS())
ASString = "ptr32_uptr";
break;
case LangAS::ptr64:
Expand Down
72 changes: 41 additions & 31 deletions clang/lib/Basic/Targets/PPC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -469,21 +469,36 @@ void PPCTargetInfo::getTargetDefines(const LangOptions &Opts,
// set of options.
static bool ppcUserFeaturesCheck(DiagnosticsEngine &Diags,
const std::vector<std::string> &FeaturesVec) {
// Cannot allow soft-float with Altivec.
if (llvm::is_contained(FeaturesVec, "-hard-float") &&
llvm::is_contained(FeaturesVec, "+altivec")) {
Diags.Report(diag::err_opt_not_valid_with_opt) << "-msoft-float"
<< "-maltivec";
auto FindVSXSubfeature = [&](StringRef Feature, StringRef SubOption,
StringRef Option) {
if (llvm::is_contained(FeaturesVec, Feature)) {
Diags.Report(diag::err_opt_not_valid_with_opt) << SubOption << Option;
return true;
}
return false;
}
};

// Cannot allow soft-float with VSX.
if (llvm::is_contained(FeaturesVec, "-hard-float") &&
llvm::is_contained(FeaturesVec, "+vsx")) {
Diags.Report(diag::err_opt_not_valid_with_opt) << "-msoft-float"
<< "-mvsx";
return false;
// Cannot allow soft-float with VSX, Altivec, or any
// VSX subfeatures.
bool Found = false;
if (llvm::is_contained(FeaturesVec, "-hard-float")) {
Found |= FindVSXSubfeature("+vsx", "-mvsx", "-msoft-float");
Found |= FindVSXSubfeature("+altivec", "-maltivec", "-msoft-float");
Found |=
FindVSXSubfeature("+power8-vector", "-mpower8-vector", "-msoft-float");
Found |= FindVSXSubfeature("+direct-move", "-mdirect-move", "-msoft-float");
Found |= FindVSXSubfeature("+float128", "-mfloat128", "-msoft-float");
Found |=
FindVSXSubfeature("+power9-vector", "-mpower9-vector", "-msoft-float");
Found |= FindVSXSubfeature("+paired-vector-memops",
"-mpaired-vector-memops", "-msoft-float");
Found |= FindVSXSubfeature("+mma", "-mmma", "-msoft-float");
Found |= FindVSXSubfeature("+crypto", "-mcrypto", "-msoft-float");
Found |= FindVSXSubfeature("+power10-vector", "-mpower10-vector",
"-msoft-float");
}
if (Found)
return false;

// Cannot allow VSX with no Altivec.
if (llvm::is_contained(FeaturesVec, "+vsx") &&
Expand All @@ -497,21 +512,14 @@ static bool ppcUserFeaturesCheck(DiagnosticsEngine &Diags,
if (!llvm::is_contained(FeaturesVec, "-vsx"))
return true;

auto FindVSXSubfeature = [&](StringRef Feature, StringRef Option) {
if (llvm::is_contained(FeaturesVec, Feature)) {
Diags.Report(diag::err_opt_not_valid_with_opt) << Option << "-mno-vsx";
return true;
}
return false;
};

bool Found = FindVSXSubfeature("+power8-vector", "-mpower8-vector");
Found |= FindVSXSubfeature("+direct-move", "-mdirect-move");
Found |= FindVSXSubfeature("+float128", "-mfloat128");
Found |= FindVSXSubfeature("+power9-vector", "-mpower9-vector");
Found |= FindVSXSubfeature("+paired-vector-memops", "-mpaired-vector-memops");
Found |= FindVSXSubfeature("+mma", "-mmma");
Found |= FindVSXSubfeature("+power10-vector", "-mpower10-vector");
Found = FindVSXSubfeature("+power8-vector", "-mpower8-vector", "-mno-vsx");
Found |= FindVSXSubfeature("+direct-move", "-mdirect-move", "-mno-vsx");
Found |= FindVSXSubfeature("+float128", "-mfloat128", "-mno-vsx");
Found |= FindVSXSubfeature("+power9-vector", "-mpower9-vector", "-mno-vsx");
Found |= FindVSXSubfeature("+paired-vector-memops", "-mpaired-vector-memops",
"-mno-vsx");
Found |= FindVSXSubfeature("+mma", "-mmma", "-mno-vsx");
Found |= FindVSXSubfeature("+power10-vector", "-mpower10-vector", "-mno-vsx");

// Return false if any vsx subfeatures was found.
return !Found;
Expand Down Expand Up @@ -693,7 +701,6 @@ bool PPCTargetInfo::initFeatureMap(
Diags.Report(diag::err_opt_not_valid_with_opt) << "-mprivileged" << CPU;
return false;
}

return TargetInfo::initFeatureMap(Features, Diags, CPU, FeaturesVec);
}

Expand Down Expand Up @@ -783,13 +790,16 @@ void PPCTargetInfo::setFeatureEnabled(llvm::StringMap<bool> &Features,
} else {
if (Name == "spe")
Features["efpu2"] = false;
// If we're disabling altivec or vsx go ahead and disable all of the vsx
// features.
if ((Name == "altivec") || (Name == "vsx"))
// If we're disabling altivec, hard-float, or vsx go ahead and disable all
// of the vsx features.
if ((Name == "altivec") || (Name == "vsx") || (Name == "hard-float")) {
if (Name != "vsx")
Features["altivec"] = Features["crypto"] = false;
Features["vsx"] = Features["direct-move"] = Features["power8-vector"] =
Features["float128"] = Features["power9-vector"] =
Features["paired-vector-memops"] = Features["mma"] =
Features["power10-vector"] = false;
}
if (Name == "power8-vector")
Features["power9-vector"] = Features["paired-vector-memops"] =
Features["mma"] = Features["power10-vector"] = false;
Expand Down
10 changes: 7 additions & 3 deletions clang/lib/Frontend/ASTUnit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,8 @@ class ASTInfoCollector : public ASTReaderListener {
LangOpt(LangOpt), TargetOpts(TargetOpts), Target(Target),
Counter(Counter) {}

bool ReadLanguageOptions(const LangOptions &LangOpts, bool Complain,
bool ReadLanguageOptions(const LangOptions &LangOpts,
StringRef ModuleFilename, bool Complain,
bool AllowCompatibleDifferences) override {
if (InitializedLanguage)
return false;
Expand All @@ -559,6 +560,7 @@ class ASTInfoCollector : public ASTReaderListener {
}

bool ReadHeaderSearchOptions(const HeaderSearchOptions &HSOpts,
StringRef ModuleFilename,
StringRef SpecificModuleCachePath,
bool Complain) override {
// llvm::SaveAndRestore doesn't support bit field.
Expand Down Expand Up @@ -597,13 +599,15 @@ class ASTInfoCollector : public ASTReaderListener {
}

bool ReadPreprocessorOptions(const PreprocessorOptions &PPOpts,
bool ReadMacros, bool Complain,
StringRef ModuleFilename, bool ReadMacros,
bool Complain,
std::string &SuggestedPredefines) override {
this->PPOpts = PPOpts;
return false;
}

bool ReadTargetOptions(const TargetOptions &TargetOpts, bool Complain,
bool ReadTargetOptions(const TargetOptions &TargetOpts,
StringRef ModuleFilename, bool Complain,
bool AllowCompatibleDifferences) override {
// If we've already initialized the target, don't do it again.
if (Target)
Expand Down
11 changes: 8 additions & 3 deletions clang/lib/Frontend/FrontendActions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -622,7 +622,8 @@ namespace {
Out.indent(2) << "Module map file: " << ModuleMapPath << "\n";
}

bool ReadLanguageOptions(const LangOptions &LangOpts, bool Complain,
bool ReadLanguageOptions(const LangOptions &LangOpts,
StringRef ModuleFilename, bool Complain,
bool AllowCompatibleDifferences) override {
Out.indent(2) << "Language options:\n";
#define LANGOPT(Name, Bits, Default, Description) \
Expand All @@ -645,7 +646,8 @@ namespace {
return false;
}

bool ReadTargetOptions(const TargetOptions &TargetOpts, bool Complain,
bool ReadTargetOptions(const TargetOptions &TargetOpts,
StringRef ModuleFilename, bool Complain,
bool AllowCompatibleDifferences) override {
Out.indent(2) << "Target options:\n";
Out.indent(4) << " Triple: " << TargetOpts.Triple << "\n";
Expand All @@ -665,6 +667,7 @@ namespace {
}

bool ReadDiagnosticOptions(IntrusiveRefCntPtr<DiagnosticOptions> DiagOpts,
StringRef ModuleFilename,
bool Complain) override {
Out.indent(2) << "Diagnostic options:\n";
#define DIAGOPT(Name, Bits, Default) DUMP_BOOLEAN(DiagOpts->Name, #Name);
Expand All @@ -684,6 +687,7 @@ namespace {
}

bool ReadHeaderSearchOptions(const HeaderSearchOptions &HSOpts,
StringRef ModuleFilename,
StringRef SpecificModuleCachePath,
bool Complain) override {
Out.indent(2) << "Header search options:\n";
Expand Down Expand Up @@ -717,7 +721,8 @@ namespace {
}

bool ReadPreprocessorOptions(const PreprocessorOptions &PPOpts,
bool ReadMacros, bool Complain,
StringRef ModuleFilename, bool ReadMacros,
bool Complain,
std::string &SuggestedPredefines) override {
Out.indent(2) << "Preprocessor options:\n";
DUMP_BOOLEAN(PPOpts.UsePredefines,
Expand Down
5 changes: 0 additions & 5 deletions clang/lib/Parse/Parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -629,11 +629,6 @@ bool Parser::ParseTopLevelDecl(DeclGroupPtrTy &Result,
Sema::ModuleImportState &ImportState) {
DestroyTemplateIdAnnotationsRAIIObj CleanupRAII(*this);

// Skip over the EOF token, flagging end of previous input for incremental
// processing
if (PP.isIncrementalProcessingEnabled() && Tok.is(tok::eof))
ConsumeToken();

Result = nullptr;
switch (Tok.getKind()) {
case tok::annot_pragma_unused:
Expand Down
12 changes: 12 additions & 0 deletions clang/lib/Sema/Sema.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1272,6 +1272,18 @@ void Sema::ActOnEndOfTranslationUnit() {
Module::ExplicitGlobalModuleFragment) {
Diag(ModuleScopes.back().BeginLoc,
diag::err_module_declaration_missing_after_global_module_introducer);
} else if (getLangOpts().getCompilingModule() ==
LangOptions::CMK_ModuleInterface &&
// We can't use ModuleScopes here since ModuleScopes is always
// empty if we're compiling the BMI.
!getASTContext().getCurrentNamedModule()) {
// If we are building a module interface unit, we should have seen the
// module declaration.
//
// FIXME: Make a better guess as to where to put the module declaration.
Diag(getSourceManager().getLocForStartOfFile(
getSourceManager().getMainFileID()),
diag::err_module_declaration_missing);
}

// Now we can decide whether the modules we're building need an initializer.
Expand Down
11 changes: 4 additions & 7 deletions clang/lib/Sema/SemaConcept.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -414,8 +414,7 @@ DiagRecursiveConstraintEval(Sema &S, llvm::FoldingSetNodeID &ID,
E->Profile(ID, S.Context, /*Canonical=*/true);
for (const auto &List : MLTAL)
for (const auto &TemplateArg : List.Args)
S.Context.getCanonicalTemplateArgument(TemplateArg)
.Profile(ID, S.Context);
TemplateArg.Profile(ID, S.Context);

// Note that we have to do this with our own collection, because there are
// times where a constraint-expression check can cause us to need to evaluate
Expand Down Expand Up @@ -643,8 +642,8 @@ bool Sema::CheckConstraintSatisfaction(
// here.
llvm::SmallVector<TemplateArgument, 4> FlattenedArgs;
for (auto List : TemplateArgsLists)
for (const TemplateArgument &Arg : List.Args)
FlattenedArgs.emplace_back(Context.getCanonicalTemplateArgument(Arg));
FlattenedArgs.insert(FlattenedArgs.end(), List.Args.begin(),
List.Args.end());

llvm::FoldingSetNodeID ID;
ConstraintSatisfaction::Profile(ID, Context, Template, FlattenedArgs);
Expand Down Expand Up @@ -828,8 +827,6 @@ Sema::SetupConstraintCheckingTemplateArgumentsAndScope(
/*RelativeToPrimary=*/true,
/*Pattern=*/nullptr,
/*ForConstraintInstantiation=*/true);
if (TemplateArgs)
MLTAL.replaceInnermostTemplateArguments(FD, *TemplateArgs, /*Final=*/true);
if (SetupConstraintScope(FD, TemplateArgs, MLTAL, Scope))
return std::nullopt;

Expand Down Expand Up @@ -1483,7 +1480,7 @@ static bool substituteParameterMappings(Sema &S, NormalizedConstraint &N,
const ConceptSpecializationExpr *CSE) {
MultiLevelTemplateArgumentList MLTAL = S.getTemplateInstantiationArgs(
CSE->getNamedConcept(), CSE->getNamedConcept()->getLexicalDeclContext(),
/*Final=*/true, CSE->getTemplateArguments(),
/*Final=*/false, CSE->getTemplateArguments(),
/*RelativeToPrimary=*/true,
/*Pattern=*/nullptr,
/*ForConstraintInstantiation=*/true);
Expand Down
5 changes: 3 additions & 2 deletions clang/lib/Sema/SemaExprCXX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9330,13 +9330,14 @@ Sema::BuildExprRequirement(
// be satisfied.
TemplateParameterList *TPL =
ReturnTypeRequirement.getTypeConstraintTemplateParameterList();
QualType MatchedType = Context.getReferenceQualifiedType(E);
QualType MatchedType =
Context.getReferenceQualifiedType(E).getCanonicalType();
llvm::SmallVector<TemplateArgument, 1> Args;
Args.push_back(TemplateArgument(MatchedType));

auto *Param = cast<TemplateTypeParmDecl>(TPL->getParam(0));

MultiLevelTemplateArgumentList MLTAL(Param, Args, /*Final=*/true);
MultiLevelTemplateArgumentList MLTAL(Param, Args, /*Final=*/false);
MLTAL.addOuterRetainedLevels(TPL->getDepth());
const TypeConstraint *TC = Param->getTypeConstraint();
assert(TC && "Type Constraint cannot be null here");
Expand Down
56 changes: 46 additions & 10 deletions clang/lib/Sema/SemaInit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4340,7 +4340,7 @@ static OverloadingResult ResolveConstructorOverload(
/// \param IsListInit Is this list-initialization?
/// \param IsInitListCopy Is this non-list-initialization resulting from a
/// list-initialization from {x} where x is the same
/// type as the entity?
/// aggregate type as the entity?
static void TryConstructorInitialization(Sema &S,
const InitializedEntity &Entity,
const InitializationKind &Kind,
Expand Down Expand Up @@ -4370,6 +4370,14 @@ static void TryConstructorInitialization(Sema &S,
Entity.getKind() !=
InitializedEntity::EK_LambdaToBlockConversionBlockElement);

bool CopyElisionPossible = false;
auto ElideConstructor = [&] {
// Convert qualifications if necessary.
Sequence.AddQualificationConversionStep(DestType, VK_PRValue);
if (ILE)
Sequence.RewrapReferenceInitList(DestType, ILE);
};

// C++17 [dcl.init]p17:
// - If the initializer expression is a prvalue and the cv-unqualified
// version of the source type is the same class as the class of the
Expand All @@ -4382,11 +4390,33 @@ static void TryConstructorInitialization(Sema &S,
if (S.getLangOpts().CPlusPlus17 && !RequireActualConstructor &&
UnwrappedArgs.size() == 1 && UnwrappedArgs[0]->isPRValue() &&
S.Context.hasSameUnqualifiedType(UnwrappedArgs[0]->getType(), DestType)) {
// Convert qualifications if necessary.
Sequence.AddQualificationConversionStep(DestType, VK_PRValue);
if (ILE)
Sequence.RewrapReferenceInitList(DestType, ILE);
return;
if (ILE && !DestType->isAggregateType()) {
// CWG2311: T{ prvalue_of_type_T } is not eligible for copy elision
// Make this an elision if this won't call an initializer-list
// constructor. (Always on an aggregate type or check constructors first.)

// This effectively makes our resolution as follows. The parts in angle
// brackets are additions.
// C++17 [over.match.list]p(1.2):
// - If no viable initializer-list constructor is found <and the
// initializer list does not consist of exactly a single element with
// the same cv-unqualified class type as T>, [...]
// C++17 [dcl.init.list]p(3.6):
// - Otherwise, if T is a class type, constructors are considered. The
// applicable constructors are enumerated and the best one is chosen
// through overload resolution. <If no constructor is found and the
// initializer list consists of exactly a single element with the same
// cv-unqualified class type as T, the object is initialized from that
// element (by copy-initialization for copy-list-initialization, or by
// direct-initialization for direct-list-initialization). Otherwise, >
// if a narrowing conversion [...]
assert(!IsInitListCopy &&
"IsInitListCopy only possible with aggregate types");
CopyElisionPossible = true;
} else {
ElideConstructor();
return;
}
}

const RecordType *DestRecordType = DestType->getAs<RecordType>();
Expand Down Expand Up @@ -4431,6 +4461,12 @@ static void TryConstructorInitialization(Sema &S,
S, Kind.getLocation(), Args, CandidateSet, DestType, Ctors, Best,
CopyInitialization, AllowExplicit,
/*OnlyListConstructors=*/true, IsListInit, RequireActualConstructor);

if (CopyElisionPossible && Result == OR_No_Viable_Function) {
// No initializer list candidate
ElideConstructor();
return;
}
}

// C++11 [over.match.list]p1:
Expand Down Expand Up @@ -4712,9 +4748,9 @@ static void TryListInitialization(Sema &S,
return;
}

// C++11 [dcl.init.list]p3, per DR1467:
// - If T is a class type and the initializer list has a single element of
// type cv U, where U is T or a class derived from T, the object is
// C++11 [dcl.init.list]p3, per DR1467 and DR2137:
// - If T is an aggregate class and the initializer list has a single element
// of type cv U, where U is T or a class derived from T, the object is
// initialized from that element (by copy-initialization for
// copy-list-initialization, or by direct-initialization for
// direct-list-initialization).
Expand All @@ -4725,7 +4761,7 @@ static void TryListInitialization(Sema &S,
// - Otherwise, if T is an aggregate, [...] (continue below).
if (S.getLangOpts().CPlusPlus11 && InitList->getNumInits() == 1 &&
!IsDesignatedInit) {
if (DestType->isRecordType()) {
if (DestType->isRecordType() && DestType->isAggregateType()) {
QualType InitType = InitList->getInit(0)->getType();
if (S.Context.hasSameUnqualifiedType(InitType, DestType) ||
S.IsDerivedFrom(InitList->getBeginLoc(), InitType, DestType)) {
Expand Down
41 changes: 29 additions & 12 deletions clang/lib/Sema/SemaOverload.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1619,19 +1619,36 @@ TryUserDefinedConversion(Sema &S, Expr *From, QualType ToType,
// called for those cases.
if (CXXConstructorDecl *Constructor
= dyn_cast<CXXConstructorDecl>(ICS.UserDefined.ConversionFunction)) {
QualType FromCanon
= S.Context.getCanonicalType(From->getType().getUnqualifiedType());
QualType FromType;
SourceLocation FromLoc;
// C++11 [over.ics.list]p6, per DR2137:
// C++17 [over.ics.list]p6:
// If C is not an initializer-list constructor and the initializer list
// has a single element of type cv U, where U is X or a class derived
// from X, the implicit conversion sequence has Exact Match rank if U is
// X, or Conversion rank if U is derived from X.
if (const auto *InitList = dyn_cast<InitListExpr>(From);
InitList && InitList->getNumInits() == 1 &&
!S.isInitListConstructor(Constructor)) {
const Expr *SingleInit = InitList->getInit(0);
FromType = SingleInit->getType();
FromLoc = SingleInit->getBeginLoc();
} else {
FromType = From->getType();
FromLoc = From->getBeginLoc();
}
QualType FromCanon =
S.Context.getCanonicalType(FromType.getUnqualifiedType());
QualType ToCanon
= S.Context.getCanonicalType(ToType).getUnqualifiedType();
if (Constructor->isCopyConstructor() &&
(FromCanon == ToCanon ||
S.IsDerivedFrom(From->getBeginLoc(), FromCanon, ToCanon))) {
if ((FromCanon == ToCanon ||
S.IsDerivedFrom(FromLoc, FromCanon, ToCanon))) {
// Turn this into a "standard" conversion sequence, so that it
// gets ranked with standard conversion sequences.
DeclAccessPair Found = ICS.UserDefined.FoundConversionFunction;
ICS.setStandard();
ICS.Standard.setAsIdentityConversion();
ICS.Standard.setFromType(From->getType());
ICS.Standard.setFromType(FromType);
ICS.Standard.setAllToTypes(ToType);
ICS.Standard.CopyConstructor = Constructor;
ICS.Standard.FoundCopyConstructor = Found;
Expand Down Expand Up @@ -5335,18 +5352,18 @@ TryListConversion(Sema &S, InitListExpr *From, QualType ToType,
IsDesignatedInit)
return Result;

// Per DR1467:
// If the parameter type is a class X and the initializer list has a single
// element of type cv U, where U is X or a class derived from X, the
// implicit conversion sequence is the one required to convert the element
// to the parameter type.
// Per DR1467 and DR2137:
// If the parameter type is an aggregate class X and the initializer list
// has a single element of type cv U, where U is X or a class derived from
// X, the implicit conversion sequence is the one required to convert the
// element to the parameter type.
//
// Otherwise, if the parameter type is a character array [... ]
// and the initializer list has a single element that is an
// appropriately-typed string literal (8.5.2 [dcl.init.string]), the
// implicit conversion sequence is the identity conversion.
if (From->getNumInits() == 1 && !IsDesignatedInit) {
if (ToType->isRecordType()) {
if (ToType->isRecordType() && ToType->isAggregateType()) {
QualType InitType = From->getInit(0)->getType();
if (S.Context.hasSameUnqualifiedType(InitType, ToType) ||
S.IsDerivedFrom(From->getBeginLoc(), InitType, ToType))
Expand Down
10 changes: 5 additions & 5 deletions clang/lib/Sema/SemaTemplate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4358,13 +4358,13 @@ Sema::CheckConceptTemplateId(const CXXScopeSpec &SS,

auto *CSD = ImplicitConceptSpecializationDecl::Create(
Context, NamedConcept->getDeclContext(), NamedConcept->getLocation(),
SugaredConverted);
CanonicalConverted);
ConstraintSatisfaction Satisfaction;
bool AreArgsDependent =
TemplateSpecializationType::anyDependentTemplateArguments(
*TemplateArgs, SugaredConverted);
MultiLevelTemplateArgumentList MLTAL(NamedConcept, SugaredConverted,
/*Final=*/true);
*TemplateArgs, CanonicalConverted);
MultiLevelTemplateArgumentList MLTAL(NamedConcept, CanonicalConverted,
/*Final=*/false);
LocalInstantiationScope Scope(*this);

EnterExpressionEvaluationContext EECtx{
Expand Down Expand Up @@ -5583,7 +5583,7 @@ bool Sema::CheckTemplateArgumentList(
CXXThisScopeRAII(*this, RD, ThisQuals, RD != nullptr);

MultiLevelTemplateArgumentList MLTAL = getTemplateInstantiationArgs(
Template, NewContext, /*Final=*/true, SugaredConverted,
Template, NewContext, /*Final=*/false, CanonicalConverted,
/*RelativeToPrimary=*/true,
/*Pattern=*/nullptr,
/*ForConceptInstantiation=*/true);
Expand Down
16 changes: 8 additions & 8 deletions clang/lib/Sema/SemaTemplateDeduction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3078,7 +3078,7 @@ CheckDeducedArgumentConstraints(Sema &S, TemplateDeclT *Template,
// If we don't need to replace the deduced template arguments,
// we can add them immediately as the inner-most argument list.
if (!DeducedArgsNeedReplacement(Template))
Innermost = SugaredDeducedArgs;
Innermost = CanonicalDeducedArgs;

MultiLevelTemplateArgumentList MLTAL = S.getTemplateInstantiationArgs(
Template, Template->getDeclContext(), /*Final=*/false, Innermost,
Expand All @@ -3090,7 +3090,7 @@ CheckDeducedArgumentConstraints(Sema &S, TemplateDeclT *Template,
// not class-scope explicit specialization, so replace with Deduced Args
// instead of adding to inner-most.
if (!Innermost)
MLTAL.replaceInnermostTemplateArguments(Template, SugaredDeducedArgs);
MLTAL.replaceInnermostTemplateArguments(Template, CanonicalDeducedArgs);

if (S.CheckConstraintSatisfaction(Template, AssociatedConstraints, MLTAL,
Info.getLocation(),
Expand Down Expand Up @@ -3913,13 +3913,13 @@ TemplateDeductionResult Sema::FinishTemplateArgumentDeduction(
(CanonicalBuilder.size() ==
FunctionTemplate->getTemplateParameters()->size())) {
if (CheckInstantiatedFunctionTemplateConstraints(
Info.getLocation(), Specialization, SugaredBuilder,
Info.getLocation(), Specialization, CanonicalBuilder,
Info.AssociatedConstraintsSatisfaction))
return TemplateDeductionResult::MiscellaneousDeductionFailure;

if (!Info.AssociatedConstraintsSatisfaction.IsSatisfied) {
Info.reset(TemplateArgumentList::CreateCopy(Context, SugaredBuilder),
Info.takeCanonical());
Info.reset(Info.takeSugared(),
TemplateArgumentList::CreateCopy(Context, CanonicalBuilder));
return TemplateDeductionResult::ConstraintsNotSatisfied;
}
}
Expand Down Expand Up @@ -4993,8 +4993,8 @@ static bool CheckDeducedPlaceholderConstraints(Sema &S, const AutoType &Type,
/*PartialTemplateArgs=*/false,
SugaredConverted, CanonicalConverted))
return true;
MultiLevelTemplateArgumentList MLTAL(Concept, SugaredConverted,
/*Final=*/true);
MultiLevelTemplateArgumentList MLTAL(Concept, CanonicalConverted,
/*Final=*/false);
// Build up an EvaluationContext with an ImplicitConceptSpecializationDecl so
// that the template arguments of the constraint can be preserved. For
// example:
Expand All @@ -5008,7 +5008,7 @@ static bool CheckDeducedPlaceholderConstraints(Sema &S, const AutoType &Type,
S, Sema::ExpressionEvaluationContext::Unevaluated,
ImplicitConceptSpecializationDecl::Create(
S.getASTContext(), Concept->getDeclContext(), Concept->getLocation(),
SugaredConverted));
CanonicalConverted));
if (S.CheckConstraintSatisfaction(Concept, {Concept->getConstraintExpr()},
MLTAL, TypeLoc.getLocalSourceRange(),
Satisfaction))
Expand Down
3 changes: 1 addition & 2 deletions clang/lib/Sema/SemaType.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7057,7 +7057,6 @@ static bool handleMSPointerTypeQualifierAttr(TypeProcessingState &State,

// Add address space to type based on its attributes.
LangAS ASIdx = LangAS::Default;
llvm::Triple Triple = S.Context.getTargetInfo().getTriple();
uint64_t PtrWidth =
S.Context.getTargetInfo().getPointerWidth(LangAS::Default);
if (PtrWidth == 32) {
Expand All @@ -7066,7 +7065,7 @@ static bool handleMSPointerTypeQualifierAttr(TypeProcessingState &State,
else if (Attrs[attr::UPtr])
ASIdx = LangAS::ptr32_uptr;
} else if (PtrWidth == 64 && Attrs[attr::Ptr32]) {
if (Triple.isOSzOS() || Attrs[attr::UPtr])
if (S.Context.getTargetInfo().getTriple().isOSzOS() || Attrs[attr::UPtr])
ASIdx = LangAS::ptr32_uptr;
else
ASIdx = LangAS::ptr32_sptr;
Expand Down
332 changes: 183 additions & 149 deletions clang/lib/Serialization/ASTReader.cpp

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion clang/lib/Serialization/ASTReaderDecl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2391,7 +2391,7 @@ void ASTDeclReader::VisitImplicitConceptSpecializationDecl(
VisitDecl(D);
llvm::SmallVector<TemplateArgument, 4> Args;
for (unsigned I = 0; I < D->NumTemplateArgs; ++I)
Args.push_back(Record.readTemplateArgument(/*Canonicalize=*/false));
Args.push_back(Record.readTemplateArgument(/*Canonicalize=*/true));
D->setTemplateArguments(Args);
}

Expand Down
10 changes: 4 additions & 6 deletions clang/test/AST/ast-dump-concepts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,8 @@ struct Foo {
// CHECK: TemplateTypeParmDecl {{.*}} referenced Concept {{.*}} 'binary_concept'
// CHECK-NEXT: `-ConceptSpecializationExpr {{.*}} <col:13, col:31> 'bool' Concept {{.*}} 'binary_concept'
// CHECK-NEXT: |-ImplicitConceptSpecializationDecl {{.*}} <line:13:9> col:9
// CHECK-NEXT: | |-TemplateArgument type 'R'
// CHECK-NEXT: | | `-TemplateTypeParmType {{.*}} 'R' dependent {{.*}}depth 1 index 0
// CHECK-NEXT: | | `-TemplateTypeParm {{.*}} 'R'
// CHECK-NEXT: | |-TemplateArgument type 'type-parameter-1-0'
// CHECK-NEXT: | | `-TemplateTypeParmType {{.*}} 'type-parameter-1-0' dependent {{.*}}depth 1 index 0
// CHECK-NEXT: | `-TemplateArgument type 'int'
// CHECK-NEXT: | `-BuiltinType {{.*}} 'int'
// CHECK-NEXT: |-TemplateArgument {{.*}} type 'R'
Expand All @@ -36,9 +35,8 @@ struct Foo {
// CHECK: TemplateTypeParmDecl {{.*}} referenced Concept {{.*}} 'unary_concept'
// CHECK-NEXT: `-ConceptSpecializationExpr {{.*}} <col:13> 'bool'
// CHECK-NEXT: |-ImplicitConceptSpecializationDecl {{.*}} <line:10:9> col:9
// CHECK-NEXT: | `-TemplateArgument type 'R'
// CHECK-NEXT: | `-TemplateTypeParmType {{.*}} 'R' dependent {{.*}}depth 1 index 0
// CHECK-NEXT: | `-TemplateTypeParm {{.*}} 'R'
// CHECK-NEXT: | `-TemplateArgument type 'type-parameter-1-0'
// CHECK-NEXT: | `-TemplateTypeParmType {{.*}} 'type-parameter-1-0' dependent {{.*}}depth 1 index 0
template <unary_concept R>
Foo(R);

Expand Down
1 change: 1 addition & 0 deletions clang/test/AST/attr-counted-by-or-null-struct-ptrs.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 %s -ast-dump | FileCheck %s
// RUN: %clang_cc1 -fexperimental-late-parse-attributes %s -ast-dump | FileCheck %s

#define __counted_by_or_null(f) __attribute__((counted_by_or_null(f)))

Expand Down
1 change: 1 addition & 0 deletions clang/test/AST/attr-counted-by-struct-ptrs.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 %s -ast-dump | FileCheck %s
// RUN: %clang_cc1 -fexperimental-late-parse-attributes %s -ast-dump | FileCheck %s

#define __counted_by(f) __attribute__((counted_by(f)))

Expand Down
1 change: 1 addition & 0 deletions clang/test/AST/attr-sized-by-or-null-struct-ptrs.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 %s -ast-dump | FileCheck %s
// RUN: %clang_cc1 -fexperimental-late-parse-attributes %s -ast-dump | FileCheck %s

#define __sized_by_or_null(f) __attribute__((sized_by_or_null(f)))

Expand Down
1 change: 1 addition & 0 deletions clang/test/AST/attr-sized-by-struct-ptrs.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 %s -ast-dump | FileCheck %s
// RUN: %clang_cc1 -fexperimental-late-parse-attributes %s -ast-dump | FileCheck %s

#define __sized_by(f) __attribute__((sized_by(f)))

Expand Down
10 changes: 0 additions & 10 deletions clang/test/CXX/drs/cwg14xx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -505,16 +505,6 @@ namespace cwg1467 { // cwg1467: 3.7 c++11
}
} // nonaggregate

namespace SelfInitIsNotListInit {
struct S {
S();
explicit S(S &);
S(const S &);
};
S s1;
S s2 = {s1}; // ok, not list-initialization so we pick the non-explicit constructor
}

struct NestedInit { int a, b, c; };
NestedInit ni[1] = {{NestedInit{1, 2, 3}}};

Expand Down
45 changes: 44 additions & 1 deletion clang/test/CXX/drs/cwg21xx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,15 @@
#endif

namespace std {
struct type_info;
typedef __SIZE_TYPE__ size_t;

template<typename E> struct initializer_list {
const E *p; size_t n;
initializer_list(const E *p, size_t n);
initializer_list();
};

struct type_info;
}

namespace cwg2100 { // cwg2100: 12
Expand Down Expand Up @@ -136,6 +144,41 @@ namespace cwg2126 { // cwg2126: 12
#endif
}

namespace cwg2137 { // cwg2137: 20
#if __cplusplus >= 201103L
struct Q {
Q();
Q(Q&&);
Q(std::initializer_list<Q>) = delete; // #cwg2137-Qcons
};

Q x = Q { Q() };
// since-cxx11-error@-1 {{call to deleted constructor of 'Q'}}
// since-cxx11-note@#cwg2137-Qcons {{'Q' has been explicitly marked deleted here}}

int f(Q); // #cwg2137-f
int y = f({ Q() });
// since-cxx11-error@-1 {{call to deleted constructor of 'Q'}}
// since-cxx11-note@#cwg2137-Qcons {{'Q' has been explicitly marked deleted here}}
// since-cxx11-note@#cwg2137-f {{passing argument to parameter here}}

struct U {
U();
U(const U&);
};

struct Derived : U {
Derived();
Derived(const Derived&);
} d;

int g(Derived);
int g(U(&&)[1]) = delete;

int z = g({ d });
#endif
}

namespace cwg2140 { // cwg2140: 9
#if __cplusplus >= 201103L
union U { int a; decltype(nullptr) b; };
Expand Down
99 changes: 99 additions & 0 deletions clang/test/CXX/drs/cwg23xx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,16 @@
// RUN: %clang_cc1 -std=c++23 %s -verify=expected,since-cxx11,since-cxx14,since-cxx17,since-cxx20 -fexceptions -fcxx-exceptions -pedantic-errors 2>&1 | FileCheck %s
// RUN: %clang_cc1 -std=c++2c %s -verify=expected,since-cxx11,since-cxx14,since-cxx17,since-cxx20 -fexceptions -fcxx-exceptions -pedantic-errors 2>&1 | FileCheck %s

namespace std {
__extension__ typedef __SIZE_TYPE__ size_t;

template<typename E> struct initializer_list {
const E *p; size_t n;
initializer_list(const E *p, size_t n);
initializer_list();
};
}

#if __cplusplus >= 201103L
namespace cwg2303 { // cwg2303: 12
template <typename... T>
Expand Down Expand Up @@ -94,6 +104,95 @@ struct Z : W,
// cwg2331: na
// cwg2335 is in cwg2335.cxx

namespace cwg2311 { // cwg2311 is open with no proposed resolution
#if __cplusplus >= 201707L
template<typename T>
void test() {
// Ensure none of these try to call a move constructor.
T a = T{T(0)};
T b{T(0)};
auto c{T(0)};
T d = {T(0)};
auto e = {T(0)};
#if __cplusplus >= 202302L
auto f = auto{T(0)};
#endif
void(*fn)(T);
fn({T(0)});
}

struct NonMovable {
NonMovable(int);
NonMovable(NonMovable&&) = delete;
};
struct NonMovableNonApplicableIList {
NonMovableNonApplicableIList(int);
NonMovableNonApplicableIList(NonMovableNonApplicableIList&&) = delete;
NonMovableNonApplicableIList(std::initializer_list<int>);
};
struct ExplicitMovable {
ExplicitMovable(int);
explicit ExplicitMovable(ExplicitMovable&&);
};
struct ExplicitNonMovable {
ExplicitNonMovable(int);
explicit ExplicitNonMovable(ExplicitNonMovable&&) = delete;
};
struct ExplicitNonMovableNonApplicableIList {
ExplicitNonMovableNonApplicableIList(int);
explicit ExplicitNonMovableNonApplicableIList(ExplicitNonMovableNonApplicableIList&&) = delete;
ExplicitNonMovableNonApplicableIList(std::initializer_list<int>);
};
struct CopyOnly {
CopyOnly(int);
CopyOnly(const CopyOnly&);
CopyOnly(CopyOnly&&) = delete;
};
struct ExplicitCopyOnly {
ExplicitCopyOnly(int);
explicit ExplicitCopyOnly(const ExplicitCopyOnly&);
explicit ExplicitCopyOnly(ExplicitCopyOnly&&) = delete;
};

template void test<NonMovable>();
template void test<NonMovableNonApplicableIList>();
template void test<ExplicitMovable>();
template void test<ExplicitNonMovable>();
template void test<ExplicitNonMovableNonApplicableIList>();
template void test<CopyOnly>();
template void test<ExplicitCopyOnly>();

struct any {
template<typename T>
any(T&&);
};

template<typename T>
struct X {
X();
X(T) = delete; // #cwg2311-X
};

X<std::initializer_list<any>> x{ X<std::initializer_list<any>>() };
// since-cxx17-error@-1 {{call to deleted constructor of 'X<std::initializer_list<any>>'}}
// since-cxx17-note@#cwg2311-X {{'X' has been explicitly marked deleted here}}

// Per the currently implemented resolution, this does not apply to std::initializer_list.
// An initializer list initialized from `{ e }` always has exactly one element constructed
// from `e`, where previously that could have been a copy of an init list or `e.operator std::initializer_list()`
struct InitListCtor {
InitListCtor(int);
InitListCtor(InitListCtor&&) = delete;
InitListCtor(std::initializer_list<InitListCtor>) = delete; // #cwg2311-InitListCtor
};

std::initializer_list<InitListCtor> i;
auto j = std::initializer_list<InitListCtor>{ i };
// since-cxx17-error@-1 {{conversion function from 'std::initializer_list<InitListCtor>' to 'const cwg2311::InitListCtor' invokes a deleted function}}
// since-cxx17-note@#cwg2311-InitListCtor {{'InitListCtor' has been explicitly marked deleted here}}
#endif
}

#if __cplusplus >= 201103L
namespace cwg2338 { // cwg2338: 12
namespace B {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@ using r2i2 = r2<A>; // expected-error{{constraints not satisfied for class templ
using r2i3 = r2<D>;
using r2i4 = r2<const D>; // expected-error{{constraints not satisfied for class template 'r2' [with T = const D]}}

template<typename T> requires requires { { sizeof(T) }; } // expected-note{{because 'sizeof(T)' would be invalid: invalid application of 'sizeof' to an incomplete type 'void'}} expected-note{{because 'sizeof(T)' would be invalid: invalid application of 'sizeof' to an incomplete type 'class nonexistent'}}
template<typename T> requires requires { { sizeof(T) }; } // expected-note{{because 'sizeof(T)' would be invalid: invalid application of 'sizeof' to an incomplete type 'void'}} expected-note{{because 'sizeof(T)' would be invalid: invalid application of 'sizeof' to an incomplete type 'nonexistent'}}
struct r3 {};

using r3i1 = r3<int>;
using r3i2 = r3<A>;
using r3i3 = r3<A &>;
using r3i4 = r3<void>; // expected-error{{constraints not satisfied for class template 'r3' [with T = void]}}
using r3i4 = r3<class nonexistent>; // expected-error{{constraints not satisfied for class template 'r3' [with T = class nonexistent]}}
using r3i4 = r3<class nonexistent>; // expected-error{{constraints not satisfied for class template 'r3' [with T = nonexistent]}}

// Non-dependent expressions

Expand Down Expand Up @@ -149,7 +149,7 @@ namespace std_example {
template<typename T> constexpr bool is_same_v<T, T> = true;

template<typename T, typename U> concept same_as = is_same_v<T, U>;
// expected-note@-1 {{because 'is_same_v<int, typename T2::inner>' evaluated to false}}
// expected-note@-1 {{because 'is_same_v<int, int *>' evaluated to false}}

static_assert(C1<int>);
static_assert(C1<int*>);
Expand All @@ -173,9 +173,9 @@ namespace std_example {
int operator *() { return 0; }
};
static_assert(C2<T1>);
template<C2 T> struct C2_check {}; // expected-note{{because 'int' does not satisfy 'C2'}} expected-note{{because 'T2' does not satisfy 'C2'}}
template<C2 T> struct C2_check {}; // expected-note{{because 'int' does not satisfy 'C2'}} expected-note{{because 'std_example::T2' does not satisfy 'C2'}}
using c2c1 = C2_check<int>; // expected-error{{constraints not satisfied for class template 'C2_check' [with T = int]}}
using c2c2 = C2_check<T2>; // expected-error{{constraints not satisfied for class template 'C2_check' [with T = T2]}}
using c2c2 = C2_check<T2>; // expected-error{{constraints not satisfied for class template 'C2_check' [with T = std_example::T2]}}

template<typename T>
void g(T t) noexcept(sizeof(T) == 1) {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ using r4i = X<void>::r4<int>; // expected-error{{constraints not satisfied for c

// C++ [expr.prim.req.nested] Examples
namespace std_example {
template<typename U> concept C1 = sizeof(U) == 1; // expected-note{{because 'sizeof(decltype(+t)) == 1' (4 == 1) evaluated to false}}
template<typename U> concept C1 = sizeof(U) == 1; // expected-note{{because 'sizeof(int) == 1' (4 == 1) evaluated to false}}
template<typename T> concept D =
requires (T t) {
requires C1<decltype (+t)>; // expected-note{{because 'decltype(+t)' (aka 'int') does not satisfy 'C1'}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@ using r2i4 = r2<const D>; // expected-error{{constraints not satisfied for class

template<typename T> requires requires { sizeof(T); }
// expected-note@-1{{because 'sizeof(T)' would be invalid: invalid application of 'sizeof' to an incomplete type 'void'}}
// expected-note@-2{{because 'sizeof(T)' would be invalid: invalid application of 'sizeof' to an incomplete type 'class nonexistent'}}
// expected-note@-2{{because 'sizeof(T)' would be invalid: invalid application of 'sizeof' to an incomplete type 'nonexistent'}}
struct r3 {};

using r3i1 = r3<int>;
using r3i2 = r3<A>;
using r3i3 = r3<A &>;
using r3i4 = r3<void>; // expected-error{{constraints not satisfied for class template 'r3' [with T = void]}}
using r3i4 = r3<class nonexistent>; // expected-error{{constraints not satisfied for class template 'r3' [with T = class nonexistent]}}
using r3i4 = r3<class nonexistent>; // expected-error{{constraints not satisfied for class template 'r3' [with T = nonexistent]}}

template<typename T> requires requires (T t) { 0; "a"; (void)'a'; }
struct r4 {};
Expand Down
12 changes: 6 additions & 6 deletions clang/test/CXX/expr/expr.prim/expr.prim.req/type-requirement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,14 +182,14 @@ namespace std_example {
static_assert(C1<has_inner_and_type> && C2<has_inner_and_type> && C3<has_inner_and_type>);
template<C1 T> struct C1_check {};
// expected-note@-1 {{because 'int' does not satisfy 'C1'}}
// expected-note@-2 {{because 'has_type' does not satisfy 'C1'}}
// expected-note@-2 {{because 'std_example::has_type' does not satisfy 'C1'}}
template<C2 T> struct C2_check {};
// expected-note@-1 {{because 'has_inner' does not satisfy 'C2'}}
// expected-note@-1 {{because 'std_example::has_inner' does not satisfy 'C2'}}
template<C3 T> struct C3_check {};
// expected-note@-1 {{because 'void' does not satisfy 'C3'}}
using c1 = C1_check<int>; // expected-error{{constraints not satisfied for class template 'C1_check' [with T = int]}}
using c2 = C1_check<has_type>; // expected-error{{constraints not satisfied for class template 'C1_check' [with T = has_type]}}
using c3 = C2_check<has_inner>; // expected-error{{constraints not satisfied for class template 'C2_check' [with T = has_inner]}}
using c2 = C1_check<has_type>; // expected-error{{constraints not satisfied for class template 'C1_check' [with T = std_example::has_type]}}
using c3 = C2_check<has_inner>; // expected-error{{constraints not satisfied for class template 'C2_check' [with T = std_example::has_inner]}}
using c4 = C3_check<void>; // expected-error{{constraints not satisfied for class template 'C3_check' [with T = void]}}
}

Expand All @@ -199,10 +199,10 @@ template <typename T> concept C = requires { requires requires { T::a; }; };
// expected-note@-1 {{because 'T::a' would be invalid: no member named 'a' in 'PR48656::T1'}}

template <C...> struct A {};
// expected-note@-1 {{because 'T1' does not satisfy 'C'}}
// expected-note@-1 {{because 'PR48656::T1' does not satisfy 'C'}}

struct T1 {};
template struct A<T1>; // expected-error {{constraints not satisfied for class template 'A' [with $0 = <T1>]}}
template struct A<T1>; // expected-error {{constraints not satisfied for class template 'A' [with $0 = <PR48656::T1>]}}

struct T2 { static constexpr bool a = false; };
template struct A<T2>;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %clang_cc1 -std=c++20 %s -verify -o /dev/null
// RUN: %clang_cc1 -std=c++20 %s -verify -emit-module-interface -o /dev/null
// RUN: %clang_cc1 -std=c++20 %s -DINTERFACE -verify -emit-module-interface -o %t
// RUN: %clang_cc1 -std=c++20 %s -DIMPLEMENTATION -verify -fmodule-file=A=%t -o /dev/null
//
Expand All @@ -15,6 +15,8 @@ module A; // #module-decl
// expected-error@-2 {{missing 'export' specifier in module declaration while building module interface}}
#define INTERFACE
#endif
#else // Not in a module
// expected-error@* {{missing 'export module' declaration in module interface unit}}
#endif

#ifndef INTERFACE
Expand Down
2 changes: 1 addition & 1 deletion clang/test/CXX/temp/temp.constr/temp.constr.normal/p1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ template<typename T> requires Bar<T> && true struct S<T> { };

template<typename T> concept True2 = sizeof(T) >= 0;
template<typename T> concept Foo2 = True2<T*>;
// expected-error@-1{{'type name' declared as a pointer to a reference of type 'T &'}}
// expected-error@-1{{'type name' declared as a pointer to a reference of type 'type-parameter-0-0 &'}}
template<typename T> concept Bar2 = Foo2<T&>;
// expected-note@-1{{while substituting into concept arguments here; substitution failures not allowed in concept arguments}}
template<typename T> requires Bar2<T> struct S2 { };
Expand Down
4 changes: 2 additions & 2 deletions clang/test/CXX/temp/temp.param/p10-2a.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ concept OneOf = (is_same_v<T, Ts> || ...);
// expected-note@-5 {{and 'is_same_v<short, char>' evaluated to false}}
// expected-note@-6 3{{because 'is_same_v<int, char[1]>' evaluated to false}}
// expected-note@-7 3{{and 'is_same_v<int, char[2]>' evaluated to false}}
// expected-note@-8 2{{because 'is_same_v<decltype(nullptr), char>' evaluated to false}}
// expected-note@-9 2{{and 'is_same_v<decltype(nullptr), int>' evaluated to false}}
// expected-note@-8 2{{because 'is_same_v<std::nullptr_t, char>' evaluated to false}}
// expected-note@-9 2{{and 'is_same_v<std::nullptr_t, int>' evaluated to false}}

template<OneOf<char[1], char[2]> T, OneOf<int, long, char> U>
// expected-note@-1 2{{because 'OneOf<char, char[1], char[2]>' evaluated to false}}
Expand Down
2 changes: 1 addition & 1 deletion clang/test/CodeGen/SystemZ/zos-mixed-ptr-sizes-malloc.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// RUN: %clang -target s390x-ibm-zos -emit-llvm -S -O2 %s -o - | FileCheck %s --check-prefix=X64
// RUN: %clang_cc1 -triple s390x-ibm-zos -O2 -emit-llvm %s -o - | FileCheck %s --check-prefix=X64
#include <stddef.h>
void *__malloc31(size_t);

Expand Down
40 changes: 38 additions & 2 deletions clang/test/Driver/ppc-dependent-options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,34 @@
// RUN: -std=c++11 -msoft-float -mvsx %s 2>&1 | \
// RUN: FileCheck %s -check-prefix=CHECK-SOFTFLT-VSX

// RUN: not %clang -target powerpc64le-unknown-unknown -fsyntax-only \
// RUN: -std=c++11 -msoft-float -mpower8-vector %s 2>&1 | \
// RUN: FileCheck %s -check-prefix=CHECK-SOFTFLT-P8VEC

// RUN: not %clang -target powerpc64le-unknown-unknown -fsyntax-only \
// RUN: -std=c++11 -msoft-float -mpower9-vector %s 2>&1 | \
// RUN: FileCheck %s -check-prefix=CHECK-SOFTFLT-P9VEC

// RUN: not %clang -target powerpc64le-unknown-unknown -fsyntax-only \
// RUN: -std=c++11 -msoft-float -mpower10-vector %s 2>&1 | \
// RUN: FileCheck %s -check-prefix=CHECK-SOFTFLT-P10VEC

// RUN: not %clang -target powerpc64le-unknown-unknown -fsyntax-only \
// RUN: -std=c++11 -msoft-float -mdirect-move %s 2>&1 | \
// RUN: FileCheck %s -check-prefix=CHECK-SOFTFLT-DIRECTMOVE

// RUN: not %clang -target powerpc64le-unknown-unknown -fsyntax-only \
// RUN: -std=c++11 -msoft-float -mmma %s 2>&1 | \
// RUN: FileCheck %s -check-prefix=CHECK-SOFTFLT-MMA

// RUN: not %clang -target powerpc64le-unknown-unknown -fsyntax-only \
// RUN: -std=c++11 -msoft-float -mpaired-vector-memops %s 2>&1 | \
// RUN: FileCheck %s -check-prefix=CHECK-SOFTFLT-PAIREDVECMEMOP

// RUN: not %clang -target powerpc64le-unknown-unknown -fsyntax-only \
// RUN: -std=c++11 -msoft-float -mcrypto %s 2>&1 | \
// RUN: FileCheck %s -check-prefix=CHECK-SOFTFLT-CRYPTO

#ifdef __VSX__
static_assert(false, "VSX enabled");
#endif
Expand Down Expand Up @@ -126,5 +154,13 @@ static_assert(false, "Neither enabled");
// CHECK-NVSX: Neither enabled
// CHECK-VSX: VSX enabled
// CHECK-NALTI-VSX: error: option '-mvsx' cannot be specified with '-mno-altivec'
// CHECK-SOFTFLT-ALTI: error: option '-msoft-float' cannot be specified with '-maltivec'
// CHECK-SOFTFLT-VSX: error: option '-msoft-float' cannot be specified with '-mvsx'
// CHECK-SOFTFLT-ALTI: error: option '-maltivec' cannot be specified with '-msoft-float'
// CHECK-SOFTFLT-VSX: error: option '-mvsx' cannot be specified with '-msoft-float'
// CHECK-SOFTFLT-FLOAT128: error: option '-mfloat128' cannot be specified with '-msoft-float'
// CHECK-SOFTFLT-P8VEC: error: option '-mpower8-vector' cannot be specified with '-msoft-float'
// CHECK-SOFTFLT-P9VEC: error: option '-mpower9-vector' cannot be specified with '-msoft-float'
// CHECK-SOFTFLT-P10VEC: error: option '-mpower10-vector' cannot be specified with '-msoft-float'
// CHECK-SOFTFLT-DIRECTMOVE: error: option '-mdirect-move' cannot be specified with '-msoft-float'
// CHECK-SOFTFLT-MMA: error: option '-mmma' cannot be specified with '-msoft-float'
// CHECK-SOFTFLT-PAIREDVECMEMOP: error: option '-mpaired-vector-memops' cannot be specified with '-msoft-float'
// CHECK-SOFTFLT-CRYPTO: error: option '-mcrypto' cannot be specified with '-msoft-float'
28 changes: 28 additions & 0 deletions clang/test/Driver/ppc-soft-float.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// RUN: %clang -target powerpc64-unknown-unknown -mcpu=pwr10 -msoft-float -S -emit-llvm %s -o - | FileCheck %s -check-prefix=CHECKSOFT
// RUN: %clang -target powerpc64-unknown-unknown -mcpu=pwr10 -S -emit-llvm %s -o - | FileCheck %s -check-prefix=CHECKNOSOFT

int main () {
return 0;
}

// CHECKSOFT-DAG: -hard-float
// CHECKSOFT-DAG: -vsx
// CHECKSOFT-DAG: -altivec
// CHECKSOFT-DAG: -direct-move
// CHECKSOFT-DAG: -float128
// CHECKSOFT-DAG: -mma
// CHECKSOFT-DAG: -paired-vector-memops
// CHECKSOFT-DAG: -power10-vector
// CHECKSOFT-DAG: -power9-vector
// CHECKSOFT-DAG: -power8-vector
// CHECKSOFT-DAG: -crypto

// CHECKNOSOFT-DAG: +vsx
// CHECKNOSOFT-DAG: +altivec
// CHECKNOSOFT-DAG: +direct-move
// CHECKNOSOFT-DAG: +mma
// CHECKNOSOFT-DAG: +paired-vector-memops
// CHECKNOSOFT-DAG: +power10-vector
// CHECKNOSOFT-DAG: +power9-vector
// CHECKNOSOFT-DAG: +power8-vector
// CHECKNOSOFT-DAG: +crypto
2 changes: 1 addition & 1 deletion clang/test/Modules/check-for-sanitizer-feature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
//
// Import the PCH without ASan enabled (we expect an error).
// RUN: not %clang_cc1 -x c -include-pch %t.asan_pch %s -verify 2>&1 | FileCheck %s --check-prefix=PCH_MISMATCH
// PCH_MISMATCH: AST file was compiled with the target feature '-fsanitize=address' but the current translation unit is not
// PCH_MISMATCH: AST file '{{.*}}.asan_pch' was compiled with the target feature '-fsanitize=address' but the current translation unit is not
//
// Emit a PCH with UBSan enabled.
// RUN: %clang_cc1 -x c -fsanitize=null %S/Inputs/check-for-sanitizer-feature/check.h -emit-pch -o %t.ubsan_pch
Expand Down
2 changes: 1 addition & 1 deletion clang/test/Modules/ignored_macros.m
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
// RUN: %clang_cc1 -fmodules-cache-path=%t.modules -fmodules -fimplicit-module-maps -I %S/Inputs -emit-pch -o %t.pch -x objective-c-header %s -verify
// RUN: not %clang_cc1 -fmodules-cache-path=%t.modules -DIGNORED=1 -fmodules -fimplicit-module-maps -I %S/Inputs -include-pch %t.pch %s > %t.err 2>&1
// RUN: FileCheck -check-prefix=CHECK-CONFLICT %s < %t.err
// CHECK-CONFLICT: PCH was compiled with module cache path
// CHECK-CONFLICT: AST file '{{.*}}' was compiled with module cache path

// Third trial: pass -DIGNORED=1 only to the second invocation, but
// make it ignored. There should be no failure, IGNORED is defined in
Expand Down
2 changes: 1 addition & 1 deletion clang/test/Modules/load_failure.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
// RUN: FileCheck -check-prefix=CHECK-FAILURE %s < %t.out

// FIXME: Clean up diagnostic text below and give it a location
// CHECK-FAILURE: error: C99 was disabled in PCH file but is currently enabled
// CHECK-FAILURE: error: C99 was disabled in AST file '{{.*}}load_failure.pcm' but is currently enabled
// FIXME: When we have a syntax for modules in C, use that.


6 changes: 3 additions & 3 deletions clang/test/Modules/merge-target-features.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
// RUN: -target-cpu i386 \
// RUN: -fsyntax-only merge-target-features.cpp 2>&1 \
// RUN: | FileCheck --check-prefix=SUBSET --implicit-check-not=error: %s
// SUBSET: error: AST file was compiled with the target feature '+sse2' but the current translation unit is not
// SUBSET: error: AST file '{{.*}}foo.pcm' was compiled with the target feature '+sse2' but the current translation unit is not
// SUBSET: error: {{.*}} configuration mismatch
//
// RUN: %clang_cc1 -fmodules -x c++ -fmodules-cache-path=%t \
Expand Down Expand Up @@ -57,8 +57,8 @@
// RUN: -target-cpu i386 -target-feature +cx16 \
// RUN: -fsyntax-only merge-target-features.cpp 2>&1 \
// RUN: | FileCheck --check-prefix=MISMATCH --implicit-check-not=error: %s
// MISMATCH: error: AST file was compiled with the target feature '+sse2' but the current translation unit is not
// MISMATCH: error: current translation unit is compiled with the target feature '+cx16' but the AST file was not
// MISMATCH: error: AST file '{{.*}}foo.pcm' was compiled with the target feature '+sse2' but the current translation unit is not
// MISMATCH: error: current translation unit is compiled with the target feature '+cx16' but the AST file '{{.*}}foo.pcm' was not
// MISMATCH: error: {{.*}} configuration mismatch

#include "foo.h"
Expand Down
2 changes: 1 addition & 1 deletion clang/test/Modules/mismatch-diagnostics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@ export module mismatching_module;

//--- use.cpp
import mismatching_module;
// CHECK: error: POSIX thread support was enabled in PCH file but is currently disabled
// CHECK: error: POSIX thread support was enabled in AST file '{{.*[/|\\\\]}}mismatching_module.pcm' but is currently disabled
// CHECK-NEXT: module file {{.*[/|\\\\]}}mismatching_module.pcm cannot be loaded due to a configuration mismatch with the current compilation
4 changes: 2 additions & 2 deletions clang/test/Modules/module-pch-different-cache-path.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@

pch_int x = 0;

// CHECK-ERROR: PCH was compiled with module cache path '{{.*}}', but the path is currently '{{.*}}'
// CHECK-SUCCESS-NOT: PCH was compiled with module cache path '{{.*}}', but the path is currently '{{.*}}'
// CHECK-ERROR: AST file '{{.*}}' was compiled with module cache path '{{.*}}', but the path is currently '{{.*}}'
// CHECK-SUCCESS-NOT: AST file '{{.*}}' was compiled with module cache path '{{.*}}', but the path is currently '{{.*}}'
5 changes: 5 additions & 0 deletions clang/test/Modules/pr101398.cppm
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// RUN: mkdir -p %t
// RUN: %clang -std=c++20 -xc++-module %s -Xclang -verify --precompile -o %t/tmp.pcm
// not modules

// expected-error@* {{missing 'export module' declaration in module interface unit}}
4 changes: 2 additions & 2 deletions clang/test/Modules/pr62359.cppm
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ int use() {
return 0;
}

// CHECK: OpenMP{{.*}}differs in PCH file vs. current file
// CHECK: OpenMP{{.*}}differs in AST file '{{.*}}Hello.pcm' vs. current file

//--- use2.cpp
// expected-no-diagnostics
Expand All @@ -55,5 +55,5 @@ int use2() {
return 0;
}

// CHECK: OpenMP{{.*}}differs in PCH file vs. current file
// CHECK: OpenMP{{.*}}differs in AST file '{{.*}}Hello.pcm' vs. current file
// CHECK: use of undeclared identifier 'pragma'
8 changes: 8 additions & 0 deletions clang/test/Modules/pr99825.cppm
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// RUN: %clang_cc1 -std=c++20 %s -fsyntax-only -verify
// expected-no-diagnostics
export module mod;

extern "C++"
{
export constexpr auto x = 10;
}
4 changes: 2 additions & 2 deletions clang/test/PCH/arc.m
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@
array0 a0;
array1 a1;

// CHECK-ERR1: Objective-C automated reference counting was enabled in PCH file but is currently disabled
// CHECK-ERR2: Objective-C automated reference counting was disabled in PCH file but is currently enabled
// CHECK-ERR1: Objective-C automated reference counting was enabled in AST file '{{.*}}' but is currently disabled
// CHECK-ERR2: Objective-C automated reference counting was disabled in AST file '{{.*}}' but is currently enabled
6 changes: 3 additions & 3 deletions clang/test/PCH/fuzzy-pch.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ BAR bar = 17;
# error BAR was not defined
#endif

// CHECK-FOO: definition of macro 'FOO' differs between the precompiled header ('1') and the command line ('blah')
// CHECK-NOFOO: macro 'FOO' was defined in the precompiled header but undef'd on the command line
// CHECK-FOO: definition of macro 'FOO' differs between the AST file '{{.*}}' ('1') and the command line ('blah')
// CHECK-NOFOO: macro 'FOO' was defined in the AST file '{{.*}}' but undef'd on the command line

// CHECK-UNDEF: command line contains '-undef' but precompiled header was not built with it
// CHECK-UNDEF: command line contains '-undef' but AST file '{{.*}}' was not built with it

2 changes: 1 addition & 1 deletion clang/test/PCH/module-hash-difference.m
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
// RUN: not %clang_cc1 -fsyntax-only -include-pch %t.pch %s -I %S/Inputs/modules -fmodules -fimplicit-module-maps -fmodules-cache-path=%t.mcp -fdisable-module-hash 2> %t.err
// RUN: FileCheck -input-file=%t.err %s

// CHECK: error: PCH was compiled with module cache path {{.*}}, but the path is currently {{.*}}
// CHECK: error: AST file '{{.*}}' was compiled with module cache path {{.*}}, but the path is currently {{.*}}
@import Foo;
4 changes: 2 additions & 2 deletions clang/test/PCH/ms-pch-macro.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ BAR bar = 17;
# error BAR was not defined
#endif

// CHECK-FOO: definition of macro 'FOO' differs between the precompiled header ('1') and the command line ('blah')
// CHECK-NOFOO: macro 'FOO' was defined in the precompiled header but undef'd on the command line
// CHECK-FOO: definition of macro 'FOO' differs between the AST file '{{.*}}1.pch' ('1') and the command line ('blah')
// CHECK-NOFOO: macro 'FOO' was defined in the AST file '{{.*}}1.pch' but undef'd on the command line

// expected-warning@2 {{definition of macro 'BAR' does not match definition in precompiled header}}
4 changes: 2 additions & 2 deletions clang/test/PCH/no-validate-pch.cl
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
// CHECK: note: previous definition is here
// CHECK: #define X 4

// CHECK-VAL: error: __OPTIMIZE__ predefined macro was enabled in PCH file but is currently disabled
// CHECK-VAL: error: definition of macro 'X' differs between the precompiled header ('4') and the command line ('5')
// CHECK-VAL: error: __OPTIMIZE__ predefined macro was enabled in AST file '{{.*}}' but is currently disabled
// CHECK-VAL: error: definition of macro 'X' differs between the AST file '{{.*}}' ('4') and the command line ('5')

void test(void) {
int a = ONE;
Expand Down
1 change: 1 addition & 0 deletions clang/test/Sema/attr-counted-by-bounds-safety-vlas.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -fexperimental-bounds-safety -verify %s
// RUN: %clang_cc1 -fsyntax-only -fexperimental-bounds-safety -fexperimental-late-parse-attributes -verify %s
//
// This is a portion of the `attr-counted-by-vla.c` test but is checked
// under the semantics of `-fexperimental-bounds-safety` which has different
Expand Down
7 changes: 5 additions & 2 deletions clang/test/Sema/attr-counted-by-or-null-last-field.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
// RUN: %clang_cc1 -fsyntax-only -verify=expected,immediate %s
// RUN: %clang_cc1 -fsyntax-only -fexperimental-late-parse-attributes -verify=expected,late %s

#define __counted_by_or_null(f) __attribute__((counted_by_or_null(f)))

Expand Down Expand Up @@ -82,7 +83,9 @@ struct found_outside_of_struct {

struct self_referrential {
int bork;
struct bar *self[] __counted_by_or_null(self); // expected-error {{use of undeclared identifier 'self'}}
// immediate-error@+2{{use of undeclared identifier 'self'}}
// late-error@+1{{'counted_by_or_null' only applies to pointers; did you mean to use 'counted_by'?}}
struct bar *self[] __counted_by_or_null(self);
};

struct non_int_count {
Expand Down
Loading