]> granicus.if.org Git - clang/log
clang
11 years agoLLVM API changes.
Peter Collingbourne [Sat, 2 Mar 2013 01:20:22 +0000 (01:20 +0000)]
LLVM API changes.

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

11 years agoCMake: -Wno-nested-anon-types for Clang.
Jordan Rose [Sat, 2 Mar 2013 00:49:47 +0000 (00:49 +0000)]
CMake: -Wno-nested-anon-types for Clang.

In LLVM, -pedantic is not set unless LLVM_ENABLE_PEDANTIC is set.
However, Clang's CMakeLists.txt unilaterally adds -pedantic to the run
line, so we need to disable -Wnested-anon-types explicitly.

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

11 years ago[analyzer] Update open source checker build to checker-272.
Jordan Rose [Fri, 1 Mar 2013 23:26:05 +0000 (23:26 +0000)]
[analyzer] Update open source checker build to checker-272.

See http://clang-analyzer.llvm.org/release_notes.html for what's new
in this build.

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

11 years ago[analyzer] Special-case bitfields when finding sub-region bindings.
Jordan Rose [Fri, 1 Mar 2013 23:03:17 +0000 (23:03 +0000)]
[analyzer] Special-case bitfields when finding sub-region bindings.

Previously we were assuming that we'd never ask for the sub-region bindings
of a bitfield, since a bitfield cannot have subregions. However,
unification of code paths has made that assumption invalid. While we could
take advantage of this by just checking for the single possible binding,
it's probably better to do the right thing, so that if/when we someday
support unions we'll do the right thing there, too.

This fixes a handful of false positives in analyzing LLVM.

<rdar://problem/13325522>

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

11 years agocomment parsing. Keep the original command format
Fariborz Jahanian [Fri, 1 Mar 2013 22:51:30 +0000 (22:51 +0000)]
comment parsing. Keep the original command format
in AST for source fidelity and use it in diagnostics
to refer to the original format. // rdar://13066276

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

11 years agoFix typos: [Dd]iagnosic -> [Dd]iagnostic
Stefanus Du Toit [Fri, 1 Mar 2013 21:41:22 +0000 (21:41 +0000)]
Fix typos: [Dd]iagnosic -> [Dd]iagnostic

These all appear in comments or (ironically) diagnostics output.

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

11 years ago[analyzer] Suppress paths involving a reference whose rvalue is null.
Jordan Rose [Fri, 1 Mar 2013 19:45:10 +0000 (19:45 +0000)]
[analyzer] Suppress paths involving a reference whose rvalue is null.

Most map types have an operator[] that inserts a new element if the key
isn't found, then returns a reference to the value slot so that you can
assign into it. However, if the value type is a pointer, it will be
initialized to null. This is usually no problem.

However, if the user /knows/ the map contains a value for a particular key,
they may just use it immediately:

   // From ClangSACheckersEmitter.cpp
   recordGroupMap[group]->Checkers

In this case the analyzer reports a null dereference on the path where the
key is not in the map, even though the user knows that path is impossible
here. They could silence the warning by adding an assertion, but that means
splitting up the expression and introducing a local variable. (Note that
the analyzer has no way of knowing that recordGroupMap[group] will return
the same reference if called twice in a row!)

We already have logic that says a null dereference has a high chance of
being a false positive if the null came from an inlined function. This
patch simply extends that to references whose rvalues are null as well,
silencing several false positives in LLVM.

<rdar://problem/13239854>

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

11 years agoRemove whitespace at end of file.
Daniel Jasper [Fri, 1 Mar 2013 18:11:39 +0000 (18:11 +0000)]
Remove whitespace at end of file.

This fixes the rest of llvm.org/PR15062.

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

11 years agoCorrectly format arrays of pointers and function types.
Daniel Jasper [Fri, 1 Mar 2013 17:13:29 +0000 (17:13 +0000)]
Correctly format arrays of pointers and function types.

Before:
void f(Type(*parameter)[10]) {}
int(*func)(void *);

After:
void f(Type (*parameter)[10]) {}
int (*func)(void *);

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

11 years ago[PCH] Remove building a SmallPtrSet that is not actually used for anything.
Argyrios Kyrtzidis [Fri, 1 Mar 2013 17:01:31 +0000 (17:01 +0000)]
[PCH] Remove building a SmallPtrSet that is not actually used for anything.

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

11 years agoNormal indent for last element of builder-type call.
Daniel Jasper [Fri, 1 Mar 2013 16:48:32 +0000 (16:48 +0000)]
Normal indent for last element of builder-type call.

In builder type call, we indent to the laster function calls.
However, for the last element of such a call, we don't need to do
so, as that normally just wastes space and does not increase
readability.

Before:
aaaaaa->aaaaaa->aaaaaa( // break
                  aaaaaa);
aaaaaaaaaaaaaaaaaaaaa->aaaaaaaaaaaaaaaaaaaaaa
    ->aaaaaaaaaaaaaaaaaaaaaaaaaa(
        aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa);

After:
aaaaaa->aaaaaa->aaaaaa( // break
    aaaaaa);
