]> granicus.if.org Git - clang/log
clang
10 years agoC. Compare vector sizes using their raw element size instead of
Fariborz Jahanian [Thu, 6 Mar 2014 22:47:09 +0000 (22:47 +0000)]
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.

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

10 years agoUse llvm.compiler.used instead of llvm.used for objc symbols.
Rafael Espindola [Thu, 6 Mar 2014 22:15:10 +0000 (22:15 +0000)]
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.

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

10 years agoMake the test a bit stronger by showing what is added to llvm.used.
Rafael Espindola [Thu, 6 Mar 2014 22:02:16 +0000 (22:02 +0000)]
Make the test a bit stronger by showing what is added to llvm.used.

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

10 years agoRemove a dead store, add a FIXME for another.
Richard Smith [Thu, 6 Mar 2014 21:59:38 +0000 (21:59 +0000)]
Remove a dead store, add a FIXME for another.

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

10 years agoExclude invalid old decl from mismatching linkage assertion
Ismail Pazarbasi [Thu, 6 Mar 2014 21:48:45 +0000 (21:48 +0000)]
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.

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

10 years agoRemove dead code I introduced 6 years, 4 months ago in r43518.
Ted Kremenek [Thu, 6 Mar 2014 21:42:43 +0000 (21:42 +0000)]
Remove dead code I introduced 6 years, 4 months ago in r43518.

Found by -Wunreachable-code.

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

10 years agoPGO: rename profile data files from .pgodata to .profdata.
Bob Wilson [Thu, 6 Mar 2014 21:36:04 +0000 (21:36 +0000)]
PGO: rename profile data files from .pgodata to .profdata.

These tests were added before we had settled on using a .profdata extension
for the profile data files. Renaming them now for consistency.

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

10 years agoPGO: rename FileCheck variable to follow the existing convention.
Bob Wilson [Thu, 6 Mar 2014 21:35:59 +0000 (21:35 +0000)]
PGO: rename FileCheck variable to follow the existing convention.

I added this "STF" variable without noticing that all the other counter names
end with a "C". Renaming it to "STC" for consistency.

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

10 years agoUpdate for LLVM API change
Saleem Abdulrasool [Thu, 6 Mar 2014 20:47:19 +0000 (20:47 +0000)]
Update for LLVM API change

Use the new getObjectFormat/setObjectFormat instead of Environment now that the
file format is a separate field.

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

10 years ago[docs] s/cpp11-migrate/clang-modernize/
Rui Ueyama [Thu, 6 Mar 2014 20:30:05 +0000 (20:30 +0000)]
[docs] s/cpp11-migrate/clang-modernize/

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

10 years agoPGO: Add support for Objective-C blocks.
Bob Wilson [Thu, 6 Mar 2014 20:24:27 +0000 (20:24 +0000)]
PGO: Add support for Objective-C blocks.

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

