llvm-project/clang/lib/Basic
Chris Lattner 8488c8297c This reworks some of the Diagnostic interfaces a bit to change how diagnostics
are formed.  In particular, a diagnostic with all its strings and ranges is now
packaged up and sent to DiagnosticClients as a DiagnosticInfo instead of as a 
ton of random stuff.  This has the benefit of simplifying the interface, making
it more extensible, and allowing us to do more checking for things like access
past the end of the various arrays passed in.

In addition to introducing DiagnosticInfo, this also substantially changes how 
Diagnostic::Report works.  Instead of being passed in all of the info required
to issue a diagnostic, Report now takes only the required info (a location and 
ID) and returns a fresh DiagnosticInfo *by value*.  The caller is then free to
stuff strings and ranges into the DiagnosticInfo with the << operator.  When
the dtor runs on the DiagnosticInfo object (which should happen at the end of
the statement), the diagnostic is actually emitted with all of the accumulated
information.  This is a somewhat tricky dance, but it means that the 
accumulated DiagnosticInfo is allowed to keep pointers to other expression 
temporaries without those pointers getting invalidated.

This is just the minimal change to get this stuff working, but this will allow
us to eliminate the zillions of variant "Diag" methods scattered throughout
(e.g.) sema.  For example, instead of calling:

  Diag(BuiltinLoc, diag::err_overload_no_match, typeNames,
       SourceRange(BuiltinLoc, RParenLoc));

We will soon be able to just do:

  Diag(BuiltinLoc, diag::err_overload_no_match)
      << typeNames << SourceRange(BuiltinLoc, RParenLoc));

This scales better to support arbitrary types being passed in (not just 
strings) in a type-safe way.  Go operator overloading?!

llvm-svn: 59502
2008-11-18 07:04:44 +00:00
..
CMakeLists.txt CMake: Builds and installs clang binary and libs (no docs yet). It 2008-10-26 00:56:18 +00:00
Diagnostic.cpp This reworks some of the Diagnostic interfaces a bit to change how diagnostics 2008-11-18 07:04:44 +00:00
FileManager.cpp Make a major restructuring of the clang tree: introduce a top-level 2008-03-15 23:59:48 +00:00
IdentifierTable.cpp Eliminate all of the placeholder identifiers used for constructors, 2008-11-17 22:58:34 +00:00
LangOptions.cpp Add -fobjc-gc and -fobjc-gc-only options to the driver. 2008-04-29 04:37:03 +00:00
Makefile Make a major restructuring of the clang tree: introduce a top-level 2008-03-15 23:59:48 +00:00
SourceLocation.cpp Make some methods const, add some helpers to FullSourceLoc, 2008-09-29 21:46:13 +00:00
SourceManager.cpp SourceManager::getLineNumber is logically const except for caching. 2008-11-18 06:51:15 +00:00
TargetInfo.cpp More fallout from r58501: primary fix is some more corrections to make 2008-11-02 02:43:55 +00:00
Targets.cpp More fallout from r58501: primary fix is some more corrections to make 2008-11-02 02:43:55 +00:00
TokenKinds.cpp Make a major restructuring of the clang tree: introduce a top-level 2008-03-15 23:59:48 +00:00