Commit Graph

19598 Commits

Author SHA1 Message Date
Alexis Hunt 119c10ef23 Update our diagnostics to properly account for move operations.
llvm-svn: 132096
2011-05-25 23:16:36 +00:00
Alexis Hunt 92a0adf05f Fix a minor thinko that leads to a crash if PatternDecl is null but
Pattern is not. Thanks Nick for catching this!

llvm-svn: 132089
2011-05-25 22:02:25 +00:00
Alexis Hunt fcaeae4929 Implement a little bit of cleanup and a lot more of the base work
behind implicit moves. We now correctly identify move constructors and
assignment operators and update bits on the record correctly. Generation
of implicit moves (declarations or definitions) is not yet supported.

llvm-svn: 132080
2011-05-25 20:50:04 +00:00
David Chisnall e4e5c0f219 Remove bitcast to incorrect type.
llvm-svn: 132077
2011-05-25 20:33:17 +00:00
Douglas Gregor 6c6e6761b2 Properly align UnaryTransformType when allocating it
llvm-svn: 132064
2011-05-25 17:51:54 +00:00
Francois Pichet 2e11f5df3d Disable MSVC warning about runtime stack overflow for DebugOverflowStack.
llvm-svn: 132059
2011-05-25 16:15:03 +00:00
Francois Pichet 7e401dbe03 Fix MSVC warning: <unsafe use of type 'bool' in operation>
llvm-svn: 132058
2011-05-25 16:07:10 +00:00
Francois Pichet 8f981d5964 Add support for Microsoft __if_exists, __if_not_exists extension at class scope.
Example:

typedef int TYPE;
class C {
  __if_exists(TYPE) {
     TYPE a;
  }
  __if_not_exists(TYPE) {
     this will never be parsed.
  }
};

llvm-svn: 132052
2011-05-25 10:19:49 +00:00
Ted Kremenek 86d49ce20c Teach analyzer about cf_returns_not_retained for C functions.
llvm-svn: 132049
2011-05-25 06:29:39 +00:00
Ted Kremenek 8e2c9b0180 Enhance retain/release checker to flag warnings when functions returning CG types do not follow the Core Foundation naming conventions.
llvm-svn: 132048
2011-05-25 06:19:45 +00:00
Argyrios Kyrtzidis 0e37afa15e A StringRef-ication of the DiagnosticIDs API and internals.
Patch by Matthieu Monrocq with tweaks by me to avoid StringRefs in the static
diagnostic data structures, which resulted in a huge global-var-init function.

Depends on llvm commit r132046.

llvm-svn: 132047
2011-05-25 05:05:01 +00:00
Rafael Espindola c1ee12c952 Update for llvm api change.
llvm-svn: 132034
2011-05-25 03:44:55 +00:00
Alexis Hunt e852b100e2 Implement a new type node, UnaryTransformType, designed to represent a
type that turns one type into another. This is used as the basis to
implement __underlying_type properly - with TypeSourceInfo and proper
behavior in the face of templates.

llvm-svn: 132017
2011-05-24 22:41:36 +00:00
Nick Lewycky 82fe5f43d9 When given one of the applicable coverage flags, try to link against
libprofile_rt.a. On Darwin, don't try to link -lgcov.

llvm-svn: 132006
2011-05-24 21:54:59 +00:00
Ted Kremenek 3a60114085 Add explicit CFG support for ignoring static_asserts.
llvm-svn: 132001
2011-05-24 20:41:31 +00:00
Roman Divacky fcae03245d Let amd64 be used in target triple instead of x86_64 on FreeBSD.
Patch by Dimitry Andric!

llvm-svn: 131990
2011-05-24 19:54:09 +00:00
Argyrios Kyrtzidis 8bd428574c Add new warning that warns when invoking 'delete' on a polymorphic, non-final, class without a virtual destructor.
Patch by Matthieu Monrocq!

llvm-svn: 131989
2011-05-24 19:53:26 +00:00
Douglas Gregor fcafc6e3de Implement the initial part of C++0x [expr.const]p2, which specifies
that the unevaluated subexpressions of &&, ||, and ? : are not
considered when determining whether the expression is a constant
expression. Also, turn the "used in its own initializer" warning into
a runtime-behavior warning, so that it doesn't fire when a variable is
used as part of an unevaluated subexpression of its own initializer.

Fixes PR9999.

