Commit Graph

44321 Commits

Author SHA1 Message Date
Anna Zaks e9989bd4df [analyzer] BugReporter - more precise tracking of C++ references
When BugReporter tracks C++ references involved in a null pointer violation, we
want to differentiate between a null reference and a reference to a null pointer. In the
first case, we want to track the region for the reference location; in the second, we want
to track the null pointer.

In addition, the core creates CXXTempObjectRegion to represent the location of the
C++ reference, so teach FindLastStoreBRVisitor about it.

This helps null pointer suppression to kick in.

(Patch by Anna and Jordan.)

llvm-svn: 176969
2013-03-13 20:20:14 +00:00
Ted Kremenek 650a69e988 Remove stray space.
llvm-svn: 176966
2013-03-13 20:05:52 +00:00
Ted Kremenek 2fb5f09e15 [analyzer] Handle Objc Fast enumeration for "loop is executed 0 times".
Fixes <rdar://problem/12322528>

llvm-svn: 176965
2013-03-13 20:03:31 +00:00
Daniel Jasper 8a68b95d9e Fix incorrect cast identification.
Before: int a = sizeof(int *)+ b;"
After:  int a = sizeof(int *) + b;
llvm-svn: 176957
2013-03-13 17:13:53 +00:00
Anton Yartsev 6c2af43991 [analyzer] fixed the logic changed by r176949
llvm-svn: 176956
2013-03-13 17:07:32 +00:00
Adrian Prantl 572f8dfea0 relax check to allow for attributes (fix buildbot for elf-ppc64)
llvm-svn: 176954
2013-03-13 16:14:44 +00:00
Daniel Jasper 0f8ed9e4e1 Fix comment indentation before labels.
Before:
switch (x) {
  // if 1, do f()
case 1:
  f();
}

After:
switch (x) {
// if 1, do f()
case 1:
  f();
}

llvm-svn: 176953
2013-03-13 15:53:12 +00:00
Daniel Jasper 8f6ae19129 Fix formatting issue with builder-type calls.
Before:
->aaaaaa()->aaaaaaaaaaa(aaaaaaaa()->aaaaaa()->aaaaa() - aaaaaaaaa()->aaaaaa()
                                                             ->aaaaa());

After:
a->aaaaaa()->aaaaaaaaaaa(aaaaaaaa()->aaaaaa()->aaaaa() -
                         aaaaaaaaa()->aaaaaa()->aaaaa());

llvm-svn: 176952
2013-03-13 15:37:48 +00:00
Alexander Kornienko 62b85b9610 Added AnnotatedToken::isOneOf + a few other refactorings
Summary: <subj>

Reviewers: djasper

Reviewed By: djasper

CC: cfe-commits, klimek

Differential Revision: http://llvm-reviews.chandlerc.com/D536

llvm-svn: 176951
2013-03-13 14:41:29 +00:00
Anton Yartsev 59ed15b052 Refactoring:
+ Individual Report* method for each bug type
+ Comment improved: missing non-trivial alloca() case annotated
+ 'range' parameter of ReportBadFree() capitalized
+ 'SymbolRef Sym = State->getSVal(A, C.getLocationContext()).getAsSymbol();' shorten to 'SymbolRef Sym = C.getSVal(A).getAsSymbol();'

llvm-svn: 176949
2013-03-13 14:39:10 +00:00
Dmitri Gribenko 3605f319dd Documentation: formatting fixes
llvm-svn: 176948
2013-03-13 14:26:35 +00:00
Edwin Vane 2e9b174da6 Reverting r176944 until Author fixes test failure.
llvm-svn: 176945
2013-03-13 13:48:47 +00:00
Edwin Vane 666f6b6de7 ClangTool output cleanup
Information messages sent to stdout by ClangTool now only happen when the -debug
flag is set.

Error messages that used to go to stdout now go to stderr.

Author: Ariel J Bernal <ariel.j.bernal@intel.com>
llvm-svn: 176944
2013-03-13 13:36:56 +00:00
Evgeniy Stepanov eeabe82762 Add llvm-symbolizer as test dependency.
It is required when building tests with ASan or MSan.

llvm-svn: 176942
2013-03-13 09:36:02 +00:00
Daniel Jasper 97b894849e Fix formatting of new arrays of pointers.
Before:
A = new SomeType * [Length];
A = new SomeType *[Length]();

After:
A = new SomeType *[Length];
A = new SomeType *[Length]();

Small formatting cleanups with clang-format.

llvm-svn: 176936
2013-03-13 07:49:51 +00:00
Evgeniy Stepanov 05826ed8a0 Set symbolizer path in the test environment.
This is needed to get symbolized stack traces when running Clang tests under (A|M)San.

llvm-svn: 176934
2013-03-13 07:10:36 +00:00
John McCall 4d31b812ad Remove trailing comma in enum list.
llvm-svn: 176926
2013-03-13 05:02:21 +00:00
John McCall cdda29c968 Tighten up the rules for precise lifetime and document
the requirements on the ARC optimizer.

rdar://13407451

llvm-svn: 176924
2013-03-13 03:10:54 +00:00
Matt Beaumont-Gay dcd053e46d Test for LLVM r176911
llvm-svn: 176912
2013-03-12 23:56:16 +00:00
Fariborz Jahanian b0df66b1ba Objective-C: In my last path, also check
for existence of user setter before 
issuing the warning about non-synthesizable
property. // rdar://13388503

llvm-svn: 176906
2013-03-12 22:22:38 +00:00
Ted Kremenek 464b07086e Make modules.m test portable, now that autolinking is dependent on whether or not the target uses the integrated assembler.
llvm-svn: 176902
2013-03-12 21:49:29 +00:00
Adrian Prantl 06e5e15ba4 Eliminate backend dependency in CFE testcase.
llvm-svn: 176901
2013-03-12 21:40:00 +00:00
Ted Kremenek acd31db0ce [driver] Only enable -fmodules-autolink if we are using the integrated assembler.
Fixes <rdar://problem/13289240>

llvm-svn: 176897
2013-03-12 21:08:08 +00:00
Rafael Espindola bf5c33b752 Whitespace cleanup.
llvm-svn: 176896
2013-03-12 21:06:00 +00:00
Adrian Prantl c782242a12 Force column info to be generated for call expressions so we can
differentiate multiple inlined call sites on the same line
in the debug info.

Fixes rdar://problem/13036237

llvm-svn: 176895
2013-03-12 20:43:25 +00:00
Jim Grosbach 061dabf7df Driver: -ccc-install-dir should affect cc1 -resource-dir
-ccc-install-dir is supposed to cause the compiler to behave as-if it
were installed in the indicated location. It almost does, but misses
anything that's relying on the resource directory (libc++ header search,
in particular). The resource dir is resolved too early, before command
line args are handled.

The fix is simply to move handling of the resource dir until after we
know if a -ccc-install-dir is present.

rdar://13402696

llvm-svn: 176894
2013-03-12 20:17:58 +00:00
Bob Wilson 897ce8c8bb Revert "Revert r166370 and r166540 now that Xcode 4.6 has been available for a while."
This reverts commit 176887.  Nico asked for more time to move to Xcode 4.6.

llvm-svn: 176892
2013-03-12 20:00:34 +00:00
Richard Smith 9deb9d9d42 Make C++11 status page more consistent: we mark entries as "done" if we
implement correct functionality, even if it's not optimal. On this basis, mark
"data dependency ordering" as done. Add footnotes for cases where our
implementation is known to be suboptimal.

llvm-svn: 176891
2013-03-12 19:56:09 +00:00
Rafael Espindola 1736f74669 Add an interesting testcase we already handle correctly.
llvm-svn: 176890
2013-03-12 19:50:10 +00:00
Fariborz Jahanian 9d25a48b41 Objective-C: Issue warning in couple of obscure cases
when property autosynthesis does not synthesize a property.
When property is declared 'readonly' in a super class and
is redeclared 'readwrite' in a subclass. When a property
autosynthesis causes it to share 'ivar' with another property.
// rdar://13388503

llvm-svn: 176889
2013-03-12 19:46:17 +00:00
Rafael Espindola f67ef79820 Move the extern "C" sema tests to a new file.
llvm-svn: 176888
2013-03-12 19:45:57 +00:00
Bob Wilson 8859471c51 Revert r166370 and r166540 now that Xcode 4.6 has been available for a while.
Those changes were added as a temporary workaround for Xcode 4.5 passing the
-Wno-arc-abi option.  Xcode 4.6 does not pass that option so this should no
longer be necessary.

llvm-svn: 176887
2013-03-12 19:39:19 +00:00
Fariborz Jahanian e92f54a010 Objective-C: Fixes a comment.
llvm-svn: 176878
2013-03-12 17:43:00 +00:00
Ted Kremenek 6209366e81 Revert "Disallow using -fmodules with -no-integrated-as."
Per comment from Benjamin Kramer, this isn't portable (yet).  I'll come up
with a better fix.

llvm-svn: 176876
2013-03-12 17:02:12 +00:00
Rafael Espindola cfd2528a46 We already reported an error for
extern "C" {
  void test5_f() {
    extern int test5_b;
  }
}
static float test5_b;

This patch makes us report one for

extern "C" {
  void test6_f() {
    extern int test6_b;
  }
}
extern "C" {
  static float test6_b;
}

Not because we think the declaration would be extern C, but because of the rule:

An entity with C language linkage shall not be declared with the same name as an entity in global scope...

We were just not looking past the extern "C" to see if the decl was in global
scope.

