As part of this fix, I made a low-level change to the text diagnostics machinery (to basically avoid printing duplicate source lines/carets when you have multiple diagnostics that refer to the same exact place). For now, this only happens with we don't have a source range (could be extended to support source ranges as well).
llvm-svn: 46897
verify that the source range corresponds to the current file, not
just the current line. This allows us to emit:
a.c:1:44: error: invalid operands to binary expression ('double' and 'int *')
double a; int *b; void f(void) { int c = a +
~ ^
instead of:
a.c:1:44: error: invalid operands to binary expression ('double' and 'int *')
double a; int *b; void f(void) { int c = a +
~ ~ ^
for PR1906 (note the leading ~).
Thanks to Neil for noticing this.
llvm-svn: 45901
Moved all clients of Diagnostics to use FullSourceLoc instead of SourceLocation.
Added many utility methods to FullSourceLoc to provide shorthand for:
FullLoc.getManager().someMethod(FullLoc.getLocation());
instead we have:
FullLoc.someMethod();
Modified TextDiagnostics (and related classes) to use this short-hand.
llvm-svn: 44957
SourceManager*'s instead of SourceManager&'s. This allows the client specify a
NULL SourceManager when using a default constructed SourceLocation. Thus the
SourceManager can be NULL when the SourceLocation's isValid() == false.
The interface to most clients of Diagnostic remains the same.
Diagnostic::Report() is overload to either accept a SourceLocation and a
SourceManager&, or neither. Thus clients that do not have a SourceManager
cannot specify a SourceLocation.
Modified TextDiagnostics* to use this new interface.
Modified the driver to not passed in SourceManager when warning about "-I-".
llvm-svn: 44887
SourceManager is passed by reference, allowing the SourceManager to be
associated with a specific translation unit, and not the entire execution
of the driver.
Modified all users of Diagnostics to comply with this new interface.
Integrated SourceManager as a member variable of TargetInfo. TargetInfo will
eventually be associated with a single translation unit (just like
SourceManager).
Made the SourceManager reference in ASTContext private. Provided accessor
getSourceManager() for clients to use instead. Modified clients to comply with
new interface.
llvm-svn: 44878
that are builtin and those that are aren't. This is a bunch
of API refactoring that will make this possible, but there is
no functionality change yet.
llvm-svn: 44473
out of the llvm namespace. This makes the clang namespace be a sibling of
llvm instead of being a child.
The good thing about this is that it makes many things unambiguous. The
bad things is that many things in the llvm namespace (notably data structures
like smallvector) now require an llvm:: qualifier. IMO, libsystem and libsupport
should be split out of llvm into their own namespace in the future, which will fix
this issue.
llvm-svn: 39659
Reviewed by: Chris Lattner
- Created a base class (TextDiagnostics) for all text diagnostic classes.
Moved the "IgnoreDiagnostic" method up there, and created a method that
will format the diagnostic string, replacing %# with the appropriate
string. This is in preparation for adding a text diagnostic checker.
llvm-svn: 39650
Reviewed by: Chris Lattner
- Added a method "IgnoreDiagnostic" so that the diagnostic client can
tell the diagnostic object that it doesn't want to handle a particular
diagnostic message. In which case, it won't be counted as either a
diagnostic or error.
llvm-svn: 39641
Reviewed by: Chris Lattner
- Separated out the diagnostic client from the clang driver. This is in
preparation for creating a diagnostic client that will be used to check
error and warning messages.
llvm-svn: 39603