Commit Graph

36824 Commits

Author SHA1 Message Date
Stepan Dyatkovskiy fe3b069a6a llvm::SwitchInst
Renamed methods caseBegin, caseEnd and caseDefault with case_begin, case_end, and case_default.
Added some notes relative to case iterators.

llvm-svn: 152533
2012-03-11 06:09:37 +00:00
Douglas Gregor fdd417fcee Document the availability attribute
llvm-svn: 152531
2012-03-11 04:53:21 +00:00
Douglas Gregor 194ea69d62 When template argument deduction is ignoring qualifiers, perform deep
structural comparison of non-dependent types. Otherwise, we end up
rejecting cases where the non-dependent types don't match due to
qualifiers in, e.g., a pointee type. Fixes PR12132.

llvm-svn: 152529
2012-03-11 03:29:50 +00:00
Richard Smith 6d244d754b cxx_status: No compiler changes are required for 'minimal support for garbage
collection'. Keep it in the table to match gcc's table, but mark it N/A.

llvm-svn: 152528
2012-03-11 03:06:00 +00:00
Douglas Gregor f31cee6e1d Add a missing 'template' keyword.
llvm-svn: 152526
2012-03-11 02:23:56 +00:00
Jordy Rose f80b2cced7 [analyzer] Replace a static helper with existing logic. No functionality change.
llvm-svn: 152521
2012-03-11 00:08:24 +00:00
Douglas Gregor 50a3cdddda When determining whether an identifier followed by a '<' in a member
access expression is the start of a template-id, ignore function
templates found in the context of the entire postfix-expression. Fixes
PR11856.

llvm-svn: 152520
2012-03-10 23:52:41 +00:00
David Blaikie 631a486e6a Fix crash & accepts-invalid for array of arrays of user defined type.
Test case/other help by Richard Smith.
Code review by John McCall.

llvm-svn: 152519
2012-03-10 23:40:02 +00:00
Aaron Ballman a97fc66ef3 Updated the test so that it checks for ms-compatibility in addition to ms-extensions.
llvm-svn: 152516
2012-03-10 22:52:10 +00:00
Aaron Ballman fa432f30d4 Adding namespace qualifiers to the visualizers and improving their behavior.
Patch thanks to Nikola Smiljanic

llvm-svn: 152514
2012-03-10 22:28:45 +00:00
Gregory Szorc a8b30c5b61 [clang.py] Implement Cursor.objc_type_encoding
llvm-svn: 152513
2012-03-10 22:23:27 +00:00
Aaron Ballman b4489162b6 No longer defining GNUC mode when compiling for Microsoft compatibility. This allows people's cross-platform compiler-specific macros to work properly.
llvm-svn: 152512
2012-03-10 22:21:14 +00:00
Douglas Gregor cffca4a014 Clarify even further that the lambda-to-block-pointer conversion is only available in Objective-C++
llvm-svn: 152511
2012-03-10 22:20:11 +00:00
Gregory Szorc 0e20a09165 [clang.py] Refactor get_tu and get_cursor test helper functions into util.py
llvm-svn: 152510
2012-03-10 22:19:05 +00:00
Richard Smith 5731c75414 PR12225: The requirement that literal operators be namespace-scope functions
does not imply that such functions can't be declared at block scope.

llvm-svn: 152509
2012-03-10 22:18:57 +00:00
Benjamin Kramer ddefa6d925 Use VersionTuple to manage macosx versions in the driver. No functionality change.
llvm-svn: 152504
2012-03-10 20:55:36 +00:00
Benjamin Kramer 53ba63643c Simplify code. No functionality change.
llvm-svn: 152503
2012-03-10 20:38:56 +00:00
Fariborz Jahanian fca65102a2 objective-c modern rewriter: add __declspec(dllexport) to forward
declaration of class metadata when they are defined later.

llvm-svn: 152500
2012-03-10 18:25:06 +00:00
Fariborz Jahanian b52221e941 objc modern rewriter: Define __OBJC2__ in written file.
// rdar://11024543

llvm-svn: 152496
2012-03-10 17:45:38 +00:00
Benjamin Kramer 616f80225c Replace a map of boolean values with a set.
No functionality change.

llvm-svn: 152494
2012-03-10 15:08:09 +00:00
Rafael Espindola 1f71a23985 The type of a definition should not increase its visibility. Fixes PR12221.
llvm-svn: 152493
2012-03-10 13:01:40 +00:00
John McCall 113bee0536 Remove BlockDeclRefExpr and introduce a bit on DeclRefExpr to
track whether the referenced declaration comes from an enclosing
local context.  I'm amenable to suggestions about the exact meaning
of this bit.

llvm-svn: 152491
2012-03-10 09:33:50 +00:00
Nick Lewycky f604212a44 Slightly tweak this condition. "isTransparentContext()" was checking whether an
enum is scoped or not, which is not relevant here. Instead, phrase the loop in
the same terms that the standard uses, instead of this awkward set of
conditions that is *nearly* equal.

llvm-svn: 152489
2012-03-10 07:47:07 +00:00
Nick Lewycky d9e1e57e2a Could not find this in C99. Perhaps this rule comes from a DR, but in any case
please annotate it with a note explaining why this wrong-seeming behaviour is
correct.

llvm-svn: 152488
2012-03-10 07:45:33 +00:00
Douglas Gregor d2f7007e09 Only make a call to a copy constructor elidable if in fact we are
doing a copy. Fixes PR12139.

llvm-svn: 152485
2012-03-10 06:53:13 +00:00
Argyrios Kyrtzidis 224ec821da [Sema] A tag decl that is marked as invalid and is used in a decl-spec,
should not impede creating a proper TypeLoc info for the decl-spec.

This improves our semantic error recovery.

llvm-svn: 152481
2012-03-10 03:20:58 +00:00
Argyrios Kyrtzidis 0900a74ddf Remove the part of test/Sema/pragma-pack-2.c that has irregular "#pragma pack"s.
Before r151307 this part worked without compiler errors but now it only verifies
that our handling of irregular pragmas is broken compared to gcc, it has no
practical usefulness; it creates invalid structs that cannot be used for 'offsetof' testing.

If we later decide to handle irregular pragmas without compiler errors we can
put back this part.

llvm-svn: 152480
2012-03-10 03:20:52 +00:00
John McCall 7133505936 Unify the BlockDeclRefExpr and DeclRefExpr paths so that
we correctly emit loads of BlockDeclRefExprs even when they
don't qualify as ODR-uses.  I think I'm adequately convinced
that BlockDeclRefExpr can die.

llvm-svn: 152479
2012-03-10 03:05:10 +00:00
John McCall b785a6691b Fix the dumping of BlockExprs.
llvm-svn: 152478
2012-03-10 03:04:55 +00:00
NAKAMURA Takumi 1e5ec2fcb4 test/Rewriter/rewrite-modern-ivars-2.mm: Add "-triple i386-apple-darwin9".
llvm-svn: 152476
2012-03-10 03:02:29 +00:00
Benjamin Kramer 5291e68c0c Fix a use of the C99 PRI format macros not to conflict with C++11 UDLs.
llvm-svn: 152475
2012-03-10 02:06:27 +00:00
Eli Friedman 9135902478 Make sure the accessors for overridden methods don't return inherited constructors. Fixes PR12219.
llvm-svn: 152470
2012-03-10 01:39:01 +00:00
Fariborz Jahanian c9295ec7d2 objc modern rewriter: don't export @package ivar symbols.
llvm-svn: 152469
2012-03-10 01:34:42 +00:00
Ted Kremenek 8fdb59f979 [analyzer] fix regression in analyzer of NOT actually aborting on Stmts it doesn't understand. We registered
as aborted, but didn't treat such cases as sinks in the ExplodedGraph.

Along the way, add basic support for CXXCatchStmt, expanding the set of code we actually analyze (hopefully correctly).

Fixes: <rdar://problem/10892489>
llvm-svn: 152468
2012-03-10 01:34:17 +00:00
Daniel Dunbar f07b5ec0dc IRgen/ABI/x86_64: Avoid passing small structs using byval sometimes.
- We do this when it is easy to determine that the backend will pass them on
   the stack properly by itself.

