Support in hasDeclaration for types with getDecl()
    
Using a new metafunction for detecting the presence of the member
'getDecl' in a type T, added support to hasDeclaration for any such type
T. This allows hasDecl() to be replaced and enables several other
subclasses of clang::Type to use hasDeclaration.

Updated unittests and LibASTMatchersReference.html.

Reviewers: klimek


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175532 91177308-0d34-0410-b5e6-96231b3b80d8
Correctly format macro with unfinished template declaration.

We can now format:
  #define A template <typename T>

Before this created a segfault :-/.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175533 91177308-0d34-0410-b5e6-96231b3b80d8
[docs] Revise content on ExternalProjectsUsingClang page.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175534 91177308-0d34-0410-b5e6-96231b3b80d8
[docs] Rename to permit wider variety of  content.

I don't want to rule out the possibility of linking to e.g. interesting
blog posts about uses of Clang, so avoid restricting the content to
"projects".

This breaks URL compatibility, but this document was committed less than
an hour ago so hopefully nobody has linked to it yet.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175535 91177308-0d34-0410-b5e6-96231b3b80d8
Use MapVector::pop_back() per LLVM r175538.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175539 91177308-0d34-0410-b5e6-96231b3b80d8
[modules] Refactor code from ASTReader::makeModuleVisible() into a new function,
Module::getExportedModules() so it can be reused.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175548 91177308-0d34-0410-b5e6-96231b3b80d8
[modules] Const'ify some functions of ModuleMap.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175552 91177308-0d34-0410-b5e6-96231b3b80d8
Add missing clang-format null pointer check..

.. and a test that triggers it in valid albeit questionable code.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175554 91177308-0d34-0410-b5e6-96231b3b80d8
[analyzer] Don't accidentally strip off base object regions for lazy bindings.

If a base object is at a 0 offset, RegionStoreManager may find a lazy
binding for the entire object, then try to attach a FieldRegion or
grandparent CXXBaseObjectRegion on top of that (skipping the intermediate
region). We now preserve as many layers of base object regions necessary
to make the types match.

<rdar://problem/13239840>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175556 91177308-0d34-0410-b5e6-96231b3b80d8
PR15300: Support C++11 attributes on base-specifiers. We don't support any such
attributes yet, so just issue the appropriate diagnostics. Also generalize the
fixit for attributes-in-the-wrong-place code and reuse it here, if attributes
are placed after the access-specifier or 'virtual' in a base specifier.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175575 91177308-0d34-0410-b5e6-96231b3b80d8
[analyzer] Account for the "interesting values" hash table resizing.

RegionStoreManager::getInterestingValues() returns a pointer to a
std::vector that lives inside a DenseMap, which is constructed on demand.
However, constructing one such value can lead to constructing another
value, which will invalidate the reference created earlier.

Fixed by delaying the new entry creation until the function returns.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175582 91177308-0d34-0410-b5e6-96231b3b80d8
[preprocessor] Split the MacroInfo class into two separate concepts, MacroInfo class
for the data specific to a macro definition (e.g. what the tokens are), and
MacroDirective class which encapsulates the changes to the "macro namespace"
(e.g. the location where the macro name became active, the location where it was undefined, etc.)

(A MacroDirective always points to a MacroInfo object.)

Usually a macro definition (MacroInfo) is where a macro name becomes active (MacroDirective) but
splitting the concepts allows us to better model the effect of modules to the macro namespace
(also as a bonus it allows better modeling of push_macro/pop_macro #pragmas).
Modules can have their own macro history, separate from the local (current translation unit)
macro history; MacroDirectives will be used to model the macro history (changes to macro namespace).

For example, if "@import A;" imports macro FOO, there will be a new local MacroDirective created
to indicate that "FOO" became active at the import location. Module "A" itself will contain another
MacroDirective in its macro history (at the point of the definition of FOO) and both MacroDirectives
will point to the same MacroInfo object.

Introducing the separation of macro concepts is the first part towards better modeling of module macros.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175585 91177308-0d34-0410-b5e6-96231b3b80d8
Don't repeat the function name in the comment.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175586 91177308-0d34-0410-b5e6-96231b3b80d8
Add a new 'type_visibility' attribute to allow users to
control the visibility of a type for the purposes of RTTI
and template argument restrictions independently of how
visibility propagates to its non-type member declarations.

Also fix r175326 to not ignore template argument visibility
on a template explicit instantiation when a member has
an explicit attribute but the instantiation does not.

The type_visibility work is rdar://11880378

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175587 91177308-0d34-0410-b5e6-96231b3b80d8
intmax_t is long long on Darwin, not long.

<rdar://problem/11540697>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175588 91177308-0d34-0410-b5e6-96231b3b80d8
Replace SVal llvm::cast support to be well-defined.

See r175462 for another example/more details.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175594 91177308-0d34-0410-b5e6-96231b3b80d8
Modify the tests to use attribute group references instead of listing the
function attributes.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175606 91177308-0d34-0410-b5e6-96231b3b80d8
Remove target-specific features.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175610 91177308-0d34-0410-b5e6-96231b3b80d8
Implements breaking of string literals if they stick out.

An alternative strategy to calculating the break on demand when hitting
a token that would need to be broken would be to put all possible breaks
inside the token into the optimizer.

Currently only supports breaking at spaces; more break points to come.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175613 91177308-0d34-0410-b5e6-96231b3b80d8
Don't remove blank lines within unwrapped lines.

If the code author decides to put empty lines anywhere into the code we
should treat them equally, i.e. reduce them to the configured
MaxEmptyLinesToKeep.

With this change, we e.g. keep the newline in:
SomeType ST = {
  // First value
  a,

  // Second value
  b
};

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