]> granicus.if.org Git - clang/log
clang
12 years agoobjective-c: Improve diagnostics and
Fariborz Jahanian [Wed, 28 Mar 2012 17:56:49 +0000 (17:56 +0000)]
objective-c: Improve diagnostics and
provide 'fixit' hint when dictionary index
is not of proper type. // rdar://11062080

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153584 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[analyser] Stats checker: do not mark a node as exhausted if we will
Anna Zaks [Wed, 28 Mar 2012 17:05:50 +0000 (17:05 +0000)]
[analyser] Stats checker: do not mark a node as exhausted if we will
retry without inlining.

(+ other minor cleanups)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153581 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[analyzer] Refactor: Use Decl when determining if the Block belongs to
Anna Zaks [Wed, 28 Mar 2012 17:05:46 +0000 (17:05 +0000)]
[analyzer] Refactor: Use Decl when determining if the Block belongs to
the root function.

(This is a bit cleaner then using the StackFrame.)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153580 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoCodeGen/CGDeclCXX.cpp: Twine-ize CreateGlobalInitOrDestructFunction().
NAKAMURA Takumi [Wed, 28 Mar 2012 16:24:29 +0000 (16:24 +0000)]
CodeGen/CGDeclCXX.cpp: Twine-ize CreateGlobalInitOrDestructFunction().

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153578 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoUnify and fix our checking of C++ [dcl.meaning]p1's requirements
Douglas Gregor [Wed, 28 Mar 2012 16:01:27 +0000 (16:01 +0000)]
Unify and fix our checking of C++ [dcl.meaning]p1's requirements
concerning qualified declarator-ids. We now diagnose extraneous
qualification at namespace scope (which we had previously missed) and
diagnose these qualification errors for all kinds of declarations; it
was rather uneven before. Fixes <rdar://problem/11135644>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153577 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoWhen we form a new function/class template specialization, we first
Douglas Gregor [Wed, 28 Mar 2012 14:34:23 +0000 (14:34 +0000)]
When we form a new function/class template specialization, we first
search for the specialization (in a folding set) and, if not found
form a *Decl that is then inserted into that folding set. In rare
cases, the folding set may be reallocated between the search and the
insertion, causing a crash. No test case, because triggering rehashing
consistently in a small test case is not feasible. Fixes
<rdar://problem/11115071>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153575 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoFix suspicious comparison reported by PVS-Studio!
Ted Kremenek [Wed, 28 Mar 2012 05:24:50 +0000 (05:24 +0000)]
Fix suspicious comparison reported by PVS-Studio!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153568 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[libclang] Rename setBackGroundPriority -> setThreadBackgroundPriority.
Argyrios Kyrtzidis [Wed, 28 Mar 2012 02:49:54 +0000 (02:49 +0000)]
[libclang] Rename setBackGroundPriority -> setThreadBackgroundPriority.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153566 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[libclang] Fix gcc error.
Argyrios Kyrtzidis [Wed, 28 Mar 2012 02:49:50 +0000 (02:49 +0000)]
[libclang] Fix gcc error.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153565 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[libclang] Introduce options to control the priority for the threads
Argyrios Kyrtzidis [Wed, 28 Mar 2012 02:18:05 +0000 (02:18 +0000)]
[libclang] Introduce options to control the priority for the threads
that libclang creates.

-Introduce CXGlobalOptFlags enum for the new options that can be
 set on the CXIndex object.

-CXGlobalOpt_ThreadBackgroundPriorityForIndexing affects:
  clang_indexSourceFile
  clang_indexTranslationUnit
  clang_parseTranslationUnit
  clang_saveTranslationUnit

-CXGlobalOpt_ThreadBackgroundPriorityForEditing affects:
  clang_reparseTranslationUnit
  clang_codeCompleteAt
  clang_annotateTokens