Currently LLVM codegen is really bad in some cases with byval, for example, on
the test case here (which is derived from Sema code, which likes to pass
SourceLocations around)::

  struct s47 { unsigned a; };
  void f47(int,int,int,int,int,int,struct s47);
  void test47(int a, struct s47 b) { f47(a, a, a, a, a, a, b); }

we used to emit code like this::

  ...
  movl	%esi, -8(%rbp)
  movl	-8(%rbp), %ecx
  movl	%ecx, (%rsp)
  ...

to handle moving the struct onto the stack, which is just appalling.

Now we generate::

  movl	%esi, (%rsp)

which seems better, no?

llvm-svn: 152462
2012-03-10 01:03:58 +00:00
Fariborz Jahanian 2677dede22 Minor change to my last rewrite patch.
llvm-svn: 152461
2012-03-10 00:53:02 +00:00
Fariborz Jahanian 34327fcdae objc modern rewriter: Mark class and ivar definitions with __declspec(dllexport)
// rdar://11023563

llvm-svn: 152459
2012-03-10 00:39:34 +00:00
Douglas Gregor dfa5b22238 Qualifiers on a canonical array type go on the outermost type, not the
innermost type. Fixes PR12142.

llvm-svn: 152456
2012-03-10 00:29:33 +00:00
Richard Smith 4e9e523fcf Assign APValues by swapping from a temporary. Removes a bunch of unnecessary
copy-construction, which Daniel Dunbar reports as giving a 0.75% speedup on
403.gcc/combine.c. The performance differences on my constexpr torture tests
are below the noise floor.

llvm-svn: 152455
2012-03-10 00:28:11 +00:00
Fariborz Jahanian c2e2ad6486 objective-c modern rewriter. More fixes related to rewriting
ivars in the modern rewriter.

llvm-svn: 152451
2012-03-09 23:46:23 +00:00
Ted Kremenek 33be12003f Teach RetainCountChecker about mixing method families with explicit annotations. Fixes <rdar://problem/10824732>.
llvm-svn: 152448
2012-03-09 23:34:08 +00:00
Douglas Gregor bcfe5582a5 Document the conversion from a lambda closure type to a block pointer
in Objective-C++.

llvm-svn: 152446
2012-03-09 23:24:48 +00:00
Richard Smith 2a70e65436 Improve diagnostics for UCNs referring to control characters and members of the
basic source character set in C++98. Add -Wc++98-compat diagnostics for same in
literals in C++11. Extend such support to cover string literals as well as
character literals, and mark N2170 as done.

This seems too minor to warrant a release note to me. Let me know if you disagree.

llvm-svn: 152444
2012-03-09 22:27:51 +00:00
Daniel Dunbar 900ceade87 [Sema] Fix a diag change to include a range that appeared intended, but never
actually happened.

llvm-svn: 152442
2012-03-09 21:38:22 +00:00
Nico Weber 97bd94bd98 Update comment after r152140. Clarify a bit too.
llvm-svn: 152441
2012-03-09 21:19:44 +00:00
Anna Zaks 394d07ea88 [analyzer] Add support for NoRedundancy inlining mode.
We do not reanalyze a function, which has already been analyzed as an
inlined callee. As per PRELIMINARY testing, this gives over
50% run time reduction on some benchmarks without decreasing of the
number of bugs found.

Turning the mode on by default.

llvm-svn: 152440
2012-03-09 21:14:01 +00:00
Anna Zaks c255577062 CallGraph: Add getNode() method, constify.
llvm-svn: 152439
2012-03-09 21:13:53 +00:00
Argyrios Kyrtzidis b7d1ca27bd Allow serializing an invalid ParmVarDecl and don't set access to public for
invalid ParmVarDecls.

Part of rdar://11007039.

llvm-svn: 152437
2012-03-09 21:09:04 +00:00
Daniel Dunbar 4fccc877c9 Revert r152430 "[AST] Mark ASTContext::getTypeInfo and some friends as
LLVM_READONLY.", getTypeInfo() is totally not READONLY, which I should have
probably noticed given that I made it so mere hours ago. Oops.

llvm-svn: 152434
2012-03-09 20:41:19 +00:00
Matt Beaumont-Gay 639ac334c7 Add a helper to get a CXXConstructExpr from a CXXNewExpr.
llvm-svn: 152433
2012-03-09 20:36:34 +00:00
Argyrios Kyrtzidis 2559629c5b Improve our semantic error recovery.
When an error made a record member invalid, the record would stay as "isBeingDefined" and
not "completeDefinition". Even easily recoverable errors ended up propagating records in
such "beingDefined" state, for example:

struct A {
  ~A() const; // expected-error {{'const' qualifier is not allowed on a destructor}}
};
struct B : A {}; // A & B would stay as "not complete definition" and "being defined".

This weird state was impending lookups in the records and hitting assertion in the ASTWriter.

Part of rdar://11007039

llvm-svn: 152432
2012-03-09 20:10:30 +00:00
Daniel Dunbar d5744b9910 [AST] Mark Expr::Ignore*() functions as LLVM_READONLY.
llvm-svn: 152431
2012-03-09 20:02:56 +00:00
Daniel Dunbar b150e1b1af [AST] Mark ASTContext::getTypeInfo and some friends as LLVM_READONLY.
llvm-svn: 152430
2012-03-09 20:02:54 +00:00
Daniel Dunbar 0fbc2bd499 [AST] Mark Expr::getExprLoc() as LLVM_READONLY.
llvm-svn: 152429
2012-03-09 20:02:51 +00:00
Daniel Dunbar eda65572bb [Sema] Remove dead getSourceRange() call, caught by Clang after marking
LLVM_READONLY.

llvm-svn: 152428
2012-03-09 20:02:47 +00:00
Daniel Dunbar e4775e1659 [AST/etc] Mark {getSourceRange(),getStartLoc(),getEndLoc()} as LLVM_READONLY.
- The theory here is that we have these functions sprinkled in all over the
   place. This should allow the optimizer to at least realize it can still do
   load CSE across these calls.
 - I blindly marked all instances as such, even though the optimizer can infer
   this attribute in some instances (some of the inline ones) as that was easier
   and also, when given the choice between thinking and not thinking, I prefer
   the latter.

You might think this is mere frivolity, but actually this is good for a .7 -
1.1% speedup on 403.gcc/combine.c, JSC/Interpreter.cpp,
OGF/NSBezierPath-OAExtensions.m.

llvm-svn: 152426
2012-03-09 19:35:29 +00:00
Richard Smith f5a0d10c2c Add user-defined literals to release notes.
llvm-svn: 152424
2012-03-09 19:09:47 +00:00
Fariborz Jahanian c8a322a407 lldb support: under debugger support flag, when sending message
to forward class, and assigning to an 'id' type var, message
sends default to 'id'. // rdar"//10988847

llvm-svn: 152420
2012-03-09 18:47:16 +00:00
Daniel Dunbar 62ee6417ac [AST/Sema/libclang] Replace getSourceRange().getBegin() with getLocStart().
- getSourceRange().getBegin() is about as awesome a pattern as .copy().size().

I already killed the hot paths so this doesn't seem to impact performance on my
tests-of-the-day, but it is a much more sensible (and shorter) pattern.

llvm-svn: 152419
2012-03-09 18:35:03 +00:00
Daniel Dunbar ddb83c7194 [AST/Sema] Add {CXXBaseSpecifier,Declarator,DeclSpec,TypeLoc,UnqualifiedId}::getLoc{Start,End}.
llvm-svn: 152418
2012-03-09 18:34:54 +00:00
Daniel Dunbar cdf295c532 [AST] Define a few more key getLocStart() implementations.
- This cuts the # of getSourceRange calls by 60% on
   OGF/NSBezierPath-OAExtensions.m.

llvm-svn: 152412
2012-03-09 15:39:24 +00:00
Daniel Dunbar b0ab5e9f5c [AST] Reimplement Stmt::getLoc{Start,End} to dispatch to subclass overloads.
- getSourceRange() can be very expensive, we should try to avoid it if at all possible.

In conjunction with the previous commit I measured a ~2% speedup on 403.gcc/combine.c and a 3% speedup on OmniGroupFrameworks/NSBezierPath-OAExtensions.m.

