Commit Graph

104526 Commits

Author SHA1 Message Date
John McCall 6dc0a2b467 Update the mangler for some of the "new" unresolved-name manglings.
I've sent off an email requesting clarification on a few things that
I wasn't sure how to handle.

This also necessitated making prefixes and unresolved-prefixes get
mangled separately.

llvm-svn: 130083
2011-04-24 08:23:24 +00:00
Douglas Gregor 0e7dde535d Implement a new identifier-classification scheme where Sema
performs name lookup for an identifier and resolves it to a
type/expression/template/etc. in the same step. This scheme is
intended to improve both performance (by reducing the number of
redundant name lookups for a given identifier token) and error
recovery (by giving Sema a chance to correct type names before the
parser has decided that the identifier isn't a type name). For
example, this allows us to properly typo-correct type names at the
beginning of a statement:

t.c:6:3: error: use of undeclared identifier 'integer'; did you mean
'Integer'?
  integer *i = 0;
  ^~~~~~~
  Integer
t.c:1:13: note: 'Integer' declared here
typedef int Integer;
            ^


Previously, we wouldn't give a Fix-It because the typo correction
occurred after the parser had checked whether "integer" was a type
name (via Sema::getTypeName(), which isn't allowed to typo-correct)
and therefore decided to parse "integer * i = 0" as an expression. By
typo-correcting earlier, we typo-correct to the type name Integer and
parse this as a declaration. 

Moreover, in this context, we can also typo-correct identifiers to
keywords, e.g.,

t.c:7:3: error: use of undeclared identifier 'vid'; did you mean
'void'?
  vid *p = i;
  ^~~
  void

and recover appropriately.

Note that this is very much a work-in-progress. The new
Sema::ClassifyName is only used for expression-or-declaration
disambiguation in C at the statement level. The next steps will be to
make this work for the same disambiguation in C++ (where
functional-style casts make some trouble), then push it
further into the parser to eliminate more redundant name lookups.

Fixes <rdar://problem/7963833> for C and starts us down the path of
<rdar://problem/8172000>.

llvm-svn: 130082
2011-04-24 05:37:28 +00:00
John McCall d8d1e2ae66 The ABI settled on mangling float literals with lowercase hex dumps.
APInt::toString doesn't do those, but it's easy to postprocess that output,
and that's probably better than adding another knob to that method.

llvm-svn: 130081
2011-04-24 03:07:16 +00:00
Argyrios Kyrtzidis 82270b4679 Put -Wunneeded-internal-declaration under UnusedFunction group so it will be disabled with -Wno-unused-function.
llvm-svn: 130080
2011-04-24 02:56:06 +00:00
Chandler Carruth e71d0628f7 Implement most of the remaining logic in __is_literal type trait. This
should now support all of the C++98 types, and all of the C++0x types
Clang supports.

llvm-svn: 130079
2011-04-24 02:49:34 +00:00
Chandler Carruth 65fa1fd18e Add support for '__is_literal_type' spelling of the existing
'__is_literal' type trait for GCC compatibility. At least one relased
version if libstdc++ uses this name for the trait despite it not being
documented anywhere.

llvm-svn: 130078
2011-04-24 02:49:28 +00:00
Chandler Carruth ad7d404732 Begin tracking trivialness of move constructors and move assignment
operators in C++ record declarations.

This patch starts off by updating a bunch of the standard citations to
refer to the draft 0x standard so that the semantics intended for move
varianst is clear. Where necessary these are duplicated so they'll be
available in doxygen.

It adds bit fields to keep track of the state for the move constructs,
and updates all the code necessary to track this state (I think) as
members are declared for a class. It also wires the state into the
various trait-like accessors in the AST's API, and tests that the type
trait expressions now behave correctly in the presence of move
constructors and move assignment operators.

This isn't complete yet due to these glaring FIXMEs:
1) No synthesis of implicit move constructors or assignment operators.
2) I don't think we correctly enforce the new logic for both copy and
   move trivial checks: that the *selected* copy/move
   constructor/operator is trivial. Currently this requires *all* of them
   to be trivial.
3) Some of the trait logic needs to be folded into the fine-grained
   trivial bits to more closely match the wording of the standard. For
   example, many of the places we currently set a bit to track POD-ness
   could be removed by querying other more fine grained traits on
   demand.