rdar://9075282

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153562 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[libclang] Put the CIndexer class in the clang namespace instead of having
Argyrios Kyrtzidis [Wed, 28 Mar 2012 02:18:02 +0000 (02:18 +0000)]
[libclang] Put the CIndexer class in the clang namespace instead of having
it at global namespace.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153561 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[libclang] For clang_saveTranslationUnit, if the AST to save has invalid nodes
Argyrios Kyrtzidis [Wed, 28 Mar 2012 02:17:59 +0000 (02:17 +0000)]
[libclang] For clang_saveTranslationUnit, if the AST to save has invalid nodes
due to compiler errors, use a crash recovery thread to do the AST writing for
protection.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153560 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoMove the emission of strict enum range metadata behind a flag (the same
Chandler Carruth [Tue, 27 Mar 2012 23:58:37 +0000 (23:58 +0000)]
Move the emission of strict enum range metadata behind a flag (the same
flag as GCC uses: -fstrict-enums). There is a *lot* of code making
unwarranted assumptions about the underlying type of enums, and it
doesn't seem entirely reasonable to eagerly break all of it.

Much more importantly, the current state of affairs is *very* good at
optimizing based upon this information, which causes failures that are
very distant from the actual enum. Before we push for enabling this by
default, I think we need to implement -fcatch-undefined-behavior support
for instrumenting and trapping whenever we store or load a value outside
of the range. That way we can track down the misbehaving code very
quickly.

I discussed this with Rafael, and currently the only important cases he
is aware of are the bool range-based optimizations which are staying
hard enabled. We've not seen any issue with those either, and they are
much more important for performance.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153550 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoIntroduce a new libclang API to determine the parent context of a code
Douglas Gregor [Tue, 27 Mar 2012 23:34:16 +0000 (23:34 +0000)]
Introduce a new libclang API to determine the parent context of a code
completion item. For example, if the code completion itself represents
a declaration in a namespace (say, std::vector), then this API
retrieves the cursor kind and name of the namespace (std). Implements
<rdar://problem/11121951>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153545 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoIf we see '(...' where we're expecting an abstract-declarator, that doesn't
Richard Smith [Tue, 27 Mar 2012 23:05:05 +0000 (23:05 +0000)]
If we see '(...' where we're expecting an abstract-declarator, that doesn't
necessarily mean we've found a function declarator. If the next token is not
a ')', this is actually a parenthesized pack expansion.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153544 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[libclang] Introduce indexing option CXIndexOpt_SuppressWarnings, which
Argyrios Kyrtzidis [Tue, 27 Mar 2012 21:38:03 +0000 (21:38 +0000)]
[libclang] Introduce indexing option CXIndexOpt_SuppressWarnings, which
disables all compiler warnings.

rdar://11059556

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153539 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agomodern objective-c translator: writing objc boolean literals.
Fariborz Jahanian [Tue, 27 Mar 2012 20:17:30 +0000 (20:17 +0000)]
modern objective-c translator: writing objc boolean literals.
// rdar://11124775

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153535 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[analyzer] Add an option to re-analyze a dead-end path without inlining.
Anna Zaks [Tue, 27 Mar 2012 20:02:53 +0000 (20:02 +0000)]
[analyzer] Add an option to re-analyze a dead-end path without inlining.

The analyzer gives up path exploration under certain conditions. For
example, when the same basic block has been visited more than 4 times.
With inlining turned on, this could lead to decrease in code coverage.
Specifically, if we give up inside the inlined function, the rest of
parent's basic blocks will not get analyzed.

This commit introduces an option to enable re-run along the failed path,
in which we do not inline the last inlined call site. This is done by
enqueueing the node before the processing of the inlined call site
with a special policy encoded in the state. The policy tells us not to
inline the call site along the path.

This lead to ~10% increase in the number of paths analyzed. Even though
we expected a much greater coverage improvement.

The option is turned off by default for now.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153534 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[analyzer] Fix a typo.
Anna Zaks [Tue, 27 Mar 2012 20:02:47 +0000 (20:02 +0000)]
[analyzer] Fix a typo.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153533 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[analyzer] Stats checker: minor interprocedural tweaks.
Anna Zaks [Tue, 27 Mar 2012 20:02:44 +0000 (20:02 +0000)]
[analyzer] Stats checker: minor interprocedural tweaks.

Report root function name with exhausted block diagnostic.

Also, use stack frames, not just any location context when checking if
the basic block is in the same context.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153532 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[analyzer] Stats: Only count the number of times we run path sensitive
Anna Zaks [Tue, 27 Mar 2012 20:02:41 +0000 (20:02 +0000)]
[analyzer] Stats: Only count the number of times we run path sensitive
analyzes.

(This method can be called twice on the same function.)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153531 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoAdd better support for $fp and $sp for mips inline asm support.
Eric Christopher [Tue, 27 Mar 2012 19:56:11 +0000 (19:56 +0000)]
Add better support for $fp and $sp for mips inline asm support.

Patch by Jack Carter.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153530 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[preprocessor] Handle correctly inclusion directives that have macro expansions, e.g
Argyrios Kyrtzidis [Tue, 27 Mar 2012 18:47:48 +0000 (18:47 +0000)]
[preprocessor] Handle correctly inclusion directives that have macro expansions, e.g
"#include MACRO(STUFF)".

-As an inclusion position for the included file, use the file location of the file where it
was included but *after* the macro expansions. We want the macro expansions to be considered
as before-in-translation-unit for everything in the included file.

-In the preprocessing record take into account that only inclusion directives can be encountered
as "out-of-order" (by comparing the start of the range which for inclusions is the hash location)
and use binary search if there is an extreme number of macro expansions in the include directive.

Fixes rdar://11111779

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153527 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoobjective-c modern translator: move all inithooks into a single array
Fariborz Jahanian [Tue, 27 Mar 2012 18:41:05 +0000 (18:41 +0000)]
objective-c modern translator: move all inithooks into a single array
// rdar://11124354

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153526 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoEven more careful consideration of C++11 13.3.3.1p4. Fixes PR12241.
Sebastian Redl [Tue, 27 Mar 2012 18:33:03 +0000 (18:33 +0000)]
Even more careful consideration of C++11 13.3.3.1p4. Fixes PR12241.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153523 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoIntroduce a -cc1-level option -pubnames-dump, which simply dumps the
Douglas Gregor [Tue, 27 Mar 2012 18:06:49 +0000 (18:06 +0000)]
Introduce a -cc1-level option -pubnames-dump, which simply dumps the
list of identifiers that that 'public' names at the end of the
translation unit, e.g., defined macros or identifiers with top-level
names, in sorted order. Meant to support <rdar://problem/10921596>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153522 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoRemove few if-then-else when both branches are the
Fariborz Jahanian [Tue, 27 Mar 2012 16:42:20 +0000 (16:42 +0000)]
Remove few if-then-else when both branches are the
same. pr12357.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153515 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoCommit patch reverted in r153454 with the modified test
Fariborz Jahanian [Tue, 27 Mar 2012 16:21:30 +0000 (16:21 +0000)]
Commit patch reverted in r153454 with the modified test
case that I forgot to check in.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153512 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoUpdate the ARC specification for several changes made in the
John McCall [Tue, 27 Mar 2012 07:42:12 +0000 (07:42 +0000)]
Update the ARC specification for several changes made in the
last N months.  This required a brief soliloquy about change in
an uncertainly-versioned world.

I believe I've gotten the right target versions on all these changes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153501 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoAdd cross-referencing comments to ParseDirectDeclarator to note that
Richard Smith [Tue, 27 Mar 2012 01:42:32 +0000 (01:42 +0000)]
Add cross-referencing comments to ParseDirectDeclarator to note that
isConstructorDeclaration also needs updating for any extension to the
grammar of a direct-declarator.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153490 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoChange RetainCountChecker to eagerly "escape" retained objects when they are
Ted Kremenek [Tue, 27 Mar 2012 01:12:45 +0000 (01:12 +0000)]
Change RetainCountChecker to eagerly "escape" retained objects when they are
assigned to a struct.  This is fallout from inlining results, which expose
far more patterns where people stuff CF objects into structs and pass them
around (and we can reason about it).  The problem is that we don't have
a general way to detect when values have escaped, so as an intermediate step
we need to eagerly prune out such tracking.

Fixes <rdar://problem/11104566>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153489 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoWhen we see 'Class(X' or 'Class::Class(X' and we suspect that it names a
Richard Smith [Tue, 27 Mar 2012 00:56:56 +0000 (00:56 +0000)]
When we see 'Class(X' or 'Class::Class(X' and we suspect that it names a
constructor, but X is not a known typename, check whether the tokens could
possibly match the syntax of a declarator before concluding that it isn't
a constructor. If it's definitely ill-formed, assume it is a constructor.

Empirical evidence suggests that this pattern is much more often a
constructor with a typoed (or not-yet-declared) type name than any of the
other possibilities, so the extra cost of the check is not expected to be
problematic.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153488 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[driver] Put -cpp-precomp and -no-cpp-precomp under the clang_ignored_f_group.
Chad Rosier [Mon, 26 Mar 2012 23:36:04 +0000 (23:36 +0000)]
[driver] Put -cpp-precomp and -no-cpp-precomp under the clang_ignored_f_group.
We don't currently support these options.
rdar://11120518

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153485 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[driver] Testcase for r153469, r153470, and r153478.
Chad Rosier [Mon, 26 Mar 2012 22:43:28 +0000 (22:43 +0000)]
[driver] Testcase for r153469, r153470, and r153478.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153481 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[driver] Fix unused argument warnings.
Chad Rosier [Mon, 26 Mar 2012 22:04:46 +0000 (22:04 +0000)]
[driver]  Fix unused argument warnings.

1. Don't short-circuit conditional statements that are checking flags.
Otherwise, the driver emits warnings about unused arguments.

2. -mkernel and -fapple-kext imply no exceptions, so claim exception related
 arguments now to avoid warnings about unused arguments.

rdar://11120518

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153478 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[driver] -mkernel implies -fno-common, so claim the arg to avoid an unused
Chad Rosier [Mon, 26 Mar 2012 21:35:40 +0000 (21:35 +0000)]
[driver] -mkernel implies -fno-common, so claim the arg to avoid an unused
argument warning.
Part of rdar://11120518

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153470 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[driver] -mkernel implies -fno-builtin, so claim the arg to avoid an unused
Chad Rosier [Mon, 26 Mar 2012 21:29:17 +0000 (21:29 +0000)]
[driver] -mkernel implies -fno-builtin, so claim the arg to avoid an unused
argument warning.
Part of rdar://11120518

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153469 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoForward-declared enumerations are now complete, except for an interaction
Richard Smith [Mon, 26 Mar 2012 20:31:41 +0000 (20:31 +0000)]
Forward-declared enumerations are now complete, except for an interaction
between unscoped enumerations and class template member specializations,
whose behavior is currently under discussion in CWG (and for which there
is a preference to not implement the currently-standardized wording).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153464 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoAdd a special-case diagnostic for one of the more obnoxious special cases of
Richard Smith [Mon, 26 Mar 2012 20:28:16 +0000 (20:28 +0000)]
Add a special-case diagnostic for one of the more obnoxious special cases of
unscoped enumeration members: an enumerator name which is visible in the
out-of-class definition of a member of a templated class might not actually
exist in the instantiation of that class, if the enumeration is also lexically
defined outside the class definition and is explicitly specialized.

Depending on the result of a CWG discussion, we may have a different resolution
for a class of problems in this area, but this fixes the immediate issue of a
crash-on-invalid / accepts-invalid (depending on +Asserts). Thanks to Johannes
Schaub for digging into the standard wording to find how this case is currently
specified to behave.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153461 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[tests] Fix test failure in release mode.
Daniel Dunbar [Mon, 26 Mar 2012 20:18:16 +0000 (20:18 +0000)]
[tests] Fix test failure in release mode.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153460 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoSimplify code, no functionality change.
Benjamin Kramer [Mon, 26 Mar 2012 20:12:15 +0000 (20:12 +0000)]
Simplify code, no functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153459 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoRevert r153443 "objective-c modern translator: extern "C" exported", it fails in...
Daniel Dunbar [Mon, 26 Mar 2012 18:48:59 +0000 (18:48 +0000)]
Revert r153443 "objective-c modern translator: extern "C" exported", it fails in testing.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153454 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[analyzer] Malloc: Allow a pointer to escape through OSAtomicEnqueue.
Anna Zaks [Mon, 26 Mar 2012 18:18:39 +0000 (18:18 +0000)]
[analyzer] Malloc: Allow a pointer to escape through OSAtomicEnqueue.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153453 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoTest case for r153348.
Akira Hatanaka [Mon, 26 Mar 2012 17:37:20 +0000 (17:37 +0000)]
Test case for r153348.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153449 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoadd tbaa metadata to vtable pointer loads/stores
Kostya Serebryany [Mon, 26 Mar 2012 17:03:51 +0000 (17:03 +0000)]
add tbaa metadata to vtable pointer loads/stores

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153447 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoMove CodeCompletionBuilder's chunk adding methods out of line.
Benjamin Kramer [Mon, 26 Mar 2012 16:57:36 +0000 (16:57 +0000)]
Move CodeCompletionBuilder's chunk adding methods out of line.

This makes sense because chunk's ctor is also out of line and simplifies considerably
when inlined with a constant parameter. Shrinks clang on i386-linux-Release+Asserts by 65k.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153446 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoWhen diagnosing an invalid out-of-line redeclaration, don't permit
Douglas Gregor [Mon, 26 Mar 2012 16:54:18 +0000 (16:54 +0000)]
When diagnosing an invalid out-of-line redeclaration, don't permit
typo correction to introduce a nested-name-specifier; we aren't
prepared to handle it here. Fixes PR12297 / <rdar://problem/11075219>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153445 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoobjective-c modern translator: extern "C" exported
Fariborz Jahanian [Mon, 26 Mar 2012 16:29:49 +0000 (16:29 +0000)]
objective-c modern translator: extern "C" exported
symbols. // rdar://11103982

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153443 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoCanonicalize the declaration we write to a PCH file for an
Douglas Gregor [Mon, 26 Mar 2012 15:52:37 +0000 (15:52 +0000)]
Canonicalize the declaration we write to a PCH file for an
InjectedClassNameType; otherwise, it won't be properly wired to the
original (canonical) declaration when it is deserialized. Fixes
<rdar://problem/11112464>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153442 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoDriver: Factor string vector push_back into a helper class and optimize it.
Benjamin Kramer [Mon, 26 Mar 2012 15:39:31 +0000 (15:39 +0000)]
Driver: Factor string vector push_back into a helper class and optimize it.

Due to lack of move semantics we would create a temporary std::string from the
string literal, copy it into the vector and discard the temporary. This leads
to massive code bloat, optimizing it saves 50k on i386-linux-Release+Asserts.

While there add a two-element overload for push_back, simplifying code a bit.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153441 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoThreadSafetyReporter: Manage diagnostics in a std::list.
Benjamin Kramer [Mon, 26 Mar 2012 14:05:40 +0000 (14:05 +0000)]
ThreadSafetyReporter: Manage diagnostics in a std::list.

std::list is expensive, but so is std::sorting a SmallVector of SmallVectors of
heavyweight PartialDiagnostics.

Saves ~30k in a i386-linux-Release+Asserts clang build.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153437 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoHandle instantiations of redeclarations of forward-declared enumerations within
Richard Smith [Mon, 26 Mar 2012 04:58:10 +0000 (04:58 +0000)]
Handle instantiations of redeclarations of forward-declared enumerations within
templated functions. Build a redeclaration chain, and only instantiate the
definition of the enum when visiting the defining declaration.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153427 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoDelay checking of dependent underlying types for redeclarations of member
Richard Smith [Mon, 26 Mar 2012 04:08:46 +0000 (04:08 +0000)]
Delay checking of dependent underlying types for redeclarations of member
enumerations in templates until the template is instantiated.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153426 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoSince this change is generating a considerable amount of discussion (and possibly...
Aaron Ballman [Sun, 25 Mar 2012 22:46:17 +0000 (22:46 +0000)]
Since this change is generating a considerable amount of discussion (and possibly even a regression for known bad versions), I'm reverting it.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153420 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoNo longer hard coding paths to the MinGW include directories; using a regular express...
Aaron Ballman [Sun, 25 Mar 2012 15:47:41 +0000 (15:47 +0000)]
No longer hard coding paths to the MinGW include directories; using a regular expression instead.

Patch thanks to Nikola Smiljanic

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153413 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoclang/lib/Analysis/CFG.cpp: Get rid of early insertion of placeholder to the map.
NAKAMURA Takumi [Sun, 25 Mar 2012 06:30:37 +0000 (06:30 +0000)]
clang/lib/Analysis/CFG.cpp: Get rid of early insertion of placeholder to the map.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153407 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoclang/lib/Analysis/CFG.cpp: Fix memory leak since r153297.
NAKAMURA Takumi [Sun, 25 Mar 2012 06:30:32 +0000 (06:30 +0000)]
clang/lib/Analysis/CFG.cpp: Fix memory leak since r153297.

evaluateAsBooleanConditionNoCache(S) might update the map and invalidate the iterator.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153406 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agotest/Driver/cpath.c: Escape a few args that contain %{pathsep}.
NAKAMURA Takumi [Sun, 25 Mar 2012 03:42:26 +0000 (03:42 +0000)]
test/Driver/cpath.c: Escape a few args that contain %{pathsep}.

On msys bash, with %pathsep==os.pathsep==';', I can see lines like below in this script;

    env DIR=X:/foo%{pathsep}X:/bar

Then it is expanded to;

    env DIR=X:/foo;X:/bar

It should be with quote;

    env "DIR=X:/foo;X:/bar"

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153402 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoSimplify some users of DenseMap::erase.
Benjamin Kramer [Sat, 24 Mar 2012 18:22:12 +0000 (18:22 +0000)]
Simplify some users of DenseMap::erase.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153389 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoremove declaration of _objc_empty_vtable no longer
Fariborz Jahanian [Sat, 24 Mar 2012 16:57:13 +0000 (16:57 +0000)]
remove declaration of _objc_empty_vtable no longer
used in modern objc translator. // rdar://11105680

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153386 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoFix copy and pasto.
Rafael Espindola [Sat, 24 Mar 2012 16:57:10 +0000 (16:57 +0000)]
Fix copy and pasto.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153385 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agomoderin objc translator: remove 'const' from remaining
Fariborz Jahanian [Sat, 24 Mar 2012 16:53:16 +0000 (16:53 +0000)]
moderin objc translator: remove 'const' from remaining
fields in _class_ro_t metadata. //  rdar://11079898

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153384 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoAdd back r153360 with a fix for enums that cover all the 32 bit values.
Rafael Espindola [Sat, 24 Mar 2012 16:50:34 +0000 (16:50 +0000)]
Add back r153360 with a fix for enums that cover all the 32 bit values.
Thanks to NAKAMURA Takumi for finding it!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153383 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoRevert r153360 (and r153380), "Second part of PR12251. Produce the range metadata...
NAKAMURA Takumi [Sat, 24 Mar 2012 14:43:42 +0000 (14:43 +0000)]
Revert r153360 (and r153380), "Second part of PR12251. Produce the range metadata in clang for booleans and".

For i686 targets (eg. cygwin), I saw "Range must not be empty!" in verifier.

It produces (i32)[0x80000000:0x80000000) from (uint64_t)[0xFFFFFFFF80000000ULL:0x0000000080000000ULL), for signed i32 on MDNode::Range.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153382 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoDon't cast away constness.
Benjamin Kramer [Sat, 24 Mar 2012 13:59:42 +0000 (13:59 +0000)]
Don't cast away constness.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153381 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoOn i386 the alignment of i64 is 4, not 8.
Benjamin Kramer [Sat, 24 Mar 2012 13:22:50 +0000 (13:22 +0000)]
On i386 the alignment of i64 is 4, not 8.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153380 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[analyzer] Tighten up the realloc() failure path note generation...make sure we get...
Jordy Rose [Sat, 24 Mar 2012 03:15:09 +0000 (03:15 +0000)]
[analyzer] Tighten up the realloc() failure path note generation...make sure we get the right realloc()!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153370 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[analyzer] Restart path diagnostic generation if any of the visitors change the repor...
Jordy Rose [Sat, 24 Mar 2012 03:03:29 +0000 (03:03 +0000)]
[analyzer] Restart path diagnostic generation if any of the visitors change the report configuration while walking the path.

This required adding a change count token to BugReport, but also allowed us to ditch ImmutableList as the BugReporterVisitor data type.

Also, remove the hack from MallocChecker, now that visitors appear in the opposite order. This is not exactly a fix, but the common case -- custom diagnostics after generic ones -- is now the default behavior.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153369 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[analyzer] Add a clone() method to BugReporterVisitor, so that we'll be able to reset...
Jordy Rose [Sat, 24 Mar 2012 02:45:35 +0000 (02:45 +0000)]
[analyzer] Add a clone() method to BugReporterVisitor, so that we'll be able to reset diagnostic generation.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153368 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[parser] If there are unmatched braces in a function definition, try to
Argyrios Kyrtzidis [Sat, 24 Mar 2012 02:26:51 +0000 (02:26 +0000)]
[parser] If there are unmatched braces in a function definition, try to
recover by returning the statements that we parsed so far, instead of
dropping the whole function body.

rdar://10967343

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153367 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoSecond part of PR12251. Produce the range metadata in clang for booleans and
Rafael Espindola [Sat, 24 Mar 2012 00:28:06 +0000 (00:28 +0000)]
Second part of PR12251. Produce the range metadata in clang for booleans and
c++ enums.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153360 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoTeach APValue printer to print boolean 0 and 1 as 'false' and 'true'. Fix up
Richard Smith [Fri, 23 Mar 2012 23:55:39 +0000 (23:55 +0000)]
Teach APValue printer to print boolean 0 and 1 as 'false' and 'true'. Fix up
some calling code to actually pass in a non-null type, to avoid a crash.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153358 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agouse EP_OptimizerLast instead of EP_ScalarOptimizerLate for ThreadSanitizer
Kostya Serebryany [Fri, 23 Mar 2012 23:25:23 +0000 (23:25 +0000)]
use EP_OptimizerLast instead of EP_ScalarOptimizerLate for ThreadSanitizer

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153356 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoMake sure we don't accept an @interface inside another objc container
Argyrios Kyrtzidis [Fri, 23 Mar 2012 23:24:23 +0000 (23:24 +0000)]
Make sure we don't accept an @interface inside another objc container
just because there was an attribute in front of it.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153355 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[libclang] Make sure we don't crash when trying to index code that
Argyrios Kyrtzidis [Fri, 23 Mar 2012 23:24:18 +0000 (23:24 +0000)]
[libclang] Make sure we don't crash when trying to index code that
managed to insert an @interface as top level decl contained by another
@interface.

A commit to also not allow this as valid code will be coming.

rdar://11105114.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153354 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoRevert accidentally-committed www changes (and an unused diagnostic);
Richard Smith [Fri, 23 Mar 2012 23:11:49 +0000 (23:11 +0000)]
Revert accidentally-committed www changes (and an unused diagnostic);
forward-declared enums aren't /quite/ done yet.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153350 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoWhen defining a forward-declared enum, don't try to attach the definition to
Richard Smith [Fri, 23 Mar 2012 23:09:08 +0000 (23:09 +0000)]
When defining a forward-declared enum, don't try to attach the definition to
a previous declaration if the redeclaration is invalid. That way lies madness.
Fixes a crash-on-invalid reported by Abramo.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153349 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoAdd support for MIPS' floating ABIs (hard, soft and single) to clang driver.
Akira Hatanaka [Fri, 23 Mar 2012 23:07:09 +0000 (23:07 +0000)]
Add support for MIPS' floating ABIs (hard, soft and single) to clang driver.

Patch by Simon Atanasyan.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153348 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoUpdate checker build.
Ted Kremenek [Fri, 23 Mar 2012 07:06:16 +0000 (07:06 +0000)]
Update checker build.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153312 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoAvoid applying retain/release effects twice in RetainCountChecker when a function...
Ted Kremenek [Fri, 23 Mar 2012 06:26:56 +0000 (06:26 +0000)]
Avoid applying retain/release effects twice in RetainCountChecker when a function call was inlined (i.e., we do not need to apply summaries in such cases).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153309 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoRemove the vestiges of the C backend.
Eric Christopher [Fri, 23 Mar 2012 05:51:52 +0000 (05:51 +0000)]
Remove the vestiges of the C backend.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153308 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoSupport for definitions of member enumerations of class templates outside the
Richard Smith [Fri, 23 Mar 2012 03:33:32 +0000 (03:33 +0000)]
Support for definitions of member enumerations of class templates outside the
class template's definition, and for explicit specializations of such enum
members.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153304 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[libclang] For a CXCursor_ObjCInstanceMethodDecl/CXCursor_ObjCClassMethodDecl cursor,
Argyrios Kyrtzidis [Fri, 23 Mar 2012 03:33:19 +0000 (03:33 +0000)]
[libclang] For a CXCursor_ObjCInstanceMethodDecl/CXCursor_ObjCClassMethodDecl cursor,
return from clang_getCursorLocation the start location of the method name.

rdar://11105223

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153303 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agocorrected check::EndOfTranslationUnit checker name and added 'const' to declaration
Anton Yartsev [Fri, 23 Mar 2012 02:43:24 +0000 (02:43 +0000)]
corrected check::EndOfTranslationUnit checker name and added 'const' to declaration

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153302 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[CFG] Cache boolean evaluations of expressions to avoid multiple re-evaluations
Argyrios Kyrtzidis [Fri, 23 Mar 2012 00:59:17 +0000 (00:59 +0000)]
[CFG] Cache boolean evaluations of expressions to avoid multiple re-evaluations
during construction of branches for chained logical operators.

This makes -fsyntax-only for test/Sema/many-logical-ops.c about 32x times faster.

With measuring SemaExpr.cpp I see differences below the noise level.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153297 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoRemove unused bits.
Rafael Espindola [Fri, 23 Mar 2012 00:05:14 +0000 (00:05 +0000)]
Remove unused bits.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153295 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agomodern objc translation of block literal expressions
Fariborz Jahanian [Fri, 23 Mar 2012 00:00:49 +0000 (00:00 +0000)]
modern objc translation of block literal expressions
declared at file scope.
// rdar://11006566

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153293 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoSmall cleanup.
Bill Wendling [Thu, 22 Mar 2012 23:34:01 +0000 (23:34 +0000)]
Small cleanup.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153292 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoUse correct FileCheck regexp.
Bill Wendling [Thu, 22 Mar 2012 23:32:07 +0000 (23:32 +0000)]
Use correct FileCheck regexp.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153291 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoWhen an MMX output variable is tied to the input variable, we have to implicitly
Bill Wendling [Thu, 22 Mar 2012 23:25:07 +0000 (23:25 +0000)]
When an MMX output variable is tied to the input variable, we have to implicitly
cast the value to x86_mmx. This gives the ASM string the correct call signature.
<rdar://problem/10919182>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153290 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoline endings
Matt Beaumont-Gay [Thu, 22 Mar 2012 23:15:04 +0000 (23:15 +0000)]
line endings

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153289 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoMake sure we correctly set the alignment for vector loads and stores associated with...
Eli Friedman [Thu, 22 Mar 2012 22:36:39 +0000 (22:36 +0000)]
Make sure we correctly set the alignment for vector loads and stores associated with vector element lvalues.  Patch by Kevin Schoedel (with some minor modifications by me).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153285 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoFix static analyzer crash on code taking the address of a field. Fixes PR 11146.
Ted Kremenek [Thu, 22 Mar 2012 21:42:31 +0000 (21:42 +0000)]
Fix static analyzer crash on code taking the address of a field.  Fixes PR 11146.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153283 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[analyzer] Add the stat for the number of successfully explored paths.
Anna Zaks [Thu, 22 Mar 2012 21:06:06 +0000 (21:06 +0000)]
[analyzer] Add the stat for the number of successfully explored paths.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153281 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[analyzer] Add stats useful for coverage investigations.
Anna Zaks [Thu, 22 Mar 2012 21:06:03 +0000 (21:06 +0000)]
[analyzer] Add stats useful for coverage investigations.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153280 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[analyzer] Add inlining awareness to the block coverage computation
Anna Zaks [Thu, 22 Mar 2012 21:05:57 +0000 (21:05 +0000)]
[analyzer] Add inlining awareness to the block coverage computation
(Stats Checker).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153279 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agomodern objc rewriter: until we can translate block literals
Fariborz Jahanian [Thu, 22 Mar 2012 19:54:39 +0000 (19:54 +0000)]
modern objc rewriter: until we can translate block literals
at global scope properly, issue diagnostics.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153271 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agoFix a comment: kPropertyType = 'T' not 't'. <rdar://problem/11095729>
Bob Wilson [Thu, 22 Mar 2012 17:48:02 +0000 (17:48 +0000)]
Fix a comment: kPropertyType = 'T' not 't'.  <rdar://problem/11095729>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153264 91177308-0d34-0410-b5e6-96231b3b80d8

12 years agomodern objective-c rewriter: Fix up translation of
Fariborz Jahanian [Thu, 22 Mar 2012 17:39:35 +0000 (17:39 +0000)]
modern objective-c rewriter: Fix up translation of
property attributes. // rdar://11095151

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153261 91177308-0d34-0410-b5e6-96231b3b80d8

12 years ago[PCH] When we are replacing a decl in a chained PCH that is also a DeclContext,
Argyrios Kyrtzidis [Thu, 22 Mar 2012 16:08:04 +0000 (16:08 +0000)]
[PCH] When we are replacing a decl in a chained PCH that is also a DeclContext,
make sure to fully load its external lexical and visible declarations before
re-writing it.

rdar://10914192

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153254 91177308-0d34-0410-b5e6-96231b3b80d8