Commit Graph

11409 Commits

Author SHA1 Message Date
Douglas Gregor 2e0757f319 Give Type::getDesugaredType a "for-display" mode that can apply more
heuristics to determine when it's useful to desugar a type for display
to the user. Introduce two C++-specific heuristics:

  - For a qualified type (like "foo::bar"), only produce a new
    desugred type if desugaring the qualified type ("bar", in this
    case) produces something interesting. For example, if "foo::bar"
    refers to a class named "bar", don't desugar. However, if
    "foo::bar" refers to a typedef of something else, desugar to that
    something else. This gives some useful desugaring such as
    "foo::bar (aka 'int')".
  - Don't desugar class template specialization types like
    "basic_string<char>" down to their underlying "class
    basic_string<char, char_traits<char>, allocator<char>>, etc.";
    it's better just to leave such types alone. 

Update diagnostics.html with some discussion and examples of type
preservation in C++, showing qualified names and class template
specialization types.

llvm-svn: 68207
2009-04-01 15:47:24 +00:00
Daniel Dunbar f524eff37d Add cocoa-pth.c test case, this got lost in shuffling PTH test cases.
llvm-svn: 68205
2009-04-01 15:36:37 +00:00
Ted Kremenek 455de13de1 Re-enable PTH testing for cocoa.h and carbon.h. This tests that PTH works on
real-world header files and these tests have caught serious bugs in the past.

llvm-svn: 68204
2009-04-01 15:28:20 +00:00
Steve Naroff e14b368fa9 More "prep" work for handling UTF16 CFString.
Patch by Jean-Daniel Dupas. Thanks!

llvm-svn: 68203
2009-04-01 13:55:36 +00:00
Steve Naroff c94adda157 ProcessUCNEscape(): Incorportate some feedback from Chris.
llvm-svn: 68198
2009-04-01 11:09:15 +00:00
Daniel Dunbar e80bd1897c x86-32 Darwin ABI: Handle small structures correctly.
- Small structures are returned in a register if: 
    1. They fit nicely in a  register.
    2. All fields fit nicely in a register.
   (more or less)

 - We now pass the first 5000 ABITests if unions are disabled.

 - <rdar://problem/6497882> [irgen] x86-32 ABI compatibility with
   small structs

llvm-svn: 68197
2009-04-01 07:45:00 +00:00
Daniel Dunbar 58e2971bb0 x86-32 Darwin ABI: Single element arrays can be part of "single
element structures", which have different ABI rules.
 - Current return-arguments-32 status is: 1 out of 1000 failures (-7)

 - Also, vectors inside "single element structs" require special
   handling.

llvm-svn: 68196
2009-04-01 07:08:38 +00:00
Ted Kremenek 8b0dba358a Fix: <rdar://problem/6740387>. Sending nil to an object that returns a struct
should only be an error if that value is consumed. This fix was largely
accomplished by moving 'isConsumedExpr' back to ParentMap.

llvm-svn: 68195
2009-04-01 06:52:48 +00:00
Chris Lattner 3088a31e96 remove ASTContext::buildObjCInterfaceType, which breaks canonical
types.  It is no longer needed now that the code generator 
re-lays-out interfaces if they are defines after being laid out
from a forward decl.

llvm-svn: 68194
2009-04-01 06:23:52 +00:00
Ted Kremenek 0bb0909233 - Changed PathDiagnosticPiece::getLocation() to return a PathDiagnosticLocation
instead of a FullSourceLoc. This resulted in a bunch of small edits in various
  clients.
- Updated BugReporter to include an alternate PathDiagnostic generation
  algorithm for PathDiagnosticClients desiring more control-flow pieces.

llvm-svn: 68193
2009-04-01 06:13:56 +00:00
Daniel Dunbar cd76e673eb x86-32 Darwin ABI: Handle direct return of vectors.
- Current return-arguments-32 status is: 8 out of 1000 failures (-7)

llvm-svn: 68192
2009-04-01 06:13:08 +00:00
Zhongxing Xu 034247130e Update docs.
llvm-svn: 68191
2009-04-01 06:01:08 +00:00
Zhongxing Xu dcb7a35294 Adjust doc format.
llvm-svn: 68190
2009-04-01 05:26:39 +00:00
Daniel Dunbar 386ef885bb Pull clang-cc code for generating PTH files based on the input type.
- <rdar://problem/6741594> [pth] don't abuse -x to drive pth
   generation

 - Simpler, and fixes PR3915.

