Commit Graph

23 Commits

Author SHA1 Message Date
Richard Smith a9f521fd20 Avoid binding a reference to a dereferenced pointer in diagnostic serialization
if a diagnostic is emitted outside of any source file. The fix mirrors the
corresponding code in TextDiagnosticPrinter. This required moving the
functional parts of SDiagRenderer into SDiagWriter so they can be reused in the
non-rendering codepath.

No functionality change.

llvm-svn: 162253
2012-08-21 03:11:53 +00:00
Argyrios Kyrtzidis b16ff5d1ce Fix an assertion hit when the serialized diagnostics writer receive a diagnostic
from the frontend when the location is invalid and the SourceManager null.

Instead of keeping the SourceManager object in DiagnosticRenderer, propagate it
to the calls accordingly (as reference when it is expected to not be null, or pointer
when it may be null).
This effectively makes DiagnosticRenderer not tied to a specific SourceManager,
removing a hack from TextDiagnosticPrinter.

rdar://11386874

llvm-svn: 156536
2012-05-10 05:03:45 +00:00
Daniel Dunbar 9a96386e6d Serialization: Switch over to using the native SmallVector based BitstreamWriter
ctor.

llvm-svn: 151752
2012-02-29 20:31:23 +00:00
Ted Kremenek 0964cca5d5 Refactor DiagnosticRenderer and SDiagsRenderer to have some functionality
pulled into DiagnosticNoteRenderer, and common DiagnosticRenderer that
assumes that all custom diagnostic messages are notes.  Also extend
DiagnosticRenderer to work with StoredDiagnostics in preparation for
subsequent changes.

llvm-svn: 150455
2012-02-14 02:46:00 +00:00
Dylan Noblesmith 2c1dd2716a Basic: import SmallString<> into clang namespace
(I was going to fix the TODO about DenseMap too, but
that would break self-host right now. See PR11922.)

llvm-svn: 149799
2012-02-05 02:13:05 +00:00
Dylan Noblesmith e27789991d Basic: import OwningPtr<> into clang namespace
llvm-svn: 149798
2012-02-05 02:12:40 +00:00
Ted Kremenek 4548e04458 Refactor SerializeDiagnosticsPrinter to using DiagnosticRenderer. This gives us comparative diagnostics
to TextDiagnosticPrinter.

This certainly can be cleaned up a bit.

llvm-svn: 146820
2011-12-17 05:26:11 +00:00
Argyrios Kyrtzidis 7910d7b72a Make changes to SDiagsWriter to make it work in combination with the ARC migrator:
-Allow it to be used with multiple BeginSourceFile/EndSourceFile calls; for this introduce
 a "finish" callback method in the DiagnosticConsumer. SDiagsWriter finishes up the serialization
 file inside this method.
-Make it independent of any particular DiagnosticsEngine; make it use the SourceManager of the
 Diagnostic object.
-Ignore null source ranges.

llvm-svn: 146020
2011-12-07 05:52:12 +00:00
Devang Patel 9957e8b789 Remove extra ';'.
llvm-svn: 144604
2011-11-15 01:30:40 +00:00
Benjamin Kramer 931ee8e727 serialized diagnostics: simplify code.
llvm-svn: 144277
2011-11-10 11:29:20 +00:00
Ted Kremenek d010ba4729 serialized diagnostics: implement full deserialization of clang diagnostics via the libclang API.
I've tested it on simple cases and it works.  Test cases to follow as well as a few tweaks.

llvm-svn: 144269
2011-11-10 08:43:12 +00:00
Ted Kremenek cc88d264eb serialized diagnostics: serialize the version info in a separate meta block.
llvm-svn: 144115
2011-11-08 20:27:29 +00:00
Ted Kremenek d89a827b5c serialized diagnostics: include FixIt information in serialized diagnostics.
llvm-svn: 143776
2011-11-05 03:34:23 +00:00
Ted Kremenek f264a20721 serialized diagnostics: pull emission of filenames into diagnostic block.
llvm-svn: 143765
2011-11-05 00:10:11 +00:00
Ted Kremenek 0a49dae7f7 serialized diagnostics: pull emission of diagnostic flag string into diagnostics block.
llvm-svn: 143764
2011-11-05 00:10:07 +00:00
Ted Kremenek 31921506b4 Serialized diagnostics: pull category name serialization into diagnostic blocks. The goal is to remove BLOCK_STRINGS so that the bitcode file can potentially be streamed.
llvm-svn: 143763
2011-11-05 00:10:04 +00:00
Ted Kremenek 59f1025ca0 serialized diagnostics: emit source ranges.
llvm-svn: 143762
2011-11-05 00:10:01 +00:00
Ted Kremenek 337cd2a8e2 Move definition of record/block IDs for serialized diagnostics to public header.
llvm-svn: 143761
2011-11-05 00:09:57 +00:00
Ted Kremenek 868504ab99 Serialized diagnostics: encode a 24 bit version number as part of the "magic number" of serialized diagnostics.
llvm-svn: 143760
2011-11-05 00:09:53 +00:00
Ted Kremenek 2724b1ffc1 serialized diagnostics: unique warning strings when emitting serialized diagnostics.
llvm-svn: 143759
2011-11-05 00:09:50 +00:00
Ted Kremenek f67bbca1a4 Serialized diagnostics: serialize "notes" as sub diagnostics of warnings and errors.
llvm-svn: 143758
2011-11-05 00:09:47 +00:00
Ted Kremenek fce371acb4 Also include file modification time and size in output of SerializedDiagnosticPrinter.
llvm-svn: 143757
2011-11-05 00:09:43 +00:00
Ted Kremenek 4610ea2bcf Start work on SerializedDiagnosticPrinter, a new DiagnosticConsumer that serializes out the diagnostics for a given translation unit to a bit code file. This is a WIP.
The motivation for this new DiagnosticConsumer is to provide a way for tools invoking the compiler
to get its diagnostics via a libclang interface, rather than textually parsing the compiler output.
This gives us flexibility to change the compiler's textual output, but have a structured data format
for clients to use to get the diagnostics via a stable API.

I have no tests for this, but llvm-bcanalyzer so far shows that the emitted file is well-formed.

More work to follow.

llvm-svn: 143259
2011-10-29 00:12:39 +00:00