Граф коммитов

246 Коммитов

Автор SHA1 Сообщение Дата
Chris Lattner fe526d2be9 fix some out of bounds array access problems, which manifest particularly
spectacularly when built for x86-64.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69197 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-15 18:48:23 +00:00
Chris Lattner d2aa7c90e7 move {'s
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69179 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-15 17:13:42 +00:00
Chris Lattner 8a941e0c71 Make diagnostic class explicit in the diag record instead of
implicit from its parenting.  Now that diag mapping is 
explicit, eliminate the fatal and extwarn classes.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69177 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-15 16:56:26 +00:00
Chris Lattner 4ac072aceb Tblgen now passes the default mapping explicitly, instead of having it
be tied to the diag class.  This requires an LLVM tree update.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69175 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-15 16:44:12 +00:00
Chris Lattner 27ceb9d77d Rejigger how -pedantic and -pedantic-errors work and their interaction
with other diagnostic mapping.  In the new scheme, -Wfoo or -Wno-foo or 
-Werror=foo all override the -pedantic options, and __extension__ 
robustly silences all extension diagnostics in their scope.

An added bonus of this change is that MAP_DEFAULT goes away, meaning that
per-diagnostic mapping information can now be stored in 2 bits, doubling
the density of the Diagnostic::DiagMapping array.  This also 
substantially simplifies Diagnostic::getDiagnosticLevel.

OTOH, this temporarily introduces some "macro intensive" code in 
Diagnostic.cpp.  This will be addressed in a later patch.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69154 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-15 07:01:18 +00:00
Mike Stump aa771a838a Fixup whitespacing.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69055 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-14 18:24:37 +00:00
Douglas Gregor bd94500d3a Include the SourceManager's line table in the PCH file. We can now
properly cope with #line directives in PCH files.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68963 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-13 16:31:14 +00:00
Douglas Gregor d4f77aa7c2 Factor the internals of SourceManager (specially, LineTableInfo) into a separate Internals header. No functionality change
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68960 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-13 15:31:25 +00:00
Daniel Dunbar 8d33cd77dc Support -miphoneos-version-min in clang-cc.
- Patch by Shantonu Sen (with a minor tweak to split out
   getDarwin{OSX,IPhoneOS}Defines)!

 - <rdar://problem/6776277> Need clang-cc/ccc-analyzer support for
   -miphoneos-version-min


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68815 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-10 19:52:24 +00:00
Chris Lattner b8e240ed8b Add initial support for -imacros. Right now it has the same semantics as
-include, but that will be fixed soon.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68625 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-08 18:24:34 +00:00
Chris Lattner 837e897660 remove fixme!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68589 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-08 03:47:39 +00:00
Mike Stump 437bb4b6ec Add basic support for arm static analysis checking. Radar 6699395
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68582 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-08 02:07:04 +00:00
Chris Lattner 10d2427386 Fariborz points out that weak is now defined to the attribute even
in C mode.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68520 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-07 16:50:40 +00:00
Chris Lattner 3a5cbd37c9 The __weak and __strong defines are common to all darwin targets
and are even set in C mode.  As such, move them to Targets.cpp.

__OBJC_GC__ is also darwin specific, but seems reasonable to always
define it when in objc-gc mode.

This fixes rdar://6761450


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68494 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-07 04:48:21 +00:00
Anton Korobeynikov 264a76cdf3 Provide sema proper values of maximal number of arguments passed in registers.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68413 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-03 23:38:25 +00:00
Daniel Dunbar a9668e0b4c Add target hook for setting symbol prefix and section of unicode
string literals.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68363 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-03 00:57:44 +00:00
Douglas Gregor 2b63fbc9bf Fix a little typo that was killing de-serialization
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68354 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-03 00:25:09 +00:00
Douglas Gregor 3050ed44ae Resynchronize Decl/VarDecl serialization code with the structures
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68346 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-02 23:40:00 +00:00
Steve Naroff e9b7d8ace8 Add ConvertUTF module from http://www.unicode.org/Public/PROGRAMS/CVTUTF.
#ifdef'd out the 5 conversion routines that we don't currently need.

Still need a bit more work in GetAddrOfConstantCFString(). Added a FIXME to indicate this.

Expect to remove the FIXME today...


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68208 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-01 15:50:34 +00:00
Daniel Dunbar 8e5c2b8072 Add Target hooks for IRgen of [cf]string literals.
- Notably, set section on cfstring literal string data (for now, this
   is done everywhere because it matches what we were already doing
   for the CFString data itself)

 - <rdar://problem/6599098> [irgen] linker requires objc string data
   to go into cstring


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68160 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-31 23:42:16 +00:00
Eli Friedman 1afabd9485 Fix the default for intptr_t on *BSD x86-32 and Windows. Slight cleanup
by moving the general case to the generic x86-32 target.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68015 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-29 20:31:09 +00:00
Daniel Dunbar 1e0107a3d1 Ad FreeBSD ARM target info.
- Patch by Ed Schoeten!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67527 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-23 16:09:04 +00:00
Douglas Gregor 25a88bbf04 Eliminate post-diagnostic hooks. Instead, implement a Sema-specific
variant of DiagnosticBuilder that emits the template instantiation
backtrace when needed.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67413 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-20 22:48:49 +00:00
Chris Lattner ca45cffe5e refactor some code, fixing a problem discovered by the dragonfly bsd people, where
clang was defining "i386" even when in non-gnu mode.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67378 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-20 16:06:38 +00:00
Chris Lattner 318ca7106d pass langoptions around.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67376 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-20 15:55:34 +00:00
Chris Lattner 33328642a7 pass LangOptions into TargetInfo::getTargetDefines, so that targets
can have language-specific defines.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67375 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-20 15:52:06 +00:00
Sebastian Redl 4d7a089144 Bindir and Win32 builds work, so switch to .inc files. Leave the .def files in the tree for a day or so longer.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67346 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-19 23:18:26 +00:00
Douglas Gregor 525c4b0d1b Allow notes to be printed following a fatal error, then suppress any
diagnostics following those notes. 

Make exceeding the template instantiation depth a fatal error.

Thanks to Daniel for pointing out the problem!



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67320 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-19 18:55:06 +00:00
Douglas Gregor a393e9eedc Build system changes to use TableGen to generate the various
diagnostics. This builds on the patch that Sebastian committed and
then revert. Major differences are:

  - We don't remove or use the current ".def" files. Instead, for now,
    we just make sure that we're building the ".inc" files.
  - Fixed CMake makefiles to run TableGen and build the ".inc" files
    when needed. Tested with both the Xcode and Makefile generators
    provided by CMake, so it should be solid.
  - Fixed normal makefiles to handle out-of-source builds that involve
    the ".inc" files.

I'll send a separate patch to the list with Sebastian's changes that
eliminate the use of the .def files.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67058 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-16 23:06:59 +00:00
Sebastian Redl e89b6b272f Revert the switch to the tablegen diags. It fails for seperate objdir builds and cmake builds, and I have no clue what to do about it. Revisit this after someone with a clue about the build systems has looked at it.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67009 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-14 15:58:54 +00:00
Sebastian Redl 3801d71fbe Switch diagnostics from .def to tablegen files. Please validate the Windows build.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67007 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-14 12:00:12 +00:00
Daniel Dunbar 50f4f46902 Add Diagnostic files for Frontend and move a couple errors over.
- Notably, clang now exits with an error if it can't find a
   file. This flushed out a bug in the CGColorSpace.c test case. :)


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66789 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-12 10:14:16 +00:00
Daniel Dunbar 4ad4b3ebbe Driver: Use standard Diagnostic interface for diagnostics.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66786 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-12 08:55:43 +00:00
Chris Lattner 1841aa19aa Clear all the linetable state in clear(), fixing problems
with "clang t.i s.i" where the .i files contain line markers.
rdar://6667812


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66619 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-11 01:09:52 +00:00
Douglas Gregor ee1828a6b5 Add a notion of "post-diagnostic hooks", which are callbacks attached
to a diagnostic that will be invoked after the diagnostic (if it is
not suppressed). The hooks are allowed to produce additional
diagnostics (typically notes) that provide more information. We should
be able to use this to help diagnostic clients link notes back to the
diagnostic they clarify. Comments welcome; I'll write up documentation
and convert other clients (e.g., overload resolution failures) if
there are no screams of protest.