llvm-svn: 152411
2012-03-09 15:39:19 +00:00
Daniel Dunbar b507f27185 [AST] Add {DeclRefExpr,MemberExpr,ImplicitCastExpr}::{getLocStart,getLocEnd} methods.
- There are probably a lot more of these worth adding, but these are a start at hitting some of the exprs for which getSourceRange().getBegin() is a poor substitute for getLocStart().

llvm-svn: 152410
2012-03-09 15:39:15 +00:00
Daniel Dunbar d863d31f4b [AST] Add DeclaratioName::getLoc{Start,End} for consistency.
llvm-svn: 152409
2012-03-09 15:39:11 +00:00
Daniel Dunbar 7b93f636e0 [Basic] Rename LangOptions::NoInline to NoInlineDefine, to make things a bit
more obvious.

llvm-svn: 152408
2012-03-09 15:39:08 +00:00
Benjamin Kramer 1f5568c55f Harden test for 32 bit platforms, where size_t is unsigned int (not unsigned long).
llvm-svn: 152404
2012-03-09 13:17:27 +00:00
Hans Wennborg aa8c61cf94 -Wformat-non-iso: warn about positional arguments (pr12017)
This renames the -Wformat-non-standard flag to -Wformat-non-iso,
rewords the current warnings a bit (pointing out that a format string
is not supported by ISO C rather than being "non standard"),
and adds a warning about positional arguments.

llvm-svn: 152403
2012-03-09 10:10:54 +00:00
Richard Smith 29e9595bd7 Fix statement printing for raw and template user-defined literals.
llvm-svn: 152401
2012-03-09 10:10:02 +00:00
Richard Smith 5023188315 User-defined literals are done.
llvm-svn: 152396
2012-03-09 08:41:27 +00:00
Richard Smith c1b0565a26 Literal operator suffixes and regular names live in separate namespaces.
llvm-svn: 152395
2012-03-09 08:37:16 +00:00
Richard Smith 768ceccc75 Literal operators can't have default arguments.
llvm-svn: 152394
2012-03-09 08:16:22 +00:00
Richard Smith bcc22fc4e1 Support for raw and template forms of numeric user-defined literals,
and lots of tidying up.

llvm-svn: 152392
2012-03-09 08:00:36 +00:00
John McCall 1d0003ee32 Remove accidental binary commit.
llvm-svn: 152378
2012-03-09 04:18:33 +00:00
Daniel Dunbar c647587aa3 [AST] Memoize ASTContext::getTypeInfo().
- On -emit-llvm-only of 403.gcc/combine.c, for example, we make 160k calls to
   getTypeInfo but only ever deal with 680 some distinct types.

I saw these speedups (user time):
  403.gcc/combine.c -- 3.1%
  OmniGroupFrameworks/NSBezierPath-OAExtensions.m -- 3.6%
  JavaScriptCore/Interpreter.cpp -- 1.4%
which seems pretty sweet.

I ran some histograms on those compiles and we end up doing a ton of
getTypeInfo() on 'char' and 'int'. I tried splitting out a fast path for builtin
types, but this wasn't a win. Still kinda seems like we could be doing better
here.

llvm-svn: 152377
2012-03-09 04:12:54 +00:00
John McCall ef42902816 Perform l2r conversions on delete operands before doing
type-analysis;  otherwise, we just completely do the
wrong thing for placeholders.

llvm-svn: 152375
2012-03-09 04:08:29 +00:00
Eli Friedman 1c8d2ca829 Make sure we update the static local decl address map when we are forced to rebuild a global because of the initializer. <rdar://problem/10957867>.
llvm-svn: 152372
2012-03-09 03:27:46 +00:00
Eli Friedman effcd47eef Make sure constant emission handles initializer lists with strings correctly. Part of <rdar://problem/10957867>.
llvm-svn: 152370
2012-03-09 03:06:56 +00:00
Daniel Dunbar 3c38d435c6 [AST] NestedNameSpecifier's ctor/dtor are trivial and should be inlined.
llvm-svn: 152365
2012-03-09 01:51:59 +00:00
Daniel Dunbar 198e16fd3a [AST] Type::isVoidType() is trivial and should be inlined.
llvm-svn: 152364
2012-03-09 01:51:56 +00:00
Daniel Dunbar 9d35581907 [AST] Reduce Decl::getASTContext() calls.
- This function is not at all free; pass it around along some hot paths instead
   of recomputing it deep inside various VarDecl methods.

llvm-svn: 152363
2012-03-09 01:51:51 +00:00
Ted Kremenek 1e809b4c4c [analyzer] Implement basic path diagnostic pruning based on "interesting" symbols and regions.
Essentially, a bug centers around a story for various symbols and regions.  We should only include
the path diagnostic events that relate to those symbols and regions.

The pruning is done by associating a set of interesting symbols and regions with a BugReporter, which
can be modified at BugReport creation or by BugReporterVisitors.

This patch reduces the diagnostics emitted in several of our test cases.  I've vetted these as
having desired behavior.  The only regression is a missing null check diagnostic for the return
value of realloc() in test/Analysis/malloc-plist.c.  This will require some investigation to fix,
and I have added a FIXME to the test case.

llvm-svn: 152361
2012-03-09 01:13:14 +00:00
Anna Zaks eee9110721 [analyzer] Use call graph to determine order in which functions are
analyzed.

The CallGraph is used when inlining is on, which is the current default.

This alone does not bring any performance improvement. It's a
stepping stone for the upcoming optimization in which we do not
re-analyze a function that has already been analyzed while inlined in
other functions. Using the call graph makes it easier to play with
the order of functions to minimize redundant analyzes.

llvm-svn: 152352
2012-03-08 23:16:38 +00:00
Anna Zaks 0af3e06ff6 [analyzer] Rework inlining related command line options.
- Remove -analyzer-inline-call.
 - Add -analyzer-ipa=[none|inlining]
 - Add -analyzer-inlining-mode to allow experimentation for
different performance tuning methods.

llvm-svn: 152351
2012-03-08 23:16:35 +00:00
Anna Zaks 9a008bb7f8 Call Graph: Only the root node is allowed to have an invalid Decl*.
llvm-svn: 152350
2012-03-08 23:16:26 +00:00
Richard Smith bf79fc49b3 Remove a test FIXME for a case which is already fixed.
llvm-svn: 152349
2012-03-08 23:08:29 +00:00
Richard Smith 7d182a7909 Fix a couple of issues with literal-operator-id parsing, and provide recovery
for a few kinds of error. Specifically:

Since we're after translation phase 6, the "" token might be formed by multiple
source-level string literals. Checking the token width is not a correct way of
detecting empty string literals, due to escaped newlines. Diagnose and recover
from a missing space between "" and suffix, and from string literals other than
"", which are followed by a suffix.

llvm-svn: 152348
2012-03-08 23:06:02 +00:00
John McCall 85110b47c8 Don't crash when a statement in a block is ill-formed but
introduces cleanups anyway.

llvm-svn: 152345
2012-03-08 22:00:17 +00:00
Richard Smith 812924502b When checking the encoding of an 8-bit string literal, don't just check the
first codepoint! Also, don't reject empty raw string literals for spurious
"encoding" issues. Also, don't rely on undefined behavior in ConvertUTF.c.

llvm-svn: 152344
2012-03-08 21:59:28 +00:00
Sebastian Redl 04fe1bf52e Turn explicit construction of temporaries using initializer list syntax into CXXTemporaryObjectExprs, not just CXXConstructExprs, which have a worrying tendency to vanish. Fixes PR12167.
llvm-svn: 152340
2012-03-08 21:05:45 +00:00
Benjamin Kramer ba0495a3e1 Untangle getUnderlyingDeclImpl, no functionality change.
llvm-svn: 152339
2012-03-08 21:00:45 +00:00
Argyrios Kyrtzidis 8b0f3e0525 [utils/FuzzTest] Add '--stop-on-fail' to stop the script on the first failure
without reverting the changes.

llvm-svn: 152333
2012-03-08 20:29:39 +00:00
Daniel Dunbar 47c32287d9 [AST] Clean up NamedDecl::getUnderlyingDecl() change a bit.
llvm-svn: 152332
2012-03-08 20:29:02 +00:00
Daniel Dunbar eb72532098 Remove stray semi-colon.
llvm-svn: 152331
2012-03-08 20:28:59 +00:00
Daniel Dunbar b743157df3 [AST] APValue: Split the fast path of MakeUninit to be inline.
- This change seems to be a tiny loss on 403.gcc/combine.c (.2%), but I think
   it is the right thing to do.