llvm-svn: 176875
2013-03-12 16:45:13 +00:00
Alexander Kornienko a5151271e6 Implemented formatting of rvalue references
Summary:
Handle "&&" usage as rvalue reference, added tests and fixed incorrect
tests that interfere with this feature.

http://llvm.org/bugs/show_bug.cgi?id=15051

Reviewers: djasper

Reviewed By: djasper

CC: cfe-commits, klimek

Differential Revision: http://llvm-reviews.chandlerc.com/D531

llvm-svn: 176874
2013-03-12 16:28:18 +00:00
Sean Silva 983caaacbb [docs] Add rtags to the external examples.
llvm-svn: 176871
2013-03-12 16:07:31 +00:00
Fariborz Jahanian 969d30c087 Modify comment in user test.
llvm-svn: 176870
2013-03-12 15:53:46 +00:00
Rafael Espindola b22b91c3e4 Correctly compute linkage of decls forward declared extern C.
This fixes a crash in

namespace {
  struct X {};
}
extern "C" X test2_b;
X test2_b

before we would assign different linkages to each of the test2_b decls.

llvm-svn: 176869
2013-03-12 15:22:39 +00:00
Rafael Espindola 15770b2f3d Error if an extern C declaration matches a previous hidden extern C declaration.
Without this patch we produce an error for

extern "C" {
  void f() {
    extern int b;
  }
}
extern "C" {
  extern float b;
}

but not for

extern "C" {
  void f() {
    extern int b;
  }
}
extern "C" {
  float b;
}

llvm-svn: 176867
2013-03-12 15:13:56 +00:00
Rafael Espindola b3f4b978bb Remove a bogus assert so we don't crash in
namespace {
  struct X {};
}
extern "C" {
  X b = X();
}

llvm-svn: 176866
2013-03-12 15:06:22 +00:00
Daniel Jasper 181046566c Remove bad space after "default".
Before:
switch (x) {
default : {}
}

After:
switch (x) {
default: {}
}

llvm-svn: 176861
2013-03-12 12:26:55 +00:00
Matthew Curtis 7808cf1a39 Remove driver support for Hexagon V2 and V3
Driver will now error when trying to compile for V2 or V3.

Removal of V2 and V3 support will allow us to simplify the hexagon
back-end.

llvm-svn: 176859
2013-03-12 11:52:09 +00:00
Sean Silva 03bfc678c5 [docs] Add SourceWeb as external example.
llvm-svn: 176848
2013-03-12 02:11:17 +00:00
Fariborz Jahanian 05e2aaadae Objective-C: When using super.prop, property should be
looked up the current class's super class.
// rdar://13349296

llvm-svn: 176832
2013-03-11 22:26:33 +00:00
Jordan Rose 2eb7195ee6 [analyzer] Look for calls along with lvalue nodes in trackNullOrUndefValue.
r176737 fixed bugreporter::trackNullOrUndefValue to find nodes for an lvalue
even if the rvalue node had already been collected. This commit extends that
to call statement nodes as well, so that if a call is contained within
implicit casts we can still track the return value.

No test case because node reclamation is extremely finicky (dependent on
how the AST and CFG are built, and then on our current reclamation rules,
and /then/ on how many nodes were generated by the analyzer core and the
current set of checkers). I consider this a low-risk change, though, and
it will only happen in cases of reclamation when the rvalue node isn't
available.

<rdar://problem/13340764>

llvm-svn: 176829
2013-03-11 21:31:46 +00:00
Ted Kremenek 4b3ecba537 Disallow using -fmodules with -no-integrated-as.
Modules enables features such as auto-linking, and we simply do not want to
support a matrix of subtly enabled/disabled features depending on whether or
not a user is using the integrated assembler.

It isn't clear if this is the best place to do this check.  For one thing,
these kind of errors are not caught by the serialized diagnostics.

Fixes <rdar://problem/13289240>

llvm-svn: 176826
2013-03-11 20:51:52 +00:00
Adrian Prantl 73409ce90f Improve the caching of debuginfo Objective C interface types.
Generate forward declarations that are RAUW'd by finalize().
We thus avoid outputting the same type several times in multiple
stages of completion.

llvm-svn: 176820
2013-03-11 18:33:46 +00:00
Richard Smith 06d274fdb7 Add -Wc99-compat warning for C11 unicode string and character literals.
llvm-svn: 176817
2013-03-11 18:01:42 +00:00
Jan Wen Voung 183ced44fe Partly revert "Move clang tests that depend on llvm/ADT/Statistic.h to a subdir".
This reverts commit 176730, and uses "REQUIRES: asserts" instead.

llvm-svn: 176815
2013-03-11 17:48:03 +00:00
Sean Silva cc268f0e05 [docs] Add ellipsis.
llvm-svn: 176810
2013-03-11 17:07:47 +00:00
Argyrios Kyrtzidis 1b5b1ce4f8 [libclang] Fix a test and a warning on windows.
Patch by Guy Benyei!

llvm-svn: 176806
2013-03-11 16:03:17 +00:00
Joey Gouly 4bd55d9356 Add a test case for the 'vec_type_hint' attribute that was introduced in
r176686. I missed this file in the previous commit.

llvm-svn: 176803
2013-03-11 12:38:45 +00:00
Anton Yartsev a3c9ba364e PR15480: fixed second parameter types of vec_lde, vec_lvebx, vec_lvehx, and vec_lvewx according to AltiVec Programming Interface Manual
llvm-svn: 176789
2013-03-10 16:25:43 +00:00
Benjamin Kramer b23fc91cdc Driver: do not strip file extensions when printing diagnostics.
Before: clang-3: error: no input files
After:  clang-3.3: error: no input files

This means that we'll also print clang.exe on windows, but I don't see a problem
with that.

llvm-svn: 176788
2013-03-10 13:16:18 +00:00
Guy Benyei 3832bfd557 Fix indirect byval passing of records in address spaced memory. Allocate memory on stack, and memcpy the actual value before the call.
llvm-svn: 176786
2013-03-10 12:59:00 +00:00
Richard Smith 531c9a0c27 www tweaks to embiggen up our near-complete C++11 and C11 support.
llvm-svn: 176781
2013-03-10 00:11:00 +00:00
Richard Smith 9b36209e31 When lexing in C11 mode, accept unicode character and string literals, per C11
6.4.4.4/1 and 6.4.5/1.

llvm-svn: 176780
2013-03-09 23:56:02 +00:00
Richard Smith c98bb4ed99 Handle _Pragma on a u8, u, or U string literal per the C11 specification. Also
handle raw string literals here. C++11 doesn't yet specify how they will
behave, but discussion on core suggests that we should just strip off
everything but the r-char-sequence.

llvm-svn: 176779
2013-03-09 23:30:15 +00:00
Benjamin Kramer d235d37d27 Remove unused diagnostic.
llvm-svn: 176774
2013-03-09 18:44:47 +00:00
Benjamin Kramer 36f89ccc49 Make helper function static.
llvm-svn: 176767
2013-03-09 15:15:22 +00:00
Anna Zaks 5497d1a55c [analyzer] Make Suppress IDC checker aware that it might not start from the same node it was registered at
The visitor used to assume that the value it’s tracking is null in the first node it examines. This is not true.
If we are registering the Suppress Inlined Defensive checks visitor while traversing in another visitor
(such as FindlastStoreVisitor). When we restart with the IDC visitor, the invariance of the visitor does
not hold since the symbol we are tracking no longer exists at that point.

I had to pass the ErrorNode when creating the IDC visitor, because, in some cases, node N is
neither the error node nor will be visible along the path (we had not finalized the path at that point
and are dealing with ExplodedGraph.)

We should revisit the other visitors which might not be aware that they might get nodes, which are
later in path than the trigger point.

This suppresses a number of inline defensive checks in JavaScriptCore.

llvm-svn: 176756
2013-03-09 03:23:19 +00:00
Anna Zaks ef89339986 [analyzer] Rename AttrNonNullChecker -> NonNullParamChecker
llvm-svn: 176755
2013-03-09 03:23:14 +00:00
Anna Zaks cdbca7ae77 [analyzer] Add test case for reference to null pointer param check
This tests that we track the original Expr if getDerefExpr fails.

llvm-svn: 176754
2013-03-09 03:23:10 +00:00
Jordan Rose 613f3c0022 [analyzer] Be more consistent about Objective-C methods that free memory.
Previously, MallocChecker's pointer escape check and its post-call state
update for Objective-C method calls had a fair amount duplicated logic
and not-entirely-consistent checks. This commit restructures all this to
be more consistent and possibly allow us to be more aggressive in warning
about double-frees.

New policy (applies to system header methods only):
(1) If this is a method we know about, model it as taking/holding ownership
    of the passed-in buffer.
  (1a) ...unless there's a "freeWhenDone:" parameter with a zero (NO) value.
(2) If there's a "freeWhenDone:" parameter (but it's not a method we know
    about), treat the buffer as escaping if the value is non-zero (YES) and
    non-escaping if it's zero (NO).
