[PATCH] PR21000: pass -I options to assembler

Artem Belevich tra at google.com
Fri Feb 6 11:19:32 PST 2015


Hi echristo,

This helps compiling assembly files that .include files.

http://reviews.llvm.org/D7472

Files:
  lib/Driver/Tools.cpp
  test/Driver/integrated-as.s

Index: lib/Driver/Tools.cpp
===================================================================
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -4965,6 +4965,9 @@
     // assembler on assembly source files.
     CmdArgs.push_back("-dwarf-debug-producer");
     CmdArgs.push_back(Args.MakeArgString(getClangFullVersion()));
+
+    // And pass along -I options
+    Args.AddAllArgs(CmdArgs, options::OPT_I);
   }
 
   // Optionally embed the -cc1as level arguments into the debug info, for build
@@ -7296,6 +7299,7 @@
   if (NeedsKPIC)
     addAssemblerKPIC(Args, CmdArgs);
 
+  Args.AddAllArgs(CmdArgs, options::OPT_I);
   Args.AddAllArgValues(CmdArgs, options::OPT_Wa_COMMA,
                        options::OPT_Xassembler);
 
Index: test/Driver/integrated-as.s
===================================================================
--- test/Driver/integrated-as.s
+++ test/Driver/integrated-as.s
@@ -29,6 +29,15 @@
 // XA_INCLUDE2: cc1as
 // XA_INCLUDE2: "-Ifoo_dir"
 
+// Test that -I is passed to integrated assembler.	
+// RUN: %clang -### -c -integrated-as %s -Ifoo_dir 2>&1 | FileCheck --check-prefix=BARE_INCLUDE1 %s
+// BARE_INCLUDE1: cc1as
+// BARE_INCLUDE1: "-I" "foo_dir"
+
+// RUN: %clang -### -c -integrated-as %s -I foo_dir 2>&1 | FileCheck --check-prefix=BARE_INCLUDE2 %s
+// BARE_INCLUDE2: cc1as
+// BARE_INCLUDE2: "-I" "foo_dir"
+
 // RUN: %clang -### -c -integrated-as %s -gdwarf-2 2>&1 | FileCheck --check-prefix=DWARF2 %s
 // DWARF2: "-g" "-gdwarf-2"

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D7472.19500.patch
Type: text/x-patch
Size: 1475 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150206/82b6925f/attachment.bin>


More information about the cfe-commits mailing list