llvm-svn: 152330
2012-03-08 20:28:55 +00:00
Argyrios Kyrtzidis 941d092933 [utils/FuzzTest] The help message says that if you don't specify --max-tests
"the script will run forever continually picking new tests to run", make it so.

llvm-svn: 152327
2012-03-08 20:11:06 +00:00
Argyrios Kyrtzidis 05d2212db3 [utils/FuzzTest] For --filelist the option type is string, not integer.
llvm-svn: 152324
2012-03-08 18:56:59 +00:00
Daniel Dunbar b29f685d3c [Basic] PartialDiagnostic: Manual split out the cold part of freeStorage(), the
hot path will typically profitably get inlined (based on what I see from the
users of PartialDiagnostic).

llvm-svn: 152322
2012-03-08 18:43:59 +00:00
Daniel Dunbar 166ea9ad8b [AST] Change NamedDecl::getUnderlyingDecl() to inline the fast (and incredibly common) path.
llvm-svn: 152321
2012-03-08 18:20:41 +00:00
Rafael Espindola df88f6fe98 Replace MarkVarRequired with a more generic
HandleCXXStaticMemberVarInstantiation. Suggested by Argyrios.

llvm-svn: 152320
2012-03-08 15:51:03 +00:00
Rafael Espindola f5140611fc Also test pr12104 with pch.
llvm-svn: 152317
2012-03-08 15:07:42 +00:00
Rafael Espindola c41db927f3 Implement -fno-dwarf2-cfi-asm on linux too.
llvm-svn: 152316
2012-03-08 14:39:55 +00:00
Richard Smith 75025ba487 Ensure we don't print 123ULL_foo when printing a user-defined integer literal.
llvm-svn: 152303
2012-03-08 09:02:38 +00:00
Richard Smith 39570d0020 Add support for cooked forms of user-defined-integer-literal and
user-defined-floating-literal. Support for raw forms of these literals
to follow.

llvm-svn: 152302
2012-03-08 08:45:32 +00:00
Stepan Dyatkovskiy 85fcc2daf5 Taken into account Duncan's comments for r149481 dated by 2nd Feb 2012:
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20120130/136146.html

Implemented CaseIterator and it solves almost all described issues: we don't need to mix operand/case/successor indexing anymore. Base iterator class is implemented as a template since it may be initialized either from "const SwitchInst*" or from "SwitchInst*".

ConstCaseIt is just a read-only iterator.
CaseIt is read-write iterator; it allows to change case successor and case value.

Usage of iterator allows totally remove resolveXXXX methods. All indexing convertions done automatically inside the iterator's getters.

Main way of iterator usage looks like this:
SwitchInst *SI = ... // intialize it somehow

for (SwitchInst::CaseIt i = SI->caseBegin(), e = SI->caseEnd(); i != e; ++i) {
  BasicBlock *BB = i.getCaseSuccessor();
  ConstantInt *V = i.getCaseValue();
  // Do something.
}

If you want to convert case number to TerminatorInst successor index, just use getSuccessorIndex iterator's method.
If you want initialize iterator from TerminatorInst successor index, use CaseIt::fromSuccessorIndex(...) method.

There are also related changes in llvm-clients: klee and clang.

llvm-svn: 152298
2012-03-08 07:06:48 +00:00
Daniel Dunbar d043733ad9 [AST] Change Type::isIntegerType to be inlined(). It is very popular.
llvm-svn: 152289
2012-03-08 02:52:18 +00:00
Richard Smith 0df56f4a90 Implement C++11 [lex.ext]p10 for string and character literals: a ud-suffix not
starting with an underscore is ill-formed.

Since this rule rejects programs that were using <inttypes.h>'s macros, recover
from this error by treating the ud-suffix as a separate preprocessing-token,
with a DefaultError ExtWarn. The approach of treating such cases as two tokens
is under discussion for standardization, but is in any case a conforming
extension and allows existing codebases to keep building while the committee
makes up its mind.

Reword the warning on the definition of literal operators not starting with
underscores (which are, strangely, legal) to more explicitly state that such
operators can't be called by literals. Remove the special-case diagnostic for
hexfloats, since it was both triggering in the wrong cases and incorrect.

llvm-svn: 152287
2012-03-08 02:39:21 +00:00
Douglas Gregor 3f28ec28d5 Loosen the precondition of isCXXInstanceMember() to simply return
"false" for declarations that aren't members of classes. Fixes PR12106.

llvm-svn: 152284
2012-03-08 02:08:05 +00:00
Daniel Dunbar 1c66a0e1c0 Spelling.
llvm-svn: 152281
2012-03-08 01:54:33 +00:00
Daniel Dunbar 9e19f13416 Sema: Don't emit a gajillion calls to sanity() -- an empty function -- in NDEBUG
builds. Sheesh.

llvm-svn: 152279
2012-03-08 01:43:06 +00:00
Richard Smith 75b67d6dc5 User-defined literal support for character literals.
llvm-svn: 152277
2012-03-08 01:34:56 +00:00
Richard Trieu 978dfc0d1e Fix -Wuninitialized to catch the case of a class being initialized with a call
to its own member function.

llvm-svn: 152276
2012-03-08 01:15:31 +00:00
Argyrios Kyrtzidis 8dbcfc39cd [libclang] Fix a crash when serializing a preprocessing record that contains
an #include entry that did not resolve to header file.

Part of rdar://11007039

llvm-svn: 152275
2012-03-08 01:08:28 +00:00
Douglas Gregor 0cf55e99c6 Streamline BalancedDelimiterTracker, by eliminating the duplicate
paren/brace/bracket tracking (the Consume* functions already did it),
removing the use of ConsumeAnyToken(), and moving the hot paths inline
with the error paths out-of-line.

llvm-svn: 152274
2012-03-08 01:00:17 +00:00
Fariborz Jahanian 80f8b4e7cb improve on diagnostic when block captures uninitialized
block variable. // rdar://10817031

llvm-svn: 152273
2012-03-08 00:52:24 +00:00
Anna Zaks c000e7ed3d Add a basic CallGraph to Analysis.
The final graph contains a single root node, which is a parent of all externally available functions(and 'main'). As well as a list of Parentless/Unreachable functions, which are either truly unreachable or are unreachable due to our analyses imprecision.

The analyzer checkers debug.DumpCallGraph or debug.ViewGraph can be used to look at the produced graph.

Currently, the graph is not very precise, for example, it entirely skips edges resulted from ObjC method calls.

llvm-svn: 152272
2012-03-08 00:42:23 +00:00
Fariborz Jahanian 429fadb8e2 improve on diagnostic and provide a fixit hint when
an uninitialized block variable is being called inside the
block literal. // rdar://10817031

llvm-svn: 152271
2012-03-08 00:22:50 +00:00
Argyrios Kyrtzidis bfb2425c71 [libclang] Enhance clang_getOverriddenCursors.
Basically the current design is:
-for an implementation method, show as overridden the interface method.
  This is not useful, and is inconsistent with the C++ side
-for an interface method, show as overridden the protocols methods (this is desirable)
  and the methods from the categories; methods from categories are not useful
  since they are considered the same method (same USR).
-If there is a protocol method or category method reported, it does not check the
  super class for overridden methods. This is really problematic since
  overridden methods from super class is what we want to give back.

Change clang_getOverriddenCursors to show as overridden any method in the class's
base class, its protocols, or its categories' protocols, that has the same
selector and is of the same kind (class or instance).
If no such method exists, the search continues to the class's superclass,
its protocols, and its categories, and so on. A method from an Objective-C
implementation is considered to override the same methods as its
corresponding method in the interface.

rdar://10967206

llvm-svn: 152270
2012-03-08 00:20:03 +00:00
Bob Wilson f2a23a99db Workaround module test failures by removing the version info from module hashes.
PR12196: The module hash strings are not actually hashing the compiler version
string; the entire version string is being included in the hash.  Depending on
the module cache directory name, that can lead to failures where the path
names become too long.  As a temporary workaround, just remove the version
string from the hash.

