Commit Graph

140607 Commits

Author SHA1 Message Date
Dmitri Gribenko cb9ede9437 ClangFormat.rst: improve formatting
llvm-svn: 172007
2013-01-09 22:18:55 +00:00
David Greene 9ff8d471d6 Disable -Wuninitialized for gcc
If the compiler is gcc, disable variants of -Wuninitialized depending
on the gcc version.  This gets a lot of false positive warnings out of
the build.

Generate a new configure for the gcc -Wno-uninitialized fix.

Pick up -Wno-uninitialized from configure

Add the option -Wno[-maybe]-uninitialized as determined by configure.

llvm-svn: 172006
2013-01-09 22:11:13 +00:00
Hal Finkel 6134a6e7b8 Remove the unused Parser::ParseTranslationUnit function
Parser::ParseTranslationUnit is now dead because the loop over
ParseTopLevelDecl is in ParseAST.

llvm-svn: 172005
2013-01-09 21:49:51 +00:00
Daniel Jasper 85a77c1609 Add documentation for clang-format.
This adds documentation for both LibFormat as well as the standalone
tools and integrations built on top of it. It slightly restructures
the ClangTools documentation.

llvm-svn: 172004
2013-01-09 21:49:28 +00:00
Nico Weber d8ffe75ad1 Formatter: Make parseObjCUntilAtEnd() actually work.
llvm-svn: 172003
2013-01-09 21:42:32 +00:00
Nico Weber 8696a8d9e3 Formatting: Add support for @protocol.
Pull pieces of the @interface code into reusable methods.

llvm-svn: 172001
2013-01-09 21:15:03 +00:00
Evan Cheng 5652a8df32 Fix a DAG combine bug visitBRCOND() is transforming br(xor(x, y)) to br(x != y).
It cahced XOR's operands before calling visitXOR() but failed to update the
operands when visitXOR changed the XOR node.

rdar://12968664

llvm-svn: 171999
2013-01-09 20:56:40 +00:00
Daniel Jasper abf4cce40f Simplify reversed for-loop.
llvm-svn: 171998
2013-01-09 20:46:42 +00:00
Michael J. Spencer 41d9dc56d3 Style fixes.
llvm-svn: 171997
2013-01-09 20:39:07 +00:00
Nico Weber 4d03055e70 Fix test after r171995.
I wasn't aware libFormat is used elsewhere already. Let me know if rebasing
is not the right thing to do here.

llvm-svn: 171996
2013-01-09 20:36:10 +00:00
Nico Weber 7eecf4b6e3 Formatter: Add support for @interface.
Previously:
@interface Foo + (id)init; @end

Now:
@interface Foo
+ (id)init;
@end

Some tweaking remains, but this is a good first step.

llvm-svn: 171995
2013-01-09 20:25:35 +00:00
Daniel Jasper 46e432fb8a Initial version of diff/patch-reformat tool.
Use at your own risk :-).