As the first client of post-diagnostic hooks, we now produce a
template instantiation backtrace when a failure occurs during template
instantiation. There's still more work to do to make this output
pretty, if that's even possible.




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66557 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-10 18:03:33 +00:00
Daniel Dunbar 4a77edb3f0 Remove some now-unneeded calls to llvm::errs().flush().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66555 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-10 18:00:19 +00:00
Ted Kremenek 321abd4583 Add FullSourceLoc::getDecomposedLoc.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66522 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-10 05:13:43 +00:00
Ted Kremenek d42ffbd22f Revert my last couple patches until I can get them to not make the tests fail.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66317 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-07 01:47:10 +00:00
Ted Kremenek b9eb3afc9e Teach Diagnostic about Selector.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66314 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-07 01:36:13 +00:00
Ted Kremenek 150ec292a6 Selector: (changes made after discussing this more with Steve Naroff)
- Make Selector::getAsIdentifierInfo() private.  Using IdentifierInfo* in
  Selector is an implementation detail that clients shouldn't think about.
- Modify diagnostic emission in Sema::ProcessPropertyDecl to not use
  Selector::getAsIdentifierInfo() (which could crash when IdentifierInfo* is
  null) and instead use Selector::getAsString().
- Tidy up Selector::getAsString() implementation.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66313 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-07 01:22:02 +00:00
Ted Kremenek f5ed3961d2 Handle null IdentifierInfo* in Selector::getAsString().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66307 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-06 23:36:28 +00:00
Chris Lattner ae50fa0a9e Include information about compound statements when crashing in sema or the
parser.  For example, we now print out:

