Please use GitHub pull requests for new patches. Phabricator shutdown timeline
Changeset View
Changeset View
Standalone View
Standalone View
llvm/trunk/docs/SourceLevelDebugging.rst
Show First 20 Lines • Show All 423 Lines • ▼ Show 20 Lines | |||||
``Instruction::getDebugLoc()`` and ``DILocation::getLine()``. | ``Instruction::getDebugLoc()`` and ``DILocation::getLine()``. | ||||
.. code-block:: c++ | .. code-block:: c++ | ||||
if (DILocation *Loc = I->getDebugLoc()) { // Here I is an LLVM instruction | if (DILocation *Loc = I->getDebugLoc()) { // Here I is an LLVM instruction | ||||
unsigned Line = Loc->getLine(); | unsigned Line = Loc->getLine(); | ||||
StringRef File = Loc->getFilename(); | StringRef File = Loc->getFilename(); | ||||
StringRef Dir = Loc->getDirectory(); | StringRef Dir = Loc->getDirectory(); | ||||
bool ImplicitCode = Loc->isImplicitCode(); | |||||
} | } | ||||
When the flag ImplicitCode is true then it means that the Instruction has been | |||||
added by the front-end but doesn't correspond to source code written by the user. For example | |||||
.. code-block:: c++ | |||||
if (MyBoolean) { | |||||
MyObject MO; | |||||
... | |||||
} | |||||
At the end of the scope the MyObject's destructor is called but it isn't written | |||||
explicitly. This information is useful to avoid to have counters on brackets when | |||||
making code coverage. | |||||
C/C++ global variable information | C/C++ global variable information | ||||
--------------------------------- | --------------------------------- | ||||
Given an integer global variable declared as follows: | Given an integer global variable declared as follows: | ||||
.. code-block:: c | .. code-block:: c | ||||
_Alignas(8) int MyGlobal = 100; | _Alignas(8) int MyGlobal = 100; | ||||
▲ Show 20 Lines • Show All 1,208 Lines • Show Last 20 Lines |