aaaaaaaaaaaaaaaaaaaaa->aaaaaaaaaaaaaaaaaaaaaa->aaaaaaaaaaaaaaaaaaaaaaaaaa(
    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa);

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

11 years agoRemove trailing whitespace of line comments.
Daniel Jasper [Fri, 1 Mar 2013 16:45:59 +0000 (16:45 +0000)]
Remove trailing whitespace of line comments.

This fixed llvm.org/PR15378.

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

11 years agoImplements breaking string literals at slashes.
Manuel Klimek [Fri, 1 Mar 2013 13:29:19 +0000 (13:29 +0000)]
Implements breaking string literals at slashes.

We now break at a slash if we do not find a space to break on.

Also fixes a bug where we would go over the limit when breaking the
second line.

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

11 years agoImplement fallback split point for string literals.
Manuel Klimek [Fri, 1 Mar 2013 13:14:08 +0000 (13:14 +0000)]
Implement fallback split point for string literals.

If we don't find a natural split point (currently space) in a string
literal protruding over the line, we just split at the last possible
point.

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

11 years agoPerform the receiver-expression transformations regardless of
John McCall [Fri, 1 Mar 2013 09:20:14 +0000 (09:20 +0000)]
Perform the receiver-expression transformations regardless of
whether we already have a method.  Fixes a bug where we were
failing to properly contextually convert a message receiver
during template instantiation.

As a side-effect, we now actually perform correct method lookup
after adjusting a message-send to integral or non-ObjC pointer
types (legal outside of ARC).

rdar://13305374

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

11 years agoAttempt to not place ownership qualifiers on the result type
John McCall [Fri, 1 Mar 2013 07:58:16 +0000 (07:58 +0000)]
Attempt to not place ownership qualifiers on the result type
of block declarators.  Document the rule we use.

Also document the rule that Doug implemented a few weeks ago
which drops ownership qualifiers on function result types.

rdar://10127067

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

11 years ago[analyzer] Reword FAQ
Anna Zaks [Fri, 1 Mar 2013 06:38:16 +0000 (06:38 +0000)]
[analyzer] Reword FAQ
Reword the FAQ to stress more that the assert should be used only in case
the developer is sure that the issue is a false positive.

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

11 years agoAdd one more sanity check in SourceManager::getFileIDLoaded().
Argyrios Kyrtzidis [Fri, 1 Mar 2013 03:43:33 +0000 (03:43 +0000)]
Add one more sanity check in SourceManager::getFileIDLoaded().

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

11 years ago[PCH] Enhance InputFile to also include whether the file is out-of-date.
Argyrios Kyrtzidis [Fri, 1 Mar 2013 03:26:04 +0000 (03:26 +0000)]
[PCH] Enhance InputFile to also include whether the file is out-of-date.

Previously we would return null for an out-of-date file. This inhibited ASTReader::ReadSLocEntry
from creating a FileID to recover gracefully in such a case.

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

11 years agoIn SourceManager::getFileIDLoaded(), add some sanity checks to make sure we don't...
Argyrios Kyrtzidis [Fri, 1 Mar 2013 03:26:00 +0000 (03:26 +0000)]
In SourceManager::getFileIDLoaded(), add some sanity checks to make sure we don't enter an infinite loop.

rdar://13120919

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

11 years agoRestore order to placate test. I had no real reason to switch them.
John McCall [Fri, 1 Mar 2013 01:38:54 +0000 (01:38 +0000)]
Restore order to placate test.  I had no real reason to switch them.

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

11 years agoRe-use bit from superclass and extract stuff into a local
John McCall [Fri, 1 Mar 2013 01:24:35 +0000 (01:24 +0000)]
Re-use bit from superclass and extract stuff into a local
function.  Serves a patch we're kicking around out-of-tree.

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

11 years agoFix warning text of my last patch.
Fariborz Jahanian [Thu, 28 Feb 2013 23:16:39 +0000 (23:16 +0000)]
Fix warning text of my last patch.
// rdar://13158394

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

11 years agoAdd more of the command line options as attribute flags.
Bill Wendling [Thu, 28 Feb 2013 22:49:57 +0000 (22:49 +0000)]
Add more of the command line options as attribute flags.

These can be easily queried by the back-end.

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

11 years agoobjective-C: clang, following gcc, warns on
Fariborz Jahanian [Thu, 28 Feb 2013 22:36:31 +0000 (22:36 +0000)]
objective-C: clang, following gcc, warns on
use of stand-alone protocol as type and uses
id<proto>. Modify warning to say what compiler
is doing. // rdar//13158394

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

11 years agoUse the actual ABI-determined C calling convention for runtime
John McCall [Thu, 28 Feb 2013 19:01:20 +0000 (19:01 +0000)]
Use the actual ABI-determined C calling convention for runtime
calls and declarations.