llvm-svn: 152266
2012-03-07 23:50:05 +00:00
Richard Trieu 3933f6f6ca Remove unnecessary include in ExprObjC.h
llvm-svn: 152239
2012-03-07 17:47:10 +00:00
Sebastian Redl e0691eae7d Be smarter in discovering list-initialization of temporaries. Fixes PR12182.
llvm-svn: 152231
2012-03-07 16:10:45 +00:00
Richard Smith 1e3c1d38f2 Correct the documentation to give a legal example of a raw string literal.
llvm-svn: 152216
2012-03-07 08:57:31 +00:00
Richard Smith c67fdd4eb9 AST representation for user-defined literals, plus just enough of semantic
analysis to make the AST representation testable. They are represented by a
new UserDefinedLiteral AST node, which is a sugared CallExpr. All semantic
properties, including full CodeGen support, are achieved for free by this
representation.

UserDefinedLiterals can never be dependent, so no custom instantiation
behavior is required. They are mangled as if they were direct calls to the
underlying literal operator. This matches g++'s apparent behavior (but not its
actual mangling, which is broken for literal-operator-ids).

User-defined *string* literals are now fully-operational, but the semantic
analysis is quite hacky and needs more work. No other forms of user-defined
literal are created yet, but the AST support for them is present.

This patch committed after midnight because we had already hit the quota for
new kinds of literal yesterday.

llvm-svn: 152211
2012-03-07 08:35:16 +00:00
Richard Smith a269ac0bca Test fix-it added in r152198.
llvm-svn: 152199
2012-03-07 03:18:34 +00:00
Richard Smith 3e4a60a2cd Add -Wc++11-compat warning for string and character literals followed by
identifiers, in cases where those identifiers would be treated as
user-defined literal suffixes in C++11.

llvm-svn: 152198
2012-03-07 03:13:00 +00:00
Richard Smith 8c029611a6 Don't even try to directly emit the value of a DeclRefExpr if that declaration
is not usable in a constant expression. ~2.5% speedup on 403.gcc / combine.c.

llvm-svn: 152193
2012-03-07 01:58:44 +00:00
Argyrios Kyrtzidis 4a280ff48f [PCH] Mark a PCH file with a flag to indicate if the serialized AST had
compiler errors or not.

-Control whether ASTReader should reject such a PCH by a boolean flag at ASTReader's creation time.
By default, such a PCH file will be rejected with an error when trying to load it.

[libclang] Allow clang_saveTranslationUnit to create a PCH file even if compiler errors
occurred.
-Have libclang API calls accept a PCH that had compiler errors.

The general idea is that we want libclang to stay functional even if a PCH had a compiler error.
rdar://10976363.

llvm-svn: 152192
2012-03-07 01:51:17 +00:00
Eli Friedman 9b2ab81a0c Correct test from r152189.
llvm-svn: 152191
2012-03-07 01:13:38 +00:00
Eli Friedman 205a429891 Make sure we consistently canonicalize types when canonicalizing TemplateTemplateParmDecls. PR12179.
llvm-svn: 152189
2012-03-07 01:09:33 +00:00
Fariborz Jahanian d6cb4a858d objective-c lldb support: don't perform ivar access control check
when debugging. // rdar://10997647

llvm-svn: 152187
2012-03-07 00:58:41 +00:00
Andrew Trick 9179e8a4a3 More git-svn compatible version string, by request.
If you're using git-svn, the clang and llvm repository will typically
map to a different revision.

Before we had:
clang version 3.1 (trunk 152167 trunk 152162)

After this change:
clang version 3.1 (trunk 152167) (llvm/trunk 152162)

So it's self-descriptive with an extra parens group. Which is more
compatible with version string parsers is probably debatable, but this
style was requested.

llvm-svn: 152183
2012-03-07 00:44:24 +00:00
Richard Smith ecc124733a The constant folder's diagnosic mechanism is irrelevant for C; don't bother
producing a C-only diagnostic.

llvm-svn: 152181
2012-03-07 00:30:44 +00:00
Chad Rosier bee5a1df03 [driver] Don't try to generate diagnostic information for linker crashes.
rdar://10993648

llvm-svn: 152180
2012-03-07 00:30:40 +00:00
Benjamin Kramer e6a4affcc5 Silence unused variable warnings.
llvm-svn: 152170
2012-03-07 00:14:40 +00:00
Michael Han 4a04517329 Refactor Clang sema attribute handling.
This submission improves Clang sema handling by using Clang tablegen
to generate common boilerplate code. As a start, it implements AttributeList
enumerator generation and case statements for AttributeList::getKind.

A new field "SemaHandler" is introduced in Attr.td and by default set to 1
as most of attributes in Attr.td have semantic checking in Sema. For a small
number of attributes that don't appear in Sema, the value is set to 0.

Also there are a small number of attributes that only appear in Sema but not
in Attr.td. Currently these attributes are still hardcoded in Sema AttributeList.

Reviewed by Delesley Hutchins.

llvm-svn: 152169
2012-03-07 00:12:16 +00:00
Dylan Noblesmith bb8c7dabed AST: fix build since r152060
The declarations of the operators no longer matched.
The definitions in ASTContext.h had 'throw()' removed,
but it was still present in Attr.h.

Somehow the buildbots missed this. clang merely warns about
a missing 'throw()' specification and suggested a Fix-It adding
it back, but gcc 4.5 is not so forgiving and gives an error.

llvm-svn: 152167
2012-03-07 00:01:18 +00:00
Daniel Dunbar 082c62d943 [AST] VarDecl::hasDefinition() - Early exit if we find a strong definition.
llvm-svn: 152166
2012-03-06 23:52:46 +00:00
Daniel Dunbar 304314d739 [AST] FunctionDecl::getBuiltinID() - Eliminate spurious calls to getASTContext
-- which is very much not free -- in the common case.

llvm-svn: 152165
2012-03-06 23:52:37 +00:00
Ted Kremenek 5022f1dffe Fix horrific CFG bug where '@autoreleasepool' would be put in a dangling block in the CFG.
llvm-svn: 152163
2012-03-06 23:40:47 +00:00
Chad Rosier 909c47ba70 Missing period.
llvm-svn: 152160
2012-03-06 23:19:26 +00:00
Chad Rosier 1aeb15adf5 Whitespace.
llvm-svn: 152159
2012-03-06 23:14:35 +00:00
Sean Callanan 2db103c0ea Cleanup (style). Thanks to Argyrios for catching
this.

llvm-svn: 152158
2012-03-06 23:12:57 +00:00
Michael Han c222ced7dd commit access verified, revert change
llvm-svn: 152156
2012-03-06 22:55:51 +00:00
Michael Han b9929bdb91 test commit access
llvm-svn: 152155
2012-03-06 22:53:15 +00:00
NAKAMURA Takumi 66a7e43363 CMake: Fix build to add clangEdit to USED_LIBS.
llvm-svn: 152154
2012-03-06 22:32:32 +00:00
Argyrios Kyrtzidis 5652716a7a [objcmt] Add a triple to test/ARCMT/objcmt-subscripting-literals.m
llvm-svn: 152151
2012-03-06 22:03:39 +00:00
Sean Callanan 1249511024 Extended the UnknownAnyTy resolver to handle
blocks with unknown return types.  This allows
LLDB to call blocks even when their return types
aren't provided in the debug information.

llvm-svn: 152147
2012-03-06 21:34:12 +00:00
Fariborz Jahanian 461b7bb9e6 get rid of an unsued variable warning.
llvm-svn: 152146
2012-03-06 21:18:56 +00:00
Chad Rosier 64d6be979f [driver] What was implemented in r152130 was actually -fno-inline-functions, not
-fno-inline.
Part of rdar://10972766

llvm-svn: 152145
2012-03-06 21:17:19 +00:00
Benjamin Kramer ce80ce5fd8 Just use memcpy directly, uninitialized_copy requires an <algorithm> include.
Newer libstdc++s don't include it transitively everywhere.

llvm-svn: 152142
2012-03-06 20:39:11 +00:00
Ted Kremenek f7639e1b4a Add new code migrator support for migrating existing Objective-C code to use
the new Objective-C NSArray/NSDictionary/NSNumber literal syntax.

This introduces a new library, libEdit, which provides a new way to support
migration of code that improves on the original ARC migrator.  We now believe
that most of its functionality can be refactored into the existing libraries,
and thus this new library may shortly disappear.

