Re-introduce MatchFinder::addDynamicMatcher.

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

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

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@194223 91177308-0d34-0410-b5e6-96231b3b80d8
Re-instate contextual conversion to Objective-C pointers in message sends.

When performing an Objective-C message send to a value of class type,
perform a contextual conversion to an Objective-C pointer type. We've
had this for a long time, but it recently regressed. Fixes
<rdar://problem/15234703>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@194224 91177308-0d34-0410-b5e6-96231b3b80d8
Modules: Teach the preprocessor to recognize 'import' only after an '@'.

The preprocessor currently recognizes module declarations to load a
module based on seeing the 'import' keyword followed by an
identifier. This sequence is fairly unlikely in C (one would need a
type named 'import'), but is more common in Objective-C (where a
variable named 'import' can cause problems). Since import declarations
currently require a leading '@', recognize that in the preprocessor as
well. Fixes <rdar://problem/15084587>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@194225 91177308-0d34-0410-b5e6-96231b3b80d8
 Adds the ability to inject a DiagnosticConsumer into ClangTools.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@194226 91177308-0d34-0410-b5e6-96231b3b80d8
Eliminate an unnecessary .c_str()

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@194228 91177308-0d34-0410-b5e6-96231b3b80d8
clang-format: Make breaking before ternary operators configurable.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@194229 91177308-0d34-0410-b5e6-96231b3b80d8
ubsan: Only emit constants for filenames and type descriptors once.

Produces neater IR in significantly less time.

(~18% faster -O0 compile time for sqlite3 with -fsanitize=undefined)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@194231 91177308-0d34-0410-b5e6-96231b3b80d8
ObjectiveC migrator. Fixes an obscure bug where
NS_RETURNS_INNER_POINTER ends up unintentionally 
on the @property under -objcmt-migrate-all 
// rdar://15396636


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@194233 91177308-0d34-0410-b5e6-96231b3b80d8
[analyzer] Specialize "loop executed 0 times" for for-in and for-range loops.

The path note that says "Loop body executed 0 times" has been changed to
"Loop body skipped when range is empty" for C++11 for-range loops, and to
"Loop body skipped when collection is empty" for Objective-C for-in loops.

Part of <rdar://problem/14992886>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@194234 91177308-0d34-0410-b5e6-96231b3b80d8
[analyzer] Track whether an ObjC for-in loop had zero iterations.

An Objective-C for-in loop will have zero iterations if the collection is
empty. Previously, we could only detect this case if the program asked for
the collection's -count /before/ the for-in loop. Now, the analyzer
distinguishes for-in loops that had zero iterations from those with at
least one, and can use this information to constrain the result of calling
-count after the loop.

In order to make this actually useful, teach the checker that methods on
NSArray, NSDictionary, and the other immutable collection classes don't
change the count.

<rdar://problem/14992886>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@194235 91177308-0d34-0410-b5e6-96231b3b80d8
[analyzer] Add IdenticalExprChecker, to find copy-pasted code.

This syntactic checker looks for expressions on both sides of comparison
operators that are structurally the same. As a special case, the
floating-point idiom "x != x" for "isnan(x)" is left alone.

Currently this only checks comparison operators, but in the future we could
extend this to include logical operators or chained if-conditionals.

Checker by Per Viberg!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@194236 91177308-0d34-0410-b5e6-96231b3b80d8
Fix a bogus assert I introduced in r194224

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@194237 91177308-0d34-0410-b5e6-96231b3b80d8
ObjectiveC migrator. Added a dropped check in my
last patch.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@194238 91177308-0d34-0410-b5e6-96231b3b80d8
Objective-C++ ARC: Improve the conversion to a const __unsafe_unretained reference.

Under ARC++, a reference to a const Objective-C pointer is implicitly
treated as __unsafe_unretained, and can be initialized with (e.g.) a
__strong lvalue. Make sure this behavior does not break template
argument deduction and (related) that partial ordering still prefers a
'T* const&' template over a 'T const&' template when this case kicks
in. Fixes <rdar://problem/14467941>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@194239 91177308-0d34-0410-b5e6-96231b3b80d8
Tests for core issue 170-200.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@194240 91177308-0d34-0410-b5e6-96231b3b80d8
clang-format: Properly indent ObjC calls wrapped before first selector

Before:
  [self // break
      a:a
     aa:aa
  aaaaa:aaa];

After:
  [self // break
          a:a
         aa:aa
      aaaaa:aaa];

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@194241 91177308-0d34-0410-b5e6-96231b3b80d8
s/DebugPrint/dump/g

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@194242 91177308-0d34-0410-b5e6-96231b3b80d8
Fix tests effected by r194221

GEP expressions were folded differently from before, change the tests to
reflect this.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@194243 91177308-0d34-0410-b5e6-96231b3b80d8
StaticAnalyzer/Checkers/BasicObjCFoundationChecks.cpp: Tweak ContainerNonEmptyMap with "int" instead of "bool", to appease building since r194235.

In ADT/ImmutableSet, ImutProfileInfo<bool> cannot be matched to ImutProfileInteger.
I didn't have idea it'd the right way if PROFILE_INTEGER_INFO(bool) could be added there.

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