Commit Graph

2753 Commits

Author SHA1 Message Date
Jordan Rose 476bbb0252 [analyzer] scan-build: Handle -m* option wildcard after compiler/linker flags.
Some of the shared compiler/linker flags start with -m, so they've been
getting passed to the compiler only since r180073. Now, the -m* wildcard
is processed after the shared flags and the ignored flags.

Found by Laszlo Nagy!

llvm-svn: 193184
2013-10-22 18:55:18 +00:00
Rafael Espindola 8db352d532 Rename some functions for consistency.
Every other function in Redeclarable.h was using Decl instead of Declaration.

llvm-svn: 192900
2013-10-17 15:37:26 +00:00
Benjamin Kramer 656363d5b5 Add llvm_unreachable to pacify GCC's dropping off non-void function warning.
+ 80 cols fix.

llvm-svn: 192728
2013-10-15 18:53:18 +00:00
Argyrios Kyrtzidis dc2973f735 [libclang] When querying for the availability of an enumerator, pick up the availability from the enum declaration.
rdar://14789001.

llvm-svn: 192718
2013-10-15 17:00:53 +00:00
Alexander Kornienko 95c009afd9 Changed clang-format-diff.py to output diff by default. Added -i option to apply changes to files instead.
Summary:
"svn diff|clang-format-diff.py" will just output the diff.
Now it's possible to use:
  svn diff|clang-format-diff.py|patch -p0
as an equivalent to:
  svn diff|clang-format-diff.py -i
;)

Reviewers: djasper

Reviewed By: djasper

CC: cfe-commits

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

llvm-svn: 192505
2013-10-11 21:32:01 +00:00
Argyrios Kyrtzidis adff3ae3c8 [libclang] Introduce clang_Type_getCXXRefQualifier whichexposes ref-qualifier information of function type.
Patch by Che-Liang Chiou!

llvm-svn: 192493
2013-10-11 19:58:38 +00:00
Daniel Jasper e8845ad4c5 clang-format: Don't exit with failure on empty files.
Also let clang-format-diff.py detect errors based on clang-format's
return code. Otherwise messages like "Can't find usable .clang-format,
falling back to LLVM style" can make it fail, which might be undesired.

Patch by Alp Toker. Thank you!

llvm-svn: 192184
2013-10-08 15:54:36 +00:00
David Majnemer 3f8f8c9dbd Driver: Use the canonical command line arguments.
Summary:
Use the arguments given to the OS at process creation-time instead of
the arguments passed into main() by the C runtime environment.  The ones
that main() received may not be suitable (e.g. not Unicode).

Depends on D1834

CC: cfe-commits

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

llvm-svn: 192091
2013-10-07 07:33:27 +00:00
Argyrios Kyrtzidis 7a4253b685 [libclang] Introduce clang_Type_getClassType which returns the class type of a member pointer type.
Patch by Che-Liang Chiou!

llvm-svn: 191906
2013-10-03 16:19:23 +00:00
Daniel Jasper 164c8e1810 clang-format: Fix clang-format-diff.py according to diff specification.
Patch by Alp Toker. Many thanks!

Original descriptions:
clang-format-diff incorrectly modifies unchanged lines due to an error
in diff parsing.

The unified diff format has a default line change count of 1, and 0 may
be specified to indicate that no lines have been added. This patch
updates the parser to accurately reflect the diff specification.

This also has the benefit of stabilising the operation so it will
produce the same output when run multiple times on the same changeset,
which was previously not the case.

No tests added because this script is not currently tested (though we
should look into that!)

llvm-svn: 191820
2013-10-02 13:59:03 +00:00
Alexey Bataev d5af8e472d [OpenMP] Added parsing and semantic analysis for firstprivate clause
llvm-svn: 191730
2013-10-01 05:32:34 +00:00
David Blaikie 8b03ef8388 Remove unused variable introduced in 191666
llvm-svn: 191682
2013-09-30 17:30:41 +00:00
Edwin Vane d544aa79c9 Moving style option formatting to libFormat
The help text for clang-format's -style option and the function that processes
its value is moved to libFormat in this patch. The goal is to enable other
tools that use libFormat and also have a -style option to behave consistently
with clang-format.

