]> granicus.if.org Git - clang/log
clang
10 years agoFix PR20705, crash on invalid.
Richard Trieu [Fri, 22 Aug 2014 01:16:44 +0000 (01:16 +0000)]
Fix PR20705, crash on invalid.

dyn_cast -> dyn_cast_or_null to handle a null pointer.

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

10 years agoCGCall: Factor out the logic mapping call arguments to LLVM IR arguments.
Alexey Samsonov [Fri, 22 Aug 2014 01:06:06 +0000 (01:06 +0000)]
CGCall: Factor out the logic mapping call arguments to LLVM IR arguments.

Summary:
This refactoring introduces ClangToLLVMArgMapping class, which
encapsulates the information about the order in which function arguments listed
in CGFunctionInfo should be passed to actual LLVM IR function, such as:
1) positions of sret, if there is any
2) position of inalloca argument, if there is any
3) position of helper padding argument for each call argument
4) positions of regular argument (there can be many if it's expanded).
Simplify several related methods (ConstructAttributeList, EmitFunctionProlog
and EmitCall): now they don't have to maintain iterators over the list
of LLVM IR function arguments, dealing with all the sret/inalloca/this complexities,
and just use expected positions of LLVM IR arguments stored in ClangToLLVMArgMapping.

This may increase the running time of EmitFunctionProlog, as we have to traverse
expandable arguments twice, but in further refactoring we will be able
to speed up EmitCall by passing already calculated CallArgsToIRArgsMapping to
ConstructAttributeList, thus avoiding traversing expandable argument there.

No functionality change.

Test Plan: regression test suite

Reviewers: majnemer, rnk

Reviewed By: rnk

Subscribers: cfe-commits, rjmccall, timurrrr

Differential Revision: http://reviews.llvm.org/D4938

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

10 years ago[test/CodeGen/ARM] Adpat test to match new codegen after r216236.
Quentin Colombet [Fri, 22 Aug 2014 00:27:52 +0000 (00:27 +0000)]
[test/CodeGen/ARM] Adpat test to match new codegen after r216236.

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

10 years agoUpdate for LLVM API change to remove discriminator tracking from DILexicalBlock ...
David Blaikie [Thu, 21 Aug 2014 22:46:45 +0000 (22:46 +0000)]
Update for LLVM API change to remove discriminator tracking from DILexicalBlock (in favor of DILexicalBlockFile - where a default arg is used to avoid the need for API churn of those callers)

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

10 years agoUpdate Clang for LLVM API change to use unique_ptr in SourceManager::AddNewSourceBuffer
David Blaikie [Thu, 21 Aug 2014 21:01:00 +0000 (21:01 +0000)]
Update Clang for LLVM API change to use unique_ptr in SourceManager::AddNewSourceBuffer

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

10 years agoReturn statements are initialization; don't forget to revert the initializer to
Richard Smith [Thu, 21 Aug 2014 20:51:13 +0000 (20:51 +0000)]
Return statements are initialization; don't forget to revert the initializer to
its syntactic form before re-analyzing it during template instantiation.

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

10 years agoSimplify this logic now that -W can't be applied to remarks. No functionality change.
Richard Smith [Thu, 21 Aug 2014 20:44:44 +0000 (20:44 +0000)]
Simplify this logic now that -W can't be applied to remarks. No functionality change.

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

10 years agoFix grammatical error in diagnostic.
Richard Smith [Thu, 21 Aug 2014 20:43:52 +0000 (20:43 +0000)]
Fix grammatical error in diagnostic.

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

10 years agoPass expressions instead of argument ranges to EmitCall/EmitCXXConstructorCall.
Alexey Samsonov [Thu, 21 Aug 2014 20:26:47 +0000 (20:26 +0000)]
Pass expressions instead of argument ranges to EmitCall/EmitCXXConstructorCall.

Summary:
This is a first small step towards passing generic "Expr" instead of
ArgBeg/ArgEnd pair into EmitCallArgs() family of methods. Having "Expr" will
allow us to get the corresponding FunctionDecl and its ParmVarDecls,
thus allowing us to alter CodeGen depending on the function/parameter
attributes.

No functionality change.

Test Plan: regression test suite

Reviewers: rnk

Reviewed By: rnk

Subscribers: aemerson, cfe-commits

Differential Revision: http://reviews.llvm.org/D4915

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

10 years agoCoverage Mapping: store function's hash in coverage function records.
Alex Lorenz [Thu, 21 Aug 2014 19:25:27 +0000 (19:25 +0000)]
Coverage Mapping: store function's hash in coverage function records.

The profile data format was recently updated and the new indexing api
requires the code coverage tool to know the function's hash as well
as the function's name to get the execution counts for a function.

Differential Revision: http://reviews.llvm.org/D4995

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

10 years agoRefactor TLI creation. NFC.
Rafael Espindola [Thu, 21 Aug 2014 17:58:42 +0000 (17:58 +0000)]
Refactor TLI creation. NFC.

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

10 years agoObjective-C. Recover from missing interface decl.
Fariborz Jahanian [Thu, 21 Aug 2014 17:06:57 +0000 (17:06 +0000)]
Objective-C. Recover from missing interface decl.
and checking on availability of method declaration
instead of crashing. // rdar://18059669

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

10 years agoRange'ify some for loops over RecordDecl::fields()
Hans Wennborg [Thu, 21 Aug 2014 16:06:57 +0000 (16:06 +0000)]
Range'ify some for loops over RecordDecl::fields()

No functionality change.

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

10 years agoR600: Implement getPointerWidthV()
Tom Stellard [Thu, 21 Aug 2014 13:58:40 +0000 (13:58 +0000)]
R600: Implement getPointerWidthV()

This fixes a crash in the OCL_ImgProc/Canny OpenCV test.

NOTE: This is a candidate for the 3.5 branch.

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

10 years agoR600: Add processor type for hainan
Tom Stellard [Thu, 21 Aug 2014 13:58:38 +0000 (13:58 +0000)]
R600: Add processor type for hainan

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

10 years agoDriver: Implement -cl-denorms-are-zero
Tom Stellard [Thu, 21 Aug 2014 13:58:36 +0000 (13:58 +0000)]
Driver: Implement -cl-denorms-are-zero

This is currently a no-op, which is allowed by the OpenCL specification.

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

10 years ago[analyzer] Don't warn on virtual calls in ctors to final methods.
Benjamin Kramer [Thu, 21 Aug 2014 10:25:03 +0000 (10:25 +0000)]
[analyzer] Don't warn on virtual calls in ctors to final methods.

The call will never go to a more derived class, but that's intentional in those
cases.

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

10 years agoFix invalid test generation by utils/ABITest/ABITestGen.py when the same enum is...
Daniel Sanders [Thu, 21 Aug 2014 10:13:49 +0000 (10:13 +0000)]
Fix invalid test generation by utils/ABITest/ABITestGen.py when the same enum is generated more than once.

When generating records/unions, the same enum type may be generated more
than once (with different names). In these cases, the name of the enum
values are not sufficiently unique to prevent multiple declarations. E.g:
  typedef enum T3 { enum0val0 } T3;
  typedef T3 T2[3];
  typedef enum T4 { enum0val0 } T4;
  typedef union T1 { T2 field0; T4 field1; char field2; } T1;

Added a unique suffix to enum values so that multiple identical enum types do
not use the same enum value names.

One example of this bug is produced by:
  ABITestGen.py --no-unsigned --no-vector --no-complex --no-bool \
                --max-args 0 --max-record-depth 1 -o inputs/test.9921.a.c \
                -T inputs/test.9921.b.c -D inputs/test.9921.driver.c \
                --min=9921 --count=1

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

10 years agoMS ABI: Don't always instantiate all members of dllexported class templates (PR20163)
Hans Wennborg [Thu, 21 Aug 2014 01:14:01 +0000 (01:14 +0000)]
MS ABI: Don't always instantiate all members of dllexported class templates (PR20163)

Normally we mark all members of exported classes referenced to get them emitted.

However, MSVC doesn't do this for class templates that are implicitly specialized or
just have an explicit instantiation declaration. For such specializations, the members
are emitted when referenced.

The exception is the case when the dllexport attribute is propagated from a base class
to a base class template that doesn't have an explicit attribute: in this case all
methods of the base class template do get instantiated.

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

10 years agotest/CodeGenCXX/dllexport.cpp: don't instantiate templates in USEMEMFUNC macro
Hans Wennborg [Thu, 21 Aug 2014 00:10:34 +0000 (00:10 +0000)]
test/CodeGenCXX/dllexport.cpp: don't instantiate templates in USEMEMFUNC macro

Use the derived class in the macro instead, to make it unambigous where
the template is being instantiated.

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

10 years ago[test] Turn off warnings for test/Analysis/identical-expressions.cpp.
Jordan Rose [Wed, 20 Aug 2014 22:40:57 +0000 (22:40 +0000)]
[test] Turn off warnings for test/Analysis/identical-expressions.cpp.

Also, make it slightly clearer what's being tested by only differentiating integer
literals based on their suffix, rather than using a very large constant.

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

10 years agoTest: CoverageMapping: use "RUN: FileCheck" command instead of "RUN: cat | Filecheck".
Alex Lorenz [Wed, 20 Aug 2014 17:29:47 +0000 (17:29 +0000)]
Test: CoverageMapping: use "RUN: FileCheck" command instead of "RUN: cat | Filecheck".

Change the lit RUN commands for 3 tests to use the following pattern
"FileCheck -input-file ..." instead of "cat ... | FileCheck ..." as
suggested by Justin Bogner.

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

10 years agoCoverage mapping: fix mapping for objective-c for statement
Alex Lorenz [Wed, 20 Aug 2014 17:11:53 +0000 (17:11 +0000)]
Coverage mapping: fix mapping for objective-c for statement

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

10 years agoCoverage mapping: fix mapping for objective-c message expression
Alex Lorenz [Wed, 20 Aug 2014 17:10:56 +0000 (17:10 +0000)]
Coverage mapping: fix mapping for objective-c message expression

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

10 years ago[analyzer] UnixAPI: Check that the third argument to open(2) (if present) is an integer.
Jordan Rose [Wed, 20 Aug 2014 16:58:09 +0000 (16:58 +0000)]
[analyzer] UnixAPI: Check that the third argument to open(2) (if present) is an integer.

Patch by Daniel Fahlgren.

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

10 years ago[analyzer] UnixAPI: Check when open(2) is called with more than three arguments.
Jordan Rose [Wed, 20 Aug 2014 16:58:03 +0000 (16:58 +0000)]
[analyzer] UnixAPI: Check when open(2) is called with more than three arguments.

Patch by Daniel Fahlgren.

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

10 years ago[analyzer] IdenticalExpr: don't try to compare integer literals with different widths.
Jordan Rose [Wed, 20 Aug 2014 16:51:26 +0000 (16:51 +0000)]
[analyzer] IdenticalExpr: don't try to compare integer literals with different widths.

PR20659. Patch by Anders Rönnholm.

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

10 years ago[analyzer] IdenticalExpr: use getBytes rather than getString to compare string literals.
Jordan Rose [Wed, 20 Aug 2014 16:51:18 +0000 (16:51 +0000)]
[analyzer] IdenticalExpr: use getBytes rather than getString to compare string literals.

PR20693. Patch by Anders Rönnholm.

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

10 years agoObjective-C [qoi]. Provide fix-it hint when sending
Fariborz Jahanian [Tue, 19 Aug 2014 23:39:17 +0000 (23:39 +0000)]
Objective-C [qoi]. Provide fix-it hint when sending
class method to an object receiver. rdar://16263395

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

10 years agoHandle SPARC float command line parameters for SPARCv9.
Brad Smith [Tue, 19 Aug 2014 21:50:15 +0000 (21:50 +0000)]
Handle SPARC float command line parameters for SPARCv9.

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

10 years agoTest: Coverage Mapping: add missing RUN commands
Alex Lorenz [Tue, 19 Aug 2014 20:51:54 +0000 (20:51 +0000)]
Test: Coverage Mapping: add missing RUN commands

Add the llvm-lit RUN commands for the two coverage mapping tests
that filecheck a temporary file.

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

10 years agoAdd tests for coverage mapping generation.
Alex Lorenz [Tue, 19 Aug 2014 17:32:30 +0000 (17:32 +0000)]
Add tests for coverage mapping generation.

This patch adds the tests for the coverage mapping generation.
Most of the tests check the mapping regions produced by
the generator, and one checks the llvm IR.

Differential Revision: http://reviews.llvm.org/D4847

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

10 years agoext_vector IRGen. Patch to allow indexing into
Fariborz Jahanian [Tue, 19 Aug 2014 17:17:40 +0000 (17:17 +0000)]
ext_vector IRGen. Patch to allow indexing into
ext_vector_type's 'hi/lo' components when
used as lvalue. rdar://18031917 pr20697

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

10 years agoC++1y is now C++14!
Aaron Ballman [Tue, 19 Aug 2014 15:55:55 +0000 (15:55 +0000)]
C++1y is now C++14!

Changes diagnostic options, language standard options, diagnostic identifiers, diagnostic wording to use c++14 instead of c++1y. It also modifies related test cases to use the updated diagnostic wording.

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

10 years agoMove the body out of line to try to fix a buildbot.
Rafael Espindola [Tue, 19 Aug 2014 14:36:35 +0000 (14:36 +0000)]
Move the body out of line to try to fix a buildbot.

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

10 years agoGo back to having a takeModule instead of a getModule.
Rafael Espindola [Tue, 19 Aug 2014 14:32:16 +0000 (14:32 +0000)]
Go back to having a takeModule instead of a getModule.

Returning a std::unique_ptr is more constrained. Thanks to David Blaikie for the
suggestion.

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

10 years ago[OPENMP] Extract common superclass from all the loop directives. No functional change...
Alexander Musman [Tue, 19 Aug 2014 11:27:13 +0000 (11:27 +0000)]
[OPENMP] Extract common superclass from all the loop directives. No functional changes (having common superclass is convenient for future loop directives CodeGen implementation)

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

10 years agoMS ABI: Update alias template mangling for VC "14" CTP 3
David Majnemer [Tue, 19 Aug 2014 07:29:03 +0000 (07:29 +0000)]
MS ABI: Update alias template mangling for VC "14" CTP 3

MSVC "14" CTP 3 has fixed it's mangling for alias templates when used as
template-template arguments; update clang to be compatible with this
mangling.

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

10 years agoUpdate for llvm api change.
Rafael Espindola [Tue, 19 Aug 2014 04:04:30 +0000 (04:04 +0000)]
Update for llvm api change.

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

10 years agoAdd a warning flag for an existing diagnostic.
Nico Weber [Mon, 18 Aug 2014 23:02:03 +0000 (23:02 +0000)]
Add a warning flag for an existing diagnostic.

One more, and the number of flags without a dedicated flag fits in two decimal
digits :-)

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