10 years agoFix dead store and simplify. No functionality change (although the code is now
Richard Smith [Thu, 6 Mar 2014 20:00:05 +0000 (20:00 +0000)]
Fix dead store and simplify. No functionality change (although the code is now
correct if MaxEditDistance were increased to something greater than 1).

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

10 years agoMS ABI: Disambiguate the manglings for global guard variables
David Majnemer [Thu, 6 Mar 2014 19:57:36 +0000 (19:57 +0000)]
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.

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

10 years agoBased on usage, the NamedDecl is always set when constructing a CallingContext, but...
Aaron Ballman [Thu, 6 Mar 2014 19:37:24 +0000 (19:37 +0000)]
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.

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

10 years agoRefactored to use a simple helper function that wraps the logic of creating an SExprN...
Aaron Ballman [Thu, 6 Mar 2014 19:25:11 +0000 (19:25 +0000)]
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.

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

10 years agoAdd tests for MS inline asm change r203146
Reid Kleckner [Thu, 6 Mar 2014 19:19:36 +0000 (19:19 +0000)]
Add tests for MS inline asm change r203146

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

10 years agoMS ABI: Fix the initializer/finalizer mangling for static data members
David Majnemer [Thu, 6 Mar 2014 19:10:27 +0000 (19:10 +0000)]
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.

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

10 years agoVery minor simplification and typo correction; no functional changes intended.
Aaron Ballman [Thu, 6 Mar 2014 19:10:16 +0000 (19:10 +0000)]
Very minor simplification and typo correction; no functional changes intended.

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

10 years agoRevert "Use private linkage for remaining GlobalVariables with private names."
Rafael Espindola [Thu, 6 Mar 2014 18:54:12 +0000 (18:54 +0000)]
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.

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

10 years agoFix use-after-free detected by ASan bootstrap.
Richard Smith [Thu, 6 Mar 2014 18:08:08 +0000 (18:08 +0000)]
Fix use-after-free detected by ASan bootstrap.

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

10 years agoRun -fprofile-instr tests with %clang_cc1.
Bob Wilson [Thu, 6 Mar 2014 17:18:34 +0000 (17:18 +0000)]
Run -fprofile-instr tests with %clang_cc1.

This should help avoid problems like the buildbot fallout from my change in
r203085. I left the CodeGenCXX tests alone for now.

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

10 years agoExpand documentation section on comment parsing
Dmitri Gribenko [Thu, 6 Mar 2014 16:32:09 +0000 (16:32 +0000)]
Expand documentation section on comment parsing

Patch by Jonathan Sauer, with a little editing by me.

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

10 years ago[ASTPrinter] 'SEL' isn't a ObjCObjectPointer, so we don't need to handle it in TypePr...
Argyrios Kyrtzidis [Thu, 6 Mar 2014 15:31:56 +0000 (15:31 +0000)]
[ASTPrinter] 'SEL' isn't a ObjCObjectPointer, so we don't need to handle it in TypePrinter::printObjCObjectPointerBefore.

Suggested by Jordan.

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

10 years agoFix operator<< recognition (PR19064).
Alexander Kornienko [Thu, 6 Mar 2014 15:13:08 +0000 (15:13 +0000)]
Fix operator<< recognition (PR19064).

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

10 years ago[C++11] Adding override specifiers where appropriate, and removing virtual specifiers...
Aaron Ballman [Thu, 6 Mar 2014 15:09:50 +0000 (15:09 +0000)]
[C++11] Adding override specifiers where appropriate, and removing virtual specifiers where not needed.

No functional changes intended.

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

10 years agoReformatting the style used within the massive attribute semantic handling switch...
Aaron Ballman [Thu, 6 Mar 2014 14:02:27 +0000 (14:02 +0000)]
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.

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

10 years agoAdded an inserter for ArrayRef<SourceRange>.
Alexander Kornienko [Thu, 6 Mar 2014 13:23:30 +0000 (13:23 +0000)]
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

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

10 years ago[OPENMP] Updated comments and _OPENMP macro value for OpenMP 4.0 (for 'omp simd'...
Alexey Bataev [Thu, 6 Mar 2014 12:27:56 +0000 (12:27 +0000)]
[OPENMP] Updated comments and _OPENMP macro value for OpenMP 4.0 (for 'omp simd' support)

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

10 years ago[OPENMP] Missed test for 'simd private'
Alexey Bataev [Thu, 6 Mar 2014 11:48:22 +0000 (11:48 +0000)]
[OPENMP] Missed test for 'simd private'

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

10 years ago[-Wunreachable-code] Refine treating all branches of 'switch' as reachable, which...
Ted Kremenek [Thu, 6 Mar 2014 08:09:00 +0000 (08:09 +0000)]
[-Wunreachable-code] Refine treating all branches of 'switch' as reachable, which includes those with all cases covered but with no 'default:'.

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

10 years agoCodeGenObjC/instr-profile.m: Add -target darwin to appease bots.
NAKAMURA Takumi [Thu, 6 Mar 2014 07:29:30 +0000 (07:29 +0000)]
CodeGenObjC/instr-profile.m: Add -target darwin to appease bots.

This expected;
  ; Function Attrs: uwtable
  define internal void @"\01+[A foreach:]"(i8* %self, i8* %_cmd, %0* %array) #0 {

But the Name is mangled on other hosts; (x86_64-unknown-unknown)
  ; Function Attrs: nounwind uwtable
  define internal void @_c_A__foreach_(i8* %self, i8* %_cmd, %1* %array) #0 {

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

10 years ago[-Wunreachable-code] don't warn about dead 'return <string literal>' dominated by...
Ted Kremenek [Thu, 6 Mar 2014 06:50:46 +0000 (06:50 +0000)]
[-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.

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

10 years agoAttempt to fix buildbots by dropping the -LABEL from some FileCheck patterns.
Bob Wilson [Thu, 6 Mar 2014 06:49:37 +0000 (06:49 +0000)]
Attempt to fix buildbots by dropping the -LABEL from some FileCheck patterns.

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

10 years ago[OPENMP] Clause 'num_threads'
Alexey Bataev [Thu, 6 Mar 2014 06:15:19 +0000 (06:15 +0000)]
[OPENMP] Clause 'num_threads'

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

10 years agoPGO: add instrumentation for Objective-C methods.
Bob Wilson [Thu, 6 Mar 2014 06:10:02 +0000 (06:10 +0000)]
PGO: add instrumentation for Objective-C methods.

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

10 years ago[OPENMP] Added option -fopenmp=libiomp5|libgomp
Alexey Bataev [Thu, 6 Mar 2014 05:43:53 +0000 (05:43 +0000)]
[OPENMP] Added option -fopenmp=libiomp5|libgomp

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

10 years agoRemove 'break' dominated by 'return' in 'EmitBuiltinExpr'.
Ted Kremenek [Thu, 6 Mar 2014 05:37:38 +0000 (05:37 +0000)]
Remove 'break' dominated by 'return' in 'EmitBuiltinExpr'.

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

10 years agoRemove 2 dead 'break' statements. The 'break' usage in this switch is inconsistent...
Ted Kremenek [Thu, 6 Mar 2014 05:37:35 +0000 (05:37 +0000)]
Remove 2 dead 'break' statements.  The 'break' usage in this switch is inconsistent, making this hard to see.

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

10 years agoRemove dead return in Parser::MayBeDesignationStart().
Ted Kremenek [Thu, 6 Mar 2014 05:37:32 +0000 (05:37 +0000)]
Remove dead return in Parser::MayBeDesignationStart().

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

10 years agoRemove dead return in BugReporter (found via -Wunreachable-code).
Ted Kremenek [Thu, 6 Mar 2014 05:37:28 +0000 (05:37 +0000)]
Remove dead return in BugReporter (found via -Wunreachable-code).

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

10 years agoPGO: Use the main file name to help distinguish functions with local linkage.
Bob Wilson [Thu, 6 Mar 2014 04:55:41 +0000 (04:55 +0000)]
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.

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

10 years agoPGO: Rename variables to avoid referring to the "MangledName" of a function.
Bob Wilson [Thu, 6 Mar 2014 04:55:37 +0000 (04:55 +0000)]
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.

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

10 years agoRefactor PGO code in preparation for handling non-C/C++ code.
Bob Wilson [Thu, 6 Mar 2014 04:55:35 +0000 (04:55 +0000)]
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.

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

10 years agoPGO: don't emit counter increment if no counters have been allocated.
Bob Wilson [Thu, 6 Mar 2014 04:55:28 +0000 (04:55 +0000)]
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.

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

10 years ago[Layering] Update include of Linker.h to match its move to a Linker
Chandler Carruth [Thu, 6 Mar 2014 03:46:44 +0000 (03:46 +0000)]
[Layering] Update include of Linker.h to match its move to a Linker
subdirectory in LLVM r203065.

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

10 years agoFix crash if a submodule overrides one of its own macros, and add support for
Richard Smith [Thu, 6 Mar 2014 03:16:27 +0000 (03:16 +0000)]
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.

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

10 years agoFix test from r203061
Richard Trieu [Thu, 6 Mar 2014 02:28:22 +0000 (02:28 +0000)]
Fix test from r203061

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

10 years agoSuppress diagnostics during name lookup for absolute value type.
Richard Trieu [Thu, 6 Mar 2014 02:25:04 +0000 (02:25 +0000)]
Suppress diagnostics during name lookup for absolute value type.

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

10 years agoUse private linkage for remaining GlobalVariables with private names.
Rafael Espindola [Thu, 6 Mar 2014 01:57:34 +0000 (01:57 +0000)]
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" :-)

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

10 years agoUpdate clang test to cover for new treatment of intrinsics as readnone.
Raul E. Silvera [Thu, 6 Mar 2014 01:37:10 +0000 (01:37 +0000)]
Update clang test to cover for new treatment of intrinsics as readnone.

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

10 years agoConstruct GlobalValues with the correct linkage instead of using setLinkage.
Rafael Espindola [Thu, 6 Mar 2014 01:10:46 +0000 (01:10 +0000)]
Construct GlobalValues with the correct linkage instead of using setLinkage.

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

10 years ago[-Wunreachable-code] Handle idiomatic do...while() with an uninteresting condition.
Ted Kremenek [Thu, 6 Mar 2014 01:09:45 +0000 (01:09 +0000)]
[-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.

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

10 years agoChange the color of comment nodes from bright yellow to blue. Bright yellow on
Richard Trieu [Thu, 6 Mar 2014 01:09:03 +0000 (01:09 +0000)]
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.

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

10 years ago[Layering] Update include of DebugInfo.h which moved to the IR library
Chandler Carruth [Thu, 6 Mar 2014 00:46:56 +0000 (00:46 +0000)]
[Layering] Update include of DebugInfo.h which moved to the IR library
in LLVM r203046.

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

10 years agoObjective-C properties. Fixes a crash in Sema where RHS of
Fariborz Jahanian [Thu, 6 Mar 2014 00:34:05 +0000 (00:34 +0000)]
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.

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

10 years agoSwitch to an idiomatic C++ erase/remove for this loop, and fix a bug in the
Richard Smith [Thu, 6 Mar 2014 00:33:23 +0000 (00:33 +0000)]
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).

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

10 years ago[Layering] Update include for the move of DIBuilder.h to the IR library
Chandler Carruth [Thu, 6 Mar 2014 00:22:29 +0000 (00:22 +0000)]
[Layering] Update include for the move of DIBuilder.h to the IR library
in LLVM r203038.

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

10 years ago[-Wunreachable-code] Handle idiomatic do...while() with an uninteresting condition.
Ted Kremenek [Thu, 6 Mar 2014 00:17:44 +0000 (00:17 +0000)]
[-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.

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

10 years agoclang/test/Modules/recursive.c: Tweak expressions for win32.
NAKAMURA Takumi [Thu, 6 Mar 2014 00:12:04 +0000 (00:12 +0000)]
clang/test/Modules/recursive.c: Tweak expressions for win32.

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

10 years ago[-Wunreachable-code] generalize pruning out warning on trivial returns.
Ted Kremenek [Wed, 5 Mar 2014 23:46:07 +0000 (23:46 +0000)]
[-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.

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

10 years agoObjective-C. Suppress the warning for auto synthesis of property not
Fariborz Jahanian [Wed, 5 Mar 2014 23:44:00 +0000 (23:44 +0000)]
Objective-C. Suppress the warning for auto synthesis of property not
synthesizing protocol properties if class's super class
implements them. // rdar://16089191

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

10 years ago[-Wunreachabe-code] add test for double 'break'.
Ted Kremenek [Wed, 5 Mar 2014 23:38:43 +0000 (23:38 +0000)]
[-Wunreachabe-code] add test for double 'break'.

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

10 years ago[-Wunreachable-code] include some enum constants in "configuration value" heuristic
Ted Kremenek [Wed, 5 Mar 2014 23:38:41 +0000 (23:38 +0000)]
[-Wunreachable-code] include some enum constants in "configuration value" heuristic

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

10 years agoPR19010: Make sure we initialize (empty) indirect base class subobjects when
Richard Smith [Wed, 5 Mar 2014 23:32:50 +0000 (23:32 +0000)]
PR19010: Make sure we initialize (empty) indirect base class subobjects when
evaluating trivial default initialization of a literal class type.

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

10 years agoFix recursion bug in logic to validate 'objc_protocol_requires_explicit_implementatio...
Ted Kremenek [Wed, 5 Mar 2014 23:18:22 +0000 (23:18 +0000)]
Fix recursion bug in logic to validate 'objc_protocol_requires_explicit_implementation' conformance.

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

10 years agoDR status page: add link targets for individual DRs, and link duplicates.
Richard Smith [Wed, 5 Mar 2014 23:02:47 +0000 (23:02 +0000)]
DR status page: add link targets for individual DRs, and link duplicates.

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

10 years agoTests for DR370-380.
Richard Smith [Wed, 5 Mar 2014 22:54:58 +0000 (22:54 +0000)]
Tests for DR370-380.

Also promote a couple of Warnings on ill-formed code found by this testing to
ExtWarns.

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

10 years ago[-Wunreachable-code] generalize configuration value checking to all comparison operators.
Ted Kremenek [Wed, 5 Mar 2014 22:32:39 +0000 (22:32 +0000)]
[-Wunreachable-code] generalize configuration value checking to all comparison operators.

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

10 years agoUpdating this test case to appease build bots which support ANSI escape sequences...
Aaron Ballman [Wed, 5 Mar 2014 21:59:02 +0000 (21:59 +0000)]
Updating this test case to appease build bots which support ANSI escape sequences (unlike my dev box).

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

10 years agoCapabilities are required to pass a name specifying what type of capability is being...
Aaron Ballman [Wed, 5 Mar 2014 21:47:13 +0000 (21:47 +0000)]
Capabilities are required to pass a name specifying what type of capability is being annotated. There are currently only two supported names: mutex and role. Adding functionality to check for the capability name and diagnose when it's unexpected.

Note that for backwards compatibility, an unnamed capability will default to being a "mutex." This allows the deprecated lockable attribute to continue to function.

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

10 years agoAttempt to re-enable the VFS unittests on Windows
Ben Langmuir [Wed, 5 Mar 2014 21:32:20 +0000 (21:32 +0000)]
Attempt to re-enable the VFS unittests on Windows

Using a //net/ path to hopefully avoid problems with non-absolute paths
on Windows.

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

10 years agoDon't produce an alias between destructors with different calling conventions.
Rafael Espindola [Wed, 5 Mar 2014 21:04:41 +0000 (21:04 +0000)]
Don't produce an alias between destructors with different calling conventions.

Fixes pr19007.

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

10 years agoWhen building a module from the command line via -emit-module, add an entry to
Richard Smith [Wed, 5 Mar 2014 20:55:36 +0000 (20:55 +0000)]
When building a module from the command line via -emit-module, add an entry to
the module build stack for the module being built, so we can correctly detect
recursive module builds.

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

10 years agoIf a #include finds a file relative to the current file, don't forget to check
Richard Smith [Wed, 5 Mar 2014 20:51:45 +0000 (20:51 +0000)]
If a #include finds a file relative to the current file, don't forget to check
whether it's part of a module.

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

10 years agoMention clang-cl in MSVCCompatibility.rst
Nico Weber [Wed, 5 Mar 2014 20:18:59 +0000 (20:18 +0000)]
Mention clang-cl in MSVCCompatibility.rst

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

10 years agoUpdate for llvm change.
Rafael Espindola [Wed, 5 Mar 2014 20:08:57 +0000 (20:08 +0000)]
Update for llvm change.

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

10 years ago[code-completion] Add a couple of test cases suggested by Jordan, and a FIXME.
Argyrios Kyrtzidis [Wed, 5 Mar 2014 19:10:31 +0000 (19:10 +0000)]
[code-completion] Add a couple of test cases suggested by Jordan, and a FIXME.

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

10 years agoAST: Remove layering violation with Sema
David Majnemer [Wed, 5 Mar 2014 18:55:38 +0000 (18:55 +0000)]
AST: Remove layering violation with Sema

Scope lives in Sema and cannot be used in AST. Shuffle things around.

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

10 years ago[C++11] Using std::unique_ptr to ensure that Argument objects do not leak (since...
Aaron Ballman [Wed, 5 Mar 2014 16:49:55 +0000 (16:49 +0000)]
[C++11] Using std::unique_ptr to ensure that Argument objects do not leak (since clang-tblgen isn't long-lived, the old leak is probably acceptable, but it offended my senses nonetheless).

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

10 years agoUse ThreadSafeRefCountedBase for vfs::FileSystem
Ben Langmuir [Wed, 5 Mar 2014 15:25:59 +0000 (15:25 +0000)]
Use ThreadSafeRefCountedBase for vfs::FileSystem

Allow trivial read-only filesystems such as RealFileSystem to be shared
between threads.

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

10 years agoStyle fix: replace "1 entries" with "1 entry" in the vftable layout dumping code
Timur Iskhodzhanov [Wed, 5 Mar 2014 13:54:07 +0000 (13:54 +0000)]
Style fix: replace "1 entries" with "1 entry" in the vftable layout dumping code

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

10 years agoRevert "[C++11] Replace trivial lambda with std::cref."
Benjamin Kramer [Wed, 5 Mar 2014 13:25:00 +0000 (13:25 +0000)]
Revert "[C++11] Replace trivial lambda with std::cref."

MSVC2013's standard library is too broken to understand this pattern.

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

10 years ago[C++11] Replace trivial lambda with std::cref.
Benjamin Kramer [Wed, 5 Mar 2014 11:38:18 +0000 (11:38 +0000)]
[C++11] Replace trivial lambda with std::cref.

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

10 years agoAdded a const qualifier to SourceManager& parameters.
Alexander Kornienko [Wed, 5 Mar 2014 10:38:27 +0000 (10:38 +0000)]
Added a const qualifier to SourceManager& parameters.

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

10 years agoMS ABI: Mangle lambdas
David Majnemer [Wed, 5 Mar 2014 10:35:06 +0000 (10:35 +0000)]
MS ABI: Mangle lambdas

Use a scheme inspired by the Itanium ABI to properly implement the
mangling of lambdas.

N.B.  The incredibly astute observer will notice that we do not generate
external names that are identical, or even compatible with, MSVC.
This is fine because they don't generate names that they can use across
translation units.  Technically, we can generate any name we'd like so
long as that name wouldn't conflict with any other and would be stable
across translation units.

This fixes PR15512.

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

10 years agoDisable BasicTests/VFS on win32 for now. Investigating.
NAKAMURA Takumi [Wed, 5 Mar 2014 09:10:04 +0000 (09:10 +0000)]
Disable BasicTests/VFS on win32 for now. Investigating.

  Failing Tests (5):
    Clang-Unit :: Basic/BasicTests.exe/VFSFromYAMLTest.CaseInsensitive
    Clang-Unit :: Basic/BasicTests.exe/VFSFromYAMLTest.MappedFiles
    Clang-Unit :: Basic/BasicTests.exe/VFSFromYAMLTest.MultiComponentPath
    Clang-Unit :: Basic/BasicTests.exe/VFSFromYAMLTest.TrailingSlashes
    Clang-Unit :: Basic/BasicTests.exe/VFSFromYAMLTest.UseExternalName

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

10 years ago[-cxx-abi microsoft] Implement local manglings accurately
David Majnemer [Wed, 5 Mar 2014 08:57:59 +0000 (08:57 +0000)]
[-cxx-abi microsoft] Implement local manglings accurately

Summary:
The MSVC ABI appears to mangle the lexical scope into the names of
statics.  Specifically, a counter is incremented whenever a scope is
entered where things can be declared in such a way that an ambiguity can
arise.  For example, a class scope inside of a class scope doesn't do
anything interesting because the nested class cannot collide with
another nested class.

There are problems with this scheme:
- It is unreliable. The counter is only incremented when a previously
  never encountered scope is entered.  There are cases where this will
  cause ambiguity amongst declarations that have the same name where one
  was introduced in a deep scope while the other was introduced right
  after in the previous lexical scope.
- It is wasteful.  Statements like: {{{{{{{ static int foo = a; }}}}}}}
  will make the mangling of "foo" larger than it need be because the
  scope counter has been incremented many times.

Because of these problems, and practical implementation concerns.  We
choose not to implement this scheme if the local static or local type
isn't visible.  The mangling of these declarations will look very
similar but the numbering will make far more sense, this scheme is
lifted from the Itanium ABI implementation.

Reviewers: rsmith, doug.gregor, rnk, eli.friedman, cdavis5x

Reviewed By: rnk

CC: cfe-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D2953

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

10 years agoAdjust logic for 'objc_protocol_requires_explicit_implementation' for inherited proto...
Ted Kremenek [Wed, 5 Mar 2014 08:13:08 +0000 (08:13 +0000)]
Adjust logic for 'objc_protocol_requires_explicit_implementation' for inherited protocols and protocols already conformed in the class hierarchy.

Per more discussion, 'objc_protocol_requires_explicit_implementation' is
refinement that it mainly adds that requirement that a protocol must be
explicitly satisfied at the moment the first class in the class hierarchy
conforms to it.  Any subclasses that also conform to that protocol,
either directly or via conforming to a protocol that inherits that protocol,
do not need to re-implement that protocol.

Doing this requires first doing a pass on the super class hierarchy,
gathering the set of protocols conformed to by the super classes,
and then culling those out when determining conformance.  This
two-pass algorithm could be generalized for all protocol checking,
and could possibly be a performance win in some cases.  For now
we restrict this change to protocols with this attribute to isolate
the change in logic (especially as the design continues to evolve).

This change needs to be adjusted for properties as well; this
only impacts methods right now.

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

10 years ago[OPENMP] allow clause 'private' on directive 'omp simd'
Alexey Bataev [Wed, 5 Mar 2014 07:21:14 +0000 (07:21 +0000)]
[OPENMP] allow clause 'private' on directive 'omp simd'

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

10 years ago[OPENMP] emit error message for clause 'if(1 0)'
Alexey Bataev [Wed, 5 Mar 2014 06:53:13 +0000 (06:53 +0000)]
[OPENMP] emit error message for clause 'if(1 0)'

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

10 years ago[AST] A "Class<P>" type should not have '*' when printed out.
Argyrios Kyrtzidis [Wed, 5 Mar 2014 06:47:57 +0000 (06:47 +0000)]
[AST] A "Class<P>" type should not have '*' when printed out.

rdar://14309030

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

10 years ago[OPNEMP] Fixed instantiation of 'if' clause
Alexey Bataev [Wed, 5 Mar 2014 06:45:14 +0000 (06:45 +0000)]
[OPNEMP] Fixed instantiation of 'if' clause

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

10 years agoSpeculatively fix MSVC buildbots
David Majnemer [Wed, 5 Mar 2014 06:32:38 +0000 (06:32 +0000)]
Speculatively fix MSVC buildbots

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

10 years agoMerge using-decl-pr17575.cpp into existing test case.
Peter Collingbourne [Wed, 5 Mar 2014 02:12:55 +0000 (02:12 +0000)]
Merge using-decl-pr17575.cpp into existing test case.

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

10 years agoAdd a test case for PR17575.
Peter Collingbourne [Wed, 5 Mar 2014 01:49:35 +0000 (01:49 +0000)]
Add a test case for PR17575.

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

10 years ago[-Wunreachable-code] Don't warn about dead code guarded by a "configuration value".
Ted Kremenek [Wed, 5 Mar 2014 00:01:17 +0000 (00:01 +0000)]
[-Wunreachable-code] Don't warn about dead code guarded by a "configuration value".

Some unreachable code is only "sometimes unreachable" because it
is guarded by a configuration value that is determined at compile
time and is always constant.  Sometimes those represent real bugs,
but often they do not.  This patch causes the reachability analysis
to cover such branches even if they are technically unreachable
in the CFG itself.  There are some conservative heuristics at
play here to determine a "configuration value"; these are intended
to be refined over time.

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

10 years agoHeaders: Provide an ABI compatible max_align_t when _MSC_VER is defined
David Majnemer [Tue, 4 Mar 2014 23:43:48 +0000 (23:43 +0000)]
Headers: Provide an ABI compatible max_align_t when _MSC_VER is defined

Summary:
Our usual definition of max_align_t wouldn't match up with MSVC if it
was used in a template argument.

Reviewers: chandlerc, rsmith, rnk

Reviewed By: chandlerc

CC: cfe-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D2924

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

10 years agoRemove some unnecessary qualification
David Blaikie [Tue, 4 Mar 2014 23:39:18 +0000 (23:39 +0000)]
Remove some unnecessary qualification

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

10 years agoObjective-C. Return 0 as class of methods in protocols.
Fariborz Jahanian [Tue, 4 Mar 2014 22:57:32 +0000 (22:57 +0000)]
Objective-C. Return 0 as class of methods in protocols.
This simplifies my last patch a bit. No change in
functionality.

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

10 years agoSupport relative paths in VFSFromYAML
Ben Langmuir [Tue, 4 Mar 2014 22:34:50 +0000 (22:34 +0000)]
Support relative paths in VFSFromYAML

Use llvm::sys::fs::make_absolute to get an absolute path before
matching. Also, allow "." directories to enable testing.  ".." is still
not supported, and will require crossing file system boundaries to
implement correctly.

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