llvm-svn: 191666
2013-09-30 13:31:48 +00:00
Bob Wilson a1b4206a70 Fix up fallout from r187156.
The previous change caused the driver to translate -Wa,-L to the
-msave-temp-labels option for cc1as, but cc1as did not accept that option.
This patch follows the same approach used for similar options (-relax-all,
-noexecstack) in the previous patch.

llvm-svn: 191458
2013-09-26 21:00:51 +00:00
Argyrios Kyrtzidis 16834f1cf9 [libclang] Provide location for attributes and expose 'packed' attribute.
Patch by Loïc Jaquemet!

llvm-svn: 191345
2013-09-25 00:14:38 +00:00
Alexey Bataev 756c196f14 [OPENMP] Bug fixes and improvements.
1. Fixed constructor of shared clause.
2. Some macros for clauses processing are replaced by private template methods.
3. Additional checks in sema analysis of OpenMP clauses.

llvm-svn: 191265
2013-09-24 03:17:45 +00:00
Benjamin Kramer 04bf187e12 Fix array_pod_sort predicates after LLVM change.
llvm-svn: 191176
2013-09-22 14:10:29 +00:00
Daniel Jasper cf627f0f7b Fix clang-format-diff.py to accept -style again.
Copy and paste error in r190935..

llvm-svn: 191137
2013-09-21 10:05:02 +00:00
Daniel Jasper dcab7fbb83 Simplify clang-format-diff.py using new clang-format options.
clang-format's -lines parameter makes this significantly easier.

llvm-svn: 190935
2013-09-18 12:14:09 +00:00
Hal Finkel c4d7c82c7f Add the intrinsic __builtin_convertvector
LLVM supports applying conversion instructions to vectors of the same number of
elements (fptrunc, fptosi, etc.) but there had been no way for a Clang user to
cause such instructions to be generated when using builtin vector types.

C-style casting on vectors is already defined in terms of bitcasts, and so
cannot be used for these conversions as well (without leading to a very
confusing set of semantics). As a result, this adds a __builtin_convertvector
intrinsic (patterned after the OpenCL __builtin_astype intrinsic). This is
intended to aid the creation of vector intrinsic headers that create generic IR
instead of target-dependent intrinsics (in other words, this is a generic
_mm_cvtepi32_ps). As noted in the documentation, the action of
__builtin_convertvector is defined in terms of the action of a C-style cast on
each vector element.

llvm-svn: 190915
2013-09-18 03:29:45 +00:00
Argyrios Kyrtzidis 07ee5c44b4 [libclang] Don't report a DecayedType as "unexposed", report it as the original (as written) type.
Patch by Anders Waldenborg!

llvm-svn: 190796
2013-09-16 17:26:23 +00:00
Jordan Rose 3bde507a7a [analyzer] scan-build: add missing semicolon
Patch by Kevin Zheng!

llvm-svn: 190789
2013-09-16 16:17:18 +00:00
Jordan Rose e10c859583 [analyzer] Put more uniqueness in scan-build's temporary directory names.
This is necessary when running two scan-build processes in parallel. The
directory naming scheme is now:

  yyyy-MM-dd-HHmmss-PID-N
  2013-09-13-174210-123-1

where "PID" is the scan-build process ID, and "N" is a sequential counter
(not likely to be needed now that seconds are mangled in, but just in case).

PR17196, using a suggested fix from Greg Czajkowski!

llvm-svn: 190735
2013-09-14 00:41:32 +00:00
David Blaikie 0a4e61f81c Remove unnecessary inclusion of Sema.h
Let me tell you a tale...

Within some twisted maze of debug info I've ended up implementing an
insane man's Include What You Use device. When the debugger emits debug
info it really shouldn't, I find out why & then realize the code could
be improved too.

In this instance CIndexDiagnostics.cpp had a lot more debug info with
Clang than GCC. Upon inspection a major culprit was all the debug info
describing clang::Sema. This was emitted because clang::Sema is
befriended by DiagnosticEngine which was rightly required, but GCC
doesn't emit debug info for friends so it never emitted anything for
Clang. Clang does emit debug info for friends (will be fixed/changed to
reduce debug info size).

But why didn't Clang just emit a declaration of Sema if this entire TU
didn't require a definition?

