Commit Graph

75014 Commits

Author SHA1 Message Date
Douglas Gregor 5639af4eac Document the edit-distance algorithm used in StringRef, switch it over
to SmallVector, and add a unit test.

llvm-svn: 92340
2009-12-31 04:24:34 +00:00
Chris Lattner b0283c06b2 improve diagnostics for case when a field type is unknown by
not emitting a follow-on error about 'int', which the user
never wrote.  PR5924.

llvm-svn: 92339
2009-12-31 03:10:55 +00:00
Chris Lattner 5e9aca4c5d this #include is ok.
llvm-svn: 92338
2009-12-31 03:02:42 +00:00
Chris Lattner 6a0ca6aa90 fix Analysis/DebugInfo.h to not include Metadata.h. Do this
by moving one method out of line and eliminating redundant checks
from other methods.

llvm-svn: 92337
2009-12-31 03:02:08 +00:00
Chris Lattner cac432c846 add some basic named MD tests.
llvm-svn: 92336
2009-12-31 03:00:49 +00:00
Chris Lattner b419a1e44f use early exits to reduce indentation.
llvm-svn: 92335
2009-12-31 02:33:14 +00:00
Chris Lattner cdec581a35 eliminate another copy of the mdnode printing logic, simplify the
one that remains.

llvm-svn: 92334
2009-12-31 02:31:59 +00:00
Chris Lattner 0d50bddda6 random tidying for MDNode printing.
llvm-svn: 92333
2009-12-31 02:27:30 +00:00
Chris Lattner efb5e39428 eliminate a bunch of useless forwarding functions with one caller.
llvm-svn: 92332
2009-12-31 02:23:35 +00:00
Chris Lattner cf4a76e441 make mdnMap type safe, rename accessors for consistency with the rest of llvm.
llvm-svn: 92331
2009-12-31 02:20:11 +00:00
Chris Lattner 01635a8428 metadata can't be a global var initializer.
llvm-svn: 92330
2009-12-31 02:15:45 +00:00
Chris Lattner bddea6a530 simplify mdnode printing logic. Now N->dump() only
dumps one node instead of all of them.

llvm-svn: 92329
2009-12-31 02:13:35 +00:00
Chris Lattner 1e6e36785e don't unittest mdnode printing, we have disassembler tests for this.
llvm-svn: 92328
2009-12-31 02:12:13 +00:00
Chris Lattner 2c48c64821 unify two copies of the NamedMDNode printing code.
llvm-svn: 92327
2009-12-31 01:54:05 +00:00
Chris Lattner b9196679f9 fix printing of function-local metadata to print all the operands of the
mdnode, not just operand 0 over and over.

llvm-svn: 92326
2009-12-31 01:44:44 +00:00
Chris Lattner 31fcc28a84 simplify printing of mdstring and Argument.
llvm-svn: 92325
2009-12-31 01:41:14 +00:00
Chris Lattner be2de79b77 simplify asmprinting of NamedMDNode
llvm-svn: 92324
2009-12-31 01:36:50 +00:00
Chris Lattner cc8c8146d2 Remove #include of metadata.h from intrinsicinst.h. The only
method that needs it (DbgValueInst::getValue) has been moved out
of line.

llvm-svn: 92323
2009-12-31 01:32:41 +00:00
Chris Lattner 9b493028df rename "elements" of metadata to "operands". "Elements" are
things that occur in types.  "operands" are things that occur
in values.

llvm-svn: 92322
2009-12-31 01:22:29 +00:00
Chris Lattner 8cb6c3476d Optimize MDNode to coallocate the operand list immediately
after the MDNode in memory.  This eliminates the operands
pointer and saves a new[] per node.

Note that the code in DIDerivedType::replaceAllUsesWith is wrong
and quite scary.  A MDNode should not be RAUW'd with something
else: this changes all uses of the mdnode, which may not be debug
info related!  Debug info should use something non-mdnode for
declarations.

llvm-svn: 92321
2009-12-31 01:05:46 +00:00
Chris Lattner 8dace893fa tidy
llvm-svn: 92320
2009-12-31 00:51:46 +00:00
Anders Carlsson a442499072 Fix a bunch of bugs with VMI RTTI building, and add a whole bunch of tests.
llvm-svn: 92319
2009-12-30 23:47:56 +00:00
Zhongxing Xu da3ddfce43 The element type should also be canonicalized. Add a case for VariableArrayType.
llvm-svn: 92318
2009-12-30 22:59:54 +00:00
Chris Lattner d866c5a678 testcase for previous patch!
llvm-svn: 92317
2009-12-30 22:10:22 +00:00
Chris Lattner 8977c433d3 when making a decl for __builtin_fabsf() make sure to
attach the appropriate attributes to it.  I don't think
this manifests as any real change though, we're still
not getting the right LLVM IR attributes out of codegen.

llvm-svn: 92316
2009-12-30 22:06:22 +00:00
Chris Lattner 30ae06be14 do not bother reuniquing mdnodes whose operands drop to null. Doing
so can be a huge performance issue when tearing down modules and mdnodes
are not guaranteed to be unique anyway.  This speeds up:
$ time ~/llvm/Release/bin/clang gcc.c -w -S -g

from 72 to 35s, where gcc.c is from:
http://people.csail.mit.edu/smcc/projects/single-file-programs/

llvm-svn: 92315
2009-12-30 21:42:11 +00:00
Zhongxing Xu 1563a76fd3 Fix a comment.
llvm-svn: 92314
2009-12-30 21:24:23 +00:00
Chris Lattner c3847ba3fa fix PR5917, L'x' was getting the wrong type in c++ mode. Per
C++2.13.2p2: "A wide-character literal has type wchar_t"

llvm-svn: 92313
2009-12-30 21:19:39 +00:00
Fariborz Jahanian 92368a15f9 When rewriting a __block declaration, use a suitable API to get location of
the declaration in the presence of an initializer macro.

llvm-svn: 92312
2009-12-30 20:38:08 +00:00
Chris Lattner 09660c9b06 remove some misleading comments.
llvm-svn: 92311
2009-12-30 20:25:09 +00:00
Chris Lattner 1ca1d7adc2 remove extraneous #include
llvm-svn: 92310
2009-12-30 19:54:10 +00:00
Douglas Gregor 165882c240 Implement edit distance for StringRef
llvm-svn: 92309
2009-12-30 17:23:44 +00:00
Douglas Gregor 2d435306e5 Typo correction for type names when they appear in declarations, e.g., given
tring str2;

we produce the following diagnostic + fix-it:

typo.cpp:15:1: error: unknown type name 'tring'; did you mean 'string'?
  tring str2;
  ^~~~~
  string


To make this really useful, we'll need to introduce typo correction in
many more places (wherever we do name lookup), and implement
declaration-vs-expression heuristics that cope with typos
better. However, for now this will handle the simple cases where we
already get good "unknown type name" diagnostics.

The LookupVisibleDecls functions are intended to be used by code
completion as well as typo correction; that refactoring will happen
later.

llvm-svn: 92308
2009-12-30 17:04:44 +00:00
Douglas Gregor ad183ac3c7 Fix typo in comment
llvm-svn: 92307
2009-12-30 16:01:52 +00:00
Zhongxing Xu 4629e92e78 Remove an duplicated #include.
llvm-svn: 92306
2009-12-30 06:48:20 +00:00
Zhongxing Xu 7b8b4d70ef Simplify code by using an equivalent template class.
llvm-svn: 92305
2009-12-30 06:38:20 +00:00
Chris Lattner 16bafa6f14 remove some fixme's
llvm-svn: 92304
2009-12-30 06:00:36 +00:00
Chris Lattner c5c08899e4 fix two bogus tests that the asmparser now rejects.
llvm-svn: 92303
2009-12-30 05:54:51 +00:00
Chris Lattner 94b9c5a73b now that instruction metadata is only parsed in one place, eliminate the
parser-global MDsOnInst vector and make ParseInstructionMetadata return
its result by-ref through an argument like the entire rest of the parser.

llvm-svn: 92302
2009-12-30 05:48:36 +00:00
Chris Lattner b2f3950da7 reimplement ParseOptionalInfo as ParseOptionalCommaAlign, correctly
handle the comma case for metadata.

llvm-svn: 92301
2009-12-30 05:44:30 +00:00
Chris Lattner 5c42763452 rename ParseOptionalCustomMetadata -> ParseInstructionMetadata,
and make it non-optional.  This fixes the bug where we'd accept
and ignore a spurious comma after some instructions.

llvm-svn: 92300
2009-12-30 05:31:19 +00:00
Chris Lattner f4f0342b08 convert 4 more instructions over.
llvm-svn: 92299
2009-12-30 05:27:33 +00:00
Chris Lattner 77b89dc58b add facilities to start factoring instruction metadata parsing
out of each opcode's handler.  Change ret over so far.

llvm-svn: 92298
2009-12-30 05:23:43 +00:00
Chris Lattner 28f1eebe3e reimplement insertvalue/extractvalue metadata handling to not blindly
accept invalid input.  Actually add a testcase.

llvm-svn: 92297
2009-12-30 05:14:00 +00:00
Chris Lattner bafee45d2c remove two bogus calls that accepted metadata in the middle of insert/extract value
*constant exprs*.

llvm-svn: 92296
2009-12-30 05:04:46 +00:00
Chris Lattner eafe4de021 rename NamedOrCustomMD -> MetadataVar to follow conventions of all the rest of the code.
llvm-svn: 92295
2009-12-30 05:02:06 +00:00
Chris Lattner 1eed2d65c0 rename lltok::Metadata -> lltok::exclaim. We name tokens
after their syntactic form, not their semantic form.

llvm-svn: 92294
2009-12-30 04:56:59 +00:00
Chris Lattner fc58af26d5 rename MetadataCache -> NumberedMetadata to follow the convention
used by other things.  Convert it to a vector since it is a dense 
numbering.

llvm-svn: 92293
2009-12-30 04:51:58 +00:00
Chris Lattner a01ddfc2a3 rewrite ParseMDNodeVector to follow the normal patter used in the .ll parser.
llvm-svn: 92292
2009-12-30 04:42:57 +00:00
Chris Lattner 6dac02a4f7 rename ParseMDNode -> ParseMDNodeID, since it parses !42, not !{... } as you'd expect.
llvm-svn: 92291
2009-12-30 04:15:23 +00:00