llvm-svn: 130076
2011-04-23 23:10:33 +00:00
Chandler Carruth 78ef0957d4 Flesh out these tests just a tad more. This provides targeted
'DerivesHasFoo' types for various non-POD constructs in the base class.
Only __is_pod and __is_trivial are wired up to these, not sure how much
more of this type of exhaustive testing is really interesting.

llvm-svn: 130075
2011-04-23 21:02:37 +00:00
Chandler Carruth 0850b9d4c9 Test POD and trivial type traits given a class derived from a generic
non-POD type.

It might be nicer to have a Derives* variant for each of HasCons,
HasCopy, etc. Then we could test each of those and also test the __has_*
traits. WIP.

llvm-svn: 130074
2011-04-23 20:51:42 +00:00
Chandler Carruth 7e5eaf1173 Use a more precise name for some of the types here, and re-group several
of the tests using those types to have a (hopefully) more logical
ordering now that doing so doesn't cause unreadable deltas of counters
changing.

llvm-svn: 130073
2011-04-23 20:51:39 +00:00
Chandler Carruth 21c6a044ec Mechanical change moving all of the test statements away from a pattern
that requires needless noise in every patch (due to numbers changing) or
poorly grouped test cases in order to have strictly increasing numbers.
This will make my subsequent patches much less ugly. =D

llvm-svn: 130072
2011-04-23 20:51:37 +00:00
Chandler Carruth 7ffce73fc8 Teach the AST reader and writer to preserve the __DEPRECATED bit in
language options, and warn when reading an AST with a different value
for the bit.

There doesn't appear to be a good way to test this (commenting out
similar other language options doesn't break anything) but if folks have
suggestions on tests I'm happy to add them.

llvm-svn: 130071
2011-04-23 20:05:38 +00:00
Jay Foad 1a180156b6 Remove unused STL header includes.
llvm-svn: 130068
2011-04-23 19:53:52 +00:00
Chandler Carruth 30483fb188 Move all of the logic for __DEPRECATED to the driver based on comments
from dgregor.

llvm-svn: 130066
2011-04-23 19:48:40 +00:00
Fariborz Jahanian dbbdd2fe50 "note" location of forward class used as receiver of
a 'deprecated' selector in the diagnostics for the
selector. // rdar://9309223

llvm-svn: 130062
2011-04-23 17:27:19 +00:00
Francois Pichet a7d337d196 Remove unnecessary const away cast in LateTemplateParserCallback.
llvm-svn: 130058
2011-04-23 11:52:20 +00:00
Chandler Carruth a3e1f9a02c Implement basic __is_trivial type-trait support, enough to close PR9472.
This introduces a few APIs on the AST to bundle up the standard-based
logic so that programmatic clients have access to exactly the same
behavior.

There is only one serious FIXME here: checking for non-trivial move
constructors and move assignment operators. Those bits need to be added
to the declaration and accessors provided.

This implementation should be enough for the uses of __is_trivial in
libstdc++ 4.6's C++98 library implementation.

Ideas for more thorough test cases or any edge cases missing would be
appreciated. =D

llvm-svn: 130057
2011-04-23 10:47:28 +00:00
Chandler Carruth 7980348fcf Sort the type traits in a few places where they weren't previously
sorted in order to prepare for adding some new ones.

llvm-svn: 130056
2011-04-23 10:47:20 +00:00
Chandler Carruth 61fbf62838 Fix Clang's __DEPRECATED define to be controled by -Wdeprecated. This
matches GCC behavior which libstdc++ uses to limit #warning-based
messages about deprecation.

The machinery involves threading this through a new '-fdeprecated-macro'
flag for CC1. The flag defaults to "on", similarly to -Wdeprecated. We
turn the flag off in the driver when the warning is turned off (modulo
matching some GCC bugs). We record this as a language option, and key
the preprocessor on the option when introducing the define.

A separate flag rather than a '-D' flag allows us to properly represent
the difference between C and C++ builds (only C++ receives the define),
and it allows the specific behavior of following -Wdeprecated without
potentially impacting the set of user-provided macro flags.