(3) If the first selector piece ends with "NoCopy" (but it's not a method we
    know about and there's no "freeWhenDone:" parameter), treat the buffer
    as escaping.

The reason that (2) and (3) don't explicitly model the ownership transfer is
because we can't be sure that they will actually free the memory using free(),
and we wouldn't want to emit a spurious "mismatched allocator" warning
(coming in Anton's upcoming patch). In the future, we may have an idea of a
"generic deallocation", i.e. we assume that the deallocator is correct but
still continue tracking the region so that we can warn about double-frees.

Patch by Anton Yartsev, with modifications from me.

llvm-svn: 176744
2013-03-09 00:59:10 +00:00
John McCall e4c11cc7e5 Adjust the special non-C++ enum block return type inference
so that it looks through certain syntactic forms and applies
even if normal inference would have succeeded.

There is potential for source incompatibility from this
change, but overall we feel that it produces a much
cleaner and more defensible result, and the block
compatibility rules should curb a lot of the potential
for annoyance.

rdar://13200889

llvm-svn: 176743
2013-03-09 00:54:31 +00:00
John McCall 5ea9577016 Add TagDecl::hasNameForLinkage(), which is true if the tag
is non-anonymous or is defined in a typedef of itself.

llvm-svn: 176742
2013-03-09 00:54:27 +00:00
Fariborz Jahanian cfbac5d317 Documentation parsing. Some refactoring and code
improvements per Dmtiri's comments. // rdar://12379114

llvm-svn: 176739
2013-03-08 23:59:23 +00:00
Jordan Rose bce0583627 [analyzer] Look for lvalue nodes when tracking a null pointer.
r176010 introduced the notion of "interesting" lvalue expressions, whose
nodes are guaranteed never to be reclaimed by the ExplodedGraph. This was
used in bugreporter::trackNullOrUndefValue to find the region that contains
the null or undef value being tracked.

However, the /rvalue/ nodes (i.e. the loads from these lvalues that produce
a null or undef value) /are/ still being reclaimed, and if we couldn't
find the node for the rvalue, we just give up. This patch changes that so
that we look for the node for either the rvalue or the lvalue -- preferring
the former, since it lets us fall back to value-only tracking in cases
where we can't get a region, but allowing the latter as well.

<rdar://problem/13342842>

llvm-svn: 176737
2013-03-08 23:30:56 +00:00
Jordan Rose 5ca395462e [analyzer] Don't rely on finding the correct return statement for suppression.
Previously, ReturnVisitor waited to suppress a null return path until it
had found the inlined "return" statement. Now, it checks up front whether
the return value was NULL, and suppresses the warning right away if so.

We still have to wait until generating the path notes to invalidate the bug
report, or counter-suppression will never be triggered. (Counter-suppression
happens while generating path notes, but the generation won't happen for
reports already marked invalid.)

This isn't actually an issue today because we never reclaim nodes for
top-level statements (like return statements), but it could be an issue
some day in the future. (But, no expected behavioral change and no new
test case.)

llvm-svn: 176736
2013-03-08 23:30:53 +00:00
Argyrios Kyrtzidis 51c3318b01 [libclang] Change clang_findReferencesInFile and clang_findIncludesInFile to return an enum,
as suggested by Jordan.

llvm-svn: 176732
2013-03-08 22:47:41 +00:00
Douglas Gregor f9b76cd8b5 <rdar://problem/13170740> Be a little more careful when instantiating 'this' expressions.
llvm-svn: 176731
2013-03-08 22:43:48 +00:00
Jan Wen Voung 058927b8d4 Move clang tests that depend on llvm/ADT/Statistic.h to a subdir.
The subdirectory has a lit.local.cfg that marks the tests unsupported
if llvm was built without Asserts.  There will be a patch in LLVM
that disables statistics gathering when built without Asserts so
that full Release builds can be faster.  Statistics can also
be enabled by building with -DLLVM_ENABLE_STATS.

llvm-svn: 176730
2013-03-08 22:42:02 +00:00
Jordan Rose a0a86bed71 Sema: Preserve attributes on parameters in instantiated function templates.
This was causing correctness issues for ARC and the static analyzer when a
function template has "consumed" Objective-C object parameters (i.e.
parameters that will be released by the function before returning).

The fix is threefold:
(1) Actually copy over the attributes from old ParmVarDecls to new ones.
(2) Have Sema::BuildFunctionType only work for building FunctionProtoTypes,
    which it was doing anyway. This allows us to pass an ExtProtoInfo
    instead of a plain ExtInfo and several flags.
(3) Drop param attributes as part of StripImplicitInstantiation, which is
    used when an implicit instantiation is followed by an explicit one.

<rdar://problem/12685622>

llvm-svn: 176728
2013-03-08 22:25:36 +00:00
Douglas Gregor d831d955f6 <rdar://problem/13094134> Don't try to wire up typedef names for invalid anonymous tag declarations encountered during template instantiation.
llvm-svn: 176727
2013-03-08 22:15:15 +00:00
Jordan Rose 5c38272c1a ArrayRef-ize ASTContext::getFunctionType and Sema::BuildFunctionType.
No (intended) functionality change.

llvm-svn: 176726
2013-03-08 21:51:21 +00:00
Douglas Gregor a88c55b571 <rdar://problem/13140795> Transform the scope type of a pseudo-destructor expression within the object scope.
We were transforming the scope type of a pseudo-destructor expression
(e.g., the first T in x->T::~T()) as a freestanding type, which meant
that dependent template specialization types here would stay dependent
even when no template parameters were named. This would eventually
mean that a dependent expression would end up in what should be
fully-instantiated ASTs, causing IRgen to assert.

llvm-svn: 176723
2013-03-08 21:25:01 +00:00
Argyrios Kyrtzidis c4720399ec [PCH] When complaining that a header from the PCH was modified, also mention
the filename of the PCH file.

llvm-svn: 176717
2013-03-08 20:42:38 +00:00
Argyrios Kyrtzidis 951f61fae2 [libclang] Modify clang_findReferencesInFile and clang_findIncludesInFile to return a value.
Possible values are:
 1  : if a parameter was invalid
 -1 : if the callback returned CXVisit_Break,
 otherwise returns 0.

llvm-svn: 176716
2013-03-08 20:42:33 +00:00
Manuel Klimek 5085d9b275 Fixes breaking of string literals.
1. We now ignore all non-default string literals, including raw
literals.
2. We do not break inside escape sequences any more.

FIXME: We still break in trigraphs.
llvm-svn: 176710
2013-03-08 18:59:48 +00:00
Benjamin Kramer 22210a450d Remove unused variable.
llvm-svn: 176704
2013-03-08 17:04:47 +00:00
Joey Gouly aba589cceb Add support for the OpenCL attribute 'vec_type_hint'.
Patch by Murat Bolat!

llvm-svn: 176686
2013-03-08 09:42:32 +00:00
Argyrios Kyrtzidis 503c83ad81 [libclang] Introduce clang_findIncludesInFile, that can be used to retrieve all #import/#include directives in a specific file.
It passes to the visitor, that the caller provides, CXCursor_InclusionDirective cursors for
all the include directives in a particular file.

llvm-svn: 176682
2013-03-08 02:32:34 +00:00
Argyrios Kyrtzidis 733136952e [libclang] When calling the function of CXCursorAndRangeVisitor, don't forget to
stop visitation if it returns CXVisit_Break.

llvm-svn: 176681
2013-03-08 02:32:29 +00:00
Argyrios Kyrtzidis ba4b5f8646 [libclang] Add Logger::operator<< overloads for CXCursor and FileEntry.
llvm-svn: 176680
2013-03-08 02:32:26 +00:00
Chad Rosier 09d607ecf1 [driver] If we're just linking, don't report --param X as unused option.
PR15327
rdar://13372628

llvm-svn: 176670
2013-03-08 00:05:21 +00:00
Fariborz Jahanian a649eee9e8 HeaderDoc: Support more of HeaderDoc documentation
commands; top level tags such as @interface and
their 2nd level tags such as @coclass, etc.
// rdar://12379114

llvm-svn: 176667
2013-03-07 23:33:11 +00:00
Douglas Gregor 61e368182d Add code completion for @import <rdar://problem/13344306>.
llvm-svn: 176666
2013-03-07 23:26:24 +00:00
Douglas Gregor b5af2e9c5a Improve LLDB's implicit cast-to-id to work with C++11 auto and any Objective-C object type <rdar://problem/13338107>.
llvm-svn: 176665
2013-03-07 22:57:58 +00:00
Douglas Gregor ca00645e4c When possible, move __block variables to the heap rather than copying them.
Fixes <rdar://problem/13330126>.

llvm-svn: 176663
2013-03-07 22:38:24 +00:00
John McCall a8ec7eb9cf Promote atomic type sizes up to a power of two, capped by
MaxAtomicPromoteWidth.  Fix a ton of terrible bugs with
_Atomic types and (non-intrinsic-mediated) loads and stores
thereto.

llvm-svn: 176658
2013-03-07 21:37:17 +00:00
John McCall fc207f2d70 Move the atomics code into its own file.
llvm-svn: 176657
2013-03-07 21:37:12 +00:00
John McCall 47fb950871 Change hasAggregateLLVMType, which conflates complex and
aggregate types in a profoundly wrong way that has to be
worked around in every call site, to getEvaluationKind,
which classifies and distinguishes between all of these
cases.

Also, normalize the API for loading and storing complexes.

I'm working on a larger patch and wanted to pull these
changes out, but it would have be annoying to detangle
them from each other.

llvm-svn: 176656
2013-03-07 21:37:08 +00:00
John McCall b1b5d0b1e8 Add CharUnits::alignmentAtOffset.
llvm-svn: 176655
2013-03-07 21:37:02 +00:00
John McCall bea4c3d8c4 Evaluate compound literals directly into the result aggregate
when that aggregate isn't potentially aliased.

llvm-svn: 176654
2013-03-07 21:36:54 +00:00
Benjamin Kramer 95e1936477 Remove temporary std::vectors that ca be replaced with ArrayRef's magic.
llvm-svn: 176653
2013-03-07 21:18:31 +00:00
Daniel Jasper f71cf3bd3e Remove unncessary whitespace when triggered on empty line.
With the cursor located at "I", clang-format would not do anything to:

int a;

   I

  int b;

With this patch, it reduces the number of empty lines as necessary, and
removes unnecessary whitespace. It does not change/reformat "int a;" or
"int b;".

llvm-svn: 176650
2013-03-07 20:50:00 +00:00
Edwin Vane 2a760d02f7 Adding lvalue and rvalue reference type matchers
Updated docs and tests.
    
Reviewers: klimek, gribozavr

llvm-svn: 176630
2013-03-07 15:44:40 +00:00
Guy Benyei 5ea30273a1 Add 'e' to the SPIR data layout - SPIR is little endian for now.
Add 32/64 bit specific target defines for SPIR.

llvm-svn: 176629
2013-03-07 13:06:10 +00:00
Matthew Curtis 7ab8b2b2e0 Minor refactor of how we get compilation phases.
There is now a single function to get the list of phases for a given
output Type.

No functionality change intended.

llvm-svn: 176628
2013-03-07 12:32:26 +00:00
Nick Lewycky 9164513e4f Fix build with clang, this was supposed to be part of r176617.
llvm-svn: 176619
2013-03-07 08:42:27 +00:00
Nick Lewycky 737a452173 Add flags for additional control over coverage generation. Pick the version
string to be emitted, and two properties about the files themselves.

Use $PWD to absolut-ify the path to the coverage file. Yes, this is what GCC
does. Reverts my own r175706.

llvm-svn: 176617
2013-03-07 08:28:53 +00:00
Anna Zaks 9e0da9e070 [analyzer] Warn on passing a reference to null pointer as an argument in a call
Warn about null pointer dereference earlier when a reference to a null pointer is
passed in a call. The idea is that even though the standard might allow this, reporting
the issue earlier is better for diagnostics (the error is reported closer to the place where
the pointer was set to NULL). This also simplifies analyzer’s diagnostic logic, which has
to track “where the null came from”. As a consequence, some of our null pointer
warning suppression mechanisms started triggering more often.

TODO: Change the name of the file and class to reflect the new check.
llvm-svn: 176612
2013-03-07 03:02:36 +00:00
Rafael Espindola 2199c126f5 Don't duplicate function names. Thanks to Jordan Rose for pointing it out.
llvm-svn: 176609
2013-03-07 02:43:24 +00:00
Rafael Espindola 45b620aab5 Add a hasExternalLinkage helper. No functionality change.
llvm-svn: 176607
2013-03-07 02:00:27 +00:00
Rafael Espindola 8f326a5a39 Add a hasExternalStorageAsWritten helper. No functionality change.
It is possible that some of the current uses of
"getStorageClassAsWritten() == SC_Extern" should use this but I don't know
enough about SC_PrivateExtern to change and test them.

llvm-svn: 176606
2013-03-07 01:42:44 +00:00
Rafael Espindola ee86f00f6e Fix typo.
llvm-svn: 176603
2013-03-07 01:34:57 +00:00
Jordan Rose b41977f852 [analyzer] Check for returning null references in ReturnUndefChecker.
Officially in the C++ standard, a null reference cannot exist. However,
it's still very easy to create one:

int &getNullRef() {
  int *p = 0;
  return *p;
}

We already check that binds to reference regions don't create null references.
This patch checks that we don't create null references by returning, either.

<rdar://problem/13364378>

llvm-svn: 176601
2013-03-07 01:23:25 +00:00
Jordan Rose 6f09928d5b [analyzer] Clean up a few doc comments for ProgramState and CallEvent.
No functionality change.

llvm-svn: 176600
2013-03-07 01:23:14 +00:00
Adrian Prantl a03a85a425 Ensure that DIType is regenerated after we visit an implementation
that adds ivars to an interface.

Fixes rdar://13175234

This is an update to r176116 that performs a smart caching of interfaces.

llvm-svn: 176584
2013-03-06 22:03:30 +00:00
Anna Zaks 23c85ed52b [analyzer] Pass the correct Expr to the bug reporter visitors when dealing with CompoundLiteralExpr
This allows us to trigger the IDC visitor in the added test case.

llvm-svn: 176577
2013-03-06 20:26:02 +00:00
Anna Zaks 6fe2fc633a [analyzer] IDC: Add config option; perform the idc check on first “null node” rather than last “non-null”.
The second modification does not lead to any visible result, but, theoretically, is what we should
have been looking at to begin with since we are checking if the node was assumed to be null in
an inlined function.

llvm-svn: 176576
2013-03-06 20:25:59 +00:00
Argyrios Kyrtzidis 7d23857a07 [PCH] When pre-validating the headers from the PCH, only validate non-system headers.
Stat'ing all the headers from the PCH to make sure they are up-to-date takes significant time.
In a particular source file (whose PCH file included Cocoa.h) from total -fsyntax-only time
12% was just stat calls. Change pre-validation to only check non-system headers.

There are some notable disadvantages:

-If a system header, that is not include-guarded, changes after the PCH was created, we will not
find it in the header info table and we will #import it, effectively #importing it twice, thus
we will emit some error due to a multiple definition and after that the "header was modified" error will likely
be emitted, for example something like:

NSDictionary.h:12:1: error: duplicate interface definition for class 'NSDictionary'
@interface NSDictionary : NSObject <NSCopying, NSMutableCopying, NSSecureCoding, NSFastEnumeration>
^
NSDictionary.h:12:12: note: previous definition is here
@interface NSDictionary : NSObject <NSCopying, NSMutableCopying, NSSecureCoding, NSFastEnumeration>
           ^
fatal error: file 'NSDictionary.h' has been modified since the precompiled header was built

Though we get the "header was modified" error, this is a bit confusing.

-Theoretically it is possible that such a system header will cause no errors but it will just cause an
unfortunate semantic change, though I find this rather unlikely.

The advantages:

-Reduces compilation time when using a huge PCH like the Cocoa ones
-System headers change very infrequent and when they do, users/build systems should be able to know that
re-building from scratch is needed.

Addresses rdar://13056262

llvm-svn: 176567
2013-03-06 18:12:50 +00:00
Argyrios Kyrtzidis 5c2a345e48 [PCH] For HeaderFileInfoTrait, hash the key using size & time of the file.
Previously the hash would be the filename portion of the path, which could be
different for a filename with different case or a symbolic link with a different
name completely.
This did not actually create any issue so far because by validating all headers
in the PCH we created uniqued FileEntries based on inodes, so an #include of
a symbolic link (refering to a file from the PCH) would end up with a FileEntry
with filename same as the one recorded in the PCH.

llvm-svn: 176566
2013-03-06 18:12:47 +00:00
Argyrios Kyrtzidis 61a3896d9f [PCH] We don't need to instantiate HeaderFileInfoTrait in ASTReader more than once.
We can just re-use the one from HeaderFileInfoLookupTable.

llvm-svn: 176565
2013-03-06 18:12:44 +00:00
Argyrios Kyrtzidis b42863e258 [PCH] Remove a couple of fields from serialization::reader::HeaderFileInfoTrait that are not used for anything.
llvm-svn: 176564
2013-03-06 18:12:41 +00:00
Fariborz Jahanian ff81b824a2 Spell Objective-C correctly.
llvm-svn: 176563
2013-03-06 17:55:30 +00:00
Fariborz Jahanian 41bb7131b3 say objective-C in the warning and streamline
several diagnostics into one. // rdar://13094352

llvm-svn: 176560
2013-03-06 17:36:51 +00:00
Dmitri Gribenko 15225aee17 Driver: add support for new style multiarch in Ubuntu 13.04
Patch by Sanne Wouda.

llvm-svn: 176557
2013-03-06 17:14:05 +00:00
Edwin Vane 0a4836ed0e New ASTMatchers and enhancement to hasOverloadedOperatorName
Added two new narrowing matchers:
* hasMethod: aplies a matcher to a CXXRecordDecl's methods until a match is made
  or there are no more methods.
* hasCanonicalType: applies a matcher to a QualType's canonicalType.

Enhanced hasOverloadedOperatorName to work on CXXMethodDecl as well as
CXXOperatorCallExpr.

Updated tests and docs.

Reviewers: klimek, gribozavr
llvm-svn: 176556
2013-03-06 17:02:57 +00:00
Alexey Samsonov a1c0a2a2c6 [Sanitize] Don't emit function attribute sanitize_address/thread/memory if the function is blacklisted.
llvm-svn: 176550
2013-03-06 10:54:18 +00:00
Weiming Zhao ff2a3ad81b revert r176531 due to clan-native-arm fails
llvm-svn: 176544
2013-03-06 02:08:54 +00:00
Richard Smith 5afcdf3f1c PR15390: If a function returns a pointer to a function, that function type
can't have default arguments even though it's a parameter-declaration-clause in
a function declaration.

llvm-svn: 176542
2013-03-06 01:37:38 +00:00
Richard Smith 7b24254e91 After issuing a diagnostic for undefining or redefining a builtin macro,
continue parsing the directive rather than silently discarding it.

Allowing undef or redef of __TIME__ and __DATE__ is important to folks
who want stable, reproducible builds.

llvm-svn: 176540
2013-03-06 00:46:00 +00:00
Fariborz Jahanian 47ef466b0f objective-C: don't crash after diagnosing
using object subscripting without declaring objectForKeyedSubscript:
// rdar://13333205

llvm-svn: 176539
2013-03-06 00:37:40 +00:00
Douglas Gregor 551eedbd27 Remove unused static variable.
llvm-svn: 176535
2013-03-05 23:59:13 +00:00
Jordan Rose 67b66231a8 Preprocessor: don't keep comments under -traditional-cpp.
This patch is designed for minimal intrusion into normal preprocessing
and compilation; under -E -traditional-cpp, the lexer will still
generate tok::comment nodes since it is preserving all whitespace, but
the output printer will then throw it away.

<rdar://problem/13338680>

llvm-svn: 176534
2013-03-05 23:54:55 +00:00
Weiming Zhao a35cc6fb6b PR 11326: Lack diagnosic message when ABI conflicts on ARM
When both Triple and -mabi are used, it may result into conflicting ABI value.

llvm-svn: 176531
2013-03-05 23:27:21 +00:00
Fariborz Jahanian a668bf548d fix a missing check in my last patch.
// rdar://13094352

llvm-svn: 176529
2013-03-05 23:20:29 +00:00
Jordan Rose 864b810739 Preprocessor: don't consider // to be a line comment in -E -std=c89 mode.
It's beneficial when compiling to treat // as the start of a line
comment even in -std=c89 mode, since it's not valid C code (with a few
rare exceptions) and is usually intended as such. We emit a pedantic
warning and then continue on as if line comments were enabled.
This has been our behavior for quite some time.

However, people use the preprocessor for things besides C source files.
In today's prompting example, the input contains (unquoted) URLs, which
contain // but should still be preserved.

This change instructs the lexer to treat // as a plain token if Clang is
in C90 mode and generating preprocessed output rather than actually compiling.

<rdar://problem/13338743>

llvm-svn: 176526
2013-03-05 22:51:04 +00:00
Fariborz Jahanian 56fe4066e5 doc. parsing. Improve on diagnostics on my last patch.
// rdar://13094352.

llvm-svn: 176525
2013-03-05 22:46:07 +00:00
Richard Smith 115314926d Remove outdated claim that GCC builds without a C++ compiler from compilers comparison.
llvm-svn: 176515
2013-03-05 21:49:52 +00:00
Lang Hames 224ae88bc3 Use ASTContext::getDeclAlign(<Field Decl>) to get the alignment of the first
field to be memcpy'd, rather instead of ASTContext::getTypeAlign(<Field Type>).
For packed structs the alignment of a field may be less than the alignment of
the field's type.

<rdar://problem/13338585>

llvm-svn: 176512
2013-03-05 20:27:24 +00:00
Argyrios Kyrtzidis 37f2ab4824 [libclang] When logging a CXTranslationUnit that came from an AST file, print out the filename.
llvm-svn: 176511
2013-03-05 20:21:14 +00:00
Fariborz Jahanian 43c8df8153 Fix this checkin.
llvm-svn: 176510
2013-03-05 19:52:24 +00:00
Fariborz Jahanian f4ba35d809 doc parsing. Add @method and @callback for
checkings and few other refactoring/cleanup.
// rdar://13094352.

llvm-svn: 176509
2013-03-05 19:40:47 +00:00
Jack Carter beaccddcba Mips specific inline assembler constraint 'R'
'R' An address that can be sued in a non-macro load or store.

Including missing positive test case and fixed typo for r176453.

Thanks to Richard Smith for catching this!

Jack

llvm-svn: 176506
2013-03-05 19:10:54 +00:00
Edwin Vane eec9a93262 Make LibASTMatchersTutorial code match text
Fixed code to match text. Slight adjustment for readability.

Author: Béatrice Creusillet
llvm-svn: 176493
2013-03-05 18:04:37 +00:00
Dmitri Gribenko 68a0668453 Documentation: use code highlighting
llvm-svn: 176480
2013-03-05 13:05:56 +00:00
David Chisnall 87aeeecc65 Add a test that we are passing the -fobjc-default-synthesize flag for Apple and
non-Apple platforms.

llvm-svn: 176477
2013-03-05 11:20:04 +00:00
Richard Smith 49af629057 Don't emit calls to virtual [[noreturn]] functions as noreturn; overrides of a
[[noreturn]] function are not required to also be [[noreturn]]. We still emit
calls to virtual __attribute__((noreturn)) functions as noreturn; unlike GCC,
we do require overriders to also be noreturn for that attribute.

llvm-svn: 176476
2013-03-05 08:30:04 +00:00
David Blaikie e750491ff3 Add quotation marks to template names in diagnostics.
llvm-svn: 176474
2013-03-05 06:21:38 +00:00
Jordan Rose 838b72f6b5 scan-build: explicitly say "No bugs found" if there are no reports.
Patch by Martin Storsjo!

llvm-svn: 176472
2013-03-05 02:33:08 +00:00
Jordan Rose d03d99da16 Silence a number of static analyzer warnings with assertions and such.
No functionality change.

llvm-svn: 176469
2013-03-05 01:27:54 +00:00
Fariborz Jahanian 8a7a59226d doc parsing. We want to issue a strong warning when
an @function comment is not followed by a function decl.
// rdar://13094352

llvm-svn: 176468
2013-03-05 01:05:07 +00:00
Jordan Rose 85707b28e8 [analyzer] Don't let cf_audited_transfer override CFRetain semantics.
We weren't treating a cf_audited_transfer CFRetain as returning +1 because
its name doesn't contain "Create" or "Copy". Oops! Fortunately, the
standard definitions of these functions are not marked audited.

<rdar://problem/13339601>

llvm-svn: 176463
2013-03-04 23:21:32 +00:00
Dmitri Gribenko bcf7f4d3bb Comment parsing: refactor handling of command markers in AST
* Use the term 'command marker', because the semantics of 'backslash' and 'at'
  commands are the same.  (Talking about 'at commands' makes them look like a
  special entity.)

* Sink the flag down into bitfields, reducing the size of AST nodes.

* Change the flag into an enum for clarity.  Boolean function parameters are
  not very clear.

* Add unittests for new tok::at_command tokens.

llvm-svn: 176461
2013-03-04 23:06:15 +00:00
Bob Wilson 743bf67caf Add ARM v6m, v7m, and v7em architectures for Cortex-M series processors.
<rdar://problem/11314476>

llvm-svn: 176458
2013-03-04 22:37:49 +00:00
Bob Wilson f643afcd31 Tidy up lists of Cortex-A series processors, adding entries for A7.
Also fix a missing entry for cortex-r5 in one copy of getLLVMArchSuffixForARM.

llvm-svn: 176457
2013-03-04 22:37:46 +00:00
Bob Wilson 872f04d19d Fix confused use of llvm::StringSwitch for armv7r architecture.
svn 170909 added support for cortex-r5 but in this case it was done
incorrectly. The last argument to StringSwitch.Cases() is the replacement
value, so by adding "cortex-r5" it changed the default cpu for armv7r to
cortex-r5 instead of cortex-r4.

llvm-svn: 176456
2013-03-04 22:37:43 +00:00
Jack Carter 427b404d0a Mips specific inline assembler constraint 'R'
'R' An address that can be sued in a non-macro load or store.
This patch includes a positive test case.

llvm-svn: 176453
2013-03-04 21:36:11 +00:00
Argyrios Kyrtzidis 2a513e8218 [PCH] In HeaderFileInfoTrait::EqualKey(), use FileManager::getFile() to compare two filenames, instead of llvm::sys::fs::equivalent().
llvm::sys::fs::equivalent() does 2 stat calls every time it's called. Use FileManager::getFile() to take advantage
of the stat caching that FileManager is providing.

llvm-svn: 176450
2013-03-04 20:33:40 +00:00
Dmitri Gribenko 05e22f2ef0 Comment parsing tests: move a test into a group of similar tests
llvm-svn: 176449
2013-03-04 20:23:16 +00:00
Fariborz Jahanian c551ecc8f0 [comment parsing] source fidelity for tparam command too.
// rdar://13066276

llvm-svn: 176448
2013-03-04 20:08:47 +00:00
Manuel Klimek abf6e03bc1 Make sure to not split string literals at the first character.
llvm-svn: 176447
2013-03-04 20:03:38 +00:00
Dmitri Gribenko fd5ef42830 warn-documentation.cpp: reorganize tests
Tests are ordered by command in this file.  It is nice to keep it that way.

llvm-svn: 176445
2013-03-04 19:39:33 +00:00
Fariborz Jahanian 5f2a813d2a comment parsing. Missed a case of referring
to original command in diagnostic. // rdar://13066276

llvm-svn: 176444
2013-03-04 18:53:41 +00:00
Edwin Vane 6972f6d3c7 hasQualifer() matcher should return false if there's no qualifier
Instead of passing NULL on to sub-matcher, just return false. Updated tests and
regenerated docs.

Author: Tareq A Siraj <tareq.a.siraj@intel.com>
llvm-svn: 176441
2013-03-04 17:51:00 +00:00
Tom Stellard c74b1e054c R600: Use the GPU type to determine the correct DataLayout v2
v2:
  - Add R600_DOUBLE_OPS for RV670
  - s/CPU/GPU/

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
llvm-svn: 176440
2013-03-04 17:40:53 +00:00
Daniel Jasper 973c9420e1 Format a line if a range in its leading whitespace was selected.
With [] marking the selected range, clang-format invoked on

    [  ]   int a;

Would so far not reformat anything. With this patch, it formats a
line if its leading whitespace is touched.

llvm-svn: 176435
2013-03-04 13:43:19 +00:00
Manuel Klimek 3de6d3a2a0 Make the tutorial easier to compile by adding in some of the details.
Patch by Béatrice Creusillet.

llvm-svn: 176434
2013-03-04 11:31:46 +00:00
John McCall 02ba35092b Correction to r176432: the bug actually fixed was <rdar://13025708>.
llvm-svn: 176433
2013-03-04 07:35:41 +00:00
John McCall cc5788c5ce Centralize and refine the __unknown_anytype argument rules
and be sure to apply them whether or not the debugger gave
us a method declaration.

rdar://12565338

llvm-svn: 176432
2013-03-04 07:34:02 +00:00
John McCall a37c2fa409 Fix the emission of the copy-initialization of a block capture
from a lambda capture when the capture is not trivially-copyable.

rdar://13295759

llvm-svn: 176431
2013-03-04 06:32:36 +00:00
Chandler Carruth 58d6eb6d03 Check for warnings in a bunch of the linker invocations, and add one
with both -static-libgcc and -static on the commandline.

Fix a warning in the latter case due to a backwards short circuiting ||
operator in the driver. No real functionality changed here, just allows
the driver to properly consume -static-libgcc when -static is also
specified.

llvm-svn: 176429
2013-03-04 02:07:55 +00:00
John McCall f22d0acfac Perform non-overload placeholder conversions on the operands
to a subscript operator.

rdar://13332183

llvm-svn: 176428
2013-03-04 01:30:55 +00:00
Chandler Carruth 4588e349b0 Beef up the testing of our 'ld' invocation on linux to cover static
linking. About to fix a bug here and there was no good test case.

llvm-svn: 176427
2013-03-04 01:27:49 +00:00
Dmitri Gribenko 80bfa95d5b Add an idea for a cpp11-migrate tool: TR1 migration
Idea by Marshall Clow.

llvm-svn: 176423
2013-03-03 17:54:36 +00:00
David Chisnall 168a15188e Remove unused check from test.
llvm-svn: 176422
2013-03-03 17:50:06 +00:00
Sean Silva d4ac85d21a [docs] Spelling
llvm-svn: 176421
2013-03-03 17:07:35 +00:00
David Chisnall ef78c305fa Improve C11 atomics support:
- Generate atomicrmw operations in most of the cases when it's sensible to do
  so.
- Don't crash in several common cases (and hopefully don't crash in more of
  them).