llvm-svn: 131968
2011-05-24 16:02:01 +00:00
Jim Grosbach 7c2c664500 For non-Darwin, a plain 'char' type is unsigned.
llvm-svn: 131967
2011-05-24 15:40:46 +00:00
Chandler Carruth e5d9d906cb Fix a bug in the most recent openSUSE support patch.
This patch also by Ismail Donmez.

llvm-svn: 131958
2011-05-24 07:51:17 +00:00
Chandler Carruth 0dc3f8db1a Fix a bug in -Wundefined-reinterpret-cast where we failed to look
through sugared types when testing for TagTypes. This was the actual
cause of the only false positive in Clang+LLVM.

Next evaluation will be over a much larger selection of code including
large amounts of open source code.

llvm-svn: 131957
2011-05-24 07:43:19 +00:00
Nico Weber 3b1d1217f8 Make it possible for external tools to distinguish between paths that come from -I and paths that come from -system. Patch from Paul Holden!
llvm-svn: 131955
2011-05-24 04:31:14 +00:00
Francois Pichet a8032e96b5 MSVC doesn't do any validation regarding exception specification.
llvm-svn: 131950
2011-05-24 02:11:43 +00:00
Alexis Hunt 6a31f2c7c9 Delete the extraneous return statement that was causing my earlier
issues and also add a test.

We should now handle defaulted members of templates properly. No
comment as to whether or not this also holds for templated functions,
but defaulting those is kind of insane.

