<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <br>
    <div class="moz-cite-prefix">On 22/10/2013 00:14, Reid Kleckner
      wrote:<br>
    </div>
    <blockquote
cite="mid:differential-rev-PHID-DREV-zonyyix24sqliavj63ae-req@llvm-reviews.chandlerc.com"
      type="cite">
      <pre wrap="">This has the unfortunate side effect of suggesting _alloca as a
typo-correction for malloc when it is undeclared, but I don't see a good
way around that.</pre>
    </blockquote>
    <br>
    Perhaps we shouldn't be suggesting underscore-prefixed typo
    corrections?<br>
    <br>
    <meta http-equiv="Content-Type" content="text/html;
      charset=ISO-8859-1">
    <div class="page" title="Page 444">
      <div class="layoutArea">
        <div class="column">
          <ol style="list-style-type: none">
            <li>
              <p><span style="font-size: 10.000000pt; font-family:
                  'LMRoman10'; font-weight: 700">17.6.4.3.2 Global names
                  [global.names]
                </span></p>
            </li>
          </ol>
          <p><span style="font-size: 7.000000pt; font-family:
              'LMRoman7'; vertical-align: 2.000000pt">1 </span><span
              style="font-size: 10.000000pt; font-family: 'LMRoman10'">Certain
              sets of names and function signatures are always reserved
              to the implementation:
            </span></p>
          <ul style="list-style-type: none">
            <li>
              <p><span style="font-size: 10.000000pt; font-family:
                  'LMRoman10'">—  Each name that contains a double
                  underscore </span><span style="font-size:
                  10.000000pt; font-family: 'LMMono10'">_ _ </span><span
                  style="font-size: 10.000000pt; font-family:
                  'LMRoman10'">or begins with an underscore followed by
                  an uppercase
                </span></p>
              <p><span style="font-size: 10.000000pt; font-family:
                  'LMRoman10'">letter (</span><span style="font-size:
                  10.000000pt; font-family: 'LMRoman10'; color:
                  rgb(0.000000%, 0.000000%, 100.000000%)">2.12</span><span
                  style="font-size: 10.000000pt; font-family:
                  'LMRoman10'">) is reserved to the implementation for
                  any use.
                </span></p>
            </li>
            <li>
              <p><b><span style="font-size: 10.000000pt; font-family:
                    'LMRoman10'">—  Each name that begins with an
                    underscore is reserved to the implementation for use
                    as a name in the
                  </span></b></p>
              <b> </b>
              <p><b><span style="font-size: 10.000000pt; font-family:
                    'LMRoman10'">global namespace.
                  </span></b></p>
            </li>
          </ul>
        </div>
      </div>
    </div>
    <title>C++ International Standard</title>
    <br>
    Alp.<br>
    <br>
    <blockquote
cite="mid:differential-rev-PHID-DREV-zonyyix24sqliavj63ae-req@llvm-reviews.chandlerc.com"
      type="cite">
      <pre wrap="">

<a class="moz-txt-link-freetext" href="http://llvm-reviews.chandlerc.com/D1989">http://llvm-reviews.chandlerc.com/D1989</a>

Files:
  include/clang/Basic/Builtins.def
  lib/CodeGen/CGBuiltin.cpp
  test/CodeGen/builtins.c
  test/SemaCXX/no-implicit-builtin-decls.cpp

Index: include/clang/Basic/Builtins.def
===================================================================
--- include/clang/Basic/Builtins.def
+++ include/clang/Basic/Builtins.def
@@ -671,6 +671,7 @@
 BUILTIN(__builtin_rindex, "c*cC*i", "Fn")
 
 // Microsoft builtins.
+BUILTIN(_alloca, "v*z", "n")
 BUILTIN(__assume, "vb", "n")
 BUILTIN(__noop, "v.", "n")
 BUILTIN(__debugbreak, "v", "n")
Index: lib/CodeGen/CGBuiltin.cpp
===================================================================
--- lib/CodeGen/CGBuiltin.cpp
+++ lib/CodeGen/CGBuiltin.cpp
@@ -603,6 +603,7 @@
   }
 
   case Builtin::BIalloca:
+  case Builtin::BI_alloca:
   case Builtin::BI__builtin_alloca: {
     Value *Size = EmitScalarExpr(E->getArg(0));
     return RValue::get(Builder.CreateAlloca(Builder.getInt8Ty(), Size));
Index: test/CodeGen/builtins.c
===================================================================
--- test/CodeGen/builtins.c
+++ test/CodeGen/builtins.c
@@ -210,3 +210,11 @@
   // CHECK: call i64 @llvm.readcyclecounter()
   return __builtin_readcyclecounter();
 }
+
+// CHECK-LABEL: define void @test_alloca
+void test_alloca(int n) {
+  extern void capture(void *);
+  capture(_alloca(n));
+  // CHECK: alloca i8, i64 %
+  // CHECK: call void @capture
+}
Index: test/SemaCXX/no-implicit-builtin-decls.cpp
===================================================================
--- test/SemaCXX/no-implicit-builtin-decls.cpp
+++ test/SemaCXX/no-implicit-builtin-decls.cpp
@@ -1,6 +1,6 @@
 // RUN: %clang_cc1 -fsyntax-only -verify %s
 
-void f() {
+void f() { // expected-note@+1 {{declared here}}
   void *p = malloc(sizeof(int) * 10); // expected-error{{use of undeclared identifier 'malloc'}}
 }
</pre>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
cfe-commits mailing list
<a class="moz-txt-link-abbreviated" href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a>
<a class="moz-txt-link-freetext" href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a>
</pre>
    </blockquote>
    <br>
    <pre class="moz-signature" cols="72">-- 
<a class="moz-txt-link-freetext" href="http://www.nuanti.com">http://www.nuanti.com</a>
the browser experts
</pre>
  </body>
</html>