Cleanup test cases for PTH:
 - Update to use -emit-pth

 - Removed PTH test of carbon.c and cocoa.mm; these didn't actually
   verify anything, and since PTH is token based the extra coverage
   (over cocoa.m) isn't particularly helpful.

 - Split PTH tests in cocoa.m to cocoa-pth.m, solely to increase
   available parallelism when running tests.

Ted, could you update the PTH test cases (include-pth.c and
cocoa-pth.m) to have some sort of positive check that the PTH is
getting used? "# of PTH cache hits" or "tokens read from PTH cache"
statistics would work great. :)

llvm-svn: 68189
2009-04-01 05:09:09 +00:00
Zhongxing Xu 1b1d3f6b0c update docs.
llvm-svn: 68188
2009-04-01 05:05:22 +00:00
Daniel Dunbar f77e292a0f Fix a subtle bug where the cleanup scope entries had a dangling block reference
- <rdar://problem/6732143> Crash when generating @synchronize for
   zero-cost exception

 - Thanks to Anders for helping track down the problem.

llvm-svn: 68186
2009-04-01 04:37:47 +00:00
Ted Kremenek 1b37951f36 CFG: For 'if(...) {}' (empty body) construct an empty CFGBlock so that we can
distinguish between the true and false branches for path-sensitive analyses.

llvm-svn: 68185
2009-04-01 03:52:47 +00:00
Daniel Dunbar 2ec6e8e2ba Remove a FIXME, use -emit-pth to drive PTH generation.
-  c.f. r68164

llvm-svn: 68184
2009-04-01 03:28:10 +00:00
Zhongxing Xu c473a44507 Update docs.
llvm-svn: 68183
2009-04-01 03:23:38 +00:00
Daniel Dunbar ae8bca038d Tweak/cleanup darwin::Link a bit, add several FIXMES, and improve test
case.

llvm-svn: 68182
2009-04-01 03:17:40 +00:00
Eli Friedman 1c3fb22cad Fix pascal string support; testcase from mailing list message.
llvm-svn: 68181
2009-04-01 03:17:08 +00:00
Eli Friedman 706e0a14e2 Follow gcc's example and warn by default on unknown escapes. Inspired
by mailing list message about "\phello" style strings.

llvm-svn: 68180
2009-04-01 02:59:02 +00:00
Eli Friedman 84ae509ac3 Fix test failure on Linux by forcing the triple to OS X.
llvm-svn: 68179
2009-04-01 02:55:21 +00:00
Eli Friedman a331a63397 Flip diagnostic from Warning to ExtWarn so that it's an error
with -pedantic-errors.  This fixes the C99 part of PR3919.

llvm-svn: 68178
2009-04-01 02:48:25 +00:00
Chris Lattner d18136a644 fix the two xfails I added with a previous patch by making ObjC interface
types get completed when their definition is seen if previously laid out by
the code generator.

llvm-svn: 68177
2009-04-01 02:36:43 +00:00
Chris Lattner 6483908957 move trivial forwarding function inline.
llvm-svn: 68176
2009-04-01 02:08:13 +00:00
Chris Lattner 87bc387f8f tidy some code.
llvm-svn: 68174
2009-04-01 02:00:48 +00:00
Mike Stump cafa0a9746 Fix block comparisons. Radar 6732116.
llvm-svn: 68171
2009-04-01 01:17:39 +00:00
Anders Carlsson 237f349073 Implement code generation of namespaces and add mangling tests.
llvm-svn: 68170
2009-04-01 00:58:25 +00:00
Chris Lattner f16f90b4fd add support for the LONG_LONG_MIN/LONG_LONG_MAX/ULONG_LONG_MAX limits.h GNU extensions.
rdar://6740292

llvm-svn: 68169
2009-04-01 00:44:37 +00:00
Anders Carlsson 12edad2c50 Fix a bug (that I thought I had fixed already) where mangling a prefix could get us into an infinite loop
llvm-svn: 68168
2009-04-01 00:42:16 +00:00
Douglas Gregor dce2b62b70 Parsing, semantic analysis, and template instantiation for typename
specifiers that terminate in a simple-template-id, e.g.,

  typename MetaFun::template apply<T1, T2>