LLVM has a default CC determined by the target triple.  This is
not always the actual default CC for the ABI we've been asked to
target, and so we sometimes find ourselves annotating all user
functions with an explicit calling convention.  Since these
calling conventions usually agree for the simple set of argument
types passed to most runtime functions, using the LLVM-default CC
in principle has no effect.  However, the LLVM optimizer goes
into histrionics if it sees this kind of formal CC mismatch,
since it has no concept of CC compatibility.  Therefore, if this
module happens to define the "runtime" function, or got LTO'ed
with such a definition, we can miscompile;  so it's quite
important to get this right.

Defining runtime functions locally is quite common in embedded
applications.

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

11 years agoClangFormat.rst: Fix two small typos
Hans Wennborg [Thu, 28 Feb 2013 18:16:24 +0000 (18:16 +0000)]
ClangFormat.rst: Fix two small typos

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

11 years agoFix a problem where 'clang' is ambiguous in MSVC builds.
Manuel Klimek [Thu, 28 Feb 2013 18:12:44 +0000 (18:12 +0000)]
Fix a problem where 'clang' is ambiguous in MSVC builds.

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

11 years agoAdd comment to my last test.
Fariborz Jahanian [Thu, 28 Feb 2013 18:03:28 +0000 (18:03 +0000)]
Add comment to my last test.

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

11 years agoobjective-C code completion. Property accessors may not
Fariborz Jahanian [Thu, 28 Feb 2013 17:47:14 +0000 (17:47 +0000)]
objective-C code completion. Property accessors may not
have their own code completion comments. Use those in
their properties in this case.
// rdar://12791315

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

11 years agoReduce penalty for splitting after "{" in static initializers.
Daniel Jasper [Thu, 28 Feb 2013 15:04:12 +0000 (15:04 +0000)]
Reduce penalty for splitting after "{" in static initializers.

This fixes llvm.org/PR15379.

Before:
const uint8_t aaaaaaaaaaaaaaaaaaaaaa[0] = { 0x00, 0x00, 0x00, 0x00, 0x00,
                                            0x00,                  // comment
                                            0x00, 0x00, 0x00, 0x00, 0x00,
                                            0x00,                  // comment
                                            0x00, 0x00, 0x00, 0x00 // comment
};

After:
const uint8_t aaaaaaaaaaaaaaaaaaaaaa[0] = {
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // comment
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // comment
  0x00, 0x00, 0x00, 0x00              // comment
};

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