llvm-svn: 131938
2011-05-23 23:56:01 +00:00
David Chisnall b85775c3ba Fix bug introduced with r131930.
llvm-svn: 131935
2011-05-23 23:15:11 +00:00
Alexis Hunt 61ae8d395e Implement explicit specialization of explicitly-defaulted constructors.
The general out-of-line case (including explicit instantiation mostly
works except that the definition is being lost somewhere between the AST
and CodeGen, so the definition is never emitted.

llvm-svn: 131933
2011-05-23 23:14:04 +00:00
David Chisnall 1254f6efe2 Don't omit retain / release / autorelease message sends in hybrid GC mode.
llvm-svn: 131932
2011-05-23 23:13:25 +00:00
David Chisnall 3fe89562e8 Fix some problems where functions must be bitcast but we're expecting a llvm::Function of the right type.
PR9994.

llvm-svn: 131930
2011-05-23 22:33:28 +00:00
Alexis Hunt 1fb4e76218 Correctly propagate defaultedness across template instantiation. This
fixes PR9965, but we're not out of the water yet, as we do not
successfully handle out-of-line definitions, due to my utter
misunderstanding of how we manage templates.

llvm-svn: 131920
2011-05-23 21:07:59 +00:00
Francois Pichet efb1af9ae8 Emulate a MSVC bug where if during an using declaration name lookup, the declaration found is unaccessible (private) and that declaration was bring into scope via another using declaration whose target declaration is accessible (public) then no error is generated.
Example:
class A { public: int f();  };
class B : public A { private: using A::f; };
class C : public B { private: using B::f; };

Here, B::f is private so this should fail in Standard C++, but because B::f refers to A::f which is public MSVC accepts it.

This fixes 1 error when parsing MFC code with clang.

llvm-svn: 131896
2011-05-23 03:43:44 +00:00
Chris Lattner e76b95ae15 make the x86-32 backend specify a byval alignment, even when the
code generator will do it.  With this patch, clang compiles the example
in PR9794 to not have an alloca temporary.

llvm-svn: 131881
2011-05-22 23:35:00 +00:00
Chris Lattner 44c2b90556 Fix x86-64 byval passing to specify the alignment even when the code
generator will give it something sufficient.  This is important because
the mid-level optimizer doesn't know what alignment is required otherwise.

llvm-svn: 131879
2011-05-22 23:21:23 +00:00
David Chisnall 5c51177981 Provide the runtime with information about the GC compile options (GNU runtimes)
llvm-svn: 131877
2011-05-22 22:37:08 +00:00
Chris Lattner 3bdc7679ce Invoke the FileChanged callback before pushing the linemarker for a system
header.  Getting it in the wrong order generated incorrect line markers in -E 
mode.  In the testcase from PR9861 we used to generate:

# 1 "test.c" 2
# 1 "./foobar.h" 1
# 0 "./foobar.h"
# 0 "./foobar.h" 3
# 2 "test.c" 2

now we properly produce:

# 1 "test.c" 2
# 1 "./foobar.h" 1
# 1 "./foobar.h" 3
# 2 "test.c" 2

This fixes PR9861.

llvm-svn: 131871
2011-05-22 22:10:16 +00:00
Chris Lattner a8cde3c08d fix 80 col violation
llvm-svn: 131870
2011-05-22 22:09:06 +00:00
Chris Lattner d075c82f8c add opensuse toolchain support, patch by Ismail Donmez!
llvm-svn: 131857
2011-05-22 16:45:07 +00:00
Chris Lattner 84e38557e0 Add Redhat Enterprise Linux to the Linux toolchain, PR9769,
patch by Bryce Lelbach

llvm-svn: 131840
2011-05-22 05:36:06 +00:00
Douglas Gregor a51c9ccf2d Add an assertion to tell us when we're going off the deep end trying
to determine outer template arguments lists for template
parameters. This is actually the problem behind PR9643, which I have
yet to figure out how to fix.

llvm-svn: 131822
2011-05-22 00:21:10 +00:00
Chris Lattner ecf0ba5bde adjust to mainline api change.
llvm-svn: 131815
2011-05-21 23:50:44 +00:00
Douglas Gregor 80af31397a Audit and finish the implementation of C++0x nullptr, fixing two
minor issues along the way:
  - Non-type template parameters of type 'std::nullptr_t' were not
  permitted.
  - We didn't properly introduce built-in operators for nullptr ==,
  !=, <, <=, >=, or > as candidate functions .

To my knowledge, there's only one (minor but annoying) part of nullptr
that hasn't been implemented: catching a thrown 'nullptr' as a pointer
or pointer-to-member, per C++0x [except.handle]p4.

llvm-svn: 131813
2011-05-21 23:15:46 +00:00
Douglas Gregor 291e8ee206 It's considered poor form to create references to the overloaded
function type. Educate template argument deduction thusly, fixing
PR9974 / <rdar://problem/9479155>.

llvm-svn: 131811
2011-05-21 22:16:50 +00:00
Douglas Gregor b7c36f6c68 Classify bound member function types are member function types. Fixes
PR9973 / <rdar://problem/9479191>.

llvm-svn: 131810
2011-05-21 21:04:55 +00:00
Chris Lattner 5c12367b44 switch clang off StandardPasses.h onto PassManagerBuilder.h
llvm-svn: 131808
2011-05-21 20:40:11 +00:00
Douglas Gregor 347e0f26be Fix our handling of the warning when one tries to pass a
non-POD/non-trivial object throuugh a C-style varargs. The warning
itself was default-mapped to error, but can be downgraded, but we were
treating it in Sema like a hard error, silently dropping the call.

Instead, treat this problem like a warning, and do what the warning
says we do: abort at runtime. To do so, we fake up a __builtin_trap()
expression that gets evaluated as part of the argument.

llvm-svn: 131805
2011-05-21 19:26:31 +00:00
Eli Friedman e08bca9eb4 Fix the clang part of PR7952: rewrite the specialization of isa<> in DeclBase,
and stop abusing the multi-level dereference isa<> used to allow.

llvm-svn: 131804
2011-05-21 19:15:39 +00:00
Douglas Gregor 781ba6e407 Diagnose the presence of storage-class-specifiers on explicit
instantiations and specializations. Fixes <rdar://problem/9126453> and PR8700.

llvm-svn: 131802
2011-05-21 18:53:30 +00:00
Douglas Gregor 9574af6ea2 Teach Sema::ActOnUninitializedDecl() not to try to interpret when one
should use a constructor to default-initialize a
variable. InitializationSequence knows the rules for default
initialization, better. Fixes <rdar://problem/8501008>.

llvm-svn: 131796
2011-05-21 17:52:48 +00:00
Douglas Gregor 643c922e66 Introduce the -fdiagnostics-format=xxx option to control how Clang
prints the file, line, and column of a diagnostic. We currently
support Clang's normal format, MSVC, and Vi formats.

Note that we no longer change the diagnostic format based on
-fms-extensions.

Patch by Andrew Fish!

llvm-svn: 131794
2011-05-21 17:07:29 +00:00
Douglas Gregor 61b6e49ee1 A few more is(Un)signedIntegerType/is(Un)signedOrEnumerationType cleanups.
llvm-svn: 131793
2011-05-21 16:28:01 +00:00
Douglas Gregor 253cadfe68 Implement C++0x semantics for passing non-POD classes through varargs.
llvm-svn: 131792
2011-05-21 16:27:21 +00:00