1) Diagnostic.h did the right thing, only using a declaration of Sema
and not including Sema.h at all.
2) Some other dependency of CIndexDiagnostics.cpp didn't do the right
thing. ASTUnit.h, only needing a declaration, still included Sema.h
(hence this commit which removes that include and adds the necessary
includes to the cpp files that were relying on this)
3) -flimit-debug-info didn't save us because of
EnterExpressionEvaluationContext, defined inline in Sema.h which fires
the "requiresCompleteType" check/flag (since it uses nested types from
Sema and calls Sema member functions) and thus, if debug info is ever
emitted for the type, the whole type is emitted and not just a
declaration.

Improving -flimit-debug-info to account for this would be... hard.
Modifying the code so that's not 'required to be complete' might be
possible, but probably only by moving EnterExpressionEvaluationContext
either into Sema, or out of Sema.h. That might be a bit too much of a
contortion to be bothered with.

Also, this is only one of the cases where emitting debug info for
friends caused us to emit a lot more debug info (this change reduces
Clang's DWO size by 0.93%, dropping friends entirely reduces debug info
by 3.2%) - I haven't hunted down the other cases, but I assume they
might be similar (Sema or something like it). IWYU or a similar tool
might help us reduce build times a bit, but analyzing debug info to find
these differences isn't worthwhile. I'll take the 3.2% win, provide this
small improvement to the code itself, and move on.

llvm-svn: 190715
2013-09-13 18:32:52 +00:00
Daniel Jasper e488f5dd1e clang-format: Add -assume-filename option for editor integrations.
With -style=file, clang-format now starts to search for a .clang-format
file starting at the file given with -assume-filename if it reads from
stdin. Otherwise, it would start searching from the current directory,
which is not helpful for editor integrations.

Also changed vim, emacs and sublime integrations to actually make use of
this flag.

This fixes llvm.org/PR17072.

llvm-svn: 190691
2013-09-13 13:40:24 +00:00
Joey Gouly 92dfcfa403 Fix the MCTargetAsmParser API change.
llvm-svn: 190601
2013-09-12 10:59:24 +00:00
Argyrios Kyrtzidis 5fcef77b2e [libclang] In clang_getLocation, check that the provided line/column is valid.
rdar://14971432

llvm-svn: 190568
2013-09-12 01:10:36 +00:00
Evgeniy Stepanov a98799fe4b Fix 2 cases of uninitialized reads of an invalid PresumedLoc.
The code in CGExpr was added back in 2012 (r165536) but not exercised in tests
until recently.

Detected on the MemorySanitizer bootstrap bot.

llvm-svn: 190521
2013-09-11 12:33:58 +00:00
Hans Wennborg 9f6581bb88 Allow _clang-format as alternative to .clang-format config filename
Dotfiles are impractical on Windows. This makes clang-format search
for the style configuration file as '_clang-format' in addition to
the usual '.clang-format'. This is similar to how VIM searches for
'_vimrc' on Windows.

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

llvm-svn: 190413
2013-09-10 15:41:12 +00:00
Bill Wendling 5257538df9 Update to the new API interface which requires the MCRegisterInfo object. <rdar://problem/13623355>
llvm-svn: 190291
2013-09-09 02:37:56 +00:00
Alexey Bataev 758e55ee58 OpenMP: Data-sharing attributes analysis and clause 'shared' (fixed test threadprivate_messages.cpp)
llvm-svn: 190183
2013-09-06 18:03:48 +00:00
Manuel Klimek ee0d350613 Make error text if clang-format is not on the system PATH more helpful,
as this is going to be a common mistake (installing LLVM defaults to not putting
the tools onto the PATH).

llvm-svn: 190036
2013-09-05 08:31:48 +00:00
Manuel Klimek bb556156a4 Adds a VSPackage project that builds a VS extension to run clang-format over a selection / the line at the cursor.
llvm-svn: 189955
2013-09-04 16:11:46 +00:00
Reid Kleckner 1d1844a7c7 clang-cl: Use "clang cl.exe" when disambiguating the diagnostic prefix.
llvm-svn: 189909
2013-09-04 03:10:36 +00:00
Reid Kleckner dc74af1ab8 clang-cl: Avoid confusing diagnostics when clang-cl is called just cl.exe
llvm-svn: 189901
2013-09-04 01:37:22 +00:00
Eric Christopher 27121641d8 Remove unused typedef.
llvm-svn: 189844
2013-09-03 20:25:28 +00:00
Rafael Espindola e892ccec0d Revert "OpenMP: Data-sharing attributes analysis and clause 'shared'"
This reverts commit r189795.

threadprivate_messages.cpp is faling on windows.