10 years agoUpdate link strategy for sanitizer runtime libraries on Linux:
Alexey Samsonov [Mon, 18 Aug 2014 22:10:42 +0000 (22:10 +0000)]
Update link strategy for sanitizer runtime libraries on Linux:

1. Always put static sanitizer runtimes to the front of the linker
invocation line. This was already done for all sanitizers except UBSan:
in case user provides static libstdc++ we need to make sure that new/delete
operator definitions are picked from sanitizer runtimes instead of libstdc++.
We have to put UBSan runtime first for similar reasons: it depends on some
libstdc++ parts (e.g. __dynamic_cast function), and has to go first in
link line to ensure these functions will be picked up from libstdc++.

2. Put sanitizer libraries system dependencies (-ldl, -lpthread etc.) right
after sanitizer runtimes. This will ensure these libraries participate in
the link even if user provided -Wl,-as-needed flag. This should fix PR15823.

3. In case we link in several sanitizer runtimes (e.g. "ubsan", "ubsan_cxx"
and "san"), add system dependencies (-ldl, -lpthread, ...) only once.

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

10 years agoFix the rececl chain for redeclarations of predefined decls
Ben Langmuir [Mon, 18 Aug 2014 19:32:45 +0000 (19:32 +0000)]
Fix the rececl chain for redeclarations of predefined decls