llvm-svn: 152141
2012-03-06 20:06:33 +00:00
Ted Kremenek d151dde0e6 Enable default @synthesize by default.
llvm-svn: 152140
2012-03-06 20:06:15 +00:00
Ted Kremenek 415287d943 Add static analyzer support for new NSArray/NSDictionary/NSNumber literals.
llvm-svn: 152139
2012-03-06 20:06:12 +00:00
Ted Kremenek 77006f6875 And libclang cursor/indexing support for new Objective-C NSArray/NSDictionary/NSNumber literals.
llvm-svn: 152138
2012-03-06 20:06:06 +00:00
Ted Kremenek e65b086e07 Add clang support for new Objective-C literal syntax for NSDictionary, NSArray,
NSNumber, and boolean literals.  This includes both Sema and Codegen support.
Included is also support for new Objective-C container subscripting.

My apologies for the large patch.  It was very difficult to break apart.
The patch introduces changes to the driver as well to cause clang to link
in additional runtime support when needed to support the new language features.

Docs are forthcoming to document the implementation and behavior of these features.

llvm-svn: 152137
2012-03-06 20:05:56 +00:00
Chad Rosier 9a099ea3eb Whitespace.
llvm-svn: 152134
2012-03-06 19:14:53 +00:00
Chad Rosier 94bdf697b2 Minor fix for r152130. Put -fno-inline in f_Group.
llvm-svn: 152132
2012-03-06 19:02:54 +00:00
Chad Rosier 806031896d [driver] Add support for -fno-inline.
rdar://10972766

llvm-svn: 152130
2012-03-06 18:49:20 +00:00
Fariborz Jahanian 197c68c856 Undo patch for // rdar://10735698
llvm-svn: 152128
2012-03-06 18:41:35 +00:00
Daniel Dunbar 492488271f AST: Move several Type::is...Type() functions to be inline.
- These functions are both (a) very commonly called and (b) excellent
   candidates for CSE in the callers in which they are commonly used.
 - That isHalfType() is hot makes me sad, but it is trivially when inlined (and
   a huge waste of time when not!!!).
 - The extra IsEnumDeclComplete() function is a hack to break the cycle between
   Type.h and Decl.h, I'm not sure of how to do this more cleanly, but am open
   to ideas.

llvm-svn: 152126
2012-03-06 18:20:20 +00:00
Benjamin Kramer d78f1ec183 NamespaceDecl: Call non-virtual method inside virtual method, not the other way round.
Moves the virtual call out of a hot path during lookup, no other functionality change.

llvm-svn: 152124
2012-03-06 18:07:25 +00:00
Fariborz Jahanian d7a3261dfb objective-c modern translator. Don't ignore unnamed bitfields
when rewriting.

llvm-svn: 152123
2012-03-06 17:16:27 +00:00
Argyrios Kyrtzidis 70b0878c46 Use newly introduced const-goodness of TinyPtrVector.
llvm-svn: 152108
2012-03-06 07:15:06 +00:00
Richard Smith d67aea28f6 User-defined literals: reject string and character UDLs in all places where the
grammar requires a string-literal and not a user-defined-string-literal. The
two constructs are still represented by the same TokenKind, in order to prevent
a combinatorial explosion of different kinds of token. A flag on Token tracks
whether a ud-suffix is present, in order to prevent clients from needing to look
at the token's spelling.

llvm-svn: 152098
2012-03-06 03:21:47 +00:00
Argyrios Kyrtzidis 735f9d4805 Use TinyPtrVector instead of UsuallyTinyPtrVector.
The latter is just a worse version of the former.

llvm-svn: 152096
2012-03-06 03:00:11 +00:00
Argyrios Kyrtzidis 04bd4321b9 Move clang/Basic/UsuallyTinyPtrVector.h to llvm/ADT/UsuallyTinyPtrVector.h.
Depends on llvm commit r152090.

llvm-svn: 152091
2012-03-06 02:09:28 +00:00
Ted Kremenek 04e860df2c [analyzer] add a diagnostic event when entering a call via inlining, within the callee, and add an edge.
llvm-svn: 152086
2012-03-06 01:25:01 +00:00
Ted Kremenek 024ba20bef [analyzer] 'Looping back to the head of the loop' diagnostics are prunable.
llvm-svn: 152083
2012-03-06 01:00:36 +00:00
Argyrios Kyrtzidis 840497dd81 Move include/clang/AST/UsuallyTinyPtrVector.h -> include/clang/Basic/UsuallyTinyPtrVector.h
and add an erase method to it.

Patch by Andrew Craik!

llvm-svn: 152082
2012-03-06 00:49:28 +00:00
Jordy Rose 330de22fe0 [analyzer] Remove now-unused constant. No functionality change.
llvm-svn: 152080
2012-03-06 00:33:35 +00:00
Jordy Rose 0accc6ae7b [analyzer] Fix unnecessary dyn_cast_or_null. No functionality change.
llvm-svn: 152078
2012-03-06 00:28:20 +00:00
Argyrios Kyrtzidis b5e420f707 Add some doxygen comments.
llvm-svn: 152075
2012-03-06 00:16:36 +00:00
Argyrios Kyrtzidis 87acf19a5c [tablegen] Make sure that the code that is determining the order of warning groups
is shared to avoid any "misalignment" if indices.

llvm-svn: 152074
2012-03-06 00:00:38 +00:00
Ted Kremenek 6762a94040 Teak CallAndMessageChecker to only warn about uninitialized struct fields in call arguments
when the called function is never inlined.

Fixes <rdar://problem/10977037>.

llvm-svn: 152073
2012-03-05 23:57:14 +00:00
Anna Zaks a5b86343f5 [analyzer] Bump up the size of the functions that should be
considered for inlining to 200 BBs.

Setting the max to 10 BBs introduced several false negatives, we'll
reevaluate the setting later on along with other inlining heuristics.

llvm-svn: 152072
2012-03-05 23:54:55 +00:00
Fariborz Jahanian d3ba40b90f Minor refactoring for previous patch for // rdar://10735698
llvm-svn: 152071
2012-03-05 23:38:41 +00:00
Richard Smith f506eaf36d static_assert: Allow any string-literal as the message, not just a character
string literal, and adjust the diagnostic code to match. This also causes us
to escape any control characters in the message.

llvm-svn: 152069
2012-03-05 23:20:05 +00:00
Ted Kremenek 9d96f843b8 Teach SimpleSValBuilder that (in the absence of more information) stack memory doesn't alias symbolic memory. This is a heuristic/hack, but works well in practice. Fixes <rdar://problem/10978247>.
llvm-svn: 152065
2012-03-05 23:06:19 +00:00
Daniel Dunbar 6290557872 AST/stats: Don't effectively use an out-of-line function to return a static
bool. Ugh.

llvm-svn: 152062
2012-03-05 21:42:49 +00:00
Daniel Dunbar e5617c79e4 ASTContext: Don't use nothrow specifications on the new operators for allocating
from the ASTContext.
 - Doing so requires the compiler to generate null checks against the returned
   result, but the BumpPtrAllocator never returns null pointers.
 - The optimizer can usually eliminate such checks, but not always, so this
   gives us tighter codegen in some places.
 - It would be really nice if we could just use __builtin_unreachable or
   something to tell the optimizer that the allocator never returns null, but
   LLVM isn't currently that smart.

llvm-svn: 152060
2012-03-05 21:02:05 +00:00
Anna Zaks 9bd4be9657 [analyzer] Time the execution (per each TU) with -analyzer-stats.
llvm-svn: 152059
2012-03-05 20:53:59 +00:00
Daniel Dunbar e8092cabeb build/compiler-rt: Stop forcing off -integrated-as for compiler-rt builds.
llvm-svn: 152054
2012-03-05 20:19:03 +00:00
Sebastian Redl 249dee5433 If the element type of an initializer list has a destructor, make sure we check it. Fixes PR12178.
llvm-svn: 152048
2012-03-05 19:35:43 +00:00
Fariborz Jahanian b0d7ce1b78 patch to optionally warn for block implementations without explicit
return types that return non-void values. // rdar://10735698

llvm-svn: 152047
2012-03-05 19:34:00 +00:00
Jim Grosbach 6c258a891f Add MCRegisterInfo to the MCInstPrinter factory function interface.
llvm-svn: 152046
2012-03-05 19:33:41 +00:00
Anna Zaks 53a0b6c161 [analyzer] False positive in SelfInit - teach the checker about method
calls with self as a parameter.