- Add some better tests.

We now generate significantly better code for things like:
_Atomic(int) x;
...
x++;

On MIPS, this now generates a 4-instruction ll/sc loop, where previously it
generated about 30 instructions in two nested loops.  On x86-64, we generate a
single lock incl, instead of a lock cmpxchgl loop (one instruction instead of
ten).

llvm-svn: 176420
2013-03-03 16:02:42 +00:00
David Chisnall e0a5c0d914 Default to enabling default-synthesized ivars on all platforms
llvm-svn: 176419
2013-03-03 15:36:10 +00:00
Sean Silva edd5ca5a36 [docs] Use vim code-block instead of console.
llvm-svn: 176418
2013-03-03 15:17:35 +00:00
Rafael Espindola de6a39f759 Process #pragma weak only after we know the linkage of the function or variable
we are looking at.

llvm-svn: 176414
2013-03-02 21:41:48 +00:00
Peter Collingbourne fe7a348614 CommandLineArgumentParser: handle single quotes.
Differential Revision: http://llvm-reviews.chandlerc.com/D482

llvm-svn: 176404
2013-03-02 06:00:16 +00:00
Anna Zaks 8d7c8a4dd6 [analyzer] Simple inline defensive checks suppression
Inlining brought a few "null pointer use" false positives, which occur because
the callee defensively checks if a pointer is NULL, whereas the caller knows
that the pointer cannot be NULL in the context of the given call.

