File: Diagnostic.xs

package info (click to toggle)
libclang-perl 0.09-6
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 276 kB
  • sloc: perl: 297; cpp: 55; makefile: 10; ansic: 8
file content (50 lines) | stat: -rw-r--r-- 888 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
MODULE = Clang				PACKAGE = Clang::Diagnostic

SV *
format(self, with_source)
	Diagnostic self
	bool with_source

	CODE:
		unsigned int opts = 0;

		if (with_source) {
			opts = CXDiagnostic_DisplaySourceLocation |
				CXDiagnostic_DisplayColumn;
		}

		CXString fmt = clang_formatDiagnostic(self, opts);

		RETVAL = newSVpv(clang_getCString(fmt), 0);

	OUTPUT: RETVAL

void
location(self)
	Diagnostic self

	INIT:
		CXFile file;
		const char *filename;
		unsigned int line, column, offset;

	PPCODE:
		CXSourceLocation loc = clang_getDiagnosticLocation(self);

		clang_getSpellingLocation(loc, &file, &line, &column, NULL);

		filename = clang_getCString(clang_getFileName(file));

		if (filename != NULL)
			mXPUSHp(filename, strlen(filename));
		else
			mXPUSHp("", 0);

		mXPUSHi(line);
		mXPUSHi(column);

void DESTROY(self)
	Diagnostic self

	CODE:
		clang_disposeDiagnostic(self);