Commit Graph

34660 Commits

Author SHA1 Message Date
Fariborz Jahanian 328a7c4b8b C. Compare vector sizes using their raw element size instead of
getTypeSize (which rounds up sizes) in order to issue diagnostics 
when casting to mismatched vector sizes; instead of crashing in IRGen.
// rdar:// 16196902. Reviewed offline by John McCall.

llvm-svn: 203175
2014-03-06 22:47:09 +00:00
Rafael Espindola 060062a433 Use llvm.compiler.used instead of llvm.used for objc symbols.
LLVM currently has a hack (shouldEmitUsedDirectiveFor) that causes it to not
print no_dead_strip for symbols starting with 'l' or 'L'. These are exactly the
ones that the clang's objc codegen is producing. The net result, is that it is
equivalent to llvm.compiler.used.

The need for putting the private symbol in llvm.compiler.used should be clear
(the objc runtime uses them). The reason for also putting the weak symbols in
it is for LTO: ld64 will not ask us to preserve the it.

llvm-svn: 203172
2014-03-06 22:15:10 +00:00
Richard Smith 131daca01d Remove a dead store, add a FIXME for another.
llvm-svn: 203169
2014-03-06 21:59:38 +00:00
Ismail Pazarbasi be19ae05e7 Exclude invalid old decl from mismatching linkage assertion
This patch fixes PR18964. In linkage computation, assertion fails when
an old invalid declaration's linkage mismatches with the current
decl's one.

llvm-svn: 203168
2014-03-06 21:48:45 +00:00
Ted Kremenek 02548c08f8 Remove dead code I introduced 6 years, 4 months ago in r43518.
Found by -Wunreachable-code.

llvm-svn: 203167
2014-03-06 21:42:43 +00:00
Saleem Abdulrasool 29b82b631d Update for LLVM API change
Use the new getObjectFormat/setObjectFormat instead of Environment now that the
file format is a separate field.

llvm-svn: 203161
2014-03-06 20:47:19 +00:00
Bob Wilson c845c00a5b PGO: Add support for Objective-C blocks.
llvm-svn: 203157
2014-03-06 20:24:27 +00:00
Richard Smith 2d70976fc0 Fix dead store and simplify. No functionality change (although the code is now
correct if MaxEditDistance were increased to something greater than 1).

llvm-svn: 203153
2014-03-06 20:00:05 +00:00
David Majnemer 34b4989658 MS ABI: Disambiguate the manglings for global guard variables
If a guard variable will be created for an entity at global scope,
then we cannot rely on the scope depth to disambiguate names for us.

Instead, mangle the entire variable into the guard to ensure it's uniqueness.

llvm-svn: 203151
2014-03-06 19:57:36 +00:00
Aaron Ballman 69bb592ad1 Based on usage, the NamedDecl is always set when constructing a CallingContext, but none of the other optional parameters are. Removing the optional parameters, and making the NamedDecl required.
No functional changes intended.

llvm-svn: 203149
2014-03-06 19:37:24 +00:00
Aaron Ballman 19842c437a Refactored to use a simple helper function that wraps the logic of creating an SExprNode and returning the position in which it was inserted.
No functional change intended.

llvm-svn: 203148
2014-03-06 19:25:11 +00:00
David Majnemer f55feec559 MS ABI: Fix the initializer/finalizer mangling for static data members
Initializers and finalizers for static data members have the variable's
access-specifier, storage-class, type and CV-qualifiers mangled in.

llvm-svn: 203145
2014-03-06 19:10:27 +00:00
Aaron Ballman cea2609b59 Very minor simplification and typo correction; no functional changes intended.
llvm-svn: 203144
2014-03-06 19:10:16 +00:00
Rafael Espindola 70efc5b4db Revert "Use private linkage for remaining GlobalVariables with private names."
This reverts commit r203059.

Revert while we discuss what does it mean to be private and weak.

llvm-svn: 203141
2014-03-06 18:54:12 +00:00
Richard Smith 6f548ec37e Fix use-after-free detected by ASan bootstrap.
llvm-svn: 203140
2014-03-06 18:08:08 +00:00
Argyrios Kyrtzidis 38765b9c17 [ASTPrinter] 'SEL' isn't a ObjCObjectPointer, so we don't need to handle it in TypePrinter::printObjCObjectPointerBefore.
Suggested by Jordan.

llvm-svn: 203124
2014-03-06 15:31:56 +00:00
Alexander Kornienko 86b2dfdc3b Fix operator<< recognition (PR19064).
llvm-svn: 203123
2014-03-06 15:13:08 +00:00
Aaron Ballman 8abdd0e090 Reformatting the style used within the massive attribute semantic handling switch statement, so now there is only one style used in this block of code, instead of three or more styles.
No functional change intended.