Predefined decls like 'Protocol' in objc are not loaded from AST files,
so we cannot rely on loading the canonical decl to complete the redecl
chain for redeclarations of these decls.  The broken redecl chain was
non-circular, so looping over redecls() would hang.

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

10 years agoStore std::unique_ptr in InMemoryBuffers. NFC.
Rafael Espindola [Mon, 18 Aug 2014 19:16:31 +0000 (19:16 +0000)]
Store std::unique_ptr in InMemoryBuffers. NFC.

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

10 years agoreturn a std::unique_ptr from getMainBufferWithPrecompiledPreamble. NFC.
Rafael Espindola [Mon, 18 Aug 2014 18:47:08 +0000 (18:47 +0000)]
return a std::unique_ptr from getMainBufferWithPrecompiledPreamble. NFC.

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

10 years agoUse std::unique_ptr to simplify this code a bit.
Rafael Espindola [Mon, 18 Aug 2014 18:33:41 +0000 (18:33 +0000)]
Use std::unique_ptr to simplify this code a bit.

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

10 years agoInline function into only use.
Rafael Espindola [Mon, 18 Aug 2014 18:17:32 +0000 (18:17 +0000)]
Inline function into only use.

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

10 years agoSimplify ASTUnit::Parse a bit by passing a std::unique_ptr to it.
Rafael Espindola [Mon, 18 Aug 2014 16:23:45 +0000 (16:23 +0000)]
Simplify ASTUnit::Parse a bit by passing a std::unique_ptr to it.

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

