Commit Graph

42930 Commits

Author SHA1 Message Date
Douglas Gregor 7a6e20070d Make getDefinitiveDeclContext() actually return a DeclContext, as one
would expect, and clean up the return/break inconsistencies. Thanks,
Sebastian!

llvm-svn: 173171
2013-01-22 17:08:30 +00:00
Nico Weber bbe1394c96 Fix a bug in VarDecl::getSourceRange() for static member arrays with an element
type with an implicit initializer expression.

Patch from Will Wilson <will@indefiant.com>!

llvm-svn: 173170
2013-01-22 17:00:09 +00:00
Nico Weber 6029d4f3ae Formatter: Remove a fixme klimek fixed in r173168.
Add a few comments to the ObjC test cases.

llvm-svn: 173169
2013-01-22 16:53:59 +00:00
Manuel Klimek f92f7bc540 Implements more principled comment parsing.
Changing nextToken() in the UnwrappedLineParser to get the next
non-comment token. This allows us to correctly layout a whole class of
snippets, like:

if /* */(/* */ a /* */) /* */
  f() /* */; /* */
else /* */
  g();

Fixes a bug in the formatter where we would assume there is a previous
non-comment token.
Also adds the indent level of an unwrapped line to the debug output in
the parser.

llvm-svn: 173168
2013-01-22 16:31:55 +00:00
Daniel Jasper 50e7ab7185 Let the formatter be more restrictive for breaking around . and ->
Before:
aaaaaaaaaaaaaaa(aaaaaaaaa, aaaaaaaaa, aaaaaaaaaaaaaaaaaaaaaaa)
    .aaaaaaaaaaaaaaaaaa();

After:
aaaaaaaaaaaaaaa(aaaaaaaaa, aaaaaaaaa,
                aaaaaaaaaaaaaaaaaaaaaaa).aaaaaaaaaaaaaaaaaa();

llvm-svn: 173160
2013-01-22 14:28:24 +00:00
Daniel Jasper 0b8206029b Fix "*" formatting when creating arrays of pointers.
Before: A = new int * [10]();
After:  A = new int *[10]();
llvm-svn: 173150
2013-01-22 11:46:26 +00:00
Tim Northover 178723a687 Switch to APFloat constructor taking fltSemantics.
This change also makes the serialisation store the required semantics,
fixing an issue where PPC128 was always assumed when re-reading a
128-bit value.

llvm-svn: 173139
2013-01-22 09:46:51 +00:00
Alexander Potapenko 015333f88c [ASan] Fixed darwin-sanitizer-ld.c to match the flags after the switch to the dynamic runtime.
llvm-svn: 173137
2013-01-22 09:27:00 +00:00
Alexander Potapenko f6b56972d5 [ASan] Link with the dynamic runtime on OS X
This patch changes the behavior of the -fsanitize=address flag, making it use the dynamic runtime library (libclang_rt.asan_osx_dynamic.dylib) instead of the static one. It also drops the CoreFoundation dependency, since the dynamic runtime doesn't need it.

llvm-svn: 173135
2013-01-22 09:16:03 +00:00
NAKAMURA Takumi 873a63ce19 libclang: Update comment about USEDLIBS in c-*-test/Makefile.
"Note that 'USEDLIBS' must include all of the core clang libraries when -static is given to linker on cygming."

llvm-svn: 173124
2013-01-22 04:11:33 +00:00
John McCall f593b10d04 Use the correct field to copy/dispose a __block variable.
We were previously hard-coding a particular field index.  This was
fine before (because we were obviously guaranteed the presence
of a copy/dispose member) except for (1) alignment padding and
(2) future extensions adding extra members to the header, such
as the extended-layout pointer.

Note that we only introduce the extended-layout pointer in the
presence of structs.  (We also seem to be introducing it even
in the presence of an all-non-object layout, but that's a
different potential issue.)

llvm-svn: 173122
2013-01-22 03:56:22 +00:00
NAKAMURA Takumi c6d09603ad clang/test/Index/comment-to-html-xml-conversion.cpp: Mark this as XFAIL:valgrind, for now. Working in progress.
llvm-svn: 173121
2013-01-22 03:49:16 +00:00
NAKAMURA Takumi df0b43d1f9 clang/test: [CMake] check-clang doesn't require llvm-dis any more.
llvm-svn: 173116
2013-01-22 01:52:04 +00:00
NAKAMURA Takumi 7b597946b1 clang/test/CodeGen: Nuke llvm's opt and llvm-dis, and FileCheck-ize two tests. -O1 is sufficient here.
llvm-svn: 173115
2013-01-22 01:51:59 +00:00
NAKAMURA Takumi 73871f6632 clang/test/CodeGen/2006-01-13-StackSave.c: Nuke llvm's opt and llvm-dis, and FileCheck-ize.
@llvm.stacksave is emitted regardless of "opt -std-compile-opts". We have optimizers' tests in llvm/test/Transforms.

