Commit Graph

141065 Commits

Author SHA1 Message Date
Nick Lewycky 80ea003c6c Fix typo in comment.
llvm-svn: 172460
2013-01-14 20:56:10 +00:00
Douglas Gregor bc25ff4661 Topologically sort the link options generated for modules based on
module-import dependencies, so we'll get the link order correct for
those silly linkers that need it.

llvm-svn: 172459
2013-01-14 20:53:57 +00:00
Howard Hinnant 2153d69672 Fix a race in the construction of future. This fixes http://llvm.org/bugs/show_bug.cgi?id=14934.
llvm-svn: 172456
2013-01-14 20:01:24 +00:00
Argyrios Kyrtzidis 49e022df8f [ADT/StringMap] Add a constructor in StringMap that accepts both an
initial size and an allocator.

llvm-svn: 172455
2013-01-14 19:41:09 +00:00
Joe Groff e14fb33a05 Fix DenseMap when LLVM_HAS_RVALUE_REFERENCES is defined but equals 0.
llvm-svn: 172454
2013-01-14 19:37:42 +00:00
Joe Groff d3fc142fdd Add DenseMap::insert(value_type&&) method.
Use the existing move implementation of the internal DenseMap::InsertIntoBucket
method to provide a user-facing move insert method.

llvm-svn: 172453
2013-01-14 19:24:15 +00:00
Michael Gottesman e9145d3846 Changed SmallPtrSet.count guard + SmallPtrSet.insert to just SmallPtrSet.insert.
llvm-svn: 172452
2013-01-14 19:18:39 +00:00
Eli Bendersky 0a8fbdd015 Move CheckForValidSection to the MCAsmParser interface.
Now that it behaves itself in terms of streamer independence (r172450), this
method can be moved to MCAsmParser to be available to all extensions,
overriding, etc.

-- -This line, and those below, will be ignored--

M    lib/MC/MCParser/AsmParser.cpp
M    include/llvm/MC/MCParser/MCAsmParser.h

llvm-svn: 172451
2013-01-14 19:15:01 +00:00
Eli Bendersky cbb2514d51 Expose an InitToTextSection through MCStreamer.
The aim of this patch is to fix the following piece of code in the
platform-independent AsmParser:

void AsmParser::CheckForValidSection() {
  if (!ParsingInlineAsm && !getStreamer().getCurrentSection()) {
    TokError("expected section directive before assembly directive");
    Out.SwitchSection(Ctx.getMachOSection(
                        "__TEXT", "__text",
                        MCSectionMachO::S_ATTR_PURE_INSTRUCTIONS,
                        0, SectionKind::getText()));
  }
}

This was added for the "-n" option of llvm-mc.

The proposed fix adds another virtual method to MCStreamer, called
InitToTextSection. Conceptually, it's similar to the existing
InitSections which initializes all common sections and switches to
text. The new method is implemented by each platform streamer in a way
that it sees fit. So AsmParser can now do this:

void AsmParser::CheckForValidSection() {
  if (!ParsingInlineAsm && !getStreamer().getCurrentSection()) {
    TokError("expected section directive before assembly directive");
    Out.InitToTextSection();
  }
}

Which is much more reasonable.

llvm-svn: 172450
2013-01-14 19:04:57 +00:00
Eli Bendersky a7b905eeaa Move ParseMacroArgument to the MCAsmParser interfance.
Since it's used by extensions. One further step to fully decoupling
GenericAsmParser from an intimate knowledge of the internals of AsmParser,
pointing it to the MCASmParser interface instead (like all other parser
extensions do).

Since this change moves the MacroArgument type to the interface header, it's
renamed to be a bit more descriptive in a general context.

llvm-svn: 172449
2013-01-14 19:00:26 +00:00
Douglas Gregor 1715a2f9d5 When forming the link options for an imported module, also include the
link options for the modules it imports.

llvm-svn: 172448
2013-01-14 19:00:05 +00:00
Howard Hinnant 1afbabab32 Fix string conversions functions to throw out_of_range properly. Fixes http://llvm.org/bugs/show_bug.cgi?id=14919.
llvm-svn: 172447
2013-01-14 18:59:43 +00:00
Jordan Rose 269894ca23 [analyzer] Add ProgramStatePartialTrait<const void *>.
This should fix cast-away-const warnings reported by David Greene.

llvm-svn: 172446
2013-01-14 18:58:42 +00:00
Jordan Rose d540aed61b [analyzer] Fix cast-away-const warning by using const_cast.
Patch by David Greene, modified by me.

llvm-svn: 172445
2013-01-14 18:58:38 +00:00
Jordan Rose cb6a721920 [analyzer] -drain is not an alias for -release.
This was previously added to support -[NSAutoreleasePool drain], which
behaves like -release under non-GC and "please collect" under GC. We're
not currently modeling the autorelease pool stack, though, so we can
just take this out entirely.

Fixes PR14927.

