title: why I am not getting precise line/column debug info from LLVM
body: <p>I am writing a very simple LLVM pass to simply iterate over all instructions in a function.</p>
  <pre><code>bool TestInstrument::runOnFunction(Function &amp;F)
  {
      for (inst_iterator it = inst_begin(F), E = inst_end(F); it != E; ++it)
      {
          std::string str;
          llvm::raw_string_ostream ss(str);
          ss &lt;&lt; *it;
          errs() &lt;&lt; ss.str() &lt;&lt; &quot;\n&quot;;
  
          const DebugLoc &amp;location = (&amp;(*it))-&gt;getDebugLoc();
          if (location)
              std::cout &lt;&lt; &quot; see line:  &quot; &lt;&lt; location.getLine() &lt;&lt; &quot;, col &quot; &lt;&lt; location.getCol() &lt;&lt; &quot; \n&quot;;
          else
              std::cout &lt;&lt; &quot;no debugloc information detected\n&quot;;
      }
      return true;
  }
  </code></pre>
  <p>I built my pass using the following command</p>
  <pre><code>clang -emit-llvm -S -fno-discard-value-names -c hello.c
  opt -load ../build/InstrumentPass.so -Instrument -S hello.ll -o hello.instrumented.ll
  
  opt -load ../build/SecondInstrumentPass.so -SecondInstrument -S hello.ll -o hello.second.instrumented.ll
  clang -o hello ../lib/util.c hello.second.instrumented.ll
  </code></pre>
  <p>When I run the above instrument pass on a very simple hello world c program, I can see print out for each instruction that were iterated. However, none of instruction has debugloc information found. all printout for the location shows &quot;no debugloc information detected\n&quot;.</p>
  <p>here is the output printed</p>
  <pre><code>  %retval = alloca i32, align 4
  no debug info!
    store i32 0, i32* %retval, align 4
  no debug info!
    %call = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i32 0, i32 0))
  no debug info!
    ret i32 0
  no debug info!
  </code></pre>
  <p>Is there any reason why location metadata is not found? Thanks in advance.</p>