[llvm] e33af27 - [llvm-c-test] Default to opaque pointers

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 2 20:34:57 PDT 2022


Author: Fangrui Song
Date: 2022-06-02T20:34:52-07:00
New Revision: e33af271eaed0bdaf6f95edd7c0841423fd0fc0e

URL: https://github.com/llvm/llvm-project/commit/e33af271eaed0bdaf6f95edd7c0841423fd0fc0e
DIFF: https://github.com/llvm/llvm-project/commit/e33af271eaed0bdaf6f95edd7c0841423fd0fc0e.diff

LOG: [llvm-c-test] Default to opaque pointers

Added: 
    

Modified: 
    llvm/test/Bindings/llvm-c/atomics.ll
    llvm/test/Bindings/llvm-c/echo.ll
    llvm/test/Bindings/llvm-c/freeze.ll
    llvm/test/Bindings/llvm-c/invoke.ll
    llvm/test/Bindings/llvm-c/memops.ll
    llvm/tools/llvm-c-test/echo.cpp
    llvm/tools/llvm-c-test/main.c

Removed: 
    


################################################################################
diff  --git a/llvm/test/Bindings/llvm-c/atomics.ll b/llvm/test/Bindings/llvm-c/atomics.ll
index d4df52a40ea86..ba29e5e1e1708 100644
--- a/llvm/test/Bindings/llvm-c/atomics.ll
+++ b/llvm/test/Bindings/llvm-c/atomics.ll
@@ -1,5 +1,5 @@
 ; RUN: llvm-as < %s | llvm-dis > %t.orig
-; RUN: llvm-as < %s | llvm-c-test --echo --opaque-pointers > %t.echo
+; RUN: llvm-as < %s | llvm-c-test --echo > %t.echo
 ; RUN: 
diff  -w %t.orig %t.echo
 
 define i32 @main() {

diff  --git a/llvm/test/Bindings/llvm-c/echo.ll b/llvm/test/Bindings/llvm-c/echo.ll
index f7f82be36b0c7..934d647437f9f 100644
--- a/llvm/test/Bindings/llvm-c/echo.ll
+++ b/llvm/test/Bindings/llvm-c/echo.ll
@@ -2,8 +2,8 @@
 ; RUN: llvm-as < %s | llvm-c-test --echo --no-opaque-pointers > %t.echo
 ; RUN: 
diff  -w %t.orig %t.echo
 ;
-; RUN: llvm-as -opaque-pointers < %s | llvm-dis -opaque-pointers > %t.orig_opaque
-; RUN: llvm-as -opaque-pointers < %s | llvm-c-test --echo --opaque-pointers > %t.echo_opaque
+; RUN: llvm-as -opaque-pointers < %s | llvm-dis > %t.orig_opaque
+; RUN: llvm-as -opaque-pointers < %s | llvm-c-test --echo > %t.echo_opaque
 ; RUN: 
diff  -w %t.orig_opaque %t.echo_opaque
 
 source_filename = "/test/Bindings/echo.ll"

diff  --git a/llvm/test/Bindings/llvm-c/freeze.ll b/llvm/test/Bindings/llvm-c/freeze.ll
index 2a3a0d68e1c69..8048a13c595bc 100644
--- a/llvm/test/Bindings/llvm-c/freeze.ll
+++ b/llvm/test/Bindings/llvm-c/freeze.ll
@@ -1,5 +1,5 @@
 ; RUN: llvm-as < %s | llvm-dis > %t.orig
-; RUN: llvm-as < %s | llvm-c-test --echo --opaque-pointers > %t.echo
+; RUN: llvm-as < %s | llvm-c-test --echo > %t.echo
 ; RUN: 
diff  -w %t.orig %t.echo
 
 %struct.T = type { i32, i32 }

diff  --git a/llvm/test/Bindings/llvm-c/invoke.ll b/llvm/test/Bindings/llvm-c/invoke.ll
index 4335a6e092051..43fb3fd0485d0 100644
--- a/llvm/test/Bindings/llvm-c/invoke.ll
+++ b/llvm/test/Bindings/llvm-c/invoke.ll
@@ -1,5 +1,5 @@
 ; RUN: llvm-as < %s | llvm-dis > %t.orig
-; RUN: llvm-as < %s | llvm-c-test --echo --opaque-pointers > %t.echo
+; RUN: llvm-as < %s | llvm-c-test --echo > %t.echo
 ; RUN: 
diff  -w %t.orig %t.echo
 
 %C6object9ClassInfo = type { ptr, ptr }

diff  --git a/llvm/test/Bindings/llvm-c/memops.ll b/llvm/test/Bindings/llvm-c/memops.ll
index 1045fba1294b6..93bbb626fc9fb 100644
--- a/llvm/test/Bindings/llvm-c/memops.ll
+++ b/llvm/test/Bindings/llvm-c/memops.ll
@@ -1,5 +1,5 @@
 ; RUN: llvm-as < %s | llvm-dis > %t.orig
-; RUN: llvm-as < %s | llvm-c-test --echo --opaque-pointers > %t.echo
+; RUN: llvm-as < %s | llvm-c-test --echo > %t.echo
 ; RUN: 
diff  -w %t.orig %t.echo
 
 %S = type { i32, i32 }

diff  --git a/llvm/tools/llvm-c-test/echo.cpp b/llvm/tools/llvm-c-test/echo.cpp
index 64f2122437f82..2323132fd7f30 100644
--- a/llvm/tools/llvm-c-test/echo.cpp
+++ b/llvm/tools/llvm-c-test/echo.cpp
@@ -1401,7 +1401,8 @@ int llvm_echo(bool OpaquePointers) {
   size_t ModuleIdentLen;
   const char *ModuleName = LLVMGetModuleIdentifier(Src, &ModuleIdentLen);
   LLVMContextRef Ctx = LLVMContextCreate();
-  LLVMContextSetOpaquePointers(Ctx, OpaquePointers);
+  if (!OpaquePointers)
+    LLVMContextSetOpaquePointers(Ctx, false);
   LLVMModuleRef M = LLVMModuleCreateWithNameInContext(ModuleName, Ctx);
 
   LLVMSetSourceFileName(M, SourceFileName, SourceFileLen);

diff  --git a/llvm/tools/llvm-c-test/main.c b/llvm/tools/llvm-c-test/main.c
index 9458f256f66fb..2d010b8254ba0 100644
--- a/llvm/tools/llvm-c-test/main.c
+++ b/llvm/tools/llvm-c-test/main.c
@@ -96,7 +96,8 @@ int main(int argc, char **argv) {
   } else if (argc == 2 && !strcmp(argv[1], "--test-callsite-attributes")) {
     return llvm_test_callsite_attributes();
   } else if ((argc == 2 || argc == 3) && !strcmp(argv[1], "--echo")) {
-    return llvm_echo(argc == 3 ? !strcmp(argv[2], "--opaque-pointers") : 0);
+    return llvm_echo(argc == 3 ? strcmp(argv[2], "--no-opaque-pointers") != 0
+                               : 1);
   } else if (argc == 2 && !strcmp(argv[1], "--test-diagnostic-handler")) {
     return llvm_test_diagnostic_handler();
   } else if (argc == 2 && !strcmp(argv[1], "--test-dibuilder")) {


        


More information about the llvm-commits mailing list