[SIL Printer] Add optional source location printing.

Added a -v(verbose) option to swift that will trigger verbose printing in SIL
Printer. SIL Printer will print the location info only in the verbose mode.

Here is the example of the format - only the line and colon are displayed for
brevity:

%24 = apply %13(%22) : $[cc(method), thin] ((), [byref] Bool) -> Builtin.Int1 // user: %26 line:46:10

(This will be used to test the validity of SILLocation info.)

Swift SVN r6991
This commit is contained in:
Anna Zaks
2013-08-07 18:39:48 +00:00
parent b478def6b1
commit aaa4b2c332
7 changed files with 61 additions and 8 deletions

View File

@@ -25,6 +25,12 @@ SourceLoc SourceManager::getCodeCompletionLoc() const {
Buffer->getBufferStart() + CodeCompletionOffset));
}
void SourceLoc::printLineAndColon(raw_ostream &OS,
const SourceManager &SM) const {
int BufferIndex = SM->FindBufferContainingLoc(Value);
print(OS, SM, BufferIndex);
}
void SourceLoc::print(raw_ostream &OS, const SourceManager &SM,
int &LastBuffer) const {
if (isInvalid()) {