llvm-svn: 171994
2013-01-09 20:20:11 +00:00
Enrico Granata b576bba229 <rdar://problem/12028723>
Adding useful formatting options to the expression (expr) command.
As a side effect of this change, the -d option now supports the same three-values enumeration that frame variables uses (run, don't run, none) instead of a boolean like it did previously

These options do not apply to print, p or po because these are aliased to not take any options.
In order to use them, use expression or expr.

llvm-svn: 171993
2013-01-09 20:12:53 +00:00
Michael J. Spencer cf2306fe2b Fix the elf/rodata.objtext test to work when first run.
llvm-svn: 171992
2013-01-09 20:10:30 +00:00
Benjamin Kramer 696651429d unwind.h: Add include guards and don't mess with visibility if HIDE_EXPORTS is specified.
For GCC compatibility.

llvm-svn: 171991
2013-01-09 19:54:57 +00:00
Greg Clayton f9fc609fe7 Expanded the flags that can be set for a command object in lldb_private::CommandObject. This list of available flags are:
enum
{
    //----------------------------------------------------------------------
    // eFlagRequiresTarget
    //
    // Ensures a valid target is contained in m_exe_ctx prior to executing
    // the command. If a target doesn't exist or is invalid, the command
    // will fail and CommandObject::GetInvalidTargetDescription() will be
    // returned as the error. CommandObject subclasses can override the
    // virtual function for GetInvalidTargetDescription() to provide custom
    // strings when needed.
    //----------------------------------------------------------------------
    eFlagRequiresTarget         = (1u << 0),
    //----------------------------------------------------------------------
    // eFlagRequiresProcess
    //
    // Ensures a valid process is contained in m_exe_ctx prior to executing
    // the command. If a process doesn't exist or is invalid, the command
    // will fail and CommandObject::GetInvalidProcessDescription() will be
    // returned as the error. CommandObject subclasses can override the
    // virtual function for GetInvalidProcessDescription() to provide custom
    // strings when needed.
    //----------------------------------------------------------------------
    eFlagRequiresProcess        = (1u << 1),
    //----------------------------------------------------------------------
    // eFlagRequiresThread
    //
    // Ensures a valid thread is contained in m_exe_ctx prior to executing
    // the command. If a thread doesn't exist or is invalid, the command
    // will fail and CommandObject::GetInvalidThreadDescription() will be
    // returned as the error. CommandObject subclasses can override the
    // virtual function for GetInvalidThreadDescription() to provide custom
    // strings when needed.
    //----------------------------------------------------------------------
    eFlagRequiresThread         = (1u << 2),
    //----------------------------------------------------------------------
    // eFlagRequiresFrame
    //
    // Ensures a valid frame is contained in m_exe_ctx prior to executing
    // the command. If a frame doesn't exist or is invalid, the command
    // will fail and CommandObject::GetInvalidFrameDescription() will be
    // returned as the error. CommandObject subclasses can override the
    // virtual function for GetInvalidFrameDescription() to provide custom
    // strings when needed.
    //----------------------------------------------------------------------
    eFlagRequiresFrame          = (1u << 3),
    //----------------------------------------------------------------------
    // eFlagRequiresRegContext
    //
    // Ensures a valid register context (from the selected frame if there
    // is a frame in m_exe_ctx, or from the selected thread from m_exe_ctx)
    // is availble from m_exe_ctx prior to executing the command. If a
    // target doesn't exist or is invalid, the command will fail and
    // CommandObject::GetInvalidRegContextDescription() will be returned as
    // the error. CommandObject subclasses can override the virtual function
    // for GetInvalidRegContextDescription() to provide custom strings when
    // needed.
    //----------------------------------------------------------------------
    eFlagRequiresRegContext     = (1u << 4),
    //----------------------------------------------------------------------
    // eFlagTryTargetAPILock
    //
    // Attempts to acquire the target lock if a target is selected in the
    // command interpreter. If the command object fails to acquire the API
    // lock, the command will fail with an appropriate error message.
    //----------------------------------------------------------------------
    eFlagTryTargetAPILock       = (1u << 5),
    //----------------------------------------------------------------------
    // eFlagProcessMustBeLaunched
    //
    // Verifies that there is a launched process in m_exe_ctx, if there
    // isn't, the command will fail with an appropriate error message.
    //----------------------------------------------------------------------
    eFlagProcessMustBeLaunched  = (1u << 6),
    //----------------------------------------------------------------------
    // eFlagProcessMustBePaused
    //
    // Verifies that there is a paused process in m_exe_ctx, if there
    // isn't, the command will fail with an appropriate error message.
    //----------------------------------------------------------------------
    eFlagProcessMustBePaused    = (1u << 7)
};

Now each command object contains a "ExecutionContext m_exe_ctx;" member variable that gets initialized prior to running the command. The validity of the target objects in m_exe_ctx are checked to ensure that any target/process/thread/frame/reg context that are required are valid prior to executing the command. Each command object also contains a Mutex::Locker m_api_locker which gets used if eFlagTryTargetAPILock is set. This centralizes a lot of checking code that was previously and inconsistently implemented across many commands.

llvm-svn: 171990
2013-01-09 19:44:40 +00:00
Argyrios Kyrtzidis eb9ae76864 Move the internal PrintStackTrace function that is used for llvm::sys::PrintStackTraceOnErrorSignal(),
into a new function llvm::sys::PrintStackTrace, so that it's available to clients for logging purposes.

llvm-svn: 171989
2013-01-09 19:42:40 +00:00
Michael Gottesman c189a392ce [ObjCARC Debug Messages] This is a squashed commit of 3x debug message commits ala echristo's suggestion.
1. Added debug messages when in OptimizeIndividualCalls we move calls into predecessors and then erase the original call.
2. Added debug messages when in the process of moving calls in ObjCARCOpt::MoveCalls we create new RR and delete old RR.
3. Added a debug message when we visit a specific retain instruction in ObjCARCOpt::PerformCodePlacement.

llvm-svn: 171988
2013-01-09 19:23:24 +00:00
Ted Kremenek 2f2edd3fb1 Do not model loads from complex types, since we don't accurately model the imaginary and real parts yet.
Fixes false positive reported in <rdar://problem/12964481>.

llvm-svn: 171987
2013-01-09 18:46:17 +00:00
Jakob Stoklund Olesen 6922e9ca7e Don't print bundle flags.
The bundle flags are used by MachineBasicBlock::print(), they don't need
to clutter up individual MachineInstrs.

llvm-svn: 171986
2013-01-09 18:35:09 +00:00
Jakob Stoklund Olesen 68d752bf6b Don't require BUNDLE headers in MachineInstr::getBundleSize().
It is possible to build MI bundles that don't begin with a BUNDLE
header. Add support for such bundles, counting all instructions inside
the bundle.

llvm-svn: 171985
2013-01-09 18:28:16 +00:00
Benjamin Kramer 130fcde3e5 LICM: Hoist insertvalue/extractvalue out of loops.
Fixes PR14854.

llvm-svn: 171984
2013-01-09 18:12:03 +00:00
Sergei Larin 3b46d7ea26 Fix a typo in MachineInstr::unbundleFromSucc() method.
llvm-svn: 171983
2013-01-09 17:54:33 +00:00
David Blaikie 5a6a020d9b Suppress GCC -Wreturn warning.
Modified from a patch by David Greene.

llvm-svn: 171982
2013-01-09 17:48:41 +00:00
Dmitry Vyukov a626d03266 tsan: detect races on fd passed to epoll_ctl
llvm-svn: 171981
2013-01-09 17:31:27 +00:00
Marshall Clow 4476100a2f Made test output iterators have value_type of 'void'; matches ones in library
llvm-svn: 171980
2013-01-09 17:20:02 +00:00
Adhemerval Zanella 1ae2248e14 PowerPC: EH adjustments
This patch adjust the r171506 to make all DWARF enconding pc-relative
for PPC64. It also adds the R_PPC64_REL32 relocation handling in MCJIT
(since the eh_frame will not generate PIC-relative relocation) and also
adds the emission of stubs created by the TTypeEncoding.

llvm-svn: 171979
2013-01-09 17:08:15 +00:00
Rafael Espindola 3bd836a58e Handle static functions being redeclared in function scope.
Fixes pr14861.

llvm-svn: 171978
2013-01-09 16:34:58 +00:00
Shankar Easwaran 9f64604e74 add hexagon flags in ELF.h
llvm-svn: 171977
2013-01-09 16:34:46 +00:00
David Tweed f42bdf7c77 For some LLVM-as-library uses it is convenient to create a
subclass of TargetMachine which "forwards" all operations to an
existing internal TargetMachine member variable. In the usage context the
specific-machine class derived from TargetMachine is not visible,
only a reference to the generic base class TargetMachine. Although
getSubtargetImpl() is public in specific-machine classes derived from
TargetMachine, the TargetMachine class unfortunately has
getSubtargetImpl() protected (and accessing non-const members makes
abusing getSubtarget() unsuitable). Making it public in the base class
allows this forwarding pattern.

llvm-svn: 171976
2013-01-09 16:21:47 +00:00
Dmitri Gribenko 06358bd078 Configure: if we compile with clang, check that it is not broken
Some linux distibutions (for example, Mageia 2, Fedora 17) ship Clang that is
essentially broken for the end user.  Clang can not find or compile libstdc++
headers.

The issue is that our configure prefers clang over gcc, thus selecting a broken
Clang when a working GCC is available.

Now we detect this issue by compiling a simple program.  If it does not
compile, configure stops with an error suggesting the user to select a
different compiler.

llvm-svn: 171975
2013-01-09 15:25:30 +00:00
Manuel Klimek 52b1515405 Enables layouting unwrapped lines around preprocessor directives.
Previously, we'd always start at indent level 0 after a preprocessor
directive, now we layout the following snippet (column limit 69) as
follows:

functionCallTo(someOtherFunction(
    withSomeParameters, whichInSequence,
    areLongerThanALine(andAnotherCall,
  B
                       withMoreParamters,
                       whichStronglyInfluenceTheLayout),
    andMoreParameters),
               trailing);

Note that the different jumping indent is a different issue that will be
addressed separately.

This is the first step towards handling #ifdef->#else->#endif chains
correctly.

llvm-svn: 171974
2013-01-09 15:25:02 +00:00
Kostya Serebryany 864ef315c0 [asan] make the slow unwinder a bit more robust. The unittests pass with fast_unwind_on_fatal=0, but I still observe some differences between the two unwinders
llvm-svn: 171973
2013-01-09 13:55:00 +00:00
Tim Northover ab7689ecee Check whether MCInst operand isImm before calling getImm.
When processing possible aliases, TableGen assumes that if an operand *can* be
an immediate, then it always *will* be. This is incorrect for the AArch64
backend. This patch inserts a check in the generated code to make sure isImm is
true first.

llvm-svn: 171972
2013-01-09 13:32:04 +00:00
Tim Northover f1450d8d7c Refactor to expose RTLIB calls to targets.
fp128 is almost but not quite completely illegal as a type on AArch64. As a
result it needs to have a register class (for argument passing mainly), but all
operations need to be lowered to runtime calls. Currently there's no way for
targets to do this (without duplicating code), as the relevant functions are
hidden in SelectionDAG. This patch changes that.

llvm-svn: 171971
2013-01-09 13:18:15 +00:00
Timur Iskhodzhanov 1d1f74cbf5 [ASan/Win] Satisfy lint
llvm-svn: 171970
2013-01-09 12:43:16 +00:00
Guy Benyei 6313f780e1 Enable intel_ocl_bicc for x86_64 target. This was missed in r171056.
llvm-svn: 171969
2013-01-09 12:21:44 +00:00
Timur Iskhodzhanov 73e484aa8a [ASan/Win] Unbreak the 32-bit RTL build
llvm-svn: 171968
2013-01-09 12:03:27 +00:00
Dmitry Vyukov a681c01b69 tsan: fix crash when user defines own fopen/fileno
llvm-svn: 171967
2013-01-09 11:54:52 +00:00
Daniel Jasper bcab430fee Only align after assignments on the top level.
This fixes llvm.org/PR14870 and we no longer mess up:
template <typename T1, typename T2 = char, typename T3 = char,
          typename T4 = char>
void f();

It removes the nice aligment for assignments inside other expressions,
but I am not sure those are actually practically relevant. If so, we can
fix those later.

llvm-svn: 171966
2013-01-09 10:40:23 +00:00
Manuel Klimek 652b9ab7df Incrase the number of parameters for AlignedCharArrayUnion.
We need this to correctly fix ASTMatchers/ASTTypeTraits.h in clang.

llvm-svn: 171965
2013-01-09 10:39:16 +00:00
Daniel Jasper 2df93311da Don't simply give up when exceeding 80cols, choose an "ok" option.
This addresses llvm.org/PR14847.

We can now format something like:
int aaaaaaaaaaaaaaaaaaaaaaaaaaa =
    // aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaiaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
    + bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb;

clang-format unavoidably exceeds the column limit, but does not just
flush everything into a single line. Moreover, it tries to minimize the
number of characters beyond the column limit.

llvm-svn: 171964
2013-01-09 10:16:05 +00:00
Daniel Jasper 890589414b Correctly format wrapped function call parameters in templated functions.
This fixes llvm.org/PR14846.

Before:
template <typename T>
void aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(
        int aaaaaaaaaaaaaaaaa);

After:
template <typename T>
void aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(
    int aaaaaaaaaaaaaaaaa);

llvm-svn: 171963
2013-01-09 09:50:48 +00:00
Manuel Klimek cdd5c2397a Fixes dump_ast_matchers to parse all matcher macros and updates the
docs.

llvm-svn: 171962
2013-01-09 09:38:21 +00:00
Daniel Jasper d8bb2db242 Allow comments in the middle of statements to be on their own line.
This fixes llvm.org/PR14860.

Before, we messed up the format of:
if (DeclaratorInfo.isFunctionDeclarator() &&
    //getDeclSpecContextFromDeclaratorContext(Context) == DSC_top_level &&
    Tok.is(tok::semi) && NextToken().is(tok::l_brace)) {
}

llvm-svn: 171961
2013-01-09 09:33:39 +00:00
Bill Wendling f927ad34e7 Alter the hasing computation when inserting into the folding set.
llvm-svn: 171960
2013-01-09 09:26:23 +00:00
Daniel Jasper fb3f2482e5 Fix ObjC block declarations.
Before: int ( ^ Block1) (int, int) = ^ (int i, int j)
After:  int (^Block1) (int, int) = ^(int i, int j)
llvm-svn: 171959
2013-01-09 08:36:49 +00:00
Dmitry Vyukov b4ede780b0 tsan: fix crash when user defines own fopen/fileno
llvm-svn: 171958
2013-01-09 08:22:06 +00:00
Daniel Jasper 399d24bc7d Improve formatting of conditional operators.
This addresses llvm.org/PR14864.

We used to completely mess this up and now format as:
Diag(NewFD->getLocation(),
     getLangOpts().MicrosoftExt ? diag::ext_function_specialization_in_class :
         diag::err_function_specialization_in_class)
    << NewFD->getDeclName();

llvm-svn: 171957
2013-01-09 07:06:56 +00:00
Nadav Rotem 3f5825c6c1 add -march to the test
llvm-svn: 171956
2013-01-09 07:04:23 +00:00