@@ -175,38 +175,40 @@ Setting locations for new instructions
175175--------------------------------------
176176
177177Whenever a new instruction is created and there is no suitable location for that
178- instruction, that location should be annotated accordingly. There are a set of
179- special ``DebugLoc `` values that can be used to indicate the reason that a new
180- instruction does not have a valid location. These are as follows:
178+ instruction, that instruction should be annotated accordingly. There are a set
179+ of special ``DebugLoc `` values that can be set on an instruction to annotate the
180+ reason that it does not have a valid location. These are as follows:
181181
182182* ``DebugLoc::getCompilerGenerated() ``: This indicates that the instruction is a
183183 compiler-generated instruction, i.e. it is not associated with any user source
184184 code.
185185
186186* ``DebugLoc::getDropped() ``: This indicates that the instruction has
187187 intentionally had its source location removed, according to the rules for
188- dropping locations; this is set automatically by
188+ :ref: ` dropping locations<WhenToDropLocation> ` ; this is set automatically by
189189 ``Instruction::dropLocation() ``.
190190
191191* ``DebugLoc::getUnknown() ``: This indicates that the instruction does not have
192- a known or currently knowable source location, e.g. the attribution is ambiguous
193- in a way that can't currently be represented in LLVM , or that it is otherwise
194- infeasible to determine or track the correct source location .
192+ a known or currently knowable source location, e.g. that it is infeasible to
193+ determine the correct source location , or that the source location is
194+ ambiguous in a way that LLVM cannot currently represent .
195195
196196* ``DebugLoc::getTemporary() ``: This is used for instructions that we don't
197- expect to be emitted (e.g. ``UnreachableInst ``), and so should not need a valid
198- location; if we ever try to emit a temporary location into an object file, this
199- indicates that something has gone wrong.
197+ expect to be emitted (e.g. ``UnreachableInst ``), and so should not need a
198+ valid location; if we ever try to emit a temporary location into an object/asm
199+ file, this indicates that something has gone wrong.
200200
201201Where applicable, these should be used instead of leaving an instruction without
202202an assigned location or explicitly setting the location as ``DebugLoc() ``.
203- Ordinarily these special locations are ignored by the compiler, but some testing
204- builds will track their use in order to detect missing locations; for this
205- reason, the most important rule is to *not * apply any of these if it isn't clear
206- which, if any, is appropriate - an absent location can be detected and fixed,
207- while an incorrectly annotated instruction is much harder to detect. On the
208- other hand, if any of these clearly apply, then they should be used to prevent
209- false positives from being flagged up.
203+ Ordinarily these special locations are identical to an absent location, but LLVM
204+ built with coverage-tracking
205+ (``-DLLVM_ENABLE_DEBUGLOC_COVERAGE_TRACKING="COVERAGE" ``) will keep track of
206+ these special locations in order to detect unintentionally-missing locations;
207+ for this reason, the most important rule is to *not * apply any of these if it
208+ isn't clear which, if any, is appropriate - an absent location can be detected
209+ and fixed, while an incorrectly annotated instruction is much harder to detect.
210+ On the other hand, if any of these clearly apply, then they should be used to
211+ prevent false positives from being flagged up.
210212
211213Rules for updating debug values
212214===============================
0 commit comments