Граф коммитов

42888 Коммитов

Автор SHA1 Сообщение Дата
Fariborz Jahanian 9db0fe97f5 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
2013-02-26 22:12:16 +00:00
Matt Arsenault 34b0adb52f 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
2013-02-26 21:16:00 +00:00
Matt Arsenault 5509f37aac 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
2013-02-26 21:15:54 +00:00
Adrian Prantl 58c7903725 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
2013-02-26 20:01:46 +00:00
Ted Kremenek 4238f41d48 [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
2013-02-26 19:44:38 +00:00
Matt Beaumont-Gay 9016bb7712 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
2013-02-26 19:34:08 +00:00
Rafael Espindola d3b2f0ac1c 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
2013-02-26 19:33:14 +00:00
Rafael Espindola d7a60ad800 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
2013-02-26 19:13:56 +00:00
Daniel Jasper 518ee34467 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
2013-02-26 13:59:14 +00:00
Evgeniy Stepanov d79f1f37b0 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
2013-02-26 13:20:29 +00:00
Daniel Jasper 84a1a63b03 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
2013-02-26 13:18:08 +00:00
Daniel Jasper 1ef81d57fb 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
2013-02-26 13:10:34 +00:00
Daniel Jasper 0fb382bfbf 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
2013-02-26 12:52:34 +00:00
Alexey Samsonov 863fb35744 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
2013-02-26 09:43:27 +00:00
Kostya Serebryany 85aee96c62 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
2013-02-26 06:58:27 +00:00
Michael Han d8be0abf30 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
2013-02-26 02:00:13 +00:00
Jordan Rose eafb5c694c [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
2013-02-26 01:21:27 +00:00
Jordan Rose a0e6e6dd37 [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
2013-02-26 01:21:21 +00:00
Will Dietz bb60fc6a71 [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
2013-02-25 22:37:49 +00:00
Anna Zaks db061e40d6 [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
2013-02-25 22:10:34 +00:00
Ted Kremenek 6f8e9b6cae [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
2013-02-25 21:32:40 +00:00
Edwin Vane 742d9e77e3 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
2013-02-25 20:43:32 +00:00
Anna Zaks c283311102 Revert "Add more attributes from the command line to functions."
This reverts commit 176009.

The commit is a likely cause of several buildbot failures.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176044 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-25 19:51:03 +00:00
Anna Zaks 42f2309f73 [analyzer] Address Jordan's code review of r175857.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176043 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-25 19:50:50 +00:00
Jordan Rose fbdbed3bde [analyzer] Handle reference parameters with default values.
r175026 added support for default values, but didn't take reference
parameters into account, which expect the default argument to be an
lvalue. Use createTemporaryRegionIfNeeded if we can evaluate the default
expr as an rvalue but the expected result is an lvalue.

Fixes the most recent report of PR12915. The original report predates
default argument support, so that can't be it.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176042 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-25 19:45:34 +00:00
Chad Rosier 59c900304a Add a front-end test case for r176036.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176038 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-25 19:13:23 +00:00
Michael Han 6980f17c78 Fix empty declaration printing.
Don't print the semicolon when visiting an empty declaration because the semicolon
will be printed as a terminator later.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176035 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-25 18:40:11 +00:00
Jordan Rose 6dc5c33fd4 [analyzer] Base regions may be invalid when layered on symbolic regions.
While RegionStore checks to make sure casts on TypedValueRegions are valid,
it does not do the same for SymbolicRegions, which do not have perfect type
info anyway. Additionally, MemRegion::getAsOffset does not take a
ProgramState, so it can't use dynamic type info to determine a better type
for the regions. (This could also be dangerous if the type of a super-region
changes!)

Account for this by checking that a base object region is valid on top of a
symbolic region, and falling back to "symbolic offset" mode if not.

Fixes PR15345.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176034 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-25 18:36:15 +00:00
Eric Christopher df779d356a Add forgotten testcase.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176032 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-25 18:19:32 +00:00
Daniel Jasper 9c3e71acb5 Re-add hack that caused regression.
This fixes llvm.org/PR15350.

Before:
Constructor(int Parameter = 0)
    : aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaa),
                aaaaaaaaaaaa(aaaaaaaaaaaaaaaaa) {}

After:
Constructor(int Parameter = 0)
    : aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaaaa),
      aaaaaaaaaaaa(aaaaaaaaaaaaaaaaa) {}

I think the correct solution is to put the VariablePos into
ParenState, not LineState. Added FIXME.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176027 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-25 15:59:54 +00:00
Edwin Vane 3abf77872c Adding hasDeclaration overload for TemplateSpecializationType
TemplateSpecializationType doesn't quite have getDecl(). Need to go
through TemplateName to get a TemplateDecl.

Added test cases for the hasDeclaration() overload for
TemplateSpecializationType. Also introduced the type matcher
templateSpecializationType() used by the new hasDeclaration() test case.

Updated LibASTMatchersReference.

Reviewers: klimek


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176025 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-25 14:49:29 +00:00
Edwin Vane b45083d083 Support in hasDeclaration for types with getDecl()
Re-introducing r175532. The has_getDecl metafunction didn't compile with
Visual Studio. This revision uses approaches has_getDecl from a
different angle that isn't a problem for Visual Studio.

Added dedicated tests for the metafunction.

Reviewers: klimek


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176024 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-25 14:32:42 +00:00
Edwin Vane 1b354b868c Reverting r176019. Corrupt patch.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176021 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-25 14:09:28 +00:00
Edwin Vane 0b6f23a23c Support in hasDeclaration for types with getDecl()
Re-introducing r175532. The has_getDecl metafunction didn't compile with Visual
Studio. This revision approaches has_getDecl from a different angle that isn't
a problem for Visual Studio.

Added dedicated tests for the metafunction.

Reviewers: klimek


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176019 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-25 13:59:06 +00:00
Daniel Jasper c7093d96d1 Update generated documentation after recent matcher addition.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176018 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-25 12:39:41 +00:00
Daniel Jasper f3197e9eb0 Add matcher for AccessSpecDecls.
Also, add matchers isPrivate(), isProtected() and isPublic(), that
restrict the matching of such AccessSpecDecls and all other Decls.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176017 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-25 12:02:08 +00:00
Ted Kremenek 6c5038cf84 [analyzer] Relax assumption in FindLastStoreBRVisitor that the thing we are looking for is always a VarRegion.
This was triggering assertion failures when analyzing the LLVM codebase.  This
is fallout from r175988.

I've got delta chewing away on a test case, but I wanted the fix to go
in now.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176011 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-25 07:37:18 +00:00
Ted Kremenek 4e9c085438 [analyzer] add the notion of an "interesting" lvalue expression for ExplodedNode pruning.
r175988 modified the ExplodedGraph trimming algorithm to retain all
nodes for "lvalue" expressions.  This patch refines that notion to
only "interesting" expressions that would be used for diagnostics.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176010 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-25 07:37:13 +00:00
Bill Wendling d620e09c13 Add more attributes from the command line to functions.
This is an ongoing process. Any command line option which a back-end cares about
should be added here.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176009 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-25 07:15:16 +00:00
Dmitri Gribenko 0a8dead530 Documentation: add an idea for a (weird) clang tool
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176005 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-25 01:14:45 +00:00
David Blaikie c1d0af1f55 Update Clang for a minor DIBuilder breaking change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176003 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-25 01:07:08 +00:00
Aaron Ballman f9067c6b56 Moving initialization into the initializer list and correcting capitalization, as suggested by Chandler.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176001 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-24 19:08:10 +00:00
Dmitri Gribenko 824ed0c7a9 Documentation: add an idea for an automatic refactoring
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176000 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-24 19:04:36 +00:00
Daniel Jasper 3c08a818a6 Allow breaking between a type and name in variable declarations.
This fixes llvm.org/PR14967 and is generall necessary to avoid
situations where the column limit is exceeded. The challenge is
restricting such lines splits, otherwise clang-format suddenly starts
breaking at bad places.

Before:
ReallyLongReturnType<TemplateParam1, TemplateParam2>
ReallyReallyLongFunctionName(
    const std::string &SomeParameter,
    const SomeType<string,
                   SomeOtherTemplateParameter> &ReallyReallyLongParameterName,
    const SomeType<string,
                   SomeOtherTemplateParameter> &AnotherLongParameterName) {}

After:
ReallyLongReturnType<TemplateParam1, TemplateParam2>
ReallyReallyLongFunctionName(
    const std::string &SomeParameter,
    const SomeType<string, SomeOtherTemplateParameter> &
        ReallyReallyLongParameterName,
    const SomeType<string, SomeOtherTemplateParameter> &
        AnotherLongParameterName) {}

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175999 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-24 18:54:32 +00:00
Benjamin Kramer 960876cd88 Add the testcase from PR13573, this used to crash.
The error is a bit strange tbh, but better than crashing.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175996 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-24 15:51:32 +00:00
Ted Kremenek 43b82b823a [analyzer] tracking stores/constraints now works for ObjC ivars or struct fields.
This required more changes than I originally expected:

- ObjCIvarRegion implements "canPrintPretty" et al
- DereferenceChecker indicates the null pointer source is an ivar
- bugreporter::trackNullOrUndefValue() uses an alternate algorithm
  to compute the location region to track by scouring the ExplodedGraph.
  This allows us to get the actual MemRegion for variables, ivars,
  fields, etc.  We only hand construct a VarRegion for C++ references.
- ExplodedGraph no longer drops nodes for expressions that are marked
  'lvalue'.  This is to facilitate the logic in the previous bullet.
  This may lead to a slight increase in size in the ExplodedGraph,
  which I have not measured, but it is likely not to be a big deal.

I have validated each of the changed plist output.

Fixes <rdar://problem/12114812>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175988 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-24 07:21:01 +00:00
Ted Kremenek 0dd15d78fb Add "KnownSVal" to represent SVals that cannot be UnknownSVal.
This provides a few sundry cleanups, and allows us to provide
a compile-time check for a case that was a runtime assertion.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175987 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-24 07:20:53 +00:00
Ted Kremenek 026cd1a273 Add regression test for serialized diagnostics for notes without locations.
This meant to be included in r175802.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175986 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-24 07:20:47 +00:00
Richard Smith 5956bcc31a PR15338: Don't assert if -fsanitize=bounds sees array indexing on an incomplete
array type.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175982 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-24 01:56:24 +00:00
Argyrios Kyrtzidis c515978bd3 [preprocessor] Use MacroDirective in the preprocessor callbacks to make available the
full information about the macro (e.g if it was imported and where).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175978 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-24 00:05:14 +00:00