llvm-svn: 203120
2014-03-06 14:02:27 +00:00
Alexander Kornienko a74979d66f Added an inserter for ArrayRef<SourceRange>.
Summary:
Added an inserter for ArrayRef<SourceRange>, as it is already needed in at least
two places (static analyzer and clang-tidy).

Reviewers: jordan_rose

CC: cfe-commits, gribozavr

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

llvm-svn: 203117
2014-03-06 13:23:30 +00:00
Alexey Bataev d4dbdf5438 [OPENMP] Updated comments and _OPENMP macro value for OpenMP 4.0 (for 'omp simd' support)
llvm-svn: 203114
2014-03-06 12:27:56 +00:00
Ted Kremenek 6999d02587 [-Wunreachable-code] Refine treating all branches of 'switch' as reachable, which includes those with all cases covered but with no 'default:'.
llvm-svn: 203094
2014-03-06 08:09:00 +00:00
Ted Kremenek ec2dc73e86 [-Wunreachable-code] don't warn about dead 'return <string literal>' dominated by a 'noreturn' call, where literal becomes an std::string.
I have mixed feelings about this one.  It's used all over the codebase,
and is analogous to the current heuristic for ordinary C string literals.

This requires some ad hoc pattern matching of the AST.  While the
test case mirrors what we see std::string in libc++, it's not really
testing the libc++ headers.

llvm-svn: 203091
2014-03-06 06:50:46 +00:00
Alexey Bataev 568a833f68 [OPENMP] Clause 'num_threads'
llvm-svn: 203087
2014-03-06 06:15:19 +00:00
Bob Wilson 5ec8fe19cf PGO: add instrumentation for Objective-C methods.
llvm-svn: 203085
2014-03-06 06:10:02 +00:00
Alexey Bataev 186b28a8cf [OPENMP] Added option -fopenmp=libiomp5|libgomp
llvm-svn: 203081
2014-03-06 05:43:53 +00:00
Ted Kremenek 90097491ed Remove 'break' dominated by 'return' in 'EmitBuiltinExpr'.
llvm-svn: 203080
2014-03-06 05:37:38 +00:00
Ted Kremenek 7bceca1fcf Remove 2 dead 'break' statements. The 'break' usage in this switch is inconsistent, making this hard to see.
llvm-svn: 203079
2014-03-06 05:37:35 +00:00
Ted Kremenek ad71fc6104 Remove dead return in Parser::MayBeDesignationStart().
llvm-svn: 203078
2014-03-06 05:37:32 +00:00
Ted Kremenek d8c64f573d Remove dead return in BugReporter (found via -Wunreachable-code).
llvm-svn: 203077
2014-03-06 05:37:28 +00:00
Bob Wilson da1ebedeea PGO: Use the main file name to help distinguish functions with local linkage.
In addition, for all functions, use the name from the llvm::Function to
identify the function in the profile data. Compute that "function name",
including the file name for local functions, once when assigning the PGO
counters and store it in the CodeGenPGO class.

Move the code to add InlineHint and Cold attributes out of StartFunction(),
because the "function name" string isn't available at that point.

llvm-svn: 203075
2014-03-06 04:55:41 +00:00
Bob Wilson d0b7824ece PGO: Rename variables to avoid referring to the "MangledName" of a function.
For C++ functions, we will continue to use the mangled name to identify
functions in the PGO profile data, but this name is confusing for things like
Objective-C methods. For functions with local linkage, we're also going to
include the file name to help distinguish those functions, so this changes to
use more generic variable names.

No functional changes.

llvm-svn: 203074
2014-03-06 04:55:37 +00:00
Bob Wilson 68f475faf7 Refactor PGO code in preparation for handling non-C/C++ code.
Move the PGO.assignRegionCounters() call out of StartFunction, because that
function is called from many places where it does not make sense to do PGO
instrumentation (e.g., compiler-generated helper functions). Change several
functions to take a StringRef argument for the unique name associated with
a function, so that the name can be set differently for things like Objective-C
methods and block literals.

llvm-svn: 203073
2014-03-06 04:55:35 +00:00
Bob Wilson 749ebc7f33 PGO: don't emit counter increment if no counters have been allocated.
I hit this while debugging another issue where my sources were in an
inconsistent state, so I don't have a testcase. Regardless, this check is
simpler and more direct than checking if the option is enabled.

llvm-svn: 203072
2014-03-06 04:55:28 +00:00
Chandler Carruth 00fa3f7bf1 [Layering] Update include of Linker.h to match its move to a Linker
subdirectory in LLVM r203065.

