platform/upstream/llvm.git
11 years ago[ELF] Fix use of LLVM RTTI.
Michael J. Spencer [Tue, 15 Jan 2013 06:55:11 +0000 (06:55 +0000)]
[ELF] Fix use of LLVM RTTI.

llvm-svn: 172511

11 years agoPR14918: Don't confuse braced-init-lists after template variable declarations
Richard Smith [Tue, 15 Jan 2013 06:49:38 +0000 (06:49 +0000)]
PR14918: Don't confuse braced-init-lists after template variable declarations
with function definitions.

We really should remove Parser::isDeclarationAfterDeclarator entirely, since
it's meaningless in C++11 (an open brace could be either a function definition
or an initializer, which is what it's trying to differentiate between). The
other caller of it happens to be correct right now...

llvm-svn: 172510

11 years agoAdd -fopenmp -cc1 option and wire it up to define _OPENMP, from Alexey Bataev!
Douglas Gregor [Tue, 15 Jan 2013 06:45:29 +0000 (06:45 +0000)]
Add -fopenmp -cc1 option and wire it up to define _OPENMP, from Alexey Bataev!

llvm-svn: 172509

11 years ago[Support] Add LLVM_CONSTEXPR.
Michael J. Spencer [Tue, 15 Jan 2013 05:01:39 +0000 (05:01 +0000)]
[Support] Add LLVM_CONSTEXPR.

Marks a decl as constexpr if the compiler supports it.

llvm-svn: 172508

11 years agoremove const from FindByName
Shankar Easwaran [Tue, 15 Jan 2013 03:02:33 +0000 (03:02 +0000)]
remove const from FindByName

llvm-svn: 172507

11 years ago<rdar://problem/13010909>
Greg Clayton [Tue, 15 Jan 2013 02:59:24 +0000 (02:59 +0000)]
<rdar://problem/13010909>

Don't accidentally sign extend unsigned bitfields.

llvm-svn: 172506

11 years agoFix for the separation between -i and -u in expression.
Jim Ingham [Tue, 15 Jan 2013 02:57:33 +0000 (02:57 +0000)]
Fix for the separation between -i and -u in expression.

llvm-svn: 172505

11 years agoFix behavior of [[gnu::]] function attributes. Per g++'s behavior, these
Richard Smith [Tue, 15 Jan 2013 02:48:13 +0000 (02:48 +0000)]
Fix behavior of [[gnu::]] function attributes. Per g++'s behavior, these
attributes appertain to a declaration, even though they would be much more
naturally modelled as appertaining to a function type. Previously, we would
try to distribute them from the declarator to the function type, then
reject them for being at an incorrect location. Now, we just distribute them
as far as the declarator; the existing attribute handling code can actually
apply them there just fine.

llvm-svn: 172504