10 years ago[x32] Handle -m64/-m32 switches by Driver in x32 mode
Pavel Chupin [Mon, 18 Aug 2014 15:38:38 +0000 (15:38 +0000)]
[x32] Handle -m64/-m32 switches by Driver in x32 mode

Summary:
Adding remaining 2 cases handling:
* from x32 to 32 via -m32
* from x32 to 64 via -m64

Test Plan: linux-ld test updated

Reviewers: chandlerc, atanasyan

Subscribers: cfe-commits, zinovy.nis

Differential Revision: http://reviews.llvm.org/D4930

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

10 years agoFix a memory leak in one of the test unit. Silent coverity warning CID 1095912
Sylvestre Ledru [Mon, 18 Aug 2014 15:18:56 +0000 (15:18 +0000)]
Fix a memory leak in one of the test unit. Silent coverity warning CID 1095912

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

10 years agoAdd the break in the switch case (even if there is llvm_unreachable. It will silent...
Sylvestre Ledru [Mon, 18 Aug 2014 15:13:44 +0000 (15:13 +0000)]
Add the break in the switch case (even if there is llvm_unreachable. It will silent coverity warning CID 1231654

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

10 years agoUpdate the call to llvm::sys::fs::UniqueID to match the definition: UniqueID(uint64_t...
Sylvestre Ledru [Mon, 18 Aug 2014 15:00:11 +0000 (15:00 +0000)]
Update the call to llvm::sys::fs::UniqueID to match the definition: UniqueID(uint64_t Device, uint64_t File)
Fixes CID 1095247

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

10 years agoRepace SmallPtrSet with SmallPtrSetImpl in function arguments to avoid needing to...
Craig Topper [Sun, 17 Aug 2014 23:49:53 +0000 (23:49 +0000)]
Repace SmallPtrSet with SmallPtrSetImpl in function arguments to avoid needing to mention the size.

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

10 years agoUse the pointer-like API of ErrorOr.
Rafael Espindola [Sun, 17 Aug 2014 23:31:27 +0000 (23:31 +0000)]
Use the pointer-like API of ErrorOr.

Thanks to David Blaikie for the suggestion.

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

10 years agoCreate a std::unique_ptr earlier.
Rafael Espindola [Sun, 17 Aug 2014 23:27:13 +0000 (23:27 +0000)]
Create a std::unique_ptr earlier.

Thanks to David Blaikie for the suggestion.

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

10 years agoUse std::unique_ptr in a few methods that take ownership.
Rafael Espindola [Sun, 17 Aug 2014 23:12:27 +0000 (23:12 +0000)]
Use std::unique_ptr in a few methods that take ownership.

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

10 years agoUpdate for llvm api changes.
Rafael Espindola [Sun, 17 Aug 2014 22:20:41 +0000 (22:20 +0000)]
Update for llvm api changes.

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

10 years agoConvert a few ownership comments with std::unique_ptr.
Rafael Espindola [Sun, 17 Aug 2014 22:12:58 +0000 (22:12 +0000)]
Convert a few ownership comments with std::unique_ptr.

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

10 years agoDo not rely on bin/ path prefix in tests.
Manuel Klimek [Sun, 17 Aug 2014 19:11:18 +0000 (19:11 +0000)]
Do not rely on bin/ path prefix in tests.

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

10 years agoAdd a test for -no-canonical-prefixes.
Rafael Espindola [Sun, 17 Aug 2014 16:22:16 +0000 (16:22 +0000)]
Add a test for -no-canonical-prefixes.

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

10 years agoFix assertion on asm register that are "%"
Olivier Goffart [Sun, 17 Aug 2014 13:19:48 +0000 (13:19 +0000)]
Fix assertion on asm register that are "%"

Name might be empty again after we removed the '%' prefix
and Name[0] would assert.

Found on code like
register int foo asm("%" MACRO);
where MACRO was supposed to be defined in a header file that was not found.

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

10 years agoUniformed parsing of GNU attributes at line beginnning and added GNU attributes parsi...
Abramo Bagnara [Sat, 16 Aug 2014 08:29:27 +0000 (08:29 +0000)]
Uniformed parsing of GNU attributes at line beginnning and added GNU attributes parsing FIXMEs.

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

10 years agoWhen loading a module with no local entities, still bump the size of the
Ben Langmuir [Sat, 16 Aug 2014 04:54:18 +0000 (04:54 +0000)]
When loading a module with no local entities, still bump the size of the

tables that correspond to ContinuousRangeMaps, since the keys to those
maps need to be unique, or we may map to the wrong offset.

This fixes a crash + malformed AST file seen when loading some modules
that import Cocoa on Darwin, which is a module with no contents except
imports of other modules. Unfortunately I have not been able to find a
reduced test case that reproduces this problem.

Also add an assert that we aren't mapping one key to multiple values
in CRM.  We ought to be able to say there are no duplicate keys at all,
but there are a bunch of 0 -> 0 mappings that are showing up, probably
coming from the source location table.

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

10 years agoClarify.
Nick Lewycky [Sat, 16 Aug 2014 02:14:37 +0000 (02:14 +0000)]
Clarify.

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

10 years agoTry indenting to put all the text inside the block.
Nick Lewycky [Sat, 16 Aug 2014 02:11:54 +0000 (02:11 +0000)]
Try indenting to put all the text inside the block.

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

10 years agoDocument what's experimental about __attribute__((enable_if)). PR20392
Nick Lewycky [Sat, 16 Aug 2014 02:09:42 +0000 (02:09 +0000)]
Document what's experimental about __attribute__((enable_if)). PR20392

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

10 years ago[libclang] Introduce clang_File_isEqual for comparing CXFile handles.
Argyrios Kyrtzidis [Sat, 16 Aug 2014 00:26:19 +0000 (00:26 +0000)]
[libclang] Introduce clang_File_isEqual for comparing CXFile handles.

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

10 years agoRevert "Update for LLVM change (StringSaver)"
Sean Silva [Fri, 15 Aug 2014 23:39:12 +0000 (23:39 +0000)]
Revert "Update for LLVM change (StringSaver)"

This reverts commit r215785 / 170ebf4f19459ae51a9561d0e65c87ee4c9b2c97.

LLD has some StringSavers that need to be updated. One of which takes a
lock and I need to investigate that more closely.

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

10 years agoMake sure that vtables referenced from delay-parsed templates get referenced.
Nico Weber [Fri, 15 Aug 2014 23:21:41 +0000 (23:21 +0000)]
Make sure that vtables referenced from delay-parsed templates get referenced.

This fixes PR20671, see the bug for details. In short, ActOnTranslationUnit()
calls DefineUsedVTables() and only then PerformPendingInstantiations(). But
PerformPendingInstantiations() is what does delayed template parsing, so
vtables only references from late-parsed templates weren't marked used.

As a fix, move the SavePendingInstantiationsAndVTableUsesRAII in
PerformPendingInstantiations() up above the delayed template parsing code.
That way, vtables referenced from templates end up in the RAII object, and the
call to DefineUsedVTables() in PerformPendingInstantiations() marks them used.

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

10 years agoUpdate for LLVM change (StringSaver)
Sean Silva [Fri, 15 Aug 2014 23:18:49 +0000 (23:18 +0000)]
Update for LLVM change (StringSaver)

There is more cleanup to be done here. Once
llvm::sys::Process::GetArgumentVector is switched over to StringSaver,
we can simplify this code a fair amount.

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

10 years agoAdd a RAII class for saving and restoring instantiations and uses. No behavior change.
Nico Weber [Fri, 15 Aug 2014 22:29:14 +0000 (22:29 +0000)]
Add a RAII class for saving and restoring instantiations and uses. No behavior change.

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

10 years agoWrap to 80 columns, no behavior change.
Nico Weber [Fri, 15 Aug 2014 22:15:00 +0000 (22:15 +0000)]
Wrap to 80 columns, no behavior change.

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

10 years agoRename as suggested by dblaikie
Sean Silva [Fri, 15 Aug 2014 21:40:51 +0000 (21:40 +0000)]
Rename as suggested by dblaikie

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

10 years agoArrayRef'ize
Sean Silva [Fri, 15 Aug 2014 21:38:36 +0000 (21:38 +0000)]
ArrayRef'ize

I've shied away from ArrayRef'izing CompilerInvocation::CreateFromArgs
in this commit because that is a less localized change.

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

10 years agoDebugInfo: While loop backedge should be attribute to the start of the while statement.
David Blaikie [Fri, 15 Aug 2014 21:11:25 +0000 (21:11 +0000)]
DebugInfo: While loop backedge should be attribute to the start of the while statement.

A little test case simplification - this could be simplified further,
though there are certainly interesting connections to the if/else
construct so I'm hesitant to remove that entirely though it does appear
somewhat unrelated.

(similar fix to r215766, related to PR19864)

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

10 years agoRename this function to better reflect its purpose
Sean Silva [Fri, 15 Aug 2014 20:59:03 +0000 (20:59 +0000)]
Rename this function to better reflect its purpose

Thanks to dblaikie for the impetus to look for a better name.

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

10 years agoDebugInfo: Fix PR19864 better - attribute the jump at the end of a range-for loop...
David Blaikie [Fri, 15 Aug 2014 20:50:45 +0000 (20:50 +0000)]
DebugInfo: Fix PR19864 better - attribute the jump at the end of a range-for loop, to the start of the loop.

This avoids debuggers stepping to strange places (like the last
statement in the loop body, or the first statement in the if).

This is not the whole answer, though - similar bugs no doubt exist in
other loops (patches to follow) and attributing exception handling code
to the correct line is also tricky (based on the previous fix to
PR19864, exception handling is still erroneously attributed to the 'if'
line).

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

10 years agoTypo fix in comments: definintion -> definition
James Dennett [Fri, 15 Aug 2014 20:04:40 +0000 (20:04 +0000)]
Typo fix in comments: definintion -> definition

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

10 years ago[cleanup] Rename this function to better reflect its purpose. NFC.
Sean Silva [Fri, 15 Aug 2014 19:23:53 +0000 (19:23 +0000)]
[cleanup] Rename this function to better reflect its purpose. NFC.

This also suggests some refactoring to simplify this code. Basically, a
ton of complexity in this argument handling code comes from the need to
save const char *'s in stable storage for pushing onto argv.
It seems like llvm::cl::StringSaver can be improved to cover all the
needs here.

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

10 years ago[cleanup] Range-for'ify this loop. NFC.
Sean Silva [Fri, 15 Aug 2014 19:23:50 +0000 (19:23 +0000)]
[cleanup] Range-for'ify this loop. NFC.

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

10 years ago[cleanup] Factor out handling CC1 tools. NFC.
Sean Silva [Fri, 15 Aug 2014 19:23:47 +0000 (19:23 +0000)]
[cleanup] Factor out handling CC1 tools. NFC.

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

10 years agoAdd missing matchers to the dynamic registry.
Samuel Benzaquen [Fri, 15 Aug 2014 19:13:27 +0000 (19:13 +0000)]
Add missing matchers to the dynamic registry.

Reviewers: klimek

Subscribers: klimek, cfe-commits

Differential Revision: http://reviews.llvm.org/D4910

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

10 years ago[cleanup] Factor out setting the driver's install dir. NFC.
Sean Silva [Fri, 15 Aug 2014 18:58:15 +0000 (18:58 +0000)]
[cleanup] Factor out setting the driver's install dir. NFC.

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

10 years ago[cleanup] Factor out initializing the DianosticOptions. NFC.
Sean Silva [Fri, 15 Aug 2014 18:58:12 +0000 (18:58 +0000)]
[cleanup] Factor out initializing the DianosticOptions. NFC.

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

10 years ago[cleanup] Factor out adjusting "cl.exe" to "clang-cl.exe". NFC.
Sean Silva [Fri, 15 Aug 2014 18:58:09 +0000 (18:58 +0000)]
[cleanup] Factor out adjusting "cl.exe" to "clang-cl.exe". NFC.

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

10 years ago[cleanup] Factor out some checks. NFC.
Sean Silva [Fri, 15 Aug 2014 18:50:00 +0000 (18:50 +0000)]
[cleanup] Factor out some checks. NFC.

The core logic in main() is actually pretty simple, but there's lots of
stuff that has been added over time which obscures the flow of the code.
In upcoming patches, I'll be pulling more stuff out of the main
codepath.

I'm open to naming suggestions for these helper functions.

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

10 years agoMS ABI: Virtual member pointer thunks are not unnamed_addr
Reid Kleckner [Fri, 15 Aug 2014 18:12:40 +0000 (18:12 +0000)]
MS ABI: Virtual member pointer thunks are not unnamed_addr

They can be compared for identity.

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

10 years agoR600: Add ldexp intrinsic
Matt Arsenault [Fri, 15 Aug 2014 17:44:32 +0000 (17:44 +0000)]
R600: Add ldexp intrinsic

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

10 years agoObjective-C. Do not warn if user is using property-dox syntax to name a
Fariborz Jahanian [Fri, 15 Aug 2014 17:39:00 +0000 (17:39 +0000)]
Objective-C. Do not warn if user is using property-dox syntax to name a
user provided setter name (as declared in @property attribute declaration).
rdar://18022762

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

10 years agoMove some code into a helper function. NFC.
Rafael Espindola [Fri, 15 Aug 2014 17:14:35 +0000 (17:14 +0000)]
Move some code into a helper function. NFC.

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

10 years agoUse a valid arch name in this triple.
Rafael Espindola [Fri, 15 Aug 2014 16:55:25 +0000 (16:55 +0000)]
Use a valid arch name in this triple.

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

10 years agoAdd isDeleted() matcher for FunctionDecl nodes.
Samuel Benzaquen [Fri, 15 Aug 2014 14:20:59 +0000 (14:20 +0000)]
Add isDeleted() matcher for FunctionDecl nodes.

Reviewers: klimek

Subscribers: klimek, cfe-commits

Differential Revision: http://reviews.llvm.org/D4911

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

10 years agoConst-correctness, return-after-else, and formatting updates. NFC.
Aaron Ballman [Fri, 15 Aug 2014 12:38:17 +0000 (12:38 +0000)]
Const-correctness, return-after-else, and formatting updates. NFC.

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

10 years agoThere are no overloads of this virtual function, nor are there any callers of it...
Aaron Ballman [Fri, 15 Aug 2014 12:34:08 +0000 (12:34 +0000)]
There are no overloads of this virtual function, nor are there any callers of it. NFC.

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

10 years agoAdding const-qualifiers to auto declarations. NFC.
Aaron Ballman [Fri, 15 Aug 2014 12:29:39 +0000 (12:29 +0000)]
Adding const-qualifiers to auto declarations. NFC.

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

10 years agoarm_acle.h: Small cleanup
Yi Kong [Fri, 15 Aug 2014 08:53:22 +0000 (08:53 +0000)]
arm_acle.h: Small cleanup

Since __SIZEOF_LONG_LONG__ is always defined as 8 on ARM targets,
there's no point in checking this. NFC.

Patch by Moritz Roth.

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

10 years agoclang-format: Prefer breaking after return type over template param
Daniel Jasper [Fri, 15 Aug 2014 05:00:39 +0000 (05:00 +0000)]
clang-format: Prefer breaking after return type over template param

Before:
  typename aaaaaaaaaa<aaaaaa>::aaaaaaaaaaa aaaaaaaaaa<
      aaaaaa>::aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(bool *aaaaaaaaaaaaaaaaaa,
                                                   bool *aa) {}

After:
  typename aaaaaaaaaa<aaaaaa>::aaaaaaaaaaa
  aaaaaaaaaa<aaaaaa>::aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(
      bool *aaaaaaaaaaaaaaaaaa, bool *aa) {}

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

10 years agoclang-format: [proto] Understand text-format nesting without :
Daniel Jasper [Fri, 15 Aug 2014 05:00:35 +0000 (05:00 +0000)]
clang-format: [proto] Understand text-format nesting without :

Before:
  option (MyProto.options) = {
    field_c : "OK" msg_field{field_d : 123}
  };

After:
  option (MyProto.options) = {
    field_c : "OK"
    msg_field{field_d : 123}
  };

(Note that the colon after "msg_field" is optional).

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

10 years agoMake sure CallExpr::getLocStart doesn't segfault
Keno Fischer [Fri, 15 Aug 2014 01:39:12 +0000 (01:39 +0000)]
Make sure CallExpr::getLocStart doesn't segfault

Summary:
When the CallExpr passed to Sema::ConvertArgumentsForCall has all default parameters, and the number of actual arguments passed is zero, this function will segfault in the call to Call->getLocStart() if the Callee has an invalid getLocStart(), the reason being that since ConvertArgumentsForCall has set the correct number of arguments, but has not filled them in yet, getLocStart() will try to access the first (not yet existent) argument and thus segfaults.

This fixes that by making getLocStart return an invalid source location if the queried argument is NULL rather than segfaulting.

Reviewers: rnk

Reviewed By: rnk

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D4917

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

10 years agoLimit our MSVC compat hack for nested names from dependent bases
Reid Kleckner [Thu, 14 Aug 2014 23:34:52 +0000 (23:34 +0000)]
Limit our MSVC compat hack for nested names from dependent bases

Previously, any undeclared unqualified id starting a nested name
specifier in a dependent context would have its lookup retried during
template instantiation.  Now we limit that retry hack to methods of a
class with dependent bases.  Free function templates in particular are
no longer affected by this hack.

Also, diagnose this as a Microsoft extension. This has the downside that
template authors may see this warning *and* an error during
instantiation time about this identifier. Fixing that will probably
require formalizing some kind of "delayed" identifier, instead of our
ad-hoc solutions of forming dependent AST nodes when lookup fails.

Based on a patch by Kim Gräsman!

Differential Revision: http://reviews.llvm.org/D4854

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

10 years agoThread Safety Analysis: Move -Wthread-safety-negative out of the
DeLesley Hutchins [Thu, 14 Aug 2014 21:54:34 +0000 (21:54 +0000)]
Thread Safety Analysis:  Move -Wthread-safety-negative out of the
-Wthread-safety umbrella flag, pending updates to documentation.  The flag
works, but is likely to be confusing to existing users of -Wthread-safety.

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