llvm-svn: 130055
2011-04-23 09:27:53 +00:00
Jay Foad 72e705ed94 Like the coding standards say, do not use "using namespace std".
llvm-svn: 130054
2011-04-23 09:06:00 +00:00
Benjamin Kramer 3db054650b Silence an overzealous uninitialized variable warning from GCC.
llvm-svn: 130053
2011-04-23 08:21:06 +00:00
Chandler Carruth 153329dad7 GCC overloads -Wwrite-strings just to make it extra confusing. While it
changes language semantics in C and ObjC (which Clang has supported for
a while), in C++ it's the name used for Clang's
-Wdeprecated-writable-strings.

Clang's name is at least less overloaded if still confusing (the string
isn't writable, we just allow converting to a non-const pointer without
warning), so I've left it in place and made the GCC name an alias for
compatibility.

With this I've implemented all the aspects of GCC's -Wwrite-strings I've
encountered which didn't work with Clang.

llvm-svn: 130052
2011-04-23 06:54:44 +00:00
Chandler Carruth b009b14971 There were some frustrating problems with the implementation of
-Wwrite-strings. First and foremost, once the positive form of the flag
was passed, it could never be disabled by passing -Wno-write-strings.
Also, the diagnostic engine couldn't in turn use -Wwrite-strings to
control diagnostics (as GCC does) because it was essentially hijacked to
drive the language semantics.

Fix this by giving CC1 a clean '-fconst-strings' flag to enable
const-qualified strings in C and ObjC compilations. Corresponding
'-fno-const-strings' is also added. Then the driver is taught to
introduce '-fconst-strings' in the CC1 command when '-Wwrite-strings'
dominates.

This entire flag is basically GCC-bug-compatibility driven, so we also
match GCC's bug where '-w' doesn't actually disable -Wwrite-strings. I'm
open to changing this though as it seems insane.

llvm-svn: 130051
2011-04-23 06:30:43 +00:00
Andrew Trick 76dca78cb4 Accidental function name mangling.
llvm-svn: 130050
2011-04-23 04:08:15 +00:00
Andrew Trick 0ed5778a1e Thumb2 and ARM add/subtract with carry fixes.
Fixes Thumb2 ADCS and SBCS lowering: <rdar://problem/9275821>.
t2ADCS/t2SBCS are now pseudo instructions, consistent with ARM, so the
assembly printer correctly prints the 's' suffix.

Fixes Thumb2 adde -> SBC matching to check for live/dead carry flags.

Fixes the internal ARM machine opcode mnemonic for ADCS/SBCS.
Fixes ARM SBC lowering to check for live carry (potential bug).

llvm-svn: 130048
2011-04-23 03:55:32 +00:00
Andrew Trick 3260c9df4e Comment edit.
llvm-svn: 130047
2011-04-23 03:27:19 +00:00
Andrew Trick 1a1f8d4640 whitespace
llvm-svn: 130046
2011-04-23 03:24:11 +00:00
John McCall d44f4d741c Diagnose C++ abstract parameters for Objective-C methods.
llvm-svn: 130045
2011-04-23 02:46:06 +00:00
Greg Clayton 7e14f91dbd Fixed the SymbolContext::DumpStopContext() to correctly indent and dump
inline contexts when the deepest most block is not inlined.

Added source path remappings to the lldb_private::Target class that allow it
to remap paths found in debug info so we can find source files that are elsewhere
on the current system.

Fixed disassembly by function name to disassemble inline functions that are
inside other functions much better and to show enough context before the
disassembly output so you can tell where things came from.

Added the ability to get more than one address range from a SymbolContext 
class for the case where a block or function has discontiguous address ranges.

llvm-svn: 130044
2011-04-23 02:04:55 +00:00
Argyrios Kyrtzidis 3d2185ba82 Exhaust the cases.
llvm-svn: 130043
2011-04-23 01:10:24 +00:00
Argyrios Kyrtzidis 7d94c9277a Fix an assertion when code-completing, rdar://9288730 & http://llvm.org/PR9728.
llvm-svn: 130042
2011-04-23 01:04:12 +00:00
Johnny Chen 9ae982053f Convert the rest of the test suite to use the lldbutil.get_description() utility function.
llvm-svn: 130041
2011-04-23 00:34:56 +00:00
NAKAMURA Takumi aa3d6242cf docs: Introduce cascading style <div> and <p> continued on <h[2-5]>.
<h2>Section Example</h2>
<div> <!-- h2+div is applied -->
<p>Section preamble.</p>

