]> granicus.if.org Git - clang/commitdiff
Update docs/comments/utils/examples to refer to clang -cc1 instead of clang-cc.
authorDaniel Dunbar <daniel@zuster.org>
Fri, 11 Dec 2009 23:04:35 +0000 (23:04 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Fri, 11 Dec 2009 23:04:35 +0000 (23:04 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91176 91177308-0d34-0410-b5e6-96231b3b80d8

examples/PrintFunctionNames/PrintFunctionNames.cpp
examples/PrintFunctionNames/README.txt
include/clang/Frontend/ASTConsumers.h
lib/Frontend/CompilerInstance.cpp
utils/TestUtils/pch-test.pl
www/analyzer/installation.html
www/get_started.html
www/hacking.html

index a103c63704af7df247838e7ec9bd3902e7f5f448..5b7b66a4f7ffda167820aa4ecf313a2f4fa1a8ef 100644 (file)
@@ -7,8 +7,8 @@
 //
 //===----------------------------------------------------------------------===//
 //
-// Example clang-cc plugin which simply prints the names of all the top-level
-// decls in the input file.
+// Example clang plugin which simply prints the names of all the top-level decls
+// in the input file.
 //
 //===----------------------------------------------------------------------===//
 
index 2859eeff55792cd1476e2c24775dc058f06264ec..ee6f7e865e91083c5f0d3c7a35648077eaca3c64 100644 (file)
@@ -1,4 +1,4 @@
-This is a simple example demonstrating how to use clang-cc's facility for
+This is a simple example demonstrating how to use clang's facility for
 providing AST consumers using a plugin.
 
 You will probably need to build clang so that it exports all symbols (disable
@@ -6,5 +6,5 @@ TOOL_NO_EXPORT in the tools/clang Makefile).
 
 Once the plugin is built, you can run it using:
 --
-$ clang-cc -load path/to/PrintFunctionNames.so -plugin=print-fns some-input-file.c
+$ clang -cc1 -load path/to/PrintFunctionNames.so -plugin=print-fns some-input-file.c
 --
index 26efa9745600d6721c5c00f6618c1b296f326256..20bf83ee0456c075c224297fff641ec42cfc8016 100644 (file)
@@ -94,9 +94,9 @@ ASTConsumer *CreateHTMLPrinter(llvm::raw_ostream *OS, Preprocessor &PP,
                                bool SyntaxHighlight = true,
                                bool HighlightMacros = true);
 
-// PCH generator: generates a precompiled header file; this file can be
-// used later with the PCHReader (clang-cc option -include-pch)
-// to speed up compile times.
+// PCH generator: generates a precompiled header file; this file can be used
+// later with the PCHReader (clang -cc1 option -include-pch) to speed up compile
+// times.
 ASTConsumer *CreatePCHGenerator(const Preprocessor &PP,
                                 llvm::raw_ostream *OS,
                                 const char *isysroot = 0);
index f36a56032b29dcc95ca37c83cec5de4c5ca0f368..2a6a8a8750d2fc29b8b2577220519e866b4aedf2 100644 (file)
@@ -95,7 +95,7 @@ static void SetUpBuildDumpLog(const DiagnosticOptions &DiagOpts,
     return;
   }
 
-  (*OS) << "clang-cc command line arguments: ";
+  (*OS) << "clang -cc1 command line arguments: ";
   for (unsigned i = 0; i != argc; ++i)
     (*OS) << argv[i] << ' ';
   (*OS) << '\n';
index 2e17117a2a292c20eea5391c15aa5d20758969af..e097c5c00c09ac6964f886e4887a3d6e39dbb504 100755 (executable)
@@ -1,7 +1,7 @@
 #!/usr/bin/perl -w
 
 # This tiny little script, which should be run from the clang
-# directory (with clang-cc in your patch), tries to take each
+# directory (with clang in your patch), tries to take each
 # compilable Clang test and build a PCH file from that test, then read
 # and dump the contents of the PCH file just created.
 use POSIX;
@@ -17,12 +17,12 @@ sub testfiles($$) {
   @files = `ls test/*/*.$suffix`;
   foreach $file (@files) {
     chomp($file);
-    my $code = system("clang-cc -fsyntax-only -x $language $file > /dev/null 2>&1");
+    my $code = system("clang- -fsyntax-only -x $language $file > /dev/null 2>&1");
     if ($code == 0) {
       print(".");
-      $code = system("clang-cc -emit-pch -x $language -o $file.pch $file > /dev/null 2>&1");
+      $code = system("clang -cc1 -emit-pch -x $language -o $file.pch $file > /dev/null 2>&1");
       if ($code == 0) {
-        $code = system("clang-cc -include-pch $file.pch -x $language -ast-dump /dev/null > /dev/null 2>&1");
+        $code = system("clang -cc1 -include-pch $file.pch -x $language -ast-dump /dev/null > /dev/null 2>&1");
         if ($code == 0) {
           $passed++;
         } elsif (($code & 0xFF) == SIGINT) {
index 81f45514fc0188fbe4d12dce48e9fa0e04918eb1..d2be711a4860412b626a576aaa173989ba8f487d 100644 (file)
@@ -87,13 +87,13 @@ source code</a>.<p>
 
 <ul>
 
-<li>The locations of the <tt>clang-cc</tt> and <tt>clang</tt> binaries.
+<li>The location of the <tt>clang</tt> binary.
 
 <p>For example, if you built a <em>Debug</em> build of LLVM/Clang, the
-resultant binaries will be in $(OBJDIR)/Debug (where <tt>$(OBJDIR)</tt>
-is often the same as the root source directory).  You can also do
-<tt>make install</tt> to install the LLVM/Clang libaries and binaries to
-the installation directory of your choice (specified when you run
+resultant<tt>clang</tt> binary will be in $(OBJDIR)/Debug
+(where <tt>$(OBJDIR)</tt> is often the same as the root source directory).  You
+can also do <tt>make install</tt> to install the LLVM/Clang libaries and
+binaries to the installation directory of your choice (specified when you run
 <tt>configure</tt>).</p></li>
 
 <li>The locations of the <tt>scan-build</tt> and <tt>scan-view</tt>
index b7df928d27a87ec521c0cdb8aa23ab40d49c423f..f750fa09216cef519a7d7deba357769db4cd8e8e 100644 (file)
@@ -73,22 +73,12 @@ follows:</p>
   </ul>
   <li>Try it out (assuming you add llvm/Debug/bin to your path):</li>
   <ul>
-    <li><tt>clang-cc --help</tt></li>
-    <li><tt>clang-cc file.c -fsyntax-only</tt> (check for correctness)</li>
-    <li><tt>clang-cc file.c -ast-dump</tt> (internal debug dump of ast)</li>
-    <li><tt>clang-cc file.c -ast-view</tt> (<a
-    href="http://llvm.org/docs/ProgrammersManual.html#ViewGraph">set up graphviz
-     and rebuild llvm first</a>)</li>
-    <li><tt>clang-cc file.c -emit-llvm</tt> (print out unoptimized llvm code)</li>
-    <li><tt>clang-cc file.c -emit-llvm -o - | llvm-as | opt -std-compile-opts |
-         llvm-dis</tt> (print out optimized llvm code)</li>
-    <li><tt>clang-cc file.c -emit-llvm -o - | llvm-as | opt -std-compile-opts | llc
-         &gt; file.s</tt> (output native machine code)</li>
+    <li><tt>clang --help</tt></li>
+    <li><tt>clang file.c -fsyntax-only</tt> (check for correctness)</li>
+    <li><tt>clang file.c -S -emit-llvm -o -</tt> (print out unoptimized llvm code)</li>
+    <li><tt>clang file.c -S -emit-llvm -o - -O3</tt></li>
+    <li><tt>clang file.c -S -O3 -o -</tt> (output native machine code)</li>
   </ul>
-  <p><em>Note</em>: Here <tt>clang-cc</tt> is the "low-level" frontend
-  executable that is similar in purpose to <tt>cc1</tt>. Clang also has a <a
-  href="#driver">high-level compiler driver</a> that acts as a drop-in
-  replacement for <tt>gcc</tt>.
 </ol>
 
 <p>Note that the C front-end uses LLVM, but does not depend on llvm-gcc. If you
@@ -159,10 +149,8 @@ Visual Studio:</p>
   <li>Build Clang:</li>
   <ul>
     <li>Open LLVM.sln in Visual Studio.</li>
-    <li>Build the "clang-cc" project for just the compiler front end.
-       Alternatively, build the "clang" project for the compiler driver
-       (note that the driver is currently broken on Windows),
-       or the "ALL_BUILD" project to build everything, including tools.</li>
+    <li>Build the "clang" project for just the compiler driver and front end, or
+      the "ALL_BUILD" project to build everything, including tools.</li>
   </ul>
   <li>Try it out (assuming you added llvm/debug/bin to your path).  (See the
     running examples from above.)</li>
@@ -175,13 +163,11 @@ Visual Studio:</p>
 to the latest code base, use the <tt>svn update</tt> command in both the
 llvm and llvm\tools\clang directories, as they are separate repositories.</p>
 
-<a name="driver"><h2>High-Level Compiler Driver (Drop-in Substitute for GCC)</h2></a>
+<a name="driver"><h2>Clang Compiler Driver (Drop-in Substitute for GCC)</h2></a>
 
-<p>While the <tt>clang-cc</tt> executable is a low-level frontend executable
-that can perform code generation, program analysis, and other actions, it is not
-designed to be a drop-in replacement for GCC's <tt>cc</tt>. For this purpose,
-use the high-level driver, aptly named <tt>clang</tt>.  Here are some
-examples of how to use the high-level driver:
+<p>The <tt>clang</tt> tool is the compiler driver and front-end, which is
+designed to be a drop-in replacement for the <tt>gcc</tt> command.  Here are
+some examples of how to use the high-level driver:
 </p>
 
 <pre class="code">
@@ -201,12 +187,6 @@ hello world
 
 <h2>Examples of using Clang</h2>
 
-<p>The high-level driver <tt>clang</tt> is designed to understand most of GCC's
-options, and the lower-level <tt>clang-cc</tt> executable also directly takes
-many of GCC's options. You can see which options <tt>clang-cc</tt> accepts with
-'<tt>clang-cc --help</tt>'. Here are a few examples of using <tt>clang</tt> and
-<tt>clang-cc</tt>:</p>
-
 <!-- Thanks to
  http://shiflett.org/blog/2006/oct/formatting-and-highlighting-php-code-listings
 Site suggested using pre in CSS, but doesn't work in IE, so went for the <pre>
@@ -251,8 +231,13 @@ typedef float V __attribute__((vector_size(16)));
 
 <h3>Pretty printing from the AST:</h3>
 
+<p>Note, the <tt>-cc1</tt> argument indicates the the compiler front-end, and
+not the driver, should be run. The compiler front-end has several additional
+Clang specific features which are not exposed through the GCC compatible driver
+interface.</p>
+
 <pre class="code">
-$ <b>clang-cc ~/t.c -ast-print</b>
+$ <b>clang -cc1 ~/t.c -ast-print</b>
 typedef float V __attribute__(( vector_size(16) ));
 V foo(V a, V b) {
    return a + b * a;
@@ -263,25 +248,21 @@ V foo(V a, V b) {
 <h3>Code generation with LLVM:</h3>
 
 <pre class="code">
-$ <b>clang-cc ~/t.c -emit-llvm -o - | llvm-as | opt -std-compile-opts | llvm-dis</b>
+$ <b>clang ~/t.c -S -emit-llvm -o -</b>
 define &lt;4 x float&gt; @foo(&lt;4 x float&gt; %a, &lt;4 x float&gt; %b) {
 entry:
          %mul = mul &lt;4 x float&gt; %b, %a
          %add = add &lt;4 x float&gt; %mul, %a
          ret &lt;4 x float&gt; %add
 }
-$ <b>clang-cc ~/t.c -emit-llvm -o - | llvm-as | opt -std-compile-opts | llc -march=ppc32 -mcpu=g5</b>
-..
-_foo:
-         vmaddfp v2, v3, v2, v2
-         blr
-$ <b>clang-cc ~/t.c -emit-llvm -o - | llvm-as | opt -std-compile-opts | llc -march=x86 -mcpu=yonah</b>
-..
+$ <b>clang -fomit-frame-pointer -O3 -S -o - t.c</b> <i># On x86_64</i>
+...
 _foo:
-         mulps %xmm0, %xmm1
-         addps %xmm0, %xmm1
-         movaps %xmm1, %xmm0
-         ret
+Leh_func_begin1:
+       mulps   %xmm0, %xmm1
+       addps   %xmm1, %xmm0
+       ret
+Leh_func_end1:
 </pre>
 
 </div>
index 372d9a62ec35c300200823e1fd83cb47e58226cc..ec9cd97cbaabe136e3f057b9e3f01029cd34f04c 100644 (file)
   correct this. Therefore your output might look something like this:</p>
 
 <tt><pre>lit.py: lit.cfg:152: note: using clang: 'C:/Tools/llvm/bin/Debug\\clang.EXE'
-lit.py: lit.cfg:157: note: using clang-cc: 'C:/Tools/llvm/bin/Debug/clang-cc.exe'
 -- Testing: 1723 tests, 2 threads --
 FAIL: Clang::(test path) (659 of 1723)
 ******************** TEST 'Clang::(test path)' FAILED ********************