11 years agoSeparated the "expr --unwind-on-error" behavior into two parts, actual errors (i...
Jim Ingham [Tue, 15 Jan 2013 02:47:48 +0000 (02:47 +0000)]
Separated the "expr --unwind-on-error" behavior into two parts, actual errors (i.e. crashes) which continue to be
controlled by the --unwind-on-error flag, and --ignore-breakpoint which separately controls behavior when a called
function hits a breakpoint.  For breakpoints, we don't unwind, we either stop, or ignore the breakpoint, which makes
more sense.
Also make both these behaviors globally settable through "settings set".
Also handle the case where a breakpoint command calls code that ends up re-hitting the breakpoint.  We were recursing
and crashing.  Now we just stop without calling the second command.

<rdar://problem/12986644>
<rdar://problem/9119325>

llvm-svn: 172503

11 years ago[docs] Add driver documentation.
Michael J. Spencer [Tue, 15 Jan 2013 02:00:59 +0000 (02:00 +0000)]
[docs] Add driver documentation.

This gives an overview of the driver and explains how to add options and driver flavors.

llvm-svn: 172502

11 years ago[docs] Update status.
Michael J. Spencer [Tue, 15 Jan 2013 02:00:48 +0000 (02:00 +0000)]
[docs] Update status.

llvm-svn: 172501

11 years ago[ADT/StringMap] Follow-up to r172455, use the correct constructor for setting the...
Argyrios Kyrtzidis [Tue, 15 Jan 2013 01:58:45 +0000 (01:58 +0000)]
[ADT/StringMap] Follow-up to r172455, use the correct constructor for setting the InitialSize,
previously it was calling the "StringMapImpl(unsigned itemSize)" constructor.

llvm-svn: 172500

11 years agoLTO: Also init TTI for codegen passes.
Nadav Rotem [Tue, 15 Jan 2013 01:53:57 +0000 (01:53 +0000)]
LTO: Also init TTI for codegen passes.

llvm-svn: 172499

11 years ago[IR] Add verifier support for llvm.module.flags.
Daniel Dunbar [Tue, 15 Jan 2013 01:22:53 +0000 (01:22 +0000)]
[IR] Add verifier support for llvm.module.flags.

 - Also, update the LangRef documentation on module flags to match the
   implementation.

llvm-svn: 172498

11 years ago[driver] Warnings for warning options are handled by the frontend. The driver needs...
Chad Rosier [Tue, 15 Jan 2013 01:21:53 +0000 (01:21 +0000)]
[driver] Warnings for warning options are handled by the frontend.  The driver needs to process the
warning options to setup diagnostic state, but should not be emitting warnings as these would be
rudndant with what the frontend emits.
rdar://13001556

llvm-svn: 172497

11 years agoThis patch fixes a Mips specific bug where
Jack Carter [Tue, 15 Jan 2013 01:08:02 +0000 (01:08 +0000)]
This patch fixes a Mips specific bug where
we need to generate a N64 compound relocation
R_MIPS_GPREL_32/R_MIPS_64/R_MIPS_NONE.

The bug was exposed by the SingleSourcetest case
DuffsDevice.c.

Contributer: Jack Carter
llvm-svn: 172496

11 years agoAdd new merge-by-content Merge attribute for use by anonymous
Nick Kledzik [Tue, 15 Jan 2013 00:17:57 +0000 (00:17 +0000)]
Add new merge-by-content Merge attribute for use by anonymous
constants and string literals which the linker should coalesce.

llvm-svn: 172495

11 years agoAdd a few other missing LOG_ types to set_logging() in RNBRemote.cpp;
Jason Molenda [Tue, 15 Jan 2013 00:08:49 +0000 (00:08 +0000)]
Add a few other missing LOG_ types to set_logging() in RNBRemote.cpp;
document some simple bourne shell to re-generate these from the DNBDefs.h
header file in case this needs to be done again in the future.

llvm-svn: 172494

11 years agoAdding a test case for expression parser's support for Unicode strings. This is an...
Enrico Granata [Tue, 15 Jan 2013 00:03:03 +0000 (00:03 +0000)]
Adding a test case for expression parser's support for Unicode strings. This is an expected failure for now

llvm-svn: 172493

11 years ago<rdar://problem/12790664>
Enrico Granata [Mon, 14 Jan 2013 23:53:26 +0000 (23:53 +0000)]
<rdar://problem/12790664>

Single-character Unicode data formatters

llvm-svn: 172492

11 years agoNow GenericAsmParser and AsmParser are no longer friends, GenericAsmParser can
Eli Bendersky [Mon, 14 Jan 2013 23:43:18 +0000 (23:43 +0000)]
Now GenericAsmParser and AsmParser are no longer friends, GenericAsmParser can
simply use the getParser method from MCAsmParserExtension, working through the
MCAsmParser interface. There's no longer a need to overload that method to
cast it to the concrete AsmParser.

llvm-svn: 172491

11 years agoProperly encapsulate additional methods and data from AsmParser.
Eli Bendersky [Mon, 14 Jan 2013 23:22:36 +0000 (23:22 +0000)]
Properly encapsulate additional methods and data from AsmParser.

This finally allows AsmParser to no longer list GenericAsmParser as a friend.
All member vars directly accessed by GenericAsmParser have been properly
encapsulated and exposed through the MCAsmParser interface. This reduces the
coupling between AsmParser and GenericAsmParser.

llvm-svn: 172490

11 years agoRemove trailing spaces.
Jakub Staszak [Mon, 14 Jan 2013 23:16:36 +0000 (23:16 +0000)]
Remove trailing spaces.

llvm-svn: 172489

11 years agoThis change is to implement following rules under the condition C_A and/or C_R
Shuxin Yang [Mon, 14 Jan 2013 22:48:41 +0000 (22:48 +0000)]
This change is to implement following rules under the condition C_A and/or C_R

 ---------------------------------------------------------------------------
 C_A: reassociation is allowed
 C_R: reciprocal of a constant C is appropriate, which means
    - 1/C is exact, or
    - reciprocal is allowed and 1/C is neither a special value nor a denormal.
 -----------------------------------------------------------------------------

 rule1:  (X/C1) / C2 => X / (C2*C1)  (if C_A)
                     => X * (1/(C2*C1))  (if C_A && C_R)
 rule 2:  X*C1 / C2 => X * (C1/C2)  if C_A
 rule 3: (X/Y)/Z = > X/(Y*Z)  (if C_A && at least one of Y and Z is symbolic value)
 rule 4: Z/(X/Y) = > (Z*Y)/X  (similar to rule3)

 rule 5: C1/(X*C2) => (C1/C2) / X (if C_A)
 rule 6: C1/(X/C2) => (C1*C2) / X (if C_A)
 rule 7: C1/(C2/X) => (C1/C2) * X (if C_A)

llvm-svn: 172488

11 years agoDocument that we should recognize attributes supported by gcc with C++11
Dmitri Gribenko [Mon, 14 Jan 2013 22:44:07 +0000 (22:44 +0000)]
Document that we should recognize attributes supported by gcc with C++11
[[gnu::...]] syntax

Pointed out by Richard Smith on the mailing list.

llvm-svn: 172487

11 years agoclang-format goodness
Tobias Grosser [Mon, 14 Jan 2013 22:40:23 +0000 (22:40 +0000)]
clang-format goodness

llvm-svn: 172486

11 years agoRefactor to call ActOnFinishFullExpr on every full expression. Teach
Richard Smith [Mon, 14 Jan 2013 22:39:08 +0000 (22:39 +0000)]
Refactor to call ActOnFinishFullExpr on every full expression. Teach
ActOnFinishFullExpr that some of its checks only apply to discarded-value
expressions. This adds missing checks for unexpanded variadic template
parameter packs to a handful of constructs.

llvm-svn: 172485

11 years ago[ms-inline asm] Extend support for parsing Intel bracketed memory operands that
Chad Rosier [Mon, 14 Jan 2013 22:31:35 +0000 (22:31 +0000)]
[ms-inline asm] Extend support for parsing Intel bracketed memory operands that
have an arbitrary ordering of the base register, index register and displacement.
rdar://12527141

llvm-svn: 172484

11 years agoImprove r172468: const_cast is not needed here
Dmitri Gribenko [Mon, 14 Jan 2013 22:18:18 +0000 (22:18 +0000)]
Improve r172468: const_cast is not needed here

llvm-svn: 172483

11 years agoFix shadowed variable warning
Nick Kledzik [Mon, 14 Jan 2013 22:10:22 +0000 (22:10 +0000)]
Fix shadowed variable warning

llvm-svn: 172482

11 years agoImprove r172471: avoid all those extra casts on the lines nearby
Dmitri Gribenko [Mon, 14 Jan 2013 22:08:37 +0000 (22:08 +0000)]
Improve r172471: avoid all those extra casts on the lines nearby

llvm-svn: 172481

11 years agoThis patch addresses an incorrect transformation in the DAG combiner.
Bill Schmidt [Mon, 14 Jan 2013 22:04:38 +0000 (22:04 +0000)]
This patch addresses an incorrect transformation in the DAG combiner.

The included test case is derived from one of the GCC compatibility tests.
The problem arises after the selection DAG has been converted to type-legalized
form.  The combiner first sees a 64-bit load that can be converted into a
pre-increment form.  The original load feeds into a SRL that isolates the
upper 32 bits of the loaded doubleword.  This looks like an opportunity for
DAGCombiner::ReduceLoadWidth() to replace the 64-bit load with a 32-bit load.

However, this transformation is not valid, as the replacement load is not
a pre-increment load.  The pre-increment load produces an extra result,
which feeds a subsequent add instruction.  The replacement load only has
one result value, and this value is propagated to all uses of the pre-
increment load, including the add.  Because the add is looking for the
second result value as its operand, it ends up attempting to add a constant
to a token chain, resulting in a crash.

So the patch simply disables this transformation for any load with more than
two result values.

llvm-svn: 172480

11 years agoOnce a function has been JIT-compiled once, don't
Sean Callanan [Mon, 14 Jan 2013 21:45:38 +0000 (21:45 +0000)]
Once a function has been JIT-compiled once, don't
JIT it again.

llvm-svn: 172477

11 years agoMultiprecision subtraction builtins.
Michael Gottesman [Mon, 14 Jan 2013 21:44:30 +0000 (21:44 +0000)]
Multiprecision subtraction builtins.

We lower these into 2x chained usub.with.overflow intrinsics.

llvm-svn: 172476

11 years agoFollow up of commit r172472.
Quentin Colombet [Mon, 14 Jan 2013 21:34:09 +0000 (21:34 +0000)]
Follow up of commit r172472.
Refactor the big if/else sequence into one string switch for ARM subtype selection.

llvm-svn: 172475

11 years agoImprove r172464: const_cast is not needed if the variable is not const
Dmitri Gribenko [Mon, 14 Jan 2013 21:23:37 +0000 (21:23 +0000)]
Improve r172464: const_cast is not needed if the variable is not const

llvm-svn: 172474

11 years agoComplete the existing support of ARM v6m, v7m, and v7em, i.e., respectively cortex...
Quentin Colombet [Mon, 14 Jan 2013 21:07:43 +0000 (21:07 +0000)]
Complete the existing support of ARM v6m, v7m, and v7em, i.e., respectively cortex-m0, cortex-m3, and cortex-m4 on the backend side.

Adds new subtype values for the MachO format and use them when the related triple are set.

llvm-svn: 172472

11 years agoFix Casting
David Greene [Mon, 14 Jan 2013 21:04:47 +0000 (21:04 +0000)]
Fix Casting

Fix a casting-away-const compiler warning.

llvm-svn: 172471

11 years agoFix Casting
David Greene [Mon, 14 Jan 2013 21:04:45 +0000 (21:04 +0000)]
Fix Casting

Do proper casting to eliminate a const-away-cast compiler warning.

llvm-svn: 172470

11 years agoFix More Casts
David Greene [Mon, 14 Jan 2013 21:04:44 +0000 (21:04 +0000)]
Fix More Casts

Properly cast some more code that triggered cast-away-const errors.

llvm-svn: 172469

11 years agoFix Another Cast
David Greene [Mon, 14 Jan 2013 21:04:42 +0000 (21:04 +0000)]
Fix Another Cast

Properly cast code to eliminate cast-away-const errors.

llvm-svn: 172468

11 years agoFix Casting Bug
David Greene [Mon, 14 Jan 2013 21:04:40 +0000 (21:04 +0000)]
Fix Casting Bug

Add a const version of getFpValPtr to avoid a cast-away-const warning.

llvm-svn: 172467

11 years agoFix More Casts
David Greene [Mon, 14 Jan 2013 21:04:38 +0000 (21:04 +0000)]
Fix More Casts

Fix another cast-away-const cast.

llvm-svn: 172466

11 years agoFix Casting
David Greene [Mon, 14 Jan 2013 21:04:37 +0000 (21:04 +0000)]
Fix Casting

Stop a gcc warning about casting away const.

llvm-svn: 172465

11 years agoFix Casts
David Greene [Mon, 14 Jan 2013 21:04:35 +0000 (21:04 +0000)]
Fix Casts

Use const_cast<> to avoid cast-away-const errors.

llvm-svn: 172464

11 years agoSCEVExpander fix. RAUW needs to update the InsertedExpressions cache.
Andrew Trick [Mon, 14 Jan 2013 21:00:37 +0000 (21:00 +0000)]
SCEVExpander fix. RAUW needs to update the InsertedExpressions cache.

Note that this bug is only exposed because LTO fails to use TTI.

Fixes self-LTO of clang. rdar://13007381.

llvm-svn: 172462

11 years agoMake <cmath> classification macros work with integral types.
Howard Hinnant [Mon, 14 Jan 2013 20:56:22 +0000 (20:56 +0000)]
Make <cmath> classification macros work with integral types.

llvm-svn: 172461

11 years agoFix typo in comment.
Nick Lewycky [Mon, 14 Jan 2013 20:56:10 +0000 (20:56 +0000)]
Fix typo in comment.

llvm-svn: 172460

11 years agoTopologically sort the link options generated for modules based on
Douglas Gregor [Mon, 14 Jan 2013 20:53:57 +0000 (20:53 +0000)]
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

11 years agoFix a race in the construction of future. This fixes http://llvm.org/bugs/show_bug...
Howard Hinnant [Mon, 14 Jan 2013 20:01:24 +0000 (20:01 +0000)]
Fix a race in the construction of future.  This fixes llvm.org/bugs/show_bug.cgi?id=14934.

llvm-svn: 172456

11 years ago[ADT/StringMap] Add a constructor in StringMap that accepts both an
Argyrios Kyrtzidis [Mon, 14 Jan 2013 19:41:09 +0000 (19:41 +0000)]
[ADT/StringMap] Add a constructor in StringMap that accepts both an
initial size and an allocator.

llvm-svn: 172455

11 years agoFix DenseMap when LLVM_HAS_RVALUE_REFERENCES is defined but equals 0.
Joe Groff [Mon, 14 Jan 2013 19:37:42 +0000 (19:37 +0000)]
Fix DenseMap when LLVM_HAS_RVALUE_REFERENCES is defined but equals 0.

llvm-svn: 172454

11 years agoAdd DenseMap::insert(value_type&&) method.
Joe Groff [Mon, 14 Jan 2013 19:24:15 +0000 (19:24 +0000)]
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

11 years agoChanged SmallPtrSet.count guard + SmallPtrSet.insert to just SmallPtrSet.insert.
Michael Gottesman [Mon, 14 Jan 2013 19:18:39 +0000 (19:18 +0000)]
Changed SmallPtrSet.count guard + SmallPtrSet.insert to just SmallPtrSet.insert.

llvm-svn: 172452

11 years agoMove CheckForValidSection to the MCAsmParser interface.
Eli Bendersky [Mon, 14 Jan 2013 19:15:01 +0000 (19:15 +0000)]
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

11 years agoExpose an InitToTextSection through MCStreamer.
Eli Bendersky [Mon, 14 Jan 2013 19:04:57 +0000 (19:04 +0000)]
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

11 years agoMove ParseMacroArgument to the MCAsmParser interfance.
Eli Bendersky [Mon, 14 Jan 2013 19:00:26 +0000 (19:00 +0000)]
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

11 years agoWhen forming the link options for an imported module, also include the
Douglas Gregor [Mon, 14 Jan 2013 19:00:05 +0000 (19:00 +0000)]
When forming the link options for an imported module, also include the
link options for the modules it imports.

llvm-svn: 172448

11 years agoFix string conversions functions to throw out_of_range properly. Fixes http://llvm...
Howard Hinnant [Mon, 14 Jan 2013 18:59:43 +0000 (18:59 +0000)]
Fix string conversions functions to throw out_of_range properly.  Fixes llvm.org/bugs/show_bug.cgi?id=14919.

llvm-svn: 172447

11 years ago[analyzer] Add ProgramStatePartialTrait<const void *>.
Jordan Rose [Mon, 14 Jan 2013 18:58:42 +0000 (18:58 +0000)]
[analyzer] Add ProgramStatePartialTrait<const void *>.

This should fix cast-away-const warnings reported by David Greene.

llvm-svn: 172446

11 years ago[analyzer] Fix cast-away-const warning by using const_cast.
Jordan Rose [Mon, 14 Jan 2013 18:58:38 +0000 (18:58 +0000)]
[analyzer] Fix cast-away-const warning by using const_cast.

Patch by David Greene, modified by me.

llvm-svn: 172445

11 years ago[analyzer] -drain is not an alias for -release.
Jordan Rose [Mon, 14 Jan 2013 18:58:33 +0000 (18:58 +0000)]
[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

11 years agoFix a logic error in the condition for a warning log message.
Jim Ingham [Mon, 14 Jan 2013 18:30:01 +0000 (18:30 +0000)]
Fix a logic error in the condition for a warning log message.

llvm-svn: 172442

11 years agoSwitch autolinking metadata format over to actual linker options, e.g.,
Douglas Gregor [Mon, 14 Jan 2013 18:28:43 +0000 (18:28 +0000)]
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

11 years agoEncapsulate the MacroEnabled flag in AsmParser behind accessor methods.
Eli Bendersky [Mon, 14 Jan 2013 18:08:41 +0000 (18:08 +0000)]
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

11 years agoInfer "link" lines for top-level frameworks. Essentially, a framework
Douglas Gregor [Mon, 14 Jan 2013 17:57:51 +0000 (17:57 +0000)]
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

11 years agoThis patch addresses varargs processing for small complex types under
Bill Schmidt [Mon, 14 Jan 2013 17:45:36 +0000 (17:45 +0000)]
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

11 years agoImplement parsing, AST, (de-)serialization, and placeholder global
Douglas Gregor [Mon, 14 Jan 2013 17:21:00 +0000 (17:21 +0000)]
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

11 years agoMichael van der Westhuizen: Improve support for testing on Linux. Fixes http://llvm...
Howard Hinnant [Mon, 14 Jan 2013 17:12:54 +0000 (17:12 +0000)]
Michael van der Westhuizen: Improve support for testing on Linux.  Fixes llvm.org/bugs/show_bug.cgi?id=14892.

llvm-svn: 172436

11 years agoMichael van der Westhuizen: Patches for Linux. Fixes http://llvm.org/bugs/show_bug...
Howard Hinnant [Mon, 14 Jan 2013 17:07:27 +0000 (17:07 +0000)]
Michael van der Westhuizen:  Patches for Linux.  Fixes llvm.org/bugs/show_bug.cgi?id=14648.

llvm-svn: 172435

11 years agoTest source file name in diagnostics
Alexander Kornienko [Mon, 14 Jan 2013 17:01:57 +0000 (17:01 +0000)]
Test source file name in diagnostics

llvm-svn: 172434

11 years agoFixes formatting of nested brace initializers.
Manuel Klimek [Mon, 14 Jan 2013 16:41:43 +0000 (16:41 +0000)]
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

11 years agoAdd support for Chromium style.
Daniel Jasper [Mon, 14 Jan 2013 16:26:38 +0000 (16:26 +0000)]
Add support for Chromium style.

llvm-svn: 172432

11 years agoMake single-line if statements optional.
Daniel Jasper [Mon, 14 Jan 2013 16:24:39 +0000 (16:24 +0000)]
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

11 years ago[ubsan] Use __sanitizer::atomic_exchange(), prefer shared impl.
Will Dietz [Mon, 14 Jan 2013 16:13:52 +0000 (16:13 +0000)]
[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

11 years agoFix a bug in the line merging.
Daniel Jasper [Mon, 14 Jan 2013 16:02:06 +0000 (16:02 +0000)]
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

11 years agoFix bug that would lead to joining preprocessor directives.
Daniel Jasper [Mon, 14 Jan 2013 15:52:06 +0000 (15:52 +0000)]
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

11 years agoPut simple preprocessor directives on a single line.
Daniel Jasper [Mon, 14 Jan 2013 15:40:57 +0000 (15:40 +0000)]
Put simple preprocessor directives on a single line.

Before: #define A  \
          A
After:  #define A A
llvm-svn: 172423

11 years agoMove large part of asan_test_utils.h to sanitizer_common.
Evgeniy Stepanov [Mon, 14 Jan 2013 15:12:26 +0000 (15:12 +0000)]
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

11 years agoTurns out there is a simpler way of getting a set difference in bash than parsing...
Benjamin Kramer [Mon, 14 Jan 2013 15:00:48 +0000 (15:00 +0000)]
Turns out there is a simpler way of getting a set difference in bash than parsing diff output.

llvm-svn: 172420

11 years agoFix-up copypasto from r172410
Alexey Samsonov [Mon, 14 Jan 2013 14:52:35 +0000 (14:52 +0000)]
Fix-up copypasto from r172410

llvm-svn: 172419

11 years agoasan: fix windows build
Dmitry Vyukov [Mon, 14 Jan 2013 14:28:06 +0000 (14:28 +0000)]
asan: fix windows build

llvm-svn: 172415

11 years agoAdding a .gitignore to tools-extra
Edwin Vane [Mon, 14 Jan 2013 14:20:19 +0000 (14:20 +0000)]
Adding a .gitignore to tools-extra

Reviewers: klimek

llvm-svn: 172414

11 years agoPut short if statements on a single line.
Daniel Jasper [Mon, 14 Jan 2013 14:14:23 +0000 (14:14 +0000)]
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

11 years agoRevert r171829 "Split changeset_ty using iterators instead of loops" as it breaks...
Timur Iskhodzhanov [Mon, 14 Jan 2013 14:13:06 +0000 (14:13 +0000)]
Revert r171829 "Split changeset_ty using iterators instead of loops" as it breaks the VS2008 build

llvm-svn: 172411

11 years agoBuild rules for sanitizer_common tests on Android.
Evgeniy Stepanov [Mon, 14 Jan 2013 14:08:25 +0000 (14:08 +0000)]
Build rules for sanitizer_common tests on Android.

llvm-svn: 172410

11 years agoDump comments in -ast-dump.
Alexander Kornienko [Mon, 14 Jan 2013 14:07:11 +0000 (14:07 +0000)]
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

11 years agoRemove thread-locals from sanitizer_common tests.
Evgeniy Stepanov [Mon, 14 Jan 2013 14:06:58 +0000 (14:06 +0000)]
Remove thread-locals from sanitizer_common tests.

Not supported on Android.

llvm-svn: 172408

11 years agoAdded a test for clang-format diagnostics.
Alexander Kornienko [Mon, 14 Jan 2013 13:57:05 +0000 (13:57 +0000)]
Added a test for clang-format diagnostics.

llvm-svn: 172407

11 years agoFix: correct file name in diagnostics.
Alexander Kornienko [Mon, 14 Jan 2013 13:40:44 +0000 (13:40 +0000)]
Fix: correct file name in diagnostics.

llvm-svn: 172405

11 years agoclang/test/SemaCXX/cxx11-gnu-attrs.cpp: Add explicit -triple x86_64-unknown-unknown...
NAKAMURA Takumi [Mon, 14 Jan 2013 13:16:02 +0000 (13:16 +0000)]
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

11 years agoRefactor datastructure used in clang-format.
Daniel Jasper [Mon, 14 Jan 2013 13:08:07 +0000 (13:08 +0000)]
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

11 years agoImprove understanding post increment and decrement.
Daniel Jasper [Mon, 14 Jan 2013 12:18:19 +0000 (12:18 +0000)]
Improve understanding post increment and decrement.

Before: (a->f()) ++;
        a[42] ++;
After:  (a->f())++;
        a[42]++;
llvm-svn: 172400

11 years agoCustom DiagnosticConsumer parameter of reformat() + silence diagnostics in unit tests.
Alexander Kornienko [Mon, 14 Jan 2013 11:34:14 +0000 (11:34 +0000)]
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

11 years agoASan: Disable alloc/dealloc mismatch test on Android. It's not supposed to work there
Alexey Samsonov [Mon, 14 Jan 2013 11:07:59 +0000 (11:07 +0000)]
ASan: Disable alloc/dealloc mismatch test on Android. It's not supposed to work there

llvm-svn: 172398

11 years ago[asan] use the slow CFI-based unwinder when reporting an error. Still use the fast...
Kostya Serebryany [Mon, 14 Jan 2013 11:01:34 +0000 (11:01 +0000)]
[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

11 years agoAdds some more tests for * and &.
Manuel Klimek [Mon, 14 Jan 2013 10:58:01 +0000 (10:58 +0000)]
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

11 years agoasan/tsan: mmap shadow memory before allocating memory (otherwise other threads can...
Dmitry Vyukov [Mon, 14 Jan 2013 10:49:11 +0000 (10:49 +0000)]
asan/tsan: mmap shadow memory before allocating memory (otherwise other threads can access non yet allocated shadow)

llvm-svn: 172395

11 years agoASan: Disable alloc/dealloc-mismatch checker on Mac for now (it produces weird false...
Alexey Samsonov [Mon, 14 Jan 2013 10:18:38 +0000 (10:18 +0000)]
ASan: Disable alloc/dealloc-mismatch checker on Mac for now (it produces weird false positives on googletest)

llvm-svn: 172394

11 years agotsan: describe stack and TLS addresses
Dmitry Vyukov [Mon, 14 Jan 2013 10:00:03 +0000 (10:00 +0000)]
tsan: describe stack and TLS addresses

llvm-svn: 172393