llvm-svn: 152039
2012-03-05 18:58:25 +00:00
Anna Zaks 12a8b90a36 [analyzer] Malloc should assume that ownership is transfered when
calling an ObjC method ending with 'NoCopy'.

llvm-svn: 152037
2012-03-05 17:42:10 +00:00
Benjamin Kramer 73ecd70d38 Avoid double lookup.
llvm-svn: 152033
2012-03-05 17:20:04 +00:00
Peter Collingbourne 15d48ec46f Properly handle non-canonical underlying types in
ASTContext::getUnaryTransformType.  This can happen if, for example,
an enumeration's underlying type is a typedef.

llvm-svn: 152031
2012-03-05 16:02:06 +00:00
Nico Weber b3ec7308b0 Fix a -Wstring-plus-int warning.
Patch from Sean Silva <silvas@purdue.edu>!

llvm-svn: 152030
2012-03-05 15:48:34 +00:00
Benjamin Kramer 27402c61c8 TargetInfo: create less temporary strings.
llvm-svn: 152029
2012-03-05 15:10:44 +00:00
Rafael Espindola 189fa748ec Fix a small difference in sema and codegen views of what needs to be output.
In the included testcase, soma thinks that we already have a definition after we
see the out of line decl. Codegen puts it in a deferred list, to be output if
a use is seen. This would break when we saw an explicit template instantiation
definition, since codegen would not be notified.

This patch adds a method to the consumer interface so that soma can notify
codegen that this decl is now required.

llvm-svn: 152024
2012-03-05 10:54:55 +00:00
James Molloy 7583ccdc1f Fix a bug in the mangler where in 'namespace std { extern "C" {X;} }', X would not be seen to be in ::std::.
Migrate two other places where the same logic is used to use the helper function that already exists.

llvm-svn: 152022
2012-03-05 09:59:43 +00:00
Argyrios Kyrtzidis afdc66f4fa [arcmt]
-Make sure we don't change to '__weak' a __block variable used as output.
-Make sure we don't apply __weak twice.

Fixes rdar://10520757&10521362

llvm-svn: 152020
2012-03-05 08:46:24 +00:00
Argyrios Kyrtzidis 647dcd80f0 [preprocessor] Enhance PreprocessingRecord to keep track of locations of conditional directives.
Introduce PreprocessingRecord::rangeIntersectsConditionalDirective() which returns
true if a given range intersects with a conditional directive block.

llvm-svn: 152018
2012-03-05 05:48:17 +00:00
Argyrios Kyrtzidis c793a61355 [preprocessor] Enhance the preprocessor callbacks:
-Add location parameter for the directives callbacks
-Skip callbacks if the directive is inside a skipped range.
-Make sure the directive callbacks are invoked in source order.

llvm-svn: 152017
2012-03-05 05:48:09 +00:00
Richard Smith 2a1b1c68f3 More tests for r152012.
llvm-svn: 152013
2012-03-05 04:06:25 +00:00
Richard Smith e18f0faff2 Lexing support for user-defined literals. Currently these lex as the same token
kinds as the underlying string literals, and we silently drop the ud-suffix;
those issues will be fixed by subsequent patches.

llvm-svn: 152012
2012-03-05 04:02:15 +00:00
Gregory Szorc 74226d3597 [clang.py] Return bool from Cursor.__eq__
llvm-svn: 152011
2012-03-05 00:42:15 +00:00
Erik Verbruggen 8c738bc98a Remove a recursive visitation in ExprEngine that is no longer needed because the CFG is fully linearized.
llvm-svn: 152007
2012-03-04 18:12:21 +00:00
Chandler Carruth 52b6ac2a78 Silence a GCC warning about a set-but-not-used variable in release builds.
llvm-svn: 152005
2012-03-04 12:16:40 +00:00
Richard Smith 72eebee0cb Add tests for [over.literal]. Fix a few bugs which were exposed by the tests.
llvm-svn: 151997
2012-03-04 09:41:16 +00:00
Chris Lattner 332673d39d From his comment in PR12168, Eli seems confused about the alignment assumptions
we're making.  We only ignore implicit casts.  Add a testcase showing that
we get the right behavior with explicit casts.

llvm-svn: 151994
2012-03-04 00:56:24 +00:00
Chris Lattner aaa18fad7d add a testcase for PR12094 and fix a crash on pointer to incomplete type,
reported by Richard Smith.

llvm-svn: 151993
2012-03-04 00:52:12 +00:00
Richard Smith 522fa53703 Add a pile of tests for unrestricted unions, and advertise support for them.
llvm-svn: 151992
2012-03-03 23:51:05 +00:00
Richard Smith 2e312c8738 constexpr: Remove APValue/CCValue distinction. It is no longer useful given the
resolution of core issue 1454.

llvm-svn: 151991
2012-03-03 22:46:17 +00:00
Benjamin Kramer 15ceed9a9e Remove unused variable.
llvm-svn: 151989
2012-03-03 21:52:22 +00:00
Jean-Daniel Dupas 999892f0d0 Fix Typo in 'objc changes' anchor.
llvm-svn: 151978
2012-03-03 13:37:22 +00:00
Eli Friedman 5358a0ab5a Avoid an unnecessary recursive loop between type canonicalization and NNS canonicalization which would (rarely) lead to memory corruption. While I'm here, simplify. Fixes PR12166. Not committing a testcase because it's impossible to reduce it.
llvm-svn: 151967
2012-03-03 04:09:56 +00:00
Ted Kremenek 868dbda367 [analyzer] do not warn about returning stack-allocated memory when it comes from an ancestor stack frame.
llvm-svn: 151964
2012-03-03 01:22:03 +00:00
Richard Smith 906ccc167c Factor bitfields of LangOptions out into a base class in order to make them
trivially-copyable. 50KiB reduction in clang binary size.

llvm-svn: 151963
2012-03-03 00:52:40 +00:00
Daniel Dunbar ae77b3dfad Frontend: Default to creating output files using temporary files + rename.
- This is a more reliable default, as it behaves better on failure and also
   ensures that we create *new* files (instead of reusing existing inodes). This
   is useful for other applications (like lldb) which want to cache inode's to
   know when a file has been rewritten.

llvm-svn: 151961
2012-03-03 00:36:06 +00:00
Daniel Dunbar b9c62c0773 Frontend: Don't automatically create missing directories when using temporary files with createOutputFile()
- This would otherwise happen as a side effect of llvm::sys::fs::unique_file creating parent directories.

llvm-svn: 151960
2012-03-03 00:36:02 +00:00
DeLesley Hutchins e2a3f75a12 Thread safety analysis: expand set of expressions that can be used to denote locks.
llvm-svn: 151956
2012-03-02 23:36:05 +00:00
Richard Smith bc638767f8 Reinstate r151879, r151880, reverted in r151922, along with a bugfix for
scalar emission of DeclRefExprs to const bools: emit scalar bools as i1,
not as i8.

In addition to the extra unit testing, this has successfully bootstrapped.

llvm-svn: 151955
2012-03-02 23:27:11 +00:00
Anna Zaks b8b21e9b56 Unbreak the CMake builds following the CallGraph change.
llvm-svn: 151952
2012-03-02 23:18:45 +00:00
Nico Weber 9b9ebfc090 Add a test for the -Wstring-plus-int fixit note.
llvm-svn: 151951
2012-03-02 23:01:20 +00:00
Anna Zaks fc5dfe9f7c [analyzer] Rename clang::CallGraph into clang::idx::CallGraph + rename
the corresponding files to avoid confusion.

This is a preparation to adding an AST-based call graph to Analysis. The
existing call graph works with indexer entries. We might be able to
refactor it to use the AST based graph in the future.

(Minimal testing here as the only example that uses the API has been
completely broken, does not compile.)

llvm-svn: 151950
2012-03-02 22:54:36 +00:00
Aaron Ballman 611306eae6 Adding support for #pragma include_alias in MS compatibility mode. This implements PR 10705.
llvm-svn: 151949
2012-03-02 22:51:54 +00:00
DeLesley Hutchins 71d6103295 Issue warning when late-parsed attributes have no declaration.
llvm-svn: 151947
2012-03-02 22:29:50 +00:00
DeLesley Hutchins bd2ee13e78 Make late-parsed attributes follow the conventions of ordinary
GNU attributes to a better extent, by allowing them in more
places on a declator.

