From 470e8b80cee02a5cdcb5152250b7d162d1b5d9c2 Mon Sep 17 00:00:00 2001 From: Chuanqi Xu Date: Fri, 31 May 2024 10:43:21 +0800 Subject: [PATCH] Address comments --- clang/include/clang/Driver/Options.td | 3 ++- clang/test/CIR/Transforms/lifetime-check-agg.cpp | 1 + clang/test/CIR/Transforms/lifetime-check-coro-task.cpp | 2 +- clang/test/CIR/Transforms/lifetime-check-lambda.cpp | 2 +- clang/test/CIR/Transforms/lifetime-check-owner.cpp | 2 +- clang/test/CIR/Transforms/lifetime-check-range-for-vector.cpp | 2 +- clang/test/CIR/Transforms/lifetime-check-remarks.cpp | 2 +- clang/test/CIR/Transforms/lifetime-check-string.cpp | 2 +- clang/test/CIR/Transforms/lifetime-check.cpp | 2 +- clang/test/CIR/Transforms/lifetime-fn-args.cpp | 2 +- clang/test/CIR/Transforms/lifetime-loop-valid.cpp | 2 +- clang/test/CIR/Transforms/lifetime-loop.cpp | 2 +- clang/test/CIR/Transforms/lifetime-null-passing.cpp | 2 +- clang/test/CIR/Transforms/lifetime-switch.cpp | 2 +- clang/test/CIR/Transforms/lifetime-this.cpp | 2 +- 15 files changed, 16 insertions(+), 14 deletions(-) diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td index 728b67bcfcad..70b467346b9f 100644 --- a/clang/include/clang/Driver/Options.td +++ b/clang/include/clang/Driver/Options.td @@ -3009,7 +3009,8 @@ defm clangir_direct_lowering : BoolFOption<"clangir-direct-lowering", NegFlag>; defm clangir_analysis_only : BoolFOption<"clangir-analysis-only", FrontendOpts<"ClangIRAnalysisOnly">, DefaultFalse, - PosFlag, + PosFlag, NegFlag>; def emit_cir : Flag<["-"], "emit-cir">, Visibility<[CC1Option]>, diff --git a/clang/test/CIR/Transforms/lifetime-check-agg.cpp b/clang/test/CIR/Transforms/lifetime-check-agg.cpp index bc61d22025ac..ebfe00c2ad56 100644 --- a/clang/test/CIR/Transforms/lifetime-check-agg.cpp +++ b/clang/test/CIR/Transforms/lifetime-check-agg.cpp @@ -1,3 +1,4 @@ +// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-linux-gnu -mconstructor-aliases -fclangir -clangir-disable-emit-cxx-default -fclangir-lifetime-check="history=all;remarks=all" -clangir-verify-diagnostics -emit-cir %s -o %t.cir // RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-linux-gnu -mconstructor-aliases -fclangir-analysis-only -fclangir-lifetime-check="history=all;remarks=all" %s -clangir-verify-diagnostics -emit-obj -o /dev/null typedef enum SType { diff --git a/clang/test/CIR/Transforms/lifetime-check-coro-task.cpp b/clang/test/CIR/Transforms/lifetime-check-coro-task.cpp index c81c6759927d..cf101b790491 100644 --- a/clang/test/CIR/Transforms/lifetime-check-coro-task.cpp +++ b/clang/test/CIR/Transforms/lifetime-check-coro-task.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -std=c++20 -I%S/Inputs -fclangir-analysis-only -fclangir-lifetime-check="history=all;remarks=all;history_limit=1" -clangir-verify-diagnostics -emit-obj %s -o /dev/null +// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -std=c++20 -I%S/Inputs -fclangir -fclangir-lifetime-check="history=all;remarks=all;history_limit=1" -clangir-verify-diagnostics -emit-cir %s -o %t.cir #include "folly-coro.h" diff --git a/clang/test/CIR/Transforms/lifetime-check-lambda.cpp b/clang/test/CIR/Transforms/lifetime-check-lambda.cpp index 66fb55dbcc13..617e18edf499 100644 --- a/clang/test/CIR/Transforms/lifetime-check-lambda.cpp +++ b/clang/test/CIR/Transforms/lifetime-check-lambda.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -std=c++20 -I%S/Inputs -Wno-return-stack-address -fclangir-analysis-only -fclangir-lifetime-check="history=all;history_limit=1" -clangir-verify-diagnostics -emit-obj %s -o /dev/null +// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -std=c++20 -I%S/Inputs -Wno-return-stack-address -fclangir -fclangir-lifetime-check="history=all;history_limit=1" -clangir-verify-diagnostics -emit-cir %s -o %t.cir // Check also implements: // EXP61-CPP. A lambda object must not outlive any of its reference captured objects diff --git a/clang/test/CIR/Transforms/lifetime-check-owner.cpp b/clang/test/CIR/Transforms/lifetime-check-owner.cpp index 66a8fd519a13..23643c821884 100644 --- a/clang/test/CIR/Transforms/lifetime-check-owner.cpp +++ b/clang/test/CIR/Transforms/lifetime-check-owner.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fclangir-analysis-only -fclangir-lifetime-check="history=all;remarks=all;history_limit=1" -clangir-verify-diagnostics -emit-obj %s -o /dev/null +// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fclangir -fclangir-lifetime-check="history=all;remarks=all;history_limit=1" -clangir-verify-diagnostics -emit-cir %s -o %t.cir struct [[gsl::Owner(int)]] MyIntOwner { int val; diff --git a/clang/test/CIR/Transforms/lifetime-check-range-for-vector.cpp b/clang/test/CIR/Transforms/lifetime-check-range-for-vector.cpp index bc5e26cdac45..e9c6d62b6f64 100644 --- a/clang/test/CIR/Transforms/lifetime-check-range-for-vector.cpp +++ b/clang/test/CIR/Transforms/lifetime-check-range-for-vector.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-linux-gnu -I%S/../Inputs -mconstructor-aliases -fclangir-analysis-only -fclangir-lifetime-check="history=all" -fclangir-skip-system-headers -clangir-verify-diagnostics -emit-obj %s -o /dev/null +// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-linux-gnu -I%S/../Inputs -mconstructor-aliases -fclangir -clangir-disable-emit-cxx-default -fclangir-lifetime-check="history=all" -fclangir-skip-system-headers -clangir-verify-diagnostics -emit-cir %s -o %t.cir #include "std-cxx.h" diff --git a/clang/test/CIR/Transforms/lifetime-check-remarks.cpp b/clang/test/CIR/Transforms/lifetime-check-remarks.cpp index fe03d19edf02..83cef25c54da 100644 --- a/clang/test/CIR/Transforms/lifetime-check-remarks.cpp +++ b/clang/test/CIR/Transforms/lifetime-check-remarks.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++17 -triple x86_64-unknown-linux-gnu -fclangir-analysis-only -fclangir-lifetime-check="remarks=pset-invalid" -clangir-verify-diagnostics -emit-obj %s -o /dev/null +// RUN: %clang_cc1 -std=c++17 -triple x86_64-unknown-linux-gnu -fclangir -fclangir-lifetime-check="remarks=pset-invalid" -clangir-verify-diagnostics -emit-cir %s -o %t.cir int *p0() { int *p = nullptr; diff --git a/clang/test/CIR/Transforms/lifetime-check-string.cpp b/clang/test/CIR/Transforms/lifetime-check-string.cpp index f2901320a206..383f3b5da626 100644 --- a/clang/test/CIR/Transforms/lifetime-check-string.cpp +++ b/clang/test/CIR/Transforms/lifetime-check-string.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++17 -triple x86_64-unknown-linux-gnu -mconstructor-aliases -fclangir-analysis-only -fclangir-lifetime-check="history=all;remarks=all" -clangir-verify-diagnostics -emit-obj %s -o /dev/null +// RUN: %clang_cc1 -std=c++17 -triple x86_64-unknown-linux-gnu -mconstructor-aliases -fclangir -clangir-disable-emit-cxx-default -fclangir-lifetime-check="history=all;remarks=all" -clangir-verify-diagnostics -emit-cir %s -o %t.cir int strlen(char const *); diff --git a/clang/test/CIR/Transforms/lifetime-check.cpp b/clang/test/CIR/Transforms/lifetime-check.cpp index 0c52dfbfe860..017de9f6495d 100644 --- a/clang/test/CIR/Transforms/lifetime-check.cpp +++ b/clang/test/CIR/Transforms/lifetime-check.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fclangir-analysis-only -fclangir-lifetime-check="history=invalid,null" -clangir-verify-diagnostics -emit-obj %s -o /dev/null +// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fclangir -fclangir-lifetime-check="history=invalid,null" -clangir-verify-diagnostics -emit-cir %s -o %t.cir int *p0() { int *p = nullptr; diff --git a/clang/test/CIR/Transforms/lifetime-fn-args.cpp b/clang/test/CIR/Transforms/lifetime-fn-args.cpp index bdf852ece466..6c1b297f1b32 100644 --- a/clang/test/CIR/Transforms/lifetime-fn-args.cpp +++ b/clang/test/CIR/Transforms/lifetime-fn-args.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-linux-gnu -mconstructor-aliases -fclangir-analysis-only -fclangir-lifetime-check="history=all;remarks=all" -clangir-verify-diagnostics -emit-obj %s -o /dev/null +// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-linux-gnu -mconstructor-aliases -fclangir -clangir-disable-emit-cxx-default -fclangir-lifetime-check="history=all;remarks=all" -clangir-verify-diagnostics -emit-cir %s -o %t.cir struct A { void* ctx; diff --git a/clang/test/CIR/Transforms/lifetime-loop-valid.cpp b/clang/test/CIR/Transforms/lifetime-loop-valid.cpp index 1f031117060a..e7ee7aca7cf3 100644 --- a/clang/test/CIR/Transforms/lifetime-loop-valid.cpp +++ b/clang/test/CIR/Transforms/lifetime-loop-valid.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++17 -triple x86_64-unknown-linux-gnu -fclangir-analysis-only -fclangir-lifetime-check="history=invalid,null;remarks=pset-always" -clangir-verify-diagnostics -emit-obj %s -o /dev/null +// RUN: %clang_cc1 -std=c++17 -triple x86_64-unknown-linux-gnu -fclangir -fclangir-lifetime-check="history=invalid,null;remarks=pset-always" -clangir-verify-diagnostics -emit-cir %s -o %t.cir // Loops that do not change psets diff --git a/clang/test/CIR/Transforms/lifetime-loop.cpp b/clang/test/CIR/Transforms/lifetime-loop.cpp index 5cd253df4607..cf58ddf48f73 100644 --- a/clang/test/CIR/Transforms/lifetime-loop.cpp +++ b/clang/test/CIR/Transforms/lifetime-loop.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++17 -triple x86_64-unknown-linux-gnu -fclangir-analysis-only -fclangir-lifetime-check="history=invalid,null;remarks=pset-invalid" -clangir-verify-diagnostics -emit-obj %s -o /dev/null +// RUN: %clang_cc1 -std=c++17 -triple x86_64-unknown-linux-gnu -fclangir -fclangir-lifetime-check="history=invalid,null;remarks=pset-invalid" -clangir-verify-diagnostics -emit-cir %s -o %t.cir void loop_basic_for() { int *p = nullptr; // expected-note {{invalidated here}} diff --git a/clang/test/CIR/Transforms/lifetime-null-passing.cpp b/clang/test/CIR/Transforms/lifetime-null-passing.cpp index 95fb6c97f6bd..e26210b56234 100644 --- a/clang/test/CIR/Transforms/lifetime-null-passing.cpp +++ b/clang/test/CIR/Transforms/lifetime-null-passing.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-linux-gnu -mconstructor-aliases -fclangir-analysis-only -fclangir-lifetime-check="history=all" -clangir-verify-diagnostics -emit-obj %s -o /dev/null +// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-linux-gnu -mconstructor-aliases -fclangir -clangir-disable-emit-cxx-default -fclangir-lifetime-check="history=all" -clangir-verify-diagnostics -emit-cir %s -o %t.cir class _j {}; typedef _j* jobj; diff --git a/clang/test/CIR/Transforms/lifetime-switch.cpp b/clang/test/CIR/Transforms/lifetime-switch.cpp index d5d33fc00e58..ca56b95f71a0 100644 --- a/clang/test/CIR/Transforms/lifetime-switch.cpp +++ b/clang/test/CIR/Transforms/lifetime-switch.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++17 -triple x86_64-unknown-linux-gnu -fclangir-analysis-only -fclangir-lifetime-check="history=invalid,null" -clangir-verify-diagnostics -emit-obj %s -o /dev/null +// RUN: %clang_cc1 -std=c++17 -triple x86_64-unknown-linux-gnu -fclangir -fclangir-lifetime-check="history=invalid,null" -clangir-verify-diagnostics -emit-cir %s -o %t.cir void s0(int b) { int *p = nullptr; diff --git a/clang/test/CIR/Transforms/lifetime-this.cpp b/clang/test/CIR/Transforms/lifetime-this.cpp index bbf46537ffb1..8e18af8a9e16 100644 --- a/clang/test/CIR/Transforms/lifetime-this.cpp +++ b/clang/test/CIR/Transforms/lifetime-this.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-linux-gnu -I%S/../Inputs -mconstructor-aliases -fclangir-analysis-only -fclangir-lifetime-check="history=all;remarks=all" -fclangir-skip-system-headers -clangir-verify-diagnostics -emit-obj %s -o /dev/null +// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-linux-gnu -I%S/../Inputs -mconstructor-aliases -fclangir -clangir-disable-emit-cxx-default -fclangir-lifetime-check="history=all;remarks=all" -fclangir-skip-system-headers -clangir-verify-diagnostics -emit-cir %s -o %t.cir #include "std-cxx.h"