This is a first attempt to silence these warnings by tracking the symbolic value
along the execution path in the BugReporter. The new visitor finds the node
in which the symbol was first constrained to NULL. If the node belongs to
a function on the active stack, the warning is reported, otherwise, it is
suppressed.

There are several areas for follow up work, for example:
 - How do we differentiate the cases where the first check is followed by
another one, which does happen on the active stack?

Also, this only silences a fraction of null pointer use warnings. For example, it
does not do anything for the cases where NULL was assigned inside a callee.

llvm-svn: 176402
2013-03-02 03:20:52 +00:00
Fariborz Jahanian e400cb70d4 Some refactoring in my patch on document
command source fidelity. // rdar://13066276

llvm-svn: 176401
2013-03-02 02:39:57 +00:00
Peter Collingbourne 2ee0b630dc LLVM API changes.
llvm-svn: 176398
2013-03-02 01:20:22 +00:00
Jordan Rose bd804e9d6a CMake: -Wno-nested-anon-types for Clang.
In LLVM, -pedantic is not set unless LLVM_ENABLE_PEDANTIC is set.
However, Clang's CMakeLists.txt unilaterally adds -pedantic to the run
line, so we need to disable -Wnested-anon-types explicitly.

llvm-svn: 176393
2013-03-02 00:49:47 +00:00
Jordan Rose 687d1d33f4 [analyzer] Update open source checker build to checker-272.
See http://clang-analyzer.llvm.org/release_notes.html for what's new
in this build.