llvm-svn: 173114
2013-01-22 01:51:54 +00:00
NAKAMURA Takumi 3bb0aa7625 clang/test/CodeGen/blocks-seq.c: FileCheck-ize.
llvm-svn: 173113
2013-01-22 01:51:48 +00:00
Daniel Jasper 304a986a72 Remove "incorrect" aligning of trailing comments.
We used to align trailing comments belong to different things.
Before:
void f() { // some function..
}
int a;     // some variable..

After:
void f() { // some function..
}
int a; // some variable..

llvm-svn: 173100
2013-01-21 22:49:20 +00:00
Bill Wendling b7abb30d77 Have AttributeSet::getRetAttributes() return an AttributeSet instead of Attribute.
This further restricts the use of the Attribute class to the Attribute family of
classes.

llvm-svn: 173099
2013-01-21 22:45:00 +00:00
Fariborz Jahanian 60ccb9b2a9 objectiveC: don't warn when in -Wselector mode and
an unimplemented selector is consumed by
"respondsToSelector:". // rdar://12938616

llvm-svn: 173097
2013-01-21 22:32:29 +00:00
Bill Wendling 304f6f0a59 Make AttributeSet::getFnAttributes() return an AttributeSet instead of an Attribute.
This is more code to isolate the use of the Attribute class to that of just
holding one attribute instead of a collection of attributes.

llvm-svn: 173095
2013-01-21 21:57:40 +00:00
Douglas Gregor bdb259d223 Give ModuleFiles an index, so that we can use indexed vectors rather
than DenseMaps and SmallPtrSets for module-visitation data. ~2.6%
speedup for modules.

llvm-svn: 173081
2013-01-21 20:07:12 +00:00
Douglas Gregor b898209086 Eliminate Sema::CompareProperties(), which was walking over a pile of
lexical declarations looking for properties when we could more
efficiently check for property mismatches at property declaration
time. Good for ~1% of -fsyntax-only time when most of the properties
we're checking against come from an AST file.

llvm-svn: 173079
2013-01-21 19:42:21 +00:00
Nico Weber 767c8d3570 Formatter: Set MatchingParen for [], to match <>, (), {}. No functionality change.
llvm-svn: 173078
2013-01-21 19:35:06 +00:00
Nico Weber ed272de0f2 Formatter: Rename LSquare to Left to make parseSquare() more consistent with the other paren parsing methods.
llvm-svn: 173077
2013-01-21 19:29:31 +00:00
Manuel Klimek 2cec01916c Fixes various problems around enum parsing.
Very similar to what we do for record definitions:
- tighten down what is an enum definition, so that we don't mistake a
  function for an enum
- allow common idioms around declarations (we'll want to handle that
  more centrally in the future)

We now correctly format:
enum X f() {
  a();
  return 42;
}

llvm-svn: 173075
2013-01-21 19:17:52 +00:00
Douglas Gregor 90d3442784 Eliminate the oddly-named Sema::ComparePropertiesInBaseAndSuper, which
did a redundant traversal of the lexical declarations in the
superclass. Instead, when we declare a new property, look into the
superclass to see whether we're redeclaring the property. Goot for 1%
of -fsyntax-only time on Cocoa.h and a little less than 3% on my
modules test case.

llvm-svn: 173073
2013-01-21 19:05:22 +00:00
Argyrios Kyrtzidis 3ad52ede46 [ASTUnit] Unlike LoadFromCommandLine, LoadFromCompilerInvocation causes a crash if Precompilepreamble
is set to true because there is no FileManager at that point.

Patch by Hurcan Solter!

llvm-svn: 173071
2013-01-21 18:45:42 +00:00
Jordan Rose a60e9268b6 [analyzer] Fix test for r173067.
Note to self: don't remove comments /after/ updating the line-sensitive
part of a test.

llvm-svn: 173070
2013-01-21 18:41:05 +00:00
Douglas Gregor a669ab9856 Replace some unnecessary O(N^2) lookups for properties with
DeclContext lookups. The performance win is negligible in my tests,
but it's the Right Thing To Do (TM).

llvm-svn: 173068
2013-01-21 18:35:55 +00:00
Jordan Rose 78328be4b7 [analyzer] Show notes inside implicit calls at the last explicit call site.
Before:
  struct Wrapper { <-- 2. Calling default constructor for 'NonTrivial'.
    NonTrivial m;
  };

  Wrapper w; <-- 1. Calling implicit default constructor for 'Wrapper'.

After:
  struct Wrapper {
    NonTrivial m;
  };

  Wrapper w; <-- 1. Calling implicit default constructor for 'Wrapper'.
             ^-- 2. Calling default constructor for 'NonTrivial'.

llvm-svn: 173067
2013-01-21 18:28:30 +00:00
Chris Lattner 15c3e7dab5 ReadSourceManagerBlock is skipping over records that can contain Blobs. Not passing
in a StringRef to bind to them forces them to be unpacked into the Record as individual
bytes.  This is wasteful, but not likely to be measurable in this instance.