llvm-svn: 172444
2013-01-14 18:58:33 +00:00
Jim Ingham d7931f7047 Fix a logic error in the condition for a warning log message.
llvm-svn: 172442
2013-01-14 18:30:01 +00:00
Douglas Gregor ea02f26536 Switch autolinking metadata format over to actual linker options, e.g.,
!0 = metadata !{metadata !"-lautolink"}
  !1 = metadata !{metadata !"-framework", metadata !"autolink_framework"}

referenced from llvm.module.linkoptions, e.g.,

  !llvm.module.linkoptions = !{!0, !1, !2, !3}

This conceptually moves the logic for figuring out the syntax the
linker will accept from LLVM into Clang. Moreover, it makes it easier
to support MSVC's

  #pragma comment(linker, "some option")

in the future, should anyone care to do so.

llvm-svn: 172441
2013-01-14 18:28:43 +00:00
Eli Bendersky c2f6f920b9 Encapsulate the MacroEnabled flag in AsmParser behind accessor methods.
The methods are also exposed via the MCAsmParser interface, which allows more
than one client to control them. Previously, GenericAsmParser was playing with
a member var in AsmParser directly (by virtue of being its friend).

llvm-svn: 172440
2013-01-14 18:08:41 +00:00
Douglas Gregor 11dfe6fe3d Infer "link" lines for top-level frameworks. Essentially, a framework
will have a shared library with the same name as its framework (and no
suffix!) within its .framework directory. Detect this both when
inferring the whole top-level framework and when parsing a module map.

llvm-svn: 172439
2013-01-14 17:57:51 +00:00
Bill Schmidt 924c478827 This patch addresses varargs processing for small complex types under
the 64-bit PowerPC ELF ABI.

The ABI requires that the real and imaginary parts of a complex argument
each occupy their own doubleword.  Arguments smaller than 8 bytes are
right-adjusted within the doubleword.

Clang expects EmitVAARG() to return a pointer to a structure in which
the real and imaginary parts are packed adjacently in memory.  To accomplish
this, we generate code to load the code appropriately from the varargs
location and pack the values into a temporary variable in the form Clang
expects, returning a pointer to that structure.

The test case demonstrates correct code generation for all "small" complex
types on PPC64:  int, short, char, and float.

llvm-svn: 172438
2013-01-14 17:45:36 +00:00
Douglas Gregor 6ddfca91e0 Implement parsing, AST, (de-)serialization, and placeholder global
metadata for linking against the libraries/frameworks for imported
modules.

The module map language is extended with a new "link" directive that
specifies what library or framework to link against when a module is
imported, e.g.,

  link "clangAST"

or

  link framework "MyFramework"

Importing the corresponding module (or any of its submodules) will
eventually link against the named library/framework.

For now, I've added some placeholder global metadata that encodes the
imported libraries/frameworks, so that we can test that this
information gets through to the IR. The format of the data is still
under discussion.

llvm-svn: 172437
2013-01-14 17:21:00 +00:00
Howard Hinnant 3778f27b23 Michael van der Westhuizen: Improve support for testing on Linux. Fixes http://llvm.org/bugs/show_bug.cgi?id=14892.
llvm-svn: 172436
2013-01-14 17:12:54 +00:00
Howard Hinnant f1e633c154 Michael van der Westhuizen: Patches for Linux. Fixes http://llvm.org/bugs/show_bug.cgi?id=14648.
llvm-svn: 172435
2013-01-14 17:07:27 +00:00
Alexander Kornienko 02fd3ad24b Test source file name in diagnostics
llvm-svn: 172434
2013-01-14 17:01:57 +00:00
Manuel Klimek a54d1a99a2 Fixes formatting of nested brace initializers.
We now format this correctly:
Status::Rep Status::global_reps[3] = {
  { kGlobalRef, OK_CODE, NULL, NULL, NULL },
  { kGlobalRef, CANCELLED_CODE, NULL, NULL, NULL },
  { kGlobalRef, UNKNOWN_CODE, NULL, NULL, NULL }
};

- fixed a bug where BreakBeforeClosingBrace would be set on the wrong
  state