llvm-svn: 151945
2012-03-02 22:12:59 +00:00
DeLesley Hutchins a2587ef26d Thread safety analysis: handle CFG blocks which call functions marked as noreturn.
llvm-svn: 151944
2012-03-02 22:02:58 +00:00
Nico Weber ccec40d9b7 Add -Wstring-plus-int, which warns on "str" + int and int + "str".
It doesn't warn if the integer is known at compile time and within
the bounds of the string.

Discussion: http://comments.gmane.org/gmane.comp.compilers.clang.scm/47203
llvm-svn: 151943
2012-03-02 22:01:22 +00:00
Fariborz Jahanian 7923ef41e1 objc: When issue diagnostic about deprecated method, also
issue the note if it is because message is sent to a forward class
declaration in delayed diagnostic. // rdar://10290322

llvm-svn: 151942
2012-03-02 21:50:02 +00:00
Ted Kremenek aa1f96add5 [analyzer diagnostics] flush locations *before* popping the current path when visiting a CallEnter.
Fixes <rdar://problem/10967815>

llvm-svn: 151938
2012-03-02 21:16:22 +00:00
Hal Finkel 2690838227 Fix an ABI problem with ptrdiff_t and intptr_t on PPC32
ptrdiff_t on PPC32 on Linux, etc. should be int not long.
This does not matter for C, but it does matter for C++ because of
name mangling.

The preprocessor test has been changed accordingly.

llvm-svn: 151935
2012-03-02 20:54:36 +00:00
Nico Weber 99c07bc822 Move int<->pointer conversion warnings behind -Wint-conversions.
This is consistent with -Wbool-conversion. Let me know if you prefer
a different flag name.

llvm-svn: 151934
2012-03-02 20:23:08 +00:00
Argyrios Kyrtzidis 4af2cb3355 [Sema] Fix crash-on-invalid-code issue:
@class I;
@implementation I(cat) // crashes here
@end

rdar://10968158

llvm-svn: 151931
2012-03-02 19:14:29 +00:00
Anna Zaks 265087721a [analyzer] Bound the size of the functions being inlined + provide
command line options for inlining tuning.

This adds the option for stack depth bound as well as function size
bound. 

+ minor doxygenification

llvm-svn: 151930
2012-03-02 19:05:03 +00:00
Jay Foad b0f3344b10 PR12094: Set the alignment of memory intrinsic instructions based on the
types of the pointer arguments.

llvm-svn: 151927
2012-03-02 18:34:30 +00:00
Fariborz Jahanian bf48281c25 Change diagnostic test for my last patch.
// rdar://10961370

llvm-svn: 151923
2012-03-02 17:05:03 +00:00
Daniel Dunbar d01281fe0d Revert r151879, r151880, "PR12145: Avoid emitting loads of constexpr variables in contexts where there" and "Fix buildbot: make this test less dependent on the value names in the produced IR."
They broke bootstrap.

llvm-svn: 151922
2012-03-02 16:24:25 +00:00
Benjamin Kramer 8fe5fc8521 Use tabs instead of spaces.
No, really, make doesn't work with spaces.

llvm-svn: 151920
2012-03-02 16:06:37 +00:00
Jia Liu 5c302484e9 clang -v support for separate clang.git and llvm.git, patch by Andrew Trick.
llvm-svn: 151910
2012-03-02 14:37:41 +00:00
David Chisnall e04307e47c Add the Solaris support directory to the header search when using libc++.
Unconditionally define __C99FEATURES__ when using C++ on Solaris.  This is a
(hopefully temporary) work around for libc++ exposing C99-but-not-C++98
features in C++98 mode.

llvm-svn: 151889
2012-03-02 10:49:52 +00:00
Richard Smith 35ecb36fcd Ensure that we instantiate static reference data members of class templates
early, since their values can be used in constant expressions in C++11. For
odr-use checking, the opposite change is required, since references are
odr-used whether or not they satisfy the requirements for appearing in a
constant expression.

llvm-svn: 151881
2012-03-02 04:14:40 +00:00
Richard Smith 545f38c3d2 Fix buildbot: make this test less dependent on the value names in the produced IR.
llvm-svn: 151880
2012-03-02 03:22:38 +00:00
Richard Smith a541a3bbee PR12145: Avoid emitting loads of constexpr variables in contexts where there
is no odr-use of the variable. Go slightly beyond what the standard requires
for variables of reference type.

llvm-svn: 151879
2012-03-02 03:16:32 +00:00
Ted Kremenek f9e9d33019 [analyzer diagnostics] Change CompactPathDiagnostic to recursively compact diagnostics in calls into macro pieces.
Also fix handling of macros within calls in the HTMLDiagnostics.

This also adds a test case for r151774.

llvm-svn: 151872
2012-03-02 01:27:31 +00:00
Fariborz Jahanian 3854a55a17 c/objc: problem originally reported as an objective-c bug.
But it is in the underlying c part of clang. clang crashes
in IRGen when passing an incomplete type argument to 
variadic function (instead of diagnosing the bug).
// rdar://10961370

llvm-svn: 151862
2012-03-01 23:42:00 +00:00
Kostya Serebryany b187449435 add documentation for -f[no-]thread-sanitizer and -f[no-]address-sanitizer to docs/UsersManual.html
llvm-svn: 151858
2012-03-01 23:14:19 +00:00
Ted Kremenek 57207d6074 Teach the analyzer to just ignore CXXBindTemporaryExpr. There's nothing special to do with it, since destructors are represented explicitly in the CFG.
llvm-svn: 151856
2012-03-01 23:06:04 +00:00
Ted Kremenek 9466603322 Moving tagging of '__experimental_modules_import' IdentifierInfo out of
IndentifierTable::get() and into IdentifierTable's constructor.

This gets a 0.7% reducing on lexing time for Cocoa.h, and
about the same for PCH generation.

llvm-svn: 151854
2012-03-01 22:53:32 +00:00
Eli Friedman c4e5d0ccda Make CodeGenFunction::EmitBlockCopyAndAutorelease actually do what its name says.
llvm-svn: 151853
2012-03-01 22:52:28 +00:00
Eric Christopher 5bc1f47b00 Update test for llvm assembly output change. Also add a fixme that this
shouldn't be relying on assembly emission.

For the record we should check the metadata output from the front
end and then check in the backend that such a thing emits a pubtypes
entry.

llvm-svn: 151851
2012-03-01 22:49:10 +00:00
Anna Zaks d5c3027473 [analyzer] Turn inlining on by default for better testing exposure.
Fix a test, which was most likely an unintended recursive call.

llvm-svn: 151848
2012-03-01 22:37:46 +00:00
Kostya Serebryany 28a7a1198b Add a flag -fthread-sanitizer.
This flag enables ThreadSanitizer instrumentation committed to llvm as r150423.
The patch includes one test for -fthread-sanitizer and one similar test for -faddress-sanitizer.
This patch does not modify the linker flags (as we do it for -faddress-sanitizer) because the run-time library is not yet
committed and it's structure in compiler-rt is not 100% clear.
The users manual wil be changed in a separate commit.

llvm-svn: 151846
2012-03-01 22:27:08 +00:00
Ted Kremenek c1e4dd0e8e Change @import to @__experimental_modules_import. We are not ready to commit to a particular syntax for modules,
and don't have time to push it forward in the near future.

llvm-svn: 151841
2012-03-01 22:07:04 +00:00
Anna Zaks 8dc53af5dc [analyzer] Fix a regression introduced in malloc with
attributes, introduced in r151188.

+ the test to catch it.

Thanks to Ahmed Charles for pointing this out.

llvm-svn: 151840
2012-03-01 22:06:06 +00:00
Eric Christopher 4b6753cf10 Reapply r151702 with a small fix for a failure to cut and paste
correctly.

Still rdar://10900684

llvm-svn: 151838
2012-03-01 21:36:52 +00:00
Eli Friedman 23b1be991e Fix the isReferenced bit on parameters in a couple of edge cases. PR12153.
llvm-svn: 151837
2012-03-01 21:32:56 +00:00