11 years agoDont break between (( in __attribute__((.
Daniel Jasper [Thu, 28 Feb 2013 14:44:25 +0000 (14:44 +0000)]
Dont break between (( in __attribute__((.

Before:
void aaaaaaaaaaaaaaaaaa() __attribute__(
    (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
     aaaaaaaaaaaaaaaaaaaaaaaaa));

After:
void aaaaaaaaaaaaaaaaaa()
    __attribute__((aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,
                   aaaaaaaaaaaaaaaaaaaaaaaaa));

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

11 years agoImprove property metadata generation with the GNUstep runtime.
David Chisnall [Thu, 28 Feb 2013 13:59:29 +0000 (13:59 +0000)]
Improve property metadata generation with the GNUstep runtime.

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

11 years agoNo spaces around pointers to members.
Daniel Jasper [Thu, 28 Feb 2013 13:40:17 +0000 (13:40 +0000)]
No spaces around pointers to members.

Before: (a ->* f)()
After:  (a->*f)()

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

11 years agoFirst step towards adding a parent map to the ASTContext.
Manuel Klimek [Thu, 28 Feb 2013 13:21:39 +0000 (13:21 +0000)]
First step towards adding a parent map to the ASTContext.

This does not yet implement the LimitNode approach discussed.

The impact of this is an O(n) in the number of nodes in the AST
reduction of complexity for certain kinds of matchers (as otherwise the
parent map gets recreated for every new MatchFinder).

See FIXMEs in the comments for the direction of future work.

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

11 years agoImprove formatting of #defines.
Daniel Jasper [Thu, 28 Feb 2013 11:05:57 +0000 (11:05 +0000)]
Improve formatting of #defines.

Two improvements:
1) Always leave at least one space before "\". Otherwise is can look bad
   and there is a risk of unwillingly joining to characters to a different
   token.
2) Use the full column limit for single-line #defines.
   Fixes llvm.org/PR15148

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

11 years agoFix bug when formatting "A<A<A>>".
Daniel Jasper [Thu, 28 Feb 2013 10:06:05 +0000 (10:06 +0000)]
Fix bug when formatting "A<A<A>>".

Before:
A<A<A>> ReadKansas(int aaaaaaaaaaaaaaaaaaaaaaaaaaa,
                     int aaaaaaaaaaaaaaaaaaaaaaa);
Before:
A<A<A>> ReadKansas(int aaaaaaaaaaaaaaaaaaaaaaaaaaa,
                   int aaaaaaaaaaaaaaaaaaaaaaa);

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

11 years agoFix incorrect recognition of bin-packing.
Daniel Jasper [Thu, 28 Feb 2013 09:39:12 +0000 (09:39 +0000)]
Fix incorrect recognition of bin-packing.

Before (in Google style):
Constructor()
    : aaaaa(aaaaaa), aaaaa(aaaaaa), aaaaa(aaaaaa), aaaaa(aaaaaa), aaaaa(
          aaaaaa) {}

After:
Constructor()
    : aaaaa(aaaaaa),
      aaaaa(aaaaaa),
      aaaaa(aaaaaa),
      aaaaa(aaaaaa),
      aaaaa(aaaaaa) {}

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

11 years agoFix spacing after binary operator as macro parameter.
Daniel Jasper [Thu, 28 Feb 2013 09:21:10 +0000 (09:21 +0000)]
Fix spacing after binary operator as macro parameter.

Before: COMPARE(a, == , b);
After:  COMPARE(a, ==, b);

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

11 years agoFix global overflow in types::lookupTypeForTypeSpecifier.
Evgeniy Stepanov [Thu, 28 Feb 2013 07:53:32 +0000 (07:53 +0000)]
Fix global overflow in types::lookupTypeForTypeSpecifier.

memcpy() is allowed to read entire contents of both memory areas.

Found with AddressSanitizer.

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

11 years ago[analyzer] RegionStore: collectSubRegionKeys -> collectSubRegionBindings
Jordan Rose [Thu, 28 Feb 2013 01:53:08 +0000 (01:53 +0000)]
[analyzer] RegionStore: collectSubRegionKeys -> collectSubRegionBindings

By returning the (key, value) binding pairs, we save lookups afterwards.
This also enables further work later on.

No functionality change.

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

11 years ago[analyzer] Mark the root SVal class as isPodLike.
Jordan Rose [Thu, 28 Feb 2013 01:53:03 +0000 (01:53 +0000)]
[analyzer] Mark the root SVal class as isPodLike.

Pure optimization, no functionality change. Probably does not make much
of a difference, but it's free.

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

11 years agoAdd a test case, to make sure there is no crash on IRGen when using PCH
Argyrios Kyrtzidis [Thu, 28 Feb 2013 01:13:53 +0000 (01:13 +0000)]
Add a test case, to make sure there is no crash on IRGen when using PCH

Related to rdar://13114142

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

11 years agoAvoiding flamewars
Renato Golin [Wed, 27 Feb 2013 23:21:44 +0000 (23:21 +0000)]
Avoiding flamewars

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

11 years agoPR15360: nullptr as a non-type template argument to a function type non-type template...
David Blaikie [Wed, 27 Feb 2013 22:10:40 +0000 (22:10 +0000)]
PR15360: nullptr as a non-type template argument to a function type non-type template parameter

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

11 years agoAdd test coverage for array to pointer decay in non-type template parameters.
David Blaikie [Wed, 27 Feb 2013 22:10:37 +0000 (22:10 +0000)]
Add test coverage for array to pointer decay in non-type template parameters.

Functionality committed in r172585 but tested the function case without the
array case.

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

11 years agoAdd config manager to open projects
Renato Golin [Wed, 27 Feb 2013 21:28:29 +0000 (21:28 +0000)]
Add config manager to open projects

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

11 years ago[analyzer] Fix test for previous commit.
Jordan Rose [Wed, 27 Feb 2013 18:57:20 +0000 (18:57 +0000)]
[analyzer] Fix test for previous commit.

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

11 years ago[analyzer] Teach FindLastStoreBRVisitor to understand stores of the same value.
Jordan Rose [Wed, 27 Feb 2013 18:49:57 +0000 (18:49 +0000)]
[analyzer] Teach FindLastStoreBRVisitor to understand stores of the same value.

Consider this case:

  int *p = 0;
  p = getPointerThatMayBeNull();
  *p = 1;

If we inline 'getPointerThatMayBeNull', we might know that the value of 'p'
is NULL, and thus emit a null pointer dereference report. However, we
usually want to suppress such warnings as error paths, and we do so by using
FindLastStoreBRVisitor to see where the NULL came from. In this case, though,
because 'p' was NULL both before and after the assignment, the visitor
would decide that the "last store" was the initialization, not the
re-assignment.

This commit changes FindLastStoreBRVisitor to consider all PostStore nodes
that assign to this region. This still won't catches changes made directly
by checkers if they re-assign the same value, but it does handle the common
case in user-written code and will trigger ReturnVisitor's suppression
machinery as expected.

<rdar://problem/13299738>

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

11 years ago[analyzer] Turn on C++ constructor inlining by default.
Jordan Rose [Wed, 27 Feb 2013 18:49:43 +0000 (18:49 +0000)]
[analyzer] Turn on C++ constructor inlining by default.

This enables constructor inlining for types with non-trivial destructors.
The plan is to enable destructor inlining within the next month, but that
needs further verification.

<rdar://problem/12295329>

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

11 years ago[driver] The failure of any phase (e.g., preprocess, compile, assemble) for a
Chad Rosier [Wed, 27 Feb 2013 18:46:04 +0000 (18:46 +0000)]
[driver] The failure of any phase (e.g., preprocess, compile, assemble) for a
single translation unit should prevent later phases from executing.  Otherwise,
this generates lots of noise in build systems.  This a fallout from r173825.
Patch by Matthew Curtis <mcurtis@codeaurora.org>.
rdar://13298009

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

11 years ago[Mips] Add two new aliases for MIPS ABI names 32 (means o32 abi) and 64
Simon Atanasyan [Wed, 27 Feb 2013 14:55:49 +0000 (14:55 +0000)]
[Mips] Add two new aliases for MIPS ABI names 32 (means o32 abi) and 64
(means n64 abi) to improve compatibility with GNU tools.
Patch by Jia Liu <proljc@gmail.com>.

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

11 years agoBetter support for constructors with -cxx-abi microsoft, partly fixes PR12784
Timur Iskhodzhanov [Wed, 27 Feb 2013 13:46:31 +0000 (13:46 +0000)]
Better support for constructors with -cxx-abi microsoft, partly fixes PR12784

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

11 years agoMake the negative test of recordType depend on a specific record.
Manuel Klimek [Wed, 27 Feb 2013 11:56:58 +0000 (11:56 +0000)]
Make the negative test of recordType depend on a specific record.

Otherwise it'll break if there's a record type in the AST by default.

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

11 years agoFix formatting of multiplications in array subscripts.
Daniel Jasper [Wed, 27 Feb 2013 11:43:50 +0000 (11:43 +0000)]
Fix formatting of multiplications in array subscripts.

Before:
a[a* a] = 1;

After:
a[a * a] = 1;

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

11 years ago[Sanitizer] Change driver behavior when linking with -fsanitize=thread and -fsanitize...
Alexey Samsonov [Wed, 27 Feb 2013 11:14:55 +0000 (11:14 +0000)]
[Sanitizer] Change driver behavior when linking with -fsanitize=thread and -fsanitize=memory. TSan/MSan also provide their versions of new/delete and should use the same strategy as ASan. Share the code that sets linker flags for all sanitizers.

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

11 years agoEnable bin-packing in Google style.
Daniel Jasper [Wed, 27 Feb 2013 09:47:53 +0000 (09:47 +0000)]
Enable bin-packing in Google style.

After some discussions, it seems that this is the better path in
the long run. Does not change Chromium style, as there, bin packing
is forbidden by the style guide.

Also fix two minor bugs wrt. formatting:
1. If a call parameter is a function call itself and is split before
   the "." or "->", split before the next parameter.
2. If a call parameter is string literal that has to be split onto
   two lines, split before the next parameter.

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

11 years agoUpdate clang for LLVM API change. No functionality change.
Nick Lewycky [Wed, 27 Feb 2013 06:22:58 +0000 (06:22 +0000)]
Update clang for LLVM API change. No functionality change.

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

11 years agoDon't cache the visibility of types.
Rafael Espindola [Wed, 27 Feb 2013 04:15:01 +0000 (04:15 +0000)]
Don't cache the visibility of types.

Since r175326 an implicitly hidden template argument can cause a template
installation to become hidden, even if the template itself has an explicit
default visibility. This requires that we keep track of "late" additions
of the visibility attribute.

This is hopefully the last followup change. It just removes the caching of
visibilities from types so that we can see new attributes even after a type has
been used.

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

11 years agoUse the correct alignment for POD-member memcpys where the first field is a
Lang Hames [Wed, 27 Feb 2013 04:14:49 +0000 (04:14 +0000)]
Use the correct alignment for POD-member memcpys where the first field is a
bitfield. CGBitField::StorageAlignment holds the alignment in chars, but
emitMemcpy had been treating it as if it were held in bits, leading to
underaligned memcpys.

Related to PR15348.

Thanks very much to Chandler for the diagnosis.

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

11 years agoRename methods to comply with the LLVM Coding Standards.
Rafael Espindola [Wed, 27 Feb 2013 02:56:45 +0000 (02:56 +0000)]
Rename methods to comply with the LLVM Coding Standards.

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

11 years agoChange Type::getLinkageAndVisibility to return a LinkageInfo.
Rafael Espindola [Wed, 27 Feb 2013 02:27:19 +0000 (02:27 +0000)]
Change Type::getLinkageAndVisibility to return a LinkageInfo.

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

11 years agoMove LinkageInfo out of NamedDecl so that it can be used in Type.h.
Rafael Espindola [Wed, 27 Feb 2013 02:15:29 +0000 (02:15 +0000)]
Move LinkageInfo out of NamedDecl so that it can be used in Type.h.

Everything that cares about visibility also cares about linkage, so I just
moved it to Visibility.h instead of creating a new .h.

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

11 years agoUpdate template diffing to handle template arguments that are declarations.
Richard Trieu [Wed, 27 Feb 2013 01:41:53 +0000 (01:41 +0000)]
Update template diffing to handle template arguments that are declarations.

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

11 years agoAdd a test to make sure __has_include works from inside a macro.
Argyrios Kyrtzidis [Wed, 27 Feb 2013 01:34:48 +0000 (01:34 +0000)]
Add a test to make sure __has_include works from inside a macro.

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

11 years agoTemporarily revert r176116 for compile-time performance regression.
Adrian Prantl [Wed, 27 Feb 2013 01:31:55 +0000 (01:31 +0000)]
Temporarily revert r176116 for compile-time performance regression.

This reverts commit ea95e4587fd13606fbf63b10a07a7d02026aa39c.

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

11 years ago[analyzer] Add stop-gap patch to prevent assertion failure when analyzing LLVM codebase.
Ted Kremenek [Wed, 27 Feb 2013 01:26:58 +0000 (01:26 +0000)]
[analyzer] Add stop-gap patch to prevent assertion failure when analyzing LLVM codebase.

This potentially reduces a performance optimization of throwing away
PreStmtPurgeDeadSymbols nodes.  I'll investigate the performance impact
soon and see if we need something better.

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

11 years ago[PCH] When deserializing an IdentifierInfo, call IdentifierInfo::RevertTokenIDToIdent...
Argyrios Kyrtzidis [Wed, 27 Feb 2013 01:13:51 +0000 (01:13 +0000)]
[PCH] When deserializing an IdentifierInfo, call IdentifierInfo::RevertTokenIDToIdentifier() only when it's not already an identifier.

Fixes an assertion hit.
rdar://13288735

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

11 years agocomment parsing: Properties are considered like methods, and people
Fariborz Jahanian [Wed, 27 Feb 2013 00:46:06 +0000 (00:46 +0000)]
comment parsing: Properties are considered like methods, and people
think of them as having return values that may be computed. Don't
warn when using @return in their comment. // rdar://13189938

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

11 years agoDon't crash when diagnosing path-constrained protected
John McCall [Wed, 27 Feb 2013 00:08:19 +0000 (00:08 +0000)]
Don't crash when diagnosing path-constrained protected
access to a private member to which we have special access.

rdar://12926092

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

11 years agoReapply r176133 with testcase fixes.
Bill Wendling [Wed, 27 Feb 2013 00:06:04 +0000 (00:06 +0000)]
Reapply r176133 with testcase fixes.

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

11 years ago[analyzer] If a struct has a partial lazy binding, its fields aren't Undef.
Jordan Rose [Wed, 27 Feb 2013 00:05:29 +0000 (00:05 +0000)]
[analyzer] If a struct has a partial lazy binding, its fields aren't Undef.

This is essentially the same problem as r174031: a lazy binding for the first
field of a struct may stomp on an existing default binding for the
entire struct. Because of the way RegionStore is set up, we can't help
but lose the top-level binding, but then we need to make sure that accessing
one of the other fields doesn't come back as Undefined.

In this case, RegionStore is now correctly detecting that the lazy binding
we have isn't the right type, but then failing to follow through on the
implications of that: we don't know anything about the other fields in the
aggregate. This fix adds a test when searching for other kinds of default
values to see if there's a lazy binding we rejected, and if so returns
a symbolic value instead of Undefined.

The long-term fix for this is probably a new Store model; see
<rdar://problem/12701038>.

Fixes <rdar://problem/13292559>.

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

11 years agoRefine SourceManager's isBeforeInTranslationUnit() cache to have more entries.
Ted Kremenek [Wed, 27 Feb 2013 00:00:26 +0000 (00:00 +0000)]
Refine SourceManager's isBeforeInTranslationUnit() cache to have more entries.

isBeforeInTranslationUnit() uses a cache to reduce the expensive work
to compute a common ancestor for two FileIDs.  This work is very
expensive, so even caching the latest used FileIDs was a big win.
A closer analysis of the cache before, however, shows that the cache
access pattern would oscillate between a working set of FileIDs, and
thus caching more pairs would be profitable.

This patch adds a side table for extending caching.  This side table
is bounded in size (experimentally determined in this case from
a simple Objective-C project), and when the table gets too large
we fall back to the single entry caching before as before.

On Sketch (a small example Objective-C project), this optimization
reduces -fsyntax-only time on SKTGraphicView.m by 5%.  This is
for a project that is already using PCH.

Fixes <rdar://problem/13299847>

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

11 years agoUse existing macros to simplify the test a bit.
Rafael Espindola [Tue, 26 Feb 2013 23:24:59 +0000 (23:24 +0000)]
Use existing macros to simplify the test a bit.

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

11 years agoTemporarily revert r176133 until testcases are modified.
Bill Wendling [Tue, 26 Feb 2013 23:18:33 +0000 (23:18 +0000)]
Temporarily revert r176133 until testcases are modified.

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

11 years agoFix testcases to not rely upon target-* attributes.
Bill Wendling [Tue, 26 Feb 2013 23:08:48 +0000 (23:08 +0000)]
Fix testcases to not rely upon target-* attributes.

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

11 years agoDon't set the -target-cpu and -target-features attributes just now.
Bill Wendling [Tue, 26 Feb 2013 23:01:33 +0000 (23:01 +0000)]
Don't set the -target-cpu and -target-features attributes just now.

This is causing some problems with some of the builders. It's non-trivial to
reset the target's features.

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

11 years agoNo need to initialize these variables.
Chad Rosier [Tue, 26 Feb 2013 22:15:50 +0000 (22:15 +0000)]
No need to initialize these variables.

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

11 years agodoxygen command. Add 'attention' command to list of similar
Fariborz Jahanian [Tue, 26 Feb 2013 22:12:16 +0000 (22:12 +0000)]
doxygen command. Add 'attention' command to list of similar
doxygen commands. // rdar://12379053

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

11 years agoFix assertion failure when a field is given an address space.
Matt Arsenault [Tue, 26 Feb 2013 21:16:00 +0000 (21:16 +0000)]
Fix assertion failure when a field is given an address space.

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

11 years agoFix initializer for variables with attribute address_space set.
Matt Arsenault [Tue, 26 Feb 2013 21:15:54 +0000 (21:15 +0000)]
Fix initializer for variables with attribute address_space set.

This would error in C++ mode unless the variable also had a cv
qualifier.

e.g.

__attribute__((address_space(2))) float foo = 1.0f; would error but
__attribute__((address_space(2))) const float foo = 1.0f; would not.

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

11 years agoEnsure that DIType is regenerated after we visited an implementation that adds ivars...
Adrian Prantl [Tue, 26 Feb 2013 20:01:46 +0000 (20:01 +0000)]
Ensure that DIType is regenerated after we visited an implementation that adds ivars to an interface. Fixes rdar://13175234

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

11 years ago[analyzer] Use 'MemRegion::printPretty()' instead of assuming the region is a VarRegion.
Ted Kremenek [Tue, 26 Feb 2013 19:44:38 +0000 (19:44 +0000)]
[analyzer] Use 'MemRegion::printPretty()' instead of assuming the region is a VarRegion.

Fixes PR15358 and <rdar://problem/13295437>.

Along the way, shorten path diagnostics that say "Variable 'x'" to just
be "'x'".  By the context, it is obvious that we have a variable,
and so this just consumes text space.

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

11 years agoWarn on dropping the return value from a warn_unused_result function, even in
Matt Beaumont-Gay [Tue, 26 Feb 2013 19:34:08 +0000 (19:34 +0000)]
Warn on dropping the return value from a warn_unused_result function, even in
macros.

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

11 years agoUse the most recent decl in getExplicitVisibility.
Rafael Espindola [Tue, 26 Feb 2013 19:33:14 +0000 (19:33 +0000)]
Use the most recent decl in getExplicitVisibility.

Now that implicitly hidden template arguments can make an instantiation hidden,
it is important to look at more than just the canonical decl of the argument
in order to see if an attribute is available in a more recent decl.

This has the disadvantage of exposing when getExplicitVisibility is called,
but lets us handle cases like

template <typename T>
struct __attribute__((visibility("default"))) barT {
  static void zed() {}
};
class foo;
class __attribute__((visibility("default"))) foo;
template struct barT<foo>;

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

11 years agoBe more careful in applying pragma weak. Fixes pr14974.
Rafael Espindola [Tue, 26 Feb 2013 19:13:56 +0000 (19:13 +0000)]
Be more careful in applying pragma weak. Fixes pr14974.

GCC applies a pragma weak to a decl if it matches the mangled name. We used
to apply if it matched the plain name.

This patch is a compromise: we apply the pragma only if it matches the name
and the decl has C language linkage.

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

11 years agoFix bad line break decision.
Daniel Jasper [Tue, 26 Feb 2013 13:59:14 +0000 (13:59 +0000)]
Fix bad line break decision.

Before:
if (Intervals[i].getRange().getFirst() < Intervals[i - 1]
                                             .getRange().getLast()) {}

After:
if (Intervals[i].getRange().getFirst() <
    Intervals[i - 1].getRange().getLast()) {}

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

11 years agoAllow dash before "ld" in android driver test.
Evgeniy Stepanov [Tue, 26 Feb 2013 13:20:29 +0000 (13:20 +0000)]
Allow dash before "ld" in android driver test.

Sometimes android linker is "arm-linux-androideabi-ld", and not just "ld".

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

11 years agoIn range-based for-loops, prefer splitting after ":".
Daniel Jasper [Tue, 26 Feb 2013 13:18:08 +0000 (13:18 +0000)]
In range-based for-loops, prefer splitting after ":".

Before:
for (const aaaaaaaaaaaaaaaaaaaaa &
         aaaaaaaaa : aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa) {}

After:
for (const aaaaaaaaaaaaaaaaaaaaa &aaaaaaaaa :
     aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa) {}

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

11 years agoOnly keep empty lines in unwrapped lines if they preceed a line comment.
Daniel Jasper [Tue, 26 Feb 2013 13:10:34 +0000 (13:10 +0000)]
Only keep empty lines in unwrapped lines if they preceed a line comment.

Empty lines followed by line comments are often used to highlight the
comment. Empty lines somewhere else are usually left over from manual or
automatic formatting and should probably be removed.

Before (clang-format would keep):
S s = {
  a,

  b
};

After:
S s = { a, b };

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

11 years agoOnly break string literals as a last resort.
Daniel Jasper [Tue, 26 Feb 2013 12:52:34 +0000 (12:52 +0000)]
Only break string literals as a last resort.

We might want to move towards doing this if the formatting can be
significantly improved, but we need to carefully evaluate the different
situations first.

Before (the string literal was split by clang-format here):
aaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaaaaa, aaaaaa("aaa aaaaa aaa aaa aaaaa aaa "
                                                  "aaaaa aaa aaa aaaaaa"));

After:
aaaaaaaaaaaaaaaaaaaa(
    aaaaaaaaaaaaaaaaaaaa,
    aaaaaa("aaa aaaaa aaa aaa aaaaa aaa aaaaa aaa aaa aaaaaa"));

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

11 years agoDefine CMake option CLANG_INCLUDE_TESTS *before* traversing into tests/ subdirectory...
Alexey Samsonov [Tue, 26 Feb 2013 09:43:27 +0000 (09:43 +0000)]
Define CMake option CLANG_INCLUDE_TESTS *before* traversing into tests/ subdirectory. Otherwise, while configuring the build tree for the first time, Clang unit tests could avoid being added to 'check-clang' command, and thus avoid being built and executed.

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

11 years agoUnify clang/llvm attributes for asan/tsan/msan (Clang part)
Kostya Serebryany [Tue, 26 Feb 2013 06:58:27 +0000 (06:58 +0000)]
Unify clang/llvm attributes for asan/tsan/msan (Clang part)

These are two related changes (one in llvm, one in clang).
LLVM:
- rename address_safety => sanitize_address (the enum value is the same, so we preserve binary compatibility with old bitcode)
- rename thread_safety => sanitize_thread
- rename no_uninitialized_checks -> sanitize_memory

CLANG:
- add __attribute__((no_sanitize_address)) as a synonym for __attribute__((no_address_safety_analysis))
- add __attribute__((no_sanitize_thread))
- add __attribute__((no_sanitize_memory))

for S in address thread memory
If -fsanitize=S is present and __attribute__((no_sanitize_S)) is not
set llvm attribute sanitize_S

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

11 years agoUpdate tests to do a full match against printed C++11 attributes.
Michael Han [Tue, 26 Feb 2013 02:00:13 +0000 (02:00 +0000)]
Update tests to do a full match against printed C++11 attributes.

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

11 years ago[analyzer] Don't look through casts when creating pointer temporaries.
Jordan Rose [Tue, 26 Feb 2013 01:21:27 +0000 (01:21 +0000)]
[analyzer] Don't look through casts when creating pointer temporaries.

Normally, we need to look through derived-to-base casts when creating
temporary object regions (added in r175854). However, if the temporary
is a pointer (rather than a struct/class instance), we need to /preserve/
the base casts that have been applied.

This also ensures that we really do create a new temporary region when
we need to: MaterializeTemporaryExpr and lvalue CXXDefaultArgExprs.

Fixes PR15342, although the test case doesn't include the crash because
I couldn't isolate it.

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

11 years ago[analyzer] StackAddrEscapeChecker: strip qualifiers from temporary types.
Jordan Rose [Tue, 26 Feb 2013 01:21:21 +0000 (01:21 +0000)]
[analyzer] StackAddrEscapeChecker: strip qualifiers from temporary types.

With the new support for trivial copy constructors, we are not always
consistent about whether a CXXTempObjectRegion gets reused or created
from scratch, which affects whether qualifiers are preserved. However,
we probably don't care anyway.

This also switches to using the current PrintingPolicy for the type,
which means C++ types don't get a spurious 'struct' prefix anymore.

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

11 years ago[ubsan] Emit single check for left shift.
Will Dietz [Mon, 25 Feb 2013 22:37:49 +0000 (22:37 +0000)]
[ubsan] Emit single check for left shift.

Avoids warning twice on same shift.

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

11 years ago[analyzer] Restrict ObjC type inference to methods that have related result type.
Anna Zaks [Mon, 25 Feb 2013 22:10:34 +0000 (22:10 +0000)]
[analyzer] Restrict ObjC type inference to methods that have related result type.

This addresses a case when we inline a wrong method due to incorrect
dynamic type inference. Specifically, when user code contains a method from init
family, which creates an instance of another class.

Use hasRelatedResultType() to find out if our inference rules should be triggered.

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

11 years ago[analyzer] Recover all PreStmtPurgeDeadSymbols nodes with a single successor or prede...
Ted Kremenek [Mon, 25 Feb 2013 21:32:40 +0000 (21:32 +0000)]
[analyzer] Recover all PreStmtPurgeDeadSymbols nodes with a single successor or predecessor.

These nodes are never consulted by any analyzer client code, so they are
used only for machinery for removing dead bindings.  Once successor nodes
are generated they can be safely removed.

This greatly reduces the amount of nodes that are generated in some case,
lowering the memory regression when analyzing Sema.cpp introduced by
r176010 from 14% to 2%.

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

11 years agoVarious additions to ASTMatcher library:
Edwin Vane [Mon, 25 Feb 2013 20:43:32 +0000 (20:43 +0000)]
Various additions to ASTMatcher library:

New type matchers:
* recordType
* elaboratedType

New narrowing matchers:
* hasQualifier
* namesType
* hasDeclContext

Added tests and updated LibASTMatchersReference.

Reviewers: klimek

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