llvm-svn: 173066
2013-01-21 18:28:26 +00:00
Douglas Gregor c8a992f727 Revert r173056; it breaks one of the CodeGen-with-PCH tests.
llvm-svn: 173058
2013-01-21 16:52:34 +00:00
Douglas Gregor d8666e49cc When loading an identifier from an AST file solely for the purpose of
forming the identifier, e.g., as part of a selector or a declaration
name, don't actually deserialize any information about the
identifier. Instead, simply mark it "out-of-date" and we'll load the
the information on demand. 2% speedup on the modules testcase I'm
looking at; should also help PCH.

llvm-svn: 173056
2013-01-21 16:47:11 +00:00
Manuel Klimek a4fe1c13c0 Fixes formatting of empty blocks.
We now only put empty blocks into a single line, if all of:
- all tokens of the structural element fit into a single line
- we're not in a control flow statement

Note that we usually don't put record definitions into a single line, as
there's usually at least one more token (the semicolon) after the
closing brace. This doesn't hold when we are in a context where there is
no semicolon, like "enum E {}".

There were some missing tests around joining lines around the corner
cases of the allowed number of columns, so this patch adds some.

llvm-svn: 173055
2013-01-21 16:42:44 +00:00
Douglas Gregor fe732d538f When deserializing a declaration, don't look for redeclarations if its
kind indicates that it can never be redeclared. Good for a 1% speedup,
and redeclaration searching drops off the profile.

llvm-svn: 173054
2013-01-21 16:16:40 +00:00
Douglas Gregor 9f78289055 Introduce a fast path for the ASTReader's name lookup within a
DeclContext. When the DeclContext is of a kind that can only be
defined once and never updated, we limit the search to the module file
that conatins the lookup table. Provides a 15% speedup in one
modules-heavy source file.

llvm-svn: 173050
2013-01-21 15:25:38 +00:00
Daniel Jasper c228619bb1 Fix parsing of templated declarations.
Before: template <template <typename T>, typename P > class X;
After:  template <template <typename T>, typename P> class X;

More importantly, the token annotations for the second ">" are now computed
correctly.

llvm-svn: 173047
2013-01-21 14:39:22 +00:00
Manuel Klimek ae610d173d Fixes indent in linkage specification blocks.
We now indent:
extern "C" {
int a;
}

without additional indent inside the extern "C" block.

llvm-svn: 173045
2013-01-21 14:32:05 +00:00
Daniel Jasper d41ee2d2af Fix bug discovered by valgrind.
When trying to merge lines, we should not touch lines that are invalid,
as we don't know how long they might be.

llvm-svn: 173043
2013-01-21 14:18:28 +00:00
Manuel Klimek d5e782b010 Add regression test.
llvm-svn: 173042
2013-01-21 14:16:56 +00:00
NAKAMURA Takumi 7b9a9201bf AST/VTableBuilder.h: Suppress a warning. [-Wunused-private-field]
llvm-svn: 173041
2013-01-21 14:15:24 +00:00
Manuel Klimek cdee74db63 Fixes detection of class template specializations.
Now correctly formats:
template <> class A<int> {} a;

llvm-svn: 173038
2013-01-21 13:58:54 +00:00
Timur Iskhodzhanov 52b8a05234 First step towards vftable generation with -cxx-abi microsoft PR13231
llvm-svn: 173035
2013-01-21 13:02:41 +00:00
Dmitri Gribenko 7ec6f3ddeb Add a fixit for _Noreturn main,
add tests for fixits removing static and inline from main

llvm-svn: 173024
2013-01-21 11:25:03 +00:00
NAKAMURA Takumi 3e0a363021 CGDebugInfo.cpp: Fix a warning. [-Wunused-variable]
llvm-svn: 173022
2013-01-21 10:51:28 +00:00
Manuel Klimek 3c6b7c7d71 Allow for nested name specifiers in record declarations.
Now correctly formats:
class A::B {} n;

llvm-svn: 173019
2013-01-21 10:17:14 +00:00
Manuel Klimek 762dd189a4 Fix parsing of return statements.
Previously, we would not detect brace initializer lists in return
statements, thus:
 return (a)(b) { 1, 2, 3 };
would put the semicolon onto the next line.

llvm-svn: 173017
2013-01-21 10:07:49 +00:00
Alexey Samsonov 969be24542 Port r172856: 'Include ubsan runtime even when building a shared library. We don't require executable to be linked with UBSan.' to Mac
llvm-svn: 173014
2013-01-21 08:45:02 +00:00
David Blaikie 0549106d88 PR14472: Preserve qualifiers while unwrapping types for debug info
Looks like r161368 fixed this for one case but not all. This change generalizes
the solution over all the unwrapping cases. Now that preserving the qualifiers
is done independent of the particular type being unwrapped I won't bother
adding test cases for each one but at least demonstrate that this change was
necessary & sufficient to fix the bug.

llvm-svn: 173002
2013-01-21 04:37:12 +00:00
Benjamin Kramer 4ab3c46874 Prune unused diagnostics.
Courtesy of utils/find-unused-diagnostics.sh.

llvm-svn: 172988
2013-01-20 19:29:01 +00:00