- added penalties for breaking between = and {, and between { and any
  other non-{ token

llvm-svn: 172433
2013-01-14 16:41:43 +00:00
Daniel Jasper 51ce63cd98 Add support for Chromium style.
llvm-svn: 172432
2013-01-14 16:26:38 +00:00
Daniel Jasper 1b750edda1 Make single-line if statements optional.
Now, "if (a) return;" is only allowed, if this option is set.

Also add a Chromium style which is currently identical to Google style
except for this option.

llvm-svn: 172431
2013-01-14 16:24:39 +00:00
Will Dietz 9d3209b5c7 [ubsan] Use __sanitizer::atomic_exchange(), prefer shared impl.
Specify weaker memory order in case we optimize for it in the future,
presently still doing same __sync_lock_test_and_set() as before.

Change suggested by Alexey Samsonov, thanks!

llvm-svn: 172429
2013-01-14 16:13:52 +00:00
Daniel Jasper 3e9218e50a Fix a bug in the line merging.
If the first line of a merge would exactly fit into the column limit,
an unsigned overflow made us not break.

llvm-svn: 172426
2013-01-14 16:02:06 +00:00
Daniel Jasper 2ab0d01a8e Fix bug that would lead to joining preprocessor directives.
Before: #include "a.h" #include "b.h"
After:  #include "a.h"
        #include "b.h"
llvm-svn: 172424
2013-01-14 15:52:06 +00:00
Daniel Jasper 39825eaff5 Put simple preprocessor directives on a single line.
Before: #define A  \
          A
After:  #define A A
llvm-svn: 172423
2013-01-14 15:40:57 +00:00
Evgeniy Stepanov 99d91289b6 Move large part of asan_test_utils.h to sanitizer_common.
Move my_rand() to the common header.

This lets us avoid the use of rand_r in sanitizer_common tests.
There is no rand_r on Android.

llvm-svn: 172421
2013-01-14 15:12:26 +00:00
Benjamin Kramer e2e6e6a3d5 Turns out there is a simpler way of getting a set difference in bash than parsing diff output.
llvm-svn: 172420
2013-01-14 15:00:48 +00:00
Alexey Samsonov 4e958e5ddb Fix-up copypasto from r172410
llvm-svn: 172419
2013-01-14 14:52:35 +00:00
Dmitry Vyukov ff19809a3d asan: fix windows build
llvm-svn: 172415
2013-01-14 14:28:06 +00:00
Edwin Vane d44cbf7d09 Adding a .gitignore to tools-extra
Reviewers: klimek

llvm-svn: 172414
2013-01-14 14:20:19 +00:00
Daniel Jasper 25837aa666 Put short if statements on a single line.
Before: if (a)
          return;
After:  if (a) return;

Not yet sure, whether this is always desired, but we can add options and
make this a style parameter as we go along.

llvm-svn: 172413
2013-01-14 14:14:23 +00:00
Timur Iskhodzhanov 6c704ebbf1 Revert r171829 "Split changeset_ty using iterators instead of loops" as it breaks the VS2008 build
llvm-svn: 172411
2013-01-14 14:13:06 +00:00
Evgeniy Stepanov cfe3b3b956 Build rules for sanitizer_common tests on Android.
llvm-svn: 172410
2013-01-14 14:08:25 +00:00
Alexander Kornienko ebc17b5b87 Dump comments in -ast-dump.
http://llvm-reviews.chandlerc.com/D269

"Added dumping of declaration comments in ASTDumper. This required moving the
comment dumping code from CommentDumper so that the indentation is correct."

Patch by Philip Craig!

llvm-svn: 172409
2013-01-14 14:07:11 +00:00
Evgeniy Stepanov e375a1f036 Remove thread-locals from sanitizer_common tests.
Not supported on Android.

llvm-svn: 172408
2013-01-14 14:06:58 +00:00
Alexander Kornienko 92bb086fba Added a test for clang-format diagnostics.
llvm-svn: 172407
2013-01-14 13:57:05 +00:00
Alexander Kornienko 79f49456fa Fix: correct file name in diagnostics.
llvm-svn: 172405
2013-01-14 13:40:44 +00:00
NAKAMURA Takumi 18c7689698 clang/test/SemaCXX/cxx11-gnu-attrs.cpp: Add explicit -triple x86_64-unknown-unknown, or it doesn't work for targetting win32.
llvm-svn: 172404
2013-01-14 13:16:02 +00:00
Daniel Jasper f1e4b7d750 Refactor datastructure used in clang-format.
Main difference, add an AnnotatedLine class to hold information about a
line while formatting. At the same time degrade the UnwrappedLine class
to a class solely used for communicating between the UnwrappedLineParser
and the Formatter.

No functional changes intended.

llvm-svn: 172403
2013-01-14 13:08:07 +00:00
Daniel Jasper 13f23e17c7 Improve understanding post increment and decrement.
Before: (a->f()) ++;
        a[42] ++;
After:  (a->f())++;
        a[42]++;
llvm-svn: 172400
2013-01-14 12:18:19 +00:00
Alexander Kornienko 116ba68220 Custom DiagnosticConsumer parameter of reformat() + silence diagnostics in unit tests.
Summary:
Added tests for clang-format diagnostics. Added DiagnosticConsumer
argument to clang::format::reformat().

Reviewers: klimek, djasper

Reviewed By: djasper

CC: cfe-commits, thakis, rafael.espindola

Differential Revision: http://llvm-reviews.chandlerc.com/D290

llvm-svn: 172399
2013-01-14 11:34:14 +00:00
Alexey Samsonov 66b35642d4 ASan: Disable alloc/dealloc mismatch test on Android. It's not supposed to work there
llvm-svn: 172398
2013-01-14 11:07:59 +00:00
Kostya Serebryany b05fc3a493 [asan] use the slow CFI-based unwinder when reporting an error. Still use the fast unwinder for malloc/free. Linux-x86-only for now.
llvm-svn: 172397
2013-01-14 11:01:34 +00:00
Manuel Klimek 557811fe6c Adds some more tests for * and &.
While reviewing r172303 I noticed that I wasn't sure whether we still
format those correctly and didn't see any tests.

llvm-svn: 172396
2013-01-14 10:58:01 +00:00