0.	t.c:5:10: in compound statement {}
1.	t.c:3:12: in compound statement {}
2.	clang t.c -fsyntax-only



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66108 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-05 00:00:31 +00:00
Chris Lattner 5f7d2284c4 allocate MultiKeywordSelector's out of a bump pointer allocator instead of malloc.
This has two advantages 1) no more leaking them, 2) fewer calls to malloc.

This changes us from calling malloc 3685/1390/883/2974/1185 times respectively on
16/20/24/28/32 byte objects when parsing cocoa.h with pth and -disable-free to
calling it 2816/1020/702/2903/1168 times each respectively.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66017 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-04 05:35:38 +00:00
Chris Lattner 6328cc316d implement support for propagating *features* down to the code generator
and defining target-specific macros based on them (like __SSE3__ and 
friends).  After extensive discussion with Daniel, this work will need
driver support, which will translate things like -msse3 into a -mattr 
feature.  Until this work is done, the code in clang.cpp is disabled and
the X86TargetInfo ctor still defaults to SSE2.  With these two things
changed, this code will work.  PR3634


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65966 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-03 19:56:18 +00:00
Chris Lattner 84f0ea849e Add plumbing to support programatically defining __SSE2__ and friends,
even though we still hard code sse2 for now.  No support for 3dnow or sse4a,
but someone could add that if they desired.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65886 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-02 22:40:39 +00:00
Chris Lattner c0f5921215 minor cleanups to target-specific #defines, no functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65885 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-02 22:27:17 +00:00
Chris Lattner 3daed52a57 improve compatibility with GCC 4.4, patch by Michel Salim (PR3697)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65884 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-02 22:20:04 +00:00
Anders Carlsson 066d2ea752 TargetInfo::validateAsmConstraint now takes a reference to the full constraints string. This will make it possible to support multi-character constraints. No functionality change (for now).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65696 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-28 17:11:49 +00:00
Douglas Gregor b2fb6de907 Clean up and document code modification hints.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65641 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-27 17:53:17 +00:00
Douglas Gregor 4b2d3f7bcc Introduce code modification hints into the diagnostics system. When we
know how to recover from an error, we can attach a hint to the
diagnostic that states how to modify the code, which can be one of:

  - Insert some new code (a text string) at a particular source
    location
  - Remove the code within a given range
  - Replace the code within a given range with some new code (a text
    string)

Right now, we use these hints to annotate diagnostic information. For
example, if one uses the '>>' in a template argument in C++98, as in
this code:

  template<int I> class B { };
  B<1000 >> 2> *b1;

we'll warn that the behavior will change in C++0x. The fix is to
insert parenthese, so we use code insertion annotations to illustrate
where the parentheses go:

test.cpp:10:10: warning: use of right-shift operator ('>>') in template
argument will require parentheses in C++0x
  B<1000 >> 2> *b1;
         ^
    (        )


Use of these annotations is partially implemented for HTML
diagnostics, but it's not (yet) producing valid HTML, which may be
related to PR2386, so it has been #if 0'd out.

In this future, we could consider hooking this mechanism up to the
rewriter to actually try to fix these problems during compilation (or,
after a compilation whose only errors have fixes). For now, however, I
suggest that we use these code modification hints whenever we can, so
that we get better diagnostics now and will have better coverage when
we find better ways to use this information.

This also fixes PR3410 by placing the complaint about missing tokens
just after the previous token (rather than at the location of the next
token).




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65570 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-26 21:00:50 +00:00