llvm-svn: 189811
2013-09-03 14:33:09 +00:00
Alexey Bataev d4183dabd7 OpenMP: Data-sharing attributes analysis and clause 'shared'
llvm-svn: 189795
2013-09-03 12:55:52 +00:00
Alexander Kornienko e3648fbe1a Added WebKit style to the BasedOnStyle handling and to the relevant help messages.
llvm-svn: 189765
2013-09-02 16:39:23 +00:00
Alexander Kornienko d83adf30c6 Whitespace changes in help messages + updated help output in .rst file.
llvm-svn: 189762
2013-09-02 15:30:26 +00:00
Chandler Carruth bc36e6e099 Switch the default mode for clang-format to '-file'. Make 'LLVM' the
fallback syntax used when we fail to find a '.clang-format' file. Adjust
variable names appropriately.

Update the editor integration pieces that specify a '-style' option to
specify it as '-style=file'. I left the functionality in place because
even if the preferred method is to use '.clang-format' files, this way
if someone needs to clobber the style in their editor we show how to do
so in these examples.

Also check in a '.clang-format' file for Clang to ensure that separate
checkouts and builds of Clang from LLVM can still get the nice
formatting. =] This unfortunately required nuking the test for the
absence of a '.clang-format' file as now the directory happening to be
under your clang source tree will cause there to always be a file. ;]

llvm-svn: 189741
2013-09-02 07:42:02 +00:00
Charles Davis b5a214e4f3 Add ms_abi and sysv_abi attribute handling.
Based on a patch by Benno Rice!

llvm-svn: 189644
2013-08-30 04:39:01 +00:00
Craig Topper da7cf8ab2b Move individual group name strings from the OptionTable into one big char array. Then only store offsets into it in the OptionTable. Saves about 4K from the clang binary and removes 400 relocation entries from DiagnosticIDs.o.
llvm-svn: 189568
2013-08-29 05:18:04 +00:00
Craig Topper a3891a7568 Reorder and shrink size of NameLen field in diagnostic group table. Shaves ~4K from clang binary.
llvm-svn: 189445
2013-08-28 06:01:10 +00:00
Craig Topper d80c17e060 Merge diagnostic group tables to reduce data size and relocation entries.
The individual group and subgroups tables are now two large tables. The option table stores an index into these two tables instead of pointers. This reduces the size of the options tabe since it doesn't need to store pointers. It also reduces the number of relocations needed.

My build shows this reducing DiagnosticsIDs.o and the clang binary by ~20.5K. It also removes ~400 relocation entries from DiagnosticIDs.o.

llvm-svn: 189438
2013-08-28 04:02:50 +00:00
Hans Wennborg 3accde52db cmake: install a cl.exe binary in the tools/msbuild-bin dir
llvm-svn: 189435
2013-08-28 01:58:44 +00:00
Reid Kleckner 78af0708b7 Delete CC_Default and use the target default CC everywhere
Summary:
Makes functions with implicit calling convention compatible with
function types with a matching explicit calling convention.  This fixes
things like calls to qsort(), which has an explicit __cdecl attribute on
the comparator in Windows headers.

Clang will now infer the calling convention from the declarator.  There
are two cases when the CC must be adjusted during redeclaration:
1. When defining a non-inline static method.
2. When redeclaring a function with an implicit or mismatched
convention.

Fixes PR13457, and allows clang to compile CommandLine.cpp for the
Microsoft C++ ABI.

Excellent test cases provided by Alexander Zinenko!

Reviewers: rsmith

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

llvm-svn: 189412
2013-08-27 23:08:25 +00:00
Jordan Rose 5ae3a670c3 CMake: Fix standalone Clang build, take two.
This time, use a variable that's defined consistently in standalone and
non-standalone builds.

llvm-svn: 189406
2013-08-27 21:52:04 +00:00
Reid Kleckner 047c61510f Revert "CMake: Fix out-of-source build's symlinks."
This reverts commit r189371, it broke the in-source cmake build.

llvm-svn: 189390
2013-08-27 18:27:08 +00:00
Jordan Rose 1c71ab00e6 scan-build: Set CC and CXX as make variables when wrapping make builds.
Variables set in a makefile are not overridden by environment variables.
Make sure we actually override CC and CXX when using scan-build.

Patch by Steve McCoy!

llvm-svn: 189372
2013-08-27 16:59:33 +00:00