llvm-svn: 176389
2013-03-01 23:26:05 +00:00
Jordan Rose e185d73101 [analyzer] Special-case bitfields when finding sub-region bindings.
Previously we were assuming that we'd never ask for the sub-region bindings
of a bitfield, since a bitfield cannot have subregions. However,
unification of code paths has made that assumption invalid. While we could
take advantage of this by just checking for the single possible binding,
it's probably better to do the right thing, so that if/when we someday
support unions we'll do the right thing there, too.

This fixes a handful of false positives in analyzing LLVM.

<rdar://problem/13325522>

llvm-svn: 176388
2013-03-01 23:03:17 +00:00
Fariborz Jahanian d49963609d comment parsing. Keep the original command format
in AST for source fidelity and use it in diagnostics 
to refer to the original format. // rdar://13066276

llvm-svn: 176387
2013-03-01 22:51:30 +00:00
Stefanus Du Toit b331850194 Fix typos: [Dd]iagnosic -> [Dd]iagnostic
These all appear in comments or (ironically) diagnostics output.

llvm-svn: 176383
2013-03-01 21:41:22 +00:00
Jordan Rose 801916baf1 [analyzer] Suppress paths involving a reference whose rvalue is null.
Most map types have an operator[] that inserts a new element if the key
isn't found, then returns a reference to the value slot so that you can
assign into it. However, if the value type is a pointer, it will be
initialized to null. This is usually no problem.

However, if the user /knows/ the map contains a value for a particular key,
they may just use it immediately:

   // From ClangSACheckersEmitter.cpp
   recordGroupMap[group]->Checkers

In this case the analyzer reports a null dereference on the path where the
key is not in the map, even though the user knows that path is impossible
here. They could silence the warning by adding an assertion, but that means
splitting up the expression and introducing a local variable. (Note that
the analyzer has no way of knowing that recordGroupMap[group] will return
the same reference if called twice in a row!)

We already have logic that says a null dereference has a high chance of
being a false positive if the null came from an inlined function. This
patch simply extends that to references whose rvalues are null as well,
silencing several false positives in LLVM.

<rdar://problem/13239854>

llvm-svn: 176371
2013-03-01 19:45:10 +00:00
Daniel Jasper a79064a88f Remove whitespace at end of file.
This fixes the rest of llvm.org/PR15062.

llvm-svn: 176361
2013-03-01 18:11:39 +00:00
Daniel Jasper 8eb371b3cc Correctly format arrays of pointers and function types.
Before:
void f(Type(*parameter)[10]) {}
int(*func)(void *);

After:
void f(Type (*parameter)[10]) {}
int (*func)(void *);

llvm-svn: 176356
2013-03-01 17:13:29 +00:00
Argyrios Kyrtzidis 7c9ba11747 [PCH] Remove building a SmallPtrSet that is not actually used for anything.
llvm-svn: 176354
2013-03-01 17:01:31 +00:00
Daniel Jasper f9a84b5f57 Normal indent for last element of builder-type call.
In builder type call, we indent to the laster function calls.
However, for the last element of such a call, we don't need to do
so, as that normally just wastes space and does not increase
readability.

Before:
aaaaaa->aaaaaa->aaaaaa( // break
                  aaaaaa);
aaaaaaaaaaaaaaaaaaaaa->aaaaaaaaaaaaaaaaaaaaaa
    ->aaaaaaaaaaaaaaaaaaaaaaaaaa(
        aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa);

After:
aaaaaa->aaaaaa->aaaaaa( // break
    aaaaaa);
aaaaaaaaaaaaaaaaaaaaa->aaaaaaaaaaaaaaaaaaaaaa->aaaaaaaaaaaaaaaaaaaaaaaaaa(
    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa);

llvm-svn: 176352
2013-03-01 16:48:32 +00:00
Daniel Jasper 3324cbefcd Remove trailing whitespace of line comments.
This fixed llvm.org/PR15378.

llvm-svn: 176351
2013-03-01 16:45:59 +00:00
Manuel Klimek e317d1b1e8 Implements breaking string literals at slashes.
We now break at a slash if we do not find a space to break on.

Also fixes a bug where we would go over the limit when breaking the
second line.