Also, implement template instantiation for dependent
nested-name-specifiers that involve unresolved identifiers, e.g.,

  typename T::type::type

llvm-svn: 68166
2009-04-01 00:28:59 +00:00
Daniel Dunbar 5c9c118600 Tweak darwin::Assemble and add a FIXME.
llvm-svn: 68165
2009-04-01 00:27:44 +00:00
Ted Kremenek 0df7051783 Add '-emit-pth' option to clang-cc as an alternate API for the high-level driver
to generate PTH files. Soon we will remove from clang-cc the GCC-style '-x
c-header' interface for generating PTH files and push this logic to 'clang'.

llvm-svn: 68164
2009-04-01 00:23:28 +00:00
Anders Carlsson 7a6f8b9281 Fix a mangling bug where functions with no arguments weren't getting the 'v' parameter specifier.
llvm-svn: 68162
2009-04-01 00:15:23 +00:00
Daniel Dunbar 08b216abf1 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

llvm-svn: 68160
2009-03-31 23:42:16 +00:00
Ted Kremenek 7062c50772 More code reshuffling. No functionality change.
llvm-svn: 68157
2009-03-31 23:00:32 +00:00
Chris Lattner f41e87f4cd Change UsedArray to be a vector of WeakVH to fix a dangling pointer problem that occurs when
attribute(used) and asm renaming are used together.

llvm-svn: 68155
2009-03-31 22:37:52 +00:00
Chris Lattner 2739d2bbe6 remove some obsolete comments, use an AssertingVH.
llvm-svn: 68151
2009-03-31 22:17:44 +00:00
Daniel Dunbar 7c92528530 Driver: Implement basic --help text.
- PR3875.
 - <rdar://problem/6615249> [driver] ccc should support some form of
   --help

llvm-svn: 68148
2009-03-31 21:38:17 +00:00
Daniel Dunbar 77684ead4b Driver: Add OptTable::getOptionKind.
Also, removed default value for getOptionMetaVar.

llvm-svn: 68146
2009-03-31 21:26:12 +00:00
Daniel Dunbar e521a8994c Driver: Forward -Wp, and -Xpreprocessor arguments to clang when using
the preprocessor.
 - PR3602.

 - As is inherent in the blanket forwarding options, this will only
   work if clang-cc happens to accept what the user passed. Users by
   and large should use driver options to interact with the
   preprocessor, if at all possible.

llvm-svn: 68144
2009-03-31 20:53:55 +00:00
Ted Kremenek 4e81c3ccac Allow two codepaths for PathDiagnostic generation. This patch mainly consists of
refactoring to make this possible (no functionality change).

llvm-svn: 68141
2009-03-31 20:22:36 +00:00
Douglas Gregor b046ffb002 Some cleanup and renaming. No functionality change
llvm-svn: 68140
2009-03-31 20:22:05 +00:00
Daniel Dunbar a207254f94 Driver: Add extra parameters for help text to option definitions.
- Currently unused.

And yes, now may be about the time I want a TableGen backend.

llvm-svn: 68139
2009-03-31 20:12:05 +00:00
Daniel Dunbar 4cb6715434 Add two FIXMEs
llvm-svn: 68138
2009-03-31 20:10:05 +00:00
Douglas Gregor 7ef46d9ae2 Improve the dependent nested-name-specifier test a bit
llvm-svn: 68136
2009-03-31 20:07:16 +00:00
Daniel Dunbar 35579146aa x86_32 Darwin ABI: Treat empty unions like empty structures.
- Current return-arguments-32 status: 15/1000 failures

llvm-svn: 68132
2009-03-31 19:01:39 +00:00
Ted Kremenek 7b4df3c3e6 Rename clang.[cpp,h] to clang-cc.[cpp,h] to reflect the name change of the
low-level frontend driver.

llvm-svn: 68131
2009-03-31 18:58:14 +00:00
Ted Kremenek 97823d32ea Update VS project.
llvm-svn: 68130
2009-03-31 18:57:19 +00:00