llvm-svn: 203067
2014-03-06 03:46:44 +00:00
Richard Smith 9d100866f2 Fix crash if a submodule overrides one of its own macros, and add support for
submodule macro overriding within the same top-level module (necessary for the
testcase to be remotely reasonable). Incidentally reduces the number of libc++
testsuite regressions with modules enabled from 7 to 6.

llvm-svn: 203063
2014-03-06 03:16:27 +00:00
Richard Trieu fe771c071a Suppress diagnostics during name lookup for absolute value type.
llvm-svn: 203061
2014-03-06 02:25:04 +00:00
Rafael Espindola d0bb55a1d4 Use private linkage for remaining GlobalVariables with private names.
This patch changes the remaining GlobalVariables using "\01L" and
"\01l" prefixes to use private linkage. What is strange about them is
that they currently use WeakAnyLinkage. There is no comment stating
why and that is really odd since the symbols are completely hidden, so
it doesn't make sense for them to be weak.

Clang revisions like r63329, r63408, r63770, r65761 set the linkage to
weak, but don't say why. I suspect they were just copying llvm-gcc.

In llvm-gcc I found r58599 and r56322 that set DECL_WEAK, but they
were just syncing from the apple gcc. I am not exactly sure what that
means, since the last commit to
svn://gcc.gnu.org/svn/gcc/branches/apple was in 2006, 2 years earlier.

In summary, I have no idea why weak linkage was being used :-(

To quote John McCall, "Let’s try without it and see" :-)

llvm-svn: 203059
2014-03-06 01:57:34 +00:00
Rafael Espindola 5d117f3742 Construct GlobalValues with the correct linkage instead of using setLinkage.
llvm-svn: 203052
2014-03-06 01:10:46 +00:00
Ted Kremenek 7549f0f9bf [-Wunreachable-code] Handle idiomatic do...while() with an uninteresting condition.
Sometimes do..while() is used to create a scope that can be left early.
In such cases, the unreachable 'while()' test is not usually interesting
unless it actually does something that is observable.

llvm-svn: 203051
2014-03-06 01:09:45 +00:00
Richard Trieu 532018f7a5 Change the color of comment nodes from bright yellow to blue. Bright yellow on
a white background is difficult to read.  Also include a chart showing which
colors are used by which elements in the AST dump.

llvm-svn: 203050
2014-03-06 01:09:03 +00:00
Chandler Carruth 0654bacac3 [Layering] Update include of DebugInfo.h which moved to the IR library
in LLVM r203046.

llvm-svn: 203047
2014-03-06 00:46:56 +00:00
Fariborz Jahanian 15dde89357 Objective-C properties. Fixes a crash in Sema where RHS of
the property assignment is an lvalue for an incomplete type.
// rdar://15118128. Reviewed offline by John McCall.

llvm-svn: 203043
2014-03-06 00:34:05 +00:00
Richard Smith bb29e518c8 Switch to an idiomatic C++ erase/remove for this loop, and fix a bug in the
process (I don't believe it's possible to write a testcase for the bug with
a non-checking STL implementation).

llvm-svn: 203042
2014-03-06 00:33:23 +00:00
Chandler Carruth 7c582545a4 [Layering] Update include for the move of DIBuilder.h to the IR library
in LLVM r203038.

llvm-svn: 203039
2014-03-06 00:22:29 +00:00
Ted Kremenek 1de2e14f2f [-Wunreachable-code] Handle idiomatic do...while() with an uninteresting condition.
Sometimes do..while() is used to create a scope that can be left early.
In such cases, the unreachable 'while()' test is not usually interesting
unless it actually does something that is observable.

llvm-svn: 203036
2014-03-06 00:17:44 +00:00
Ted Kremenek 0a69cabd35 [-Wunreachable-code] generalize pruning out warning on trivial returns.
Previously we only pruned dead returns preceded by a call to a
'noreturn' function.  After looking at the results of the LLVM codebase,
there are many others that should be pruned as well.

llvm-svn: 203029
2014-03-05 23:46:07 +00:00
Fariborz Jahanian 6766f8d23b Objective-C. Suppress the warning for auto synthesis of property not
synthesizing protocol properties if class's super class
implements them. // rdar://16089191

llvm-svn: 203028
2014-03-05 23:44:00 +00:00
Ted Kremenek 01a39b601f [-Wunreachable-code] include some enum constants in "configuration value" heuristic
llvm-svn: 203026
2014-03-05 23:38:41 +00:00
Richard Smith da3f4fd3fe PR19010: Make sure we initialize (empty) indirect base class subobjects when
evaluating trivial default initialization of a literal class type.

llvm-svn: 203025
2014-03-05 23:32:50 +00:00
Ted Kremenek 760a2acbb5 Fix recursion bug in logic to validate 'objc_protocol_requires_explicit_implementation' conformance.
llvm-svn: 203024
2014-03-05 23:18:22 +00:00