<h3>Subsection Example</h3>
<p> <!-- h3+p is applied -->
Subsection body
</p>

<!-- End of section body -->
</div>

FIXME: Care H5 better.
llvm-svn: 130040
2011-04-23 00:30:22 +00:00
NAKAMURA Takumi 576273cf56 test/CodeGen/X86/shrink-compare.ll: Relax expressions for Win64.
llvm-svn: 130039
2011-04-23 00:15:45 +00:00
Johnny Chen 90256cdaba Add a simple utility function get_description(lldb_obj, option=None) to lldbutil.py
and use it from TestTargetAPI.py.

llvm-svn: 130038
2011-04-23 00:13:34 +00:00
Devang Patel a6cb0642b2 Tie debug information for method declaration with debug information for method definition.
llvm-svn: 130037
2011-04-23 00:08:01 +00:00
Argyrios Kyrtzidis bf04231a72 Don't allow reinterpret_cast to reference of vector element and property expression. Thanks goes to Eli Friedman!
llvm-svn: 130036
2011-04-22 23:57:57 +00:00
Jim Ingham 58b59f9522 Fix up how the ValueObjects manage their life cycle so that you can hand out a shared
pointer to a ValueObject or any of its dependent ValueObjects, and the whole cluster will
stay around as long as that shared pointer stays around.

llvm-svn: 130035
2011-04-22 23:53:53 +00:00
Douglas Gregor 0ff2b2eda3 Teach libclang to be more careful around BlockDecls, and don't assume
that a TypeSourceInfo is always available, like we do everywhere else
in libclang. Fixes <rdar://problem/9311140>.

llvm-svn: 130034
2011-04-22 23:49:24 +00:00
Owen Anderson dd450b86cf Teach FastISel to deal with instructions that have two immediate operands.
llvm-svn: 130033
2011-04-22 23:38:06 +00:00
Chris Lattner 9fa385d437 don't warn about empty macro arguments in c++'0x mode, since it sucked in
the c99 preprocessor.  Patch by Jonathan Sauer!

llvm-svn: 130031
2011-04-22 23:25:09 +00:00
Francois Pichet dcb3ebeb2c Correctly emit a diagnostic for multiple templated function definitions in -flate-template-parsing mode.
llvm-svn: 130030
2011-04-22 23:20:44 +00:00
Johnny Chen 787f71f269 Add test cases for the SBTarget.GetDescription() API which takes an extra lldb::DescriptionLevel enum.
llvm-svn: 130029
2011-04-22 23:20:17 +00:00
Devang Patel 1d6bbd41aa Let front-end tie subprogram declaration with subprogram definition directly.
llvm-svn: 130028
2011-04-22 23:10:17 +00:00
Eric Christopher 2ee5b37ab6 Fix comment.
llvm-svn: 130027
2011-04-22 23:08:45 +00:00
Jakob Stoklund Olesen 032891b718 Always compare the cost of region splitting with the cost of per-block splitting.
Sometimes it is better to split per block, and we missed those cases.

llvm-svn: 130025
2011-04-22 22:47:40 +00:00
Argyrios Kyrtzidis 47a1285a69 reinterpret_cast to reference of a bit-field is not allowed.
Fixes rdar://9202628 & http://llvm.org/PR9564.

llvm-svn: 130024
2011-04-22 22:31:13 +00:00
Douglas Gregor 9750969178 At the end of the translation unit, defining a vtable can introduce
new templates that need to be instantiated and vice-versa. Iterate
until we've instantiated all required templates and defined all
required vtables. Fixed PR9325 / <rdar://problem/9055177>.

llvm-svn: 130023
2011-04-22 22:25:37 +00:00
Francois Pichet 1c229c0472 Add -fdelayed-template-parsing option. Using this option all templated function definitions are parsed at the end of the translation unit only if it is required by an actual instantiation. As such all the symbols of the TU are available during name lookup.
Using this flag is necessary for compatibility with Microsoft template code.
This also provides some parsing speed improvement.

llvm-svn: 130022
2011-04-22 22:18:13 +00:00
Mikhail Glushenkov 91956aba03 The .inc file is auto-generated and must not be edited by hand.
llvm-svn: 130021
2011-04-22 22:05:29 +00:00