llvm-svn: 176350
2013-03-01 13:29:19 +00:00
Manuel Klimek b176cff89d Implement fallback split point for string literals.
If we don't find a natural split point (currently space) in a string
literal protruding over the line, we just split at the last possible
point.

llvm-svn: 176349
2013-03-01 13:14:08 +00:00
John McCall 80c93a0793 Perform the receiver-expression transformations regardless of
whether we already have a method.  Fixes a bug where we were
failing to properly contextually convert a message receiver
during template instantiation.

As a side-effect, we now actually perform correct method lookup
after adjusting a message-send to integral or non-ObjC pointer
types (legal outside of ARC).

rdar://13305374

llvm-svn: 176339
2013-03-01 09:20:14 +00:00
John McCall 73fc0385de Attempt to not place ownership qualifiers on the result type
of block declarators.  Document the rule we use.

Also document the rule that Doug implemented a few weeks ago
which drops ownership qualifiers on function result types.

rdar://10127067

llvm-svn: 176336
2013-03-01 07:58:16 +00:00
Anna Zaks 4a8a015f13 [analyzer] Reword FAQ
Reword the FAQ to stress more that the assert should be used only in case
the developer is sure that the issue is a false positive.

llvm-svn: 176335
2013-03-01 06:38:16 +00:00
Argyrios Kyrtzidis 1ca7344506 Add one more sanity check in SourceManager::getFileIDLoaded().
llvm-svn: 176333
2013-03-01 03:43:33 +00:00
Argyrios Kyrtzidis 61c3d8778c [PCH] Enhance InputFile to also include whether the file is out-of-date.
Previously we would return null for an out-of-date file. This inhibited ASTReader::ReadSLocEntry
from creating a FileID to recover gracefully in such a case.

llvm-svn: 176332
2013-03-01 03:26:04 +00:00
Argyrios Kyrtzidis 7dc4f33c77 In SourceManager::getFileIDLoaded(), add some sanity checks to make sure we don't enter an infinite loop.
rdar://13120919

llvm-svn: 176331
2013-03-01 03:26:00 +00:00
John McCall e739a49325 Restore order to placate test. I had no real reason to switch them.
llvm-svn: 176328
2013-03-01 01:38:54 +00:00
John McCall 07e60263dd Re-use bit from superclass and extract stuff into a local
function.  Serves a patch we're kicking around out-of-tree.

llvm-svn: 176327
2013-03-01 01:24:35 +00:00
Fariborz Jahanian a1b9b3f599 Fix warning text of my last patch.
// rdar://13158394

llvm-svn: 176308
2013-02-28 23:16:39 +00:00
Bill Wendling 706469b453 Add more of the command line options as attribute flags.
These can be easily queried by the back-end.

llvm-svn: 176304
2013-02-28 22:49:57 +00:00
Fariborz Jahanian d838bba59b objective-C: clang, following gcc, warns on
use of stand-alone protocol as type and uses
id<proto>. Modify warning to say what compiler 
is doing. // rdar//13158394

llvm-svn: 176303
2013-02-28 22:36:31 +00:00
John McCall 882987f30c Use the actual ABI-determined C calling convention for runtime
calls and declarations.

LLVM has a default CC determined by the target triple.  This is
not always the actual default CC for the ABI we've been asked to
target, and so we sometimes find ourselves annotating all user
functions with an explicit calling convention.  Since these
calling conventions usually agree for the simple set of argument
types passed to most runtime functions, using the LLVM-default CC
in principle has no effect.  However, the LLVM optimizer goes
into histrionics if it sees this kind of formal CC mismatch,
since it has no concept of CC compatibility.  Therefore, if this
module happens to define the "runtime" function, or got LTO'ed
with such a definition, we can miscompile;  so it's quite
important to get this right.

Defining runtime functions locally is quite common in embedded
applications.

llvm-svn: 176286
2013-02-28 19:01:20 +00:00
Hans Wennborg c32d513385 ClangFormat.rst: Fix two small typos
llvm-svn: 176276
2013-02-28 18:16:24 +00:00
Manuel Klimek bd5ac98277 Fix a problem where 'clang' is ambiguous in MSVC builds.
llvm-svn: 176275
2013-02-28 18:12:44 +00:00
Fariborz Jahanian 07cde21584 Add comment to my last test.
llvm-svn: 176272
2013-02-28 18:03:28 +00:00
Fariborz Jahanian 15a0b55c97 objective-C code completion. Property accessors may not
have their own code completion comments. Use those in 
their properties in this case. 
// rdar://12791315

llvm-svn: 176271
2013-02-28 17:47:14 +00:00
Daniel Jasper a400cab43a Reduce penalty for splitting after "{" in static initializers.
This fixes llvm.org/PR15379.

Before:
const uint8_t aaaaaaaaaaaaaaaaaaaaaa[0] = { 0x00, 0x00, 0x00, 0x00, 0x00,
                                            0x00,                  // comment
                                            0x00, 0x00, 0x00, 0x00, 0x00,
                                            0x00,                  // comment
                                            0x00, 0x00, 0x00, 0x00 // comment
};

After:
const uint8_t aaaaaaaaaaaaaaaaaaaaaa[0] = {
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // comment
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // comment
  0x00, 0x00, 0x00, 0x00              // comment
};

