title: What is llvm::NoneType and llvm::None used for?
body: <p>I am working on a huge code base of a C/C++ project based on LLVM. The code wasn't written by me, I am just reading and trying to understand what it means.</p>
  <p>For example this code is the first time I encountered <code>llvm::None</code></p>
  <pre class="lang-cpp prettyprint-override"><code>CallInst *CI = this-&gt;CreateCall(Func, None, VALUE_NAME(&quot;localPtr&quot;));
  </code></pre>
  <p>This is the definition of <code>CreateCall()</code> function.</p>
  <pre class="lang-cpp prettyprint-override"><code>CallInst *CreateCall(Function *Callee, ArrayRef&lt;Value *&gt; Args,
                       const Twine &amp;Name = &quot;&quot;, MDNode *FPMathTag = nullptr) {
      return CreateCall(Callee-&gt;getFunctionType(), Callee, Args, Name, FPMathTag);
  }
  </code></pre>
  <p>Apparently here the <code>llvm::None</code> is passed into the <a href="https://llvm.org/doxygen/classllvm_1_1ArrayRef.html" rel="nofollow noreferrer"><code>ArrayRef</code></a> <code>&lt;Value *&gt; Args</code></p>
  <p>According to LLVM reference ArrayRef</p>
  <blockquote>
  <p>Represent a constant reference to an array (0 or more elements consecutively in memory), i.e. a start pointer and a length. It allows various APIs to take consecutive elements easily and conveniently. This class does not own the underlying data, it is expected to be used in situations where the data resides in some other buffer, whose lifetime extends past that of the ArrayRef.</p>
  </blockquote>
  <p>I am puzzled that <code>llvm::None</code> is passed into this parameter as an argument.</p>
  <p>I could not find the documentation for <code>llvm::None</code> but I found the file in which it's declared.</p>
  <pre class="lang-cpp prettyprint-override"><code>//===----------------------------------------------------------------------===//
  //
  //  This file provides None, an enumerator for use in implicit constructors
  //  of various (usually templated) types to make such construction more
  //  terse.
  //
  //===----------------------------------------------------------------------===//
  
  #ifndef LLVM_ADT_NONE_H
  #define LLVM_ADT_NONE_H
  
  namespace llvm {
  /// A simple null object to allow implicit construction of Optional&lt;T&gt;
  /// and similar types without having to spell out the specialization's name.
  // (constant value 1 in an attempt to workaround MSVC build issue... )
  enum class NoneType { None = 1 };
  const NoneType None = NoneType::None;
  }
  
  #endif
  </code></pre>
  <p>I do not understand what these comments in that file mean. So it it just the same as <code>1</code>? What is it for?</p>
  <p>How can this be passed into the <code>ArrayRef</code>?</p>