Hoist culling of -Wunreachable-code from headers before we even run the analysis.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@202200 91177308-0d34-0410-b5e6-96231b3b80d8
Address review comments for r202185, no functionality changes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@202208 91177308-0d34-0410-b5e6-96231b3b80d8
Add -Wabsolute-value, warnings about absolute value functions.

The warnings fall into three groups.
1) Using an absolute value function of the wrong type, for instance, using the
int absolute value function when the argument is a floating point type.
2) Using the improper sized absolute value function, for instance, using abs
when the argument is a long long.  llabs should be used instead.

From these two cases, an implicit conversion will occur which may cause
unexpected behavior.  Where possible, suggest the proper absolute value
function to use, and which header to include if the function is not available.

3) Taking the absolute value of an unsigned value.  In addition to this warning,
suggest to remove the function call.  This usually indicates a logic error
since the programmer assumed negative values would have been possible.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@202211 91177308-0d34-0410-b5e6-96231b3b80d8
[analyzer] NonNullParamChecker: don't freak out about nested transparent_unions.

For now, just ignore them. Later, we could try looking through LazyCompoundVals,
but we at least shouldn't crash.

<rdar://problem/16153464>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@202212 91177308-0d34-0410-b5e6-96231b3b80d8
PR16074, implement warnings to catch pointer to boolean true and pointer to
null comparison when the pointer is known to be non-null.

This catches the array to pointer decay, function to pointer decay and
address of variables.  This does not catch address of function since this
has been previously used to silence a warning.

Pointer to bool conversion is under -Wbool-conversion.
Pointer to null comparison is under -Wtautological-pointer-compare, a sub-group
of -Wtautological-compare.

void foo() {
  int arr[5];
  int x;
  // warn on these conditionals
  if (foo);
  if (arr);
  if (&x);
  if (foo == null);
  if (arr == null);
  if (&x == null);

  if (&foo);  // no warning
}


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@202216 91177308-0d34-0410-b5e6-96231b3b80d8
80-col and bad line ending fixups.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@202219 91177308-0d34-0410-b5e6-96231b3b80d8
clang/test/CodeGenCXX/debug-info-varargs.cpp: Appease msvc with %itanium_abi_triple.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@202226 91177308-0d34-0410-b5e6-96231b3b80d8
[CMake] Apply DEPENDS intrinsics_gen in clangCodeGen.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@202237 91177308-0d34-0410-b5e6-96231b3b80d8
[CMake] Use LINK_LIBS instead of target_link_libraries().

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@202238 91177308-0d34-0410-b5e6-96231b3b80d8
[CMake] Introduce cmake_policy(CMP0022) for target_link_libraries(INTERFACE|PRIVATE).

For now, use both keywords, INTERFACE and PRIVATE via the variable,
  - ${cmake_2_8_12_INTERFACE}
  - ${cmake_2_8_12_PRIVATE}

They could be cleaned up when we introduce 2.8.12.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@202239 91177308-0d34-0410-b5e6-96231b3b80d8
[CMake] Use target_link_libraries(INTERFACE|PRIVATE) on CMake-2.8.12 to increase opportunity for parallel build.

target_link_libraries(INTERFACE) doesn't bring inter-target dependencies in add_library,
although final targets have dependencies to whole dependent libraries.
It makes most libraries can be built in parallel.

target_link_libraries(PRIVATE) is used to shaared library.
Each dependent library is linked to the target.so, and its user will not see its grandchildren.
For example,

  - libclang.so has sufficient libclang*.a(s).
  - c-index-test requires just only libclang.so.

FIXME: lld is tweaked minimally. Adding INTERFACE in each library would be better thing.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@202254 91177308-0d34-0410-b5e6-96231b3b80d8
Add a StmtPrinter test for implicit and explicit conversion operator calls.

Put back a comment that I removed too aggressively.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@202255 91177308-0d34-0410-b5e6-96231b3b80d8
AArch64: use less cluttered intrinsic for vtbl/vtbx

The table is always 128-bit so there's no reason to specify it every time we
want the intrinsic.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@202259 91177308-0d34-0410-b5e6-96231b3b80d8
Add newlines to fallback-style description. Patch by Kamal Essoufi\!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@202269 91177308-0d34-0410-b5e6-96231b3b80d8
Sema: Definition of dllimport globals is not allowed

Upgrades the warning to an error and clarifies the message by treating the
definition as error instead of the attribute.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@202300 91177308-0d34-0410-b5e6-96231b3b80d8
Refactor linkage computation in CGObjCMac.cpp.

Before this patch the globals were created with the wrong linkage and patched
afterwards. From the comments it looks like something would complain about
having an internal GV with no initializer. At least in clang the verifier will
only run way after we set the initializer, so that is not a problem.

This patch should be a nop. It just figures out the linkage earlier and
converts the old calls to setLinkage to asserts. The only case where that is
not possible is when we first see a weak import that is then implemented. In
that case we have to change the linkage, but that is the only setLinkage left.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@202305 91177308-0d34-0410-b5e6-96231b3b80d8
argument -> parameter terminology fixes for FunctionTypeInfo

This is a continuation of r199686.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@202307 91177308-0d34-0410-b5e6-96231b3b80d8
PR18962: Fix "Unable to find record layout information for type"

Clang is using llvm::StructType::isOpaque() as a way of signaling if
we've finished record type conversion in
CodeGenTypes::isRecordLayoutComplete().  However, Clang was setting the
body of the type before it finished laying out the type as a base type.
Laying out the %class.C.base LLVM type attempts to convert more types,
eventually recursively attempting to layout 'C' again, at which point we
would say that layout was complete, even though we were still in the
middle of it.

By not setting the body, we correctly signal that layout is not
complete, and things work as expected.

At some point, it might be worth refactoring this to avoid looking at
the LLVM IR types under construction.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@202320 91177308-0d34-0410-b5e6-96231b3b80d8
Fix testcase for PR18962 with an explicit triple

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