How does the debug info correspond to the normal info?

Hey,

LLVM allows to export source level debug information via meta data, I
am wondering if there is any mappings between the information in the
normal LLVM code and that in the meta data associated with the normal
LLVM code. Consider one usage.

Given an function parameter (argument) "x", via "getType()" we
retrieve the type of "x". The type might be, to some extent, different
from the declared type for "x" in the source code. So, generally, is
it possible to infer the declared type of a variable (e.g. an
argument) from the type of the variable in LLVM code or any other
basis?

Best,
Xiaolong

Debugging information encodes structural information about the type
using metadata. It does not associate llvm::Type*.

Try following little example and see llvm IR generated by the compiler.

typedef struct Point { int x; int y; } Point;
typedef struct Pair { int a; int b; } Pair;

int foo(Point *p1, Pair *p2) {
  return p1->x + p2->b;
}