llvm-svn: 176262
2013-02-28 15:04:12 +00:00
Daniel Jasper 9a23be7451 Dont break between (( in __attribute__((.
Before:
void aaaaaaaaaaaaaaaaaa() __attribute__(
    (aaaaaaaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaaaaaaa,
     aaaaaaaaaaaaaaaaaaaaaaaaa));

After:
void aaaaaaaaaaaaaaaaaa()
    __attribute__((aaaaaaaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaaaaaaa,
                   aaaaaaaaaaaaaaaaaaaaaaaaa));

llvm-svn: 176260
2013-02-28 14:44:25 +00:00
David Chisnall beb8013095 Improve property metadata generation with the GNUstep runtime.
llvm-svn: 176254
2013-02-28 13:59:29 +00:00
Daniel Jasper ff6c3a9525 No spaces around pointers to members.
Before: (a ->* f)()
After:  (a->*f)()
llvm-svn: 176252
2013-02-28 13:40:17 +00:00
Manuel Klimek d4be4084b4 First step towards adding a parent map to the ASTContext.
This does not yet implement the LimitNode approach discussed.

The impact of this is an O(n) in the number of nodes in the AST
reduction of complexity for certain kinds of matchers (as otherwise the
parent map gets recreated for every new MatchFinder).

See FIXMEs in the comments for the direction of future work.

llvm-svn: 176251
2013-02-28 13:21:39 +00:00
Daniel Jasper c22f5b4abb Improve formatting of #defines.
Two improvements:
1) Always leave at least one space before "\". Otherwise is can look bad
   and there is a risk of unwillingly joining to characters to a different
   token.
2) Use the full column limit for single-line #defines.
   Fixes llvm.org/PR15148

llvm-svn: 176245
2013-02-28 11:05:57 +00:00
Daniel Jasper 57d4a5821d Fix bug when formatting "A<A<A>>".
Before:
A<A<A>> ReadKansas(int aaaaaaaaaaaaaaaaaaaaaaaaaaa,
                     int aaaaaaaaaaaaaaaaaaaaaaa);
Before:
A<A<A>> ReadKansas(int aaaaaaaaaaaaaaaaaaaaaaaaaaa,
                   int aaaaaaaaaaaaaaaaaaaaaaa);

llvm-svn: 176244
2013-02-28 10:06:05 +00:00
Daniel Jasper ead41b6b8f Fix incorrect recognition of bin-packing.
Before (in Google style):
Constructor()
    : aaaaa(aaaaaa), aaaaa(aaaaaa), aaaaa(aaaaaa), aaaaa(aaaaaa), aaaaa(
          aaaaaa) {}

After:
Constructor()
    : aaaaa(aaaaaa),
      aaaaa(aaaaaa),
      aaaaa(aaaaaa),
      aaaaa(aaaaaa),
      aaaaa(aaaaaa) {}

llvm-svn: 176242
2013-02-28 09:39:12 +00:00
Daniel Jasper d8ffcfa9b8 Fix spacing after binary operator as macro parameter.
Before: COMPARE(a, == , b);
After:  COMPARE(a, ==, b);
llvm-svn: 176241
2013-02-28 09:21:10 +00:00
Evgeniy Stepanov 00eef441ff Fix global overflow in types::lookupTypeForTypeSpecifier.
memcpy() is allowed to read entire contents of both memory areas.

Found with AddressSanitizer.

llvm-svn: 176237
2013-02-28 07:53:32 +00:00
Jordan Rose a22cd706a2 [analyzer] RegionStore: collectSubRegionKeys -> collectSubRegionBindings
By returning the (key, value) binding pairs, we save lookups afterwards.
This also enables further work later on.

No functionality change.

llvm-svn: 176230
2013-02-28 01:53:08 +00:00
Jordan Rose 4879e49c8e [analyzer] Mark the root SVal class as isPodLike.
Pure optimization, no functionality change. Probably does not make much
of a difference, but it's free.

llvm-svn: 176229
2013-02-28 01:53:03 +00:00
Argyrios Kyrtzidis 397ef40f6b Add a test case, to make sure there is no crash on IRGen when using PCH
Related to rdar://13114142

llvm-svn: 176227
2013-02-28 01:13:53 +00:00
Renato Golin 05bbce70dd Avoiding flamewars
llvm-svn: 176221
2013-02-27 23:21:44 +00:00
David Blaikie dc601e3a09 PR15360: nullptr as a non-type template argument to a function type non-type template parameter
llvm-svn: 176216
2013-02-27 22:10:40 +00:00
David Blaikie a985542ae0 Add test coverage for array to pointer decay in non-type template parameters.
Functionality committed in r172585 but tested the function case without the
array case.

llvm-svn: 176215
2013-02-27 22:10:37 +00:00
Renato Golin 4890582f2a Add config manager to open projects
llvm-svn: 176211
2013-02-27 21:28:29 +00:00
Jordan Rose 2c377feacb [analyzer] Fix test for previous commit.
llvm-svn: 176202
2013-02-27 18:57:20 +00:00
Jordan Rose f7f32d5202 [analyzer] Teach FindLastStoreBRVisitor to understand stores of the same value.
Consider this case:

  int *p = 0;
  p = getPointerThatMayBeNull();
  *p = 1;

If we inline 'getPointerThatMayBeNull', we might know that the value of 'p'
is NULL, and thus emit a null pointer dereference report. However, we
usually want to suppress such warnings as error paths, and we do so by using
FindLastStoreBRVisitor to see where the NULL came from. In this case, though,
because 'p' was NULL both before and after the assignment, the visitor
would decide that the "last store" was the initialization, not the
re-assignment.

This commit changes FindLastStoreBRVisitor to consider all PostStore nodes
that assign to this region. This still won't catches changes made directly
by checkers if they re-assign the same value, but it does handle the common
case in user-written code and will trigger ReturnVisitor's suppression
machinery as expected.

<rdar://problem/13299738>

llvm-svn: 176201
2013-02-27 18:49:57 +00:00
Jordan Rose 4587b28758 [analyzer] Turn on C++ constructor inlining by default.
This enables constructor inlining for types with non-trivial destructors.
The plan is to enable destructor inlining within the next month, but that
needs further verification.

<rdar://problem/12295329>

llvm-svn: 176200
2013-02-27 18:49:43 +00:00
Chad Rosier 6a1de5c634 [driver] The failure of any phase (e.g., preprocess, compile, assemble) for a
single translation unit should prevent later phases from executing.  Otherwise,
this generates lots of noise in build systems.  This a fallout from r173825.
Patch by Matthew Curtis <mcurtis@codeaurora.org>.
rdar://13298009

llvm-svn: 176198
2013-02-27 18:46:04 +00:00
Simon Atanasyan 0da400cf92 [Mips] Add two new aliases for MIPS ABI names 32 (means o32 abi) and 64
(means n64 abi) to improve compatibility with GNU tools.
Patch by Jia Liu <proljc@gmail.com>.

llvm-svn: 176187
2013-02-27 14:55:49 +00:00
Timur Iskhodzhanov 57cbe5c790 Better support for constructors with -cxx-abi microsoft, partly fixes PR12784
llvm-svn: 176186
2013-02-27 13:46:31 +00:00
Manuel Klimek 59b0af6381 Make the negative test of recordType depend on a specific record.
Otherwise it'll break if there's a record type in the AST by default.

llvm-svn: 176181
2013-02-27 11:56:58 +00:00
Daniel Jasper 8e55927153 Fix formatting of multiplications in array subscripts.
Before:
a[a* a] = 1;

After:
a[a * a] = 1;

llvm-svn: 176180
2013-02-27 11:43:50 +00:00
Alexey Samsonov bfb0cd355f [Sanitizer] Change driver behavior when linking with -fsanitize=thread and -fsanitize=memory. TSan/MSan also provide their versions of new/delete and should use the same strategy as ASan. Share the code that sets linker flags for all sanitizers.
llvm-svn: 176178
2013-02-27 11:14:55 +00:00
Daniel Jasper 2cf17bfcc1 Enable bin-packing in Google style.
After some discussions, it seems that this is the better path in
the long run. Does not change Chromium style, as there, bin packing
is forbidden by the style guide.

Also fix two minor bugs wrt. formatting:
1. If a call parameter is a function call itself and is split before
   the "." or "->", split before the next parameter.
2. If a call parameter is string literal that has to be split onto
   two lines, split before the next parameter.

llvm-svn: 176177
2013-02-27 09:47:53 +00:00
Nick Lewycky a0076cdbb2 Update clang for LLVM API change. No functionality change.
llvm-svn: 176174
2013-02-27 06:22:58 +00:00
Rafael Espindola 679eb4062b Don't cache the visibility of types.
Since r175326 an implicitly hidden template argument can cause a template
installation to become hidden, even if the template itself has an explicit
default visibility. This requires that we keep track of "late" additions
of the visibility attribute.

This is hopefully the last followup change. It just removes the caching of
visibilities from types so that we can see new attributes even after a type has
been used.

llvm-svn: 176164
2013-02-27 04:15:01 +00:00
Lang Hames 1694e0d21d Use the correct alignment for POD-member memcpys where the first field is a
bitfield. CGBitField::StorageAlignment holds the alignment in chars, but
emitMemcpy had been treating it as if it were held in bits, leading to
underaligned memcpys.

Related to PR15348.

Thanks very much to Chandler for the diagnosis.

llvm-svn: 176163
2013-02-27 04:14:49 +00:00
Rafael Espindola 4a5da44b34 Rename methods to comply with the LLVM Coding Standards.
llvm-svn: 176159
2013-02-27 02:56:45 +00:00
Rafael Espindola 6fbfafeddc Change Type::getLinkageAndVisibility to return a LinkageInfo.
llvm-svn: 176157
2013-02-27 02:27:19 +00:00
Rafael Espindola a8fbdab850 Move LinkageInfo out of NamedDecl so that it can be used in Type.h.
Everything that cares about visibility also cares about linkage, so I just
moved it to Visibility.h instead of creating a new .h.

llvm-svn: 176155
2013-02-27 02:15:29 +00:00
Richard Trieu 954aaaf76b Update template diffing to handle template arguments that are declarations.
llvm-svn: 176153
2013-02-27 01:41:53 +00:00
Argyrios Kyrtzidis f77453cf22 Add a test to make sure __has_include works from inside a macro.
llvm-svn: 176152
2013-02-27 01:34:48 +00:00
Adrian Prantl 68a5750d5d Temporarily revert r176116 for compile-time performance regression.
This reverts commit ea95e4587fd13606fbf63b10a07a7d02026aa39c.

llvm-svn: 176151
2013-02-27 01:31:55 +00:00
Ted Kremenek f352d8c7ec [analyzer] Add stop-gap patch to prevent assertion failure when analyzing LLVM codebase.
This potentially reduces a performance optimization of throwing away
PreStmtPurgeDeadSymbols nodes.  I'll investigate the performance impact
soon and see if we need something better.

llvm-svn: 176149
2013-02-27 01:26:58 +00:00
Argyrios Kyrtzidis ddee8c9e2b [PCH] When deserializing an IdentifierInfo, call IdentifierInfo::RevertTokenIDToIdentifier() only when it's not already an identifier.
Fixes an assertion hit.
rdar://13288735

llvm-svn: 176148
2013-02-27 01:13:51 +00:00
Fariborz Jahanian 81bbee1ed8 comment parsing: Properties are considered like methods, and people
think of them as having return values that may be computed. Don't
warn when using @return in their comment. // rdar://13189938

llvm-svn: 176147
2013-02-27 00:46:06 +00:00
John McCall d010ac9a48 Don't crash when diagnosing path-constrained protected
access to a private member to which we have special access.

rdar://12926092

llvm-svn: 176146
2013-02-27 00:08:19 +00:00
Bill Wendling 2386bb130c Reapply r176133 with testcase fixes.
llvm-svn: 176145
2013-02-27 00:06:04 +00:00
Jordan Rose 4a7bf49bd4 [analyzer] If a struct has a partial lazy binding, its fields aren't Undef.
This is essentially the same problem as r174031: a lazy binding for the first
field of a struct may stomp on an existing default binding for the
entire struct. Because of the way RegionStore is set up, we can't help
but lose the top-level binding, but then we need to make sure that accessing
one of the other fields doesn't come back as Undefined.

In this case, RegionStore is now correctly detecting that the lazy binding
we have isn't the right type, but then failing to follow through on the
implications of that: we don't know anything about the other fields in the
aggregate. This fix adds a test when searching for other kinds of default
values to see if there's a lazy binding we rejected, and if so returns
a symbolic value instead of Undefined.

The long-term fix for this is probably a new Store model; see
<rdar://problem/12701038>.

Fixes <rdar://problem/13292559>.

llvm-svn: 176144
2013-02-27 00:05:29 +00:00
Ted Kremenek 08037045f8 Refine SourceManager's isBeforeInTranslationUnit() cache to have more entries.
isBeforeInTranslationUnit() uses a cache to reduce the expensive work
to compute a common ancestor for two FileIDs.  This work is very
expensive, so even caching the latest used FileIDs was a big win.
A closer analysis of the cache before, however, shows that the cache
access pattern would oscillate between a working set of FileIDs, and
thus caching more pairs would be profitable.

This patch adds a side table for extending caching.  This side table
is bounded in size (experimentally determined in this case from
a simple Objective-C project), and when the table gets too large
we fall back to the single entry caching before as before.

On Sketch (a small example Objective-C project), this optimization
reduces -fsyntax-only time on SKTGraphicView.m by 5%.  This is
for a project that is already using PCH.

Fixes <rdar://problem/13299847>

llvm-svn: 176142
2013-02-27 00:00:26 +00:00