Commit Graph

19062 Commits

Author SHA1 Message Date
Fariborz Jahanian 5b72ed9798 Use S.str() to force a flush.
llvm-svn: 129856
2011-04-20 16:38:37 +00:00
Daniel Dunbar 2db3e73c38 Driver: Suppress some additional warnings with -Qunused-arguments.
llvm-svn: 129853
2011-04-20 15:44:48 +00:00
Douglas Gregor 3719d3455a Be sure to flush raw_string_ostream objects in the Objective-C
rewriter, from Eric Niebler!

llvm-svn: 129849
2011-04-20 13:35:54 +00:00
Douglas Gregor 49f754f423 Teach SourceManager::getSLocEntry() that it can fail due to problems
during deserialization from  a precompiled header, and update all of
its callers to note when this problem occurs and recover (more)
gracefully. Fixes <rdar://problem/9119249>.

llvm-svn: 129839
2011-04-20 00:21:03 +00:00
Daniel Dunbar fcd2389b7a TWEAK
llvm-svn: 129835
2011-04-19 23:34:21 +00:00
Daniel Dunbar 308cfd045f Driver/Darwin: Switch to using -macosx for OS name in triples.
llvm-svn: 129834
2011-04-19 23:34:17 +00:00
Daniel Dunbar 914bc4106c IRgen/ARM: Fix a think-o in conversion-to-null for member function pointers, we
were computing the conversion as (ptr != 0 && non-virtual), when it should be
(ptr != 0 || is-virtual).
 - Test to follow in LLVM test-suite.

llvm-svn: 129830
2011-04-19 23:10:47 +00:00
Chris Lattner 2531eb421f some cleanups to use IRBuilder methods instead of llvm:: foo methods.
llvm-svn: 129829
2011-04-19 22:55:03 +00:00
Daniel Dunbar 5c56828d91 Driver/Darwin: Switch to using new style triples.
llvm-svn: 129824
2011-04-19 21:45:47 +00:00
Daniel Dunbar 14ad22f09d ADT/Triple: Switch to using .isOSDarwin() predicate.
llvm-svn: 129823
2011-04-19 21:43:27 +00:00
Fariborz Jahanian 2b059998f7 Avoid superfluous warning after an error is detcted and reported.
// rdar://9132143

llvm-svn: 129822
2011-04-19 21:42:37 +00:00
Daniel Dunbar ecf1356057 Basic/Darwin: Add support for new -osx and -ios style triples (not yet used).
llvm-svn: 129820
2011-04-19 21:40:34 +00:00
Chris Lattner 46f1614d56 use the newly introduced IRBuilder getInt() method to reduce some
redundancy pointed out by John.

llvm-svn: 129808
2011-04-19 20:53:45 +00:00
Argyrios Kyrtzidis 1618023018 We regard a function as 'unused' from the codegen perspective, so our warnings diverge from
gcc's unused warnings which don't get emitted if the function is referenced even in an unevaluated context
(e.g. in templates, sizeof, etc.). Also, saying that a function is 'unused' because it won't get codegen'ed
is somewhat misleading.

- Don't emit 'unused' warnings for functions that are referenced in any part of the user's code.
- A warning that an internal function/variable won't get emitted is useful though, so introduce
  -Wunneeded-internal-declaration which will warn if a function/variable with internal linkage is not
  "needed" ('used' from the codegen perspective), e.g:

  static void foo() { }

  template <int>
  void bar() {
    foo();
  }

test.cpp:1:13: warning: function 'foo' is not needed and will not be emitted
static void foo() { }
            ^

Addresses rdar://8733476.

llvm-svn: 129794
2011-04-19 19:51:10 +00:00
Peter Collingbourne 133587f08b Add a new expression classification, CL_AddressableVoid
CL_AddressableVoid is the expression classification used for void
expressions whose address can be taken, i.e. the result of [], *
or void variable references in C, as opposed to things like the
result of a void function call.

llvm-svn: 129783
2011-04-19 18:51:51 +00:00
Anders Carlsson d1f65f61ee Make the VariadicMethodTypeChecker accept block pointers as Objective-C pointers. Fixes PR9746.
llvm-svn: 129741
2011-04-19 01:16:46 +00:00
Daniel Dunbar d107638328 Driver/Darwin: Change to use generic iOS runtime library, which we now always need.
llvm-svn: 129734
2011-04-18 23:48:36 +00:00
Ted Kremenek 1c2239e9b1 Add SelectorTable::getTotalMemory() to allow clients to query how much memory is used by selectors.
llvm-svn: 129728
2011-04-18 22:47:04 +00:00
Daniel Dunbar ed904c82b1 Driver/Darwin: Disable movw/movt with -mkernel or -fapple-kext.
llvm-svn: 129721
2011-04-18 21:26:42 +00:00
Fariborz Jahanian b107143fed Fix a bug in calculation of composite type
of conditional expressions of objc pointer types
where one type is the immediate base type of the
other. // rdar://9296866

llvm-svn: 129718
2011-04-18 21:16:59 +00:00
Daniel Dunbar 10d0868efb Driver: Support -fno-lto.
llvm-svn: 129712
2011-04-18 19:44:09 +00:00
Ted Kremenek 00abe8ee31 Add ToolChain path support for linker on Slackware.
llvm-svn: 129704
2011-04-18 17:50:19 +00:00
Devang Patel 43cfa5dce1 Fix typo in comment.
llvm-svn: 129703
2011-04-18 17:30:25 +00:00
Richard Smith 0c502d2a62 Fix PR9741. The implicit declarations created for range-based for loops weren't being added to the DeclContext (nor were they being marked as implicit). Also, the declarations were being emitted in the wrong order when building the CFG.
llvm-svn: 129700
2011-04-18 15:49:25 +00:00
Douglas Gregor 6c7a9eec42 When providing code completions of ivar names for a property
implementation such as

  @synthesize Prop1 = 

Give priority to ivars whose type matches or closely matches the
property type (as we do for several other kinds of
results). Additionally, if there is an ivar with the same name as the
property, or differs only due to a _ prefix or suffix, give that ivar
a priority bump. Finally, verify that this search is properly
returning ivars within class extensions and implementations
(<rdar://problem/8488854>).

llvm-svn: 129699
2011-04-18 14:40:46 +00:00
Anders Carlsson 566ae67ef8 Get rid of std::vector usage when getting function types in CGException.cpp
llvm-svn: 129698
2011-04-18 14:24:10 +00:00
Douglas Gregor 331faa0f73 When producing code completion results for the Objective-C property
implementation 

  @synthesize <property> = 

also produce a completion for a to-be-synthesized ivar named
_<property>.

llvm-svn: 129697
2011-04-18 14:13:53 +00:00
Anders Carlsson 940f02d248 Clean up code generation of typeid expressions and add C++ standard references.
llvm-svn: 129682
2011-04-18 00:57:03 +00:00
Chris Lattner 97bbee2fb4 Fix a miscompilation I introduced in r129652, thanks for Eli for tracking
it down.  we effectively were compile the testcase into:

void test14(int x) {
  switch (x) {
    case 11: break;
    case 42: test14(97);  // fallthrough
    default: test14(42); break;

which is not the same thing at all.  This fixes a miscompilation of 
MallocBench/gs seen on the clang-x86_64-linux-fnt buildbot.

llvm-svn: 129679
2011-04-17 23:21:26 +00:00
Anders Carlsson fcaaa697ec When laying out bases in, always try the "base subobject" LLVM type. If it
turns out that a field or base needs to be laid out in the tail padding of
the base, CGRecordLayoutBuilder::ResizeLastBaseFieldIfNecessary will convert
it to an array of i8.

I've audited the new test results to make sure that they are still valid. I've
also verified that we pass a self-host with this change.

This (finally) fixes PR5589!

llvm-svn: 129673
2011-04-17 21:56:13 +00:00
Anders Carlsson 56c4d80a4e Add addBaseSubobjectTypeName which isn't used yet.
llvm-svn: 129671
2011-04-17 21:40:34 +00:00
Anders Carlsson c58f8cb7fc Move code to add a type name to a TagDecl type out into a helper function. No functionality change.
llvm-svn: 129669
2011-04-17 21:36:59 +00:00
Anders Carlsson b6d31e7dcc Use a SmallVector for field types in CGRecordLayoutBuilder now that llvm::StructType::get takes an ArrayRef.
llvm-svn: 129667
2011-04-17 21:32:41 +00:00
Michael J. Spencer a9e4117991 Make -mno-mmx imply -mno-3dnow. This is what gcc does, and it makes sense.
Also, fold the sse4 and sse4.1 cases together.

Patch by Alexander Best!

llvm-svn: 129665
2011-04-17 19:22:03 +00:00
Eli Friedman 2e2ff8894d Hack to turn the valgrind buildbot green, until Devang can address it
properly.

llvm-svn: 129657
2011-04-17 06:40:15 +00:00
Chris Lattner bc204c8043 implement rdar://9289524 - case followed immediately by break results in empty IR block,
a -O0 code quality issue.

llvm-svn: 129652
2011-04-17 00:54:30 +00:00
Chris Lattner 30107ed600 fold memcpy/set/move_chk to llvm.memcpy/set/move when the sizes
are trivial.  This exposes opportunities earlier, and allows fastisel
to do good things with these at -O0.

This addresses rdar://9289468 - clang doesn't fold memset_chk at -O0

llvm-svn: 129651
2011-04-17 00:40:24 +00:00
Chris Lattner 56784f9de6 fix rdar://9289603 - clang should fold trivial ?: for enums as well as integer constants into select at -O0
by making the isCheapEnoughToEvaluateUnconditionally predicate handle anything that folds to a constant.  In particular, we now fold enums.

llvm-svn: 129649
2011-04-16 23:15:35 +00:00
Richard Trieu 70d14f5df3 Testing my commit access. A few whitespace changes to Sema/SemaCXXCast.cpp.
llvm-svn: 129629
2011-04-16 01:09:30 +00:00
Argyrios Kyrtzidis 0e993c3249 Introduce Rewriter::IncreaseIndentation() which increase indentations for the lines between the given source range.
To determine what the indentation should be, a SourceLocation 'parentIndent' parameter is used that should be at
a source location with an indentation one degree lower than the given range.

llvm-svn: 129628
2011-04-16 01:03:33 +00:00
Devang Patel 7294d74627 Emit proper selector name in debug info.
llvm-svn: 129626
2011-04-16 00:37:51 +00:00
Devang Patel 9d6c857862 Emit debug info for Objective-C properties.
llvm-svn: 129625
2011-04-16 00:12:55 +00:00
Tanya Lattner 5ac257d738 Fix bug in vector initializer when initializing a vector with another vector.
Add test case.

llvm-svn: 129617
2011-04-15 22:42:59 +00:00
Fariborz Jahanian 0fe1a9861c Enforce nonnull __attribute__ on Objective-C method calls.
// rdar://9287695

llvm-svn: 129615
2011-04-15 22:06:22 +00:00
Douglas Gregor 46ce91a964 Initial work to improve documentation for Clang's diagnostics, from Matthieu Monrocq
llvm-svn: 129614
2011-04-15 22:04:17 +00:00
Douglas Gregor 5d3d3fa33d For the purposes of overload resolution, consider a conversion from an
Objective-C pointer to void* as a "conversion to void*". This allows
us to prefer an Objective-C object pointer conversion to a superclass
object pointer over an Objective-C object pointer conversion to
cv-void*. Fixes PR9735.

llvm-svn: 129603
2011-04-15 20:45:44 +00:00
Douglas Gregor 39d1a0973d Forbid the use of C++ new/delete to allocate/free objects within an
address space. I could see that this functionality would be useful,
but not in its current form (where the address space is ignored):
rather, we'd want to encode the address space into the parameter list
passed to operator new/operator delete somehow, which would require a
bunch more semantic analysis.

llvm-svn: 129593
2011-04-15 19:46:20 +00:00
Douglas Gregor a3a020ae0b Parse GNU-style attributes prior to the type-id/new-type-id in a C++
"new" expression. This matches GCC's parser. Test is forthcoming.

llvm-svn: 129592
2011-04-15 19:40:02 +00:00
Fariborz Jahanian 193f783a99 Fixes a crash when generating dependency file stuff
and output file is not writable. // rdar://9286457.

llvm-svn: 129587
2011-04-15 18:49:23 +00:00
Douglas Gregor b472e93af7 Implement appropriate semantics for C++ casting and conversion when
dealing with address-space- and GC-qualified pointers. Previously,
these qualifiers were being treated just like cvr-qualifiers (in some
cases) or were completely ignored, leading to uneven behavior. For
example, const_cast would allow conversion between pointers to
different address spaces.

The new semantics are fairly simple: reinterpret_cast can be used to
explicitly cast between pointers to different address spaces
(including adding/removing addresss spaces), while
static_cast/dynamic_cast/const_cast do not tolerate any changes in the
address space. C-style casts can add/remove/change address spaces
through the reinterpret_cast mechanism. Other non-CVR qualifiers
(e.g., Objective-C GC qualifiers) work similarly.

As part of this change, I tweaked the "casts away constness"
diagnostic to use the term "casts away qualifiers". The term
"constness" actually comes from the C++ standard, despite the fact
that removing "volatile" also falls under that category. In Clang, we
also have restrict, address spaces, ObjC GC attributes, etc., so the
more general "qualifiers" is clearer.

llvm-svn: 129583
2011-04-15 17:59:54 +00:00