We generally don't warn about extensions involving keywords reserved
for the implementation, so we shouldn't warn here either: the
standard doesn't require it, and it doesn't provide useful information
to the user.
llvm-svn: 188840
This moves the logic for handling -mfoo -mno-foo from the driver to -cc1. It
also changes -cc1 to apply the options in order, fixing pr16943.
The handling of -mno-mmx -msse is now an explicit special case.
llvm-svn: 188817
It makes no sense to try and compile for arm7tdmi when we're targeting
something like gnueabihf. Although not strictly the most basic hardware
conceivable, I believe arm1176jzf-s is a reasonable compromise (that can always
be overridden explicitly if needed) since it's still in reasonably common use
unlike earlier cores.
Patch by Stephen Kelly.
llvm-svn: 188796
This patch adds four new options to control:
- Spaces after control keyworks (if(..) vs if (..))
- Spaces in empty parentheses (f( ) vs f())
- Spaces in c-style casts (( int )1.0 vs (int)1.0)
- Spaces in other parentheses (f(a) vs f( a ))
Patch by Joe Hermaszewski. Thank you for working on this!
llvm-svn: 188793
This reverts commit r188687 (reverts r188642 (reverts 188600 (reverts
188576))).
With added test coverage & fix for -gline-tables-only.
Thanks Michael Gottesman for reverting this patch when it demonstrated
problems & providing a reproduction/details to help me track this down.
llvm-svn: 188739
We previously mishandled UnresolvedUsingValueDecls in
NamedDecl::declarationReplaces, which caused us to forget decls
when there are multiple dependent using decls for the same name.
Fixes PR16936.
llvm-svn: 188737
Refactor the underlying code a bit to remove unnecessary calls to
"hasErrorOccurred" & make them consistently at all the entry points to
the IRGen ASTConsumer.
llvm-svn: 188707
The previous value was set to match some ancient version of Apple's GCC.
The value should be higher than anything used by Apple's GCC, but we don't
intend for this value to be updated in the future. We have other macros to
identify compiler versions. <rdar://problem/14749599>
llvm-svn: 188700
This reverts commit r188642.
This change is causing LTO builds to cause our 16 GB machines to swap and OOM
all weekend. I am going to work with Dave Blaikie to resolve the issue.
Sorry Dave =(.
llvm-svn: 188687
This is still an alpha checker, but we use it in certain tests to make sure
something is not being executed.
This should fix the buildbots.
llvm-svn: 188682
This keeps the analyzer from making silly assumptions, like thinking
strlen(foo)+1 could wrap around to 0. This fixes PR16558.
Patch by Karthik Bhat!
llvm-svn: 188680
This builtin does not actually evaluate its arguments for side effects,
so we shouldn't include them in the CFG. In the analyzer, rely on the
constant expression evaluator to get the proper semantics, at least for
now. (In the future, we could get ambitious and try to provide path-
sensitive size values.)
In theory, this does pose a problem for liveness analysis: a variable can
be used within the __builtin_object_size argument expression but not show
up as live. However, it is very unlikely that such a value would be used
to compute the object size and not used to access the object in some way.
<rdar://problem/14760817>
llvm-svn: 188679
Summary:
ScanReachableSymbols uses a "visited" set to avoid scanning the same object
twice. However, it did not use the optimization for LazyCompoundVal objects,
which resulted in exponential complexity for long chains of temporary objects.
Adding this resulted in a decrease of analysis time from >3h to 3 seconds for
some files.
Reviewers: jordan_rose
CC: cfe-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D1398
llvm-svn: 188677
AFAIK, there are no -W options for gcc-as and gcc-ld.
It caused failure to build clang with gcc-4.7 on cygwin.
FIXME: Could we recategorize Options for gcc-as and gcc-ld?
llvm-svn: 188668
Summary:
This change turns SanitizerArgs into high-level options
stored in the Driver, which are parsed lazily. This fixes an issue of multiple copies of the same diagnostic message produced by sanitizer arguments parser.
Reviewers: rsmith
Reviewed By: rsmith
CC: chandlerc, eugenis, cfe-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D1341
llvm-svn: 188660
Summary:
DeclRefExpr::getDecl gives us back a ValueDecl, this isa<> check will
never fire.
Reviewers: eli.friedman, doug.gregor, majnemer
Reviewed By: majnemer
CC: cfe-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D1434
llvm-svn: 188647
This reverts commit r188600.
r188640/r188639 fixed the root cause of the crash-on-valid that r188600
originally introduced. This now appears to bootstrap debug clang
successfully to the best of my testing.
llvm-svn: 188642
A partner to r188639, this is a somewhat heavy-handed fix to the general
issue, since even after that prior change the issue does still
unavoidably arise with template parameters (see test case).
There are other ways we could consider addressing this (see FIXME).
llvm-svn: 188640
Possible minor reduction in debug info & avoid some cases where creating
a context chain could lead to the type the context chain is being
created for, being created. (this is still possible with template
parameters - tests/fixes/improvements to follow)
llvm-svn: 188639
loop processing the candidates can cause new declerations to be added to
the context, invalidating lookup_result. To avoid that, make a copy of
the list of declarations to iterate over.
I don't have a way to check in a test case for this as it involves
a giant pile of source code and a generated PCH file used to accelerate
code completion, all of this running under ASan.
llvm-svn: 188623
Fixes a crash-on-valid introduced by r188486 (which should've occurred
earlier but for a blatant bug where calling createFwdDecl from the
requireCompleteType callback was useless under -flimit-debug-info and we
were just getting lucky with other later callbacks requiring the type
anyway).
llvm-svn: 188622
Per feedback from Chandler, it's better to have libraries with more specific functionality.
LibIndex will contain the indexing functionality of libclang, which includes USR generation.
llvm-svn: 188601
Updated test case to not rely on line numbers in more cases (it's hard
to use the @ check syntax for debug info test cases (due to the
interesting ordering of metadata) and this case in particular (given the
hash-line directive)) - left a few in there to cover the line number
information for these.
llvm-svn: 188585
Libclang has a lot of functionality that is inaccessible.
The purpose of clangIDE is to move most of the functionality of libclang to it so we
can expose it and have libclang be more of a thin C wrapper over clangIDE.
Start by moving the USR generation functionality into clangIDE.
llvm-svn: 188569
Summary:
Refactor ArgumentAdaptativeMatcher matchers to remove the template from their declaration.
This facilitates dynamic registration. Change the registry code to use the regular overload resolution mechanism for adaptative matchers.
Reviewers: klimek
CC: cfe-commits, revane
Differential Revision: http://llvm-reviews.chandlerc.com/D1402
llvm-svn: 188560
* Introduce operator< to replace Replacement::Less
* Make operator== and operator< on Replacements non-member functions
* Change order of comparisons in operator< to do string comparisons last
llvm-svn: 188550
Goals: Structure code better and make components easier to use for
future features (e.g. column layout for long braced initializers).
No functional changes intended.
llvm-svn: 188543
Summary:
HandleTopLevelDecl on a templated function leads us to try and mangle
it.
Reviewers: rsmith
Reviewed By: rsmith
CC: cfe-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D1412
llvm-svn: 188536
We have a lot of fancy logic to find Visual Studio, which is currently used
to set the system header include paths.
Use the same code to set the ProgramPaths, which is used for finding programs
such as link.exe. Previously, Clang would just search PATH for link.exe,
but now it should find it if it's able to find Visual Studio.
Differential Revision: http://llvm-reviews.chandlerc.com/D1417
llvm-svn: 188531
This once again restores notes to following their associated warnings
in -analyzer-output=text mode. (This is still only intended for use as a
debugging aid.)
One twist is that the warning locations in "regular" analysis output modes
(plist, multi-file-plist, html, and plist-html) are reported at a different
location on the command line than in the output file, since the command
line has no path context. This commit makes -analyzer-output=text behave
like a normal output format, which means that the *command line output
will be different* in -analyzer-text mode. Again, since -analyzer-text is
a debugging aid and lo-fi stand-in for a regular output mode, this change
makes sense.
Along the way, remove a few pieces of stale code related to the path
diagnostic consumers.
llvm-svn: 188514
When we are parsing a type for an alias template, we are not entering
the context, so we can't look into dependent classes. Make sure the
parser handles this correctly.
PR16904.
llvm-svn: 188510
In addition to storing more useful information in the AST, this
fixes a semantic check in template instantiation which checks whether
the l-paren location is valid.
Fixes PR16903.
llvm-svn: 188495
This updates clang according to a pending patch for llvm to
rename of the -arm-darwin-use-movt to arm-use-movt to make
it available for all of ARM.
note: please apply this close to the llvm change.
Patch by Jeroen Hofstee.
llvm-svn: 188488
Rather than going through the whole getOrCreateType machinery to
manifest a type, cut straight to the implementation because we know we
have to do work.
While the previous implementation was sufficient for the two cases
(completeness and required completeness) we have already (the general
machinery could inspect the type for those attributes & go down the full
definition path), a pending change (to emit info for types when we emit
their vtables) won't have that luxury & we'll need to force the creation
rather than relying on the general purpose routine.
llvm-svn: 188486
Summary:
We would crash in CodeGen::CodeGenModule::EmitUuidofInitializer
because our attempt to enter CodeGen::CodeGenModule::EmitConstantValue
will be foiled: the type of the constant value is incomplete.
Instead, create an unnamed type with the proper layout on all platforms.
Punt the problem of wrongly defined struct _GUID types to the user.
(It's impossible because the TU may never get to see the type and thus
we can't verify that it is suitable.)
This fixes PR16856.
Reviewers: rsmith, rnk, thakis
Reviewed By: rnk
CC: cfe-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D1375
llvm-svn: 188481
When a region is realloc()ed, MallocChecker records whether it was known
to be allocated or not. If it is, and the reallocation fails, the original
region has to be freed. Previously, when an allocated region escaped,
MallocChecker completely stopped tracking it, so a failed reallocation
still (correctly) wouldn't require freeing the original region. Recently,
however, MallocChecker started tracking escaped symbols, so that if it were
freed we could check that the deallocator matched the allocator. This
broke the reallocation model for whether or not a symbol was allocated.
Now, MallocChecker will actually check if a symbol is owned, and only
require freeing after a failed reallocation if it was owned before.
PR16730
llvm-svn: 188468
Add support for half (a.k.a. __fp16) in builtin descriptions.
The second argument to BUILTIN() now accepts 'h' to represent half.
Patch by Daniel Sanders
llvm-svn: 188464
Summary:
There were several things going wrong:
- We mangled in useless qualifiers like "volatile void" return types.
- We didn't propagate 64-bit pointer markers sufficiently.
- We mangled qualifiers belonging to the pointee incorrectly.
This fixes PR16844 and PR16848.
Reviewers: rnk, whunt
Reviewed By: rnk
CC: cfe-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D1353
llvm-svn: 188450
properties (direct or indirect) setter/getter (or declared
methods as well) are seen by the method implementation type
matching logic before declaration of method in super class
is seen. This fixes the warning coming out of that method mismatch.
// rdar://14650159
llvm-svn: 188438
This is intended to be a simplified API, whose internals are
deliberately less efficient for the purpose of a simplified interface,
for use with clients that want to query the analyzer's heuristics for
determining retain count semantics.
There are no immediate clients, but it is intended to be used
by the ObjC modernizer.
llvm-svn: 188433
referenced as a member of the current instantiation. In that case, deduce the
type of the function to a dependent type rather than exposing an undeduced auto
type to the rest of the current instantiation.
The standard doesn't really say that the type is dependent in this case; I'll
bring this up with CWG.
llvm-svn: 188410
Otherwise it lists all files (e.g. shared libraries) that happen to be in the
same paths the GCC installations usually reside in.
On a x86_64 Debian 7 system with i386 multilibs.
before: clang -v 2>&1|wc -l
3059
after: clang -v 2>&1|wc -l
10
llvm-svn: 188400
The rationale for this change is to differentiate following two situations:
1) clang -c -emit-llvm a.c
2) clang -c -flto a.c
Reviewed by Eric Christopher. Thanks a lot!
llvm-svn: 188352
This adds support for the /link option, which forwards
subsequent arguments to the linker.
The test for this will only work when targetting win32.
Since that's the only target where clang-cl makes sense,
use that target by default.
Differential Revision: http://llvm-reviews.chandlerc.com/D1388
llvm-svn: 188331
It doesn't make any sense to accept "..." in the argument to a C-style cast,
so use a separate expression list parsing routine which rejects it. PR16874.
llvm-svn: 188330
Anything that comes after -- is treated as an input file. This
used to be handled automagically by the option parsing library,
but after LLVM r188314, we should handle it ourselves.
No functionality change.
llvm-svn: 188316
When a local extern declaration redeclares some other entity, the type of that
entity is merged with the prior type if the prior declaration is visible (in C)
or is declared in the same scope (in C++).
- Make LookupRedeclarationWithLinkage actually work in C++, use it in the right
set of cases, and make it track whether it found a shadowed declaration.
- Track whether we found a declaration in the same scope (for C++) including
across serialization and template instantiation.
llvm-svn: 188307
One day soon, tooling::Replacements will be changed from being implemented as
an std::set to being implemented as an std::vector. Until then, some new code
using vectors of Replacements would enjoy having a version of
applyAllReplacements that takes a vector.
Differential Revision: http://llvm-reviews.chandlerc.com/D1380
llvm-svn: 188295
If a Replacment is contained within the conflict range being built, the
conflict range would be erroneously shortened. Now fixed. Tests updated to
catch this case.
llvm-svn: 188287
We used to decide whether to really vectorize depending on the optimization
level in PassManagerBuilder.
This patch moves this decision to the clang driver. We look at the optimization
level and whether the f(no-)vectorize is set and decide whether to vectorize.
This allows us to simplify the logic in PassManagerBuilder to just a check for
whether the vectorizer should run or not.
We now do the right thing for:
$ clang -O1 -fvectorize
$ clang -fno-vectorize -O3
llvm-svn: 188280
Summary:
Refactor "MatcherList" into "VariantMatcher" and abstract the notion of a list of matchers for the polymorphic case.
This work is to support future changes needed for eachOf/allOf/anyOf matchers. We will add a new type on VariantMatcher.
Reviewers: klimek
CC: cfe-commits, revane
Differential Revision: http://llvm-reviews.chandlerc.com/D1365
llvm-svn: 188272
Some coding styles use a different indent for constructor initializers.
Patch by Klemens Baum. Thank you.
Review: http://llvm-reviews.chandlerc.com/D1360
Post review changes: Changed data type to unsigned as a negative indent
width does not make sense and added test for configuration parsing.
llvm-svn: 188260
Summary:
It seems that __uuidof introduces a global extern "C" declaration of
type __s_GUID. However, our implementation of __uuidof does not provide
such a declaration and thus must open-code the mangling for __uuidof in
template parameters.
This allows us to codegen scoped COM pointers and other such things.
This fixes PR16836.
Depends on D1356.
Reviewers: rnk, cdavis5x, rsmith
Reviewed By: rnk
CC: cfe-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D1357
llvm-svn: 188252
The cmake-clang-x86_64 was upset:
error: 'template<class ImplClass, class RetTy> class clang::ConstStmtVisitor' used without template parameters
llvm-svn: 188211
I'm not really satisfied with the ad-hoc nature of
Sema::diagnoseQualifiedDeclaration, but I'm not sure how to fix it.
Fixes <rdar://problem/14639501>.
llvm-svn: 188208
Reviewed by delesley, dblaikie.
Add the annotations and code needed to support a basic 'consumed' analysis.
Summary:
This new analysis is based on academic literature on linear types. It tracks
the state of a value, either as unconsumed, consumed, or unknown. Methods are
then annotated as CallableWhenUnconsumed, and when an annotated method is
called while the value is in the 'consumed' state a warning is issued. A value
may be tested in the conditional statement of an if-statement; when this occurs
we know the state of the value in the different branches, and this information
is added to our analysis. The code is still highly experimental, and the names
of annotations or the algorithm may be subject to change.
llvm-svn: 188206
This patch adds -mmsa and -mno-msa to the options supported by
clang to enable and disable support for MSA.
When MSA is enabled, a predefined macro '__mips_msa' is defined to 1.
Patch by Daniel Sanders
llvm-svn: 188184
- Open files before calling stat on them.
- Go through FileManager for getting the buffer of named pipes. It has the
necessary plumbing to deal with "volatile" files.
- Print the cause when stdin reading fails. The only case I can imagine where
this happens is when stdin is wired to a device file, so no test case.
llvm-svn: 188178
Previously these were formatting as catch (E & e) because the inner parenthesis
was being marked as an expression.
Patch by Thomas Gibson-Robinson.
llvm-svn: 188153
Summary:
Source-centric tools need access to the location of a C++11
lambda expression's capture-default ('&' or '=') when it's present.
It's possible for them to find it by re-lexing and re-implementing
rules that Clang's parser has already applied, but the cost of storing
the SourceLocation and making it available to them is 32 bits per
LambdaExpr (a small delta, proportionally), and the simplification in
client code is significant.
Reviewers: rsmith
Reviewed By: rsmith
CC: cfe-commits, klimek, revane
Differential Revision: http://llvm-reviews.chandlerc.com/D1192
llvm-svn: 188121
comparing non-reference function parameters. The qualifiers don't matter for
comparisons.
This is a re-commit of r187769, which was accidentially reverted in r187770,
with a simplification at the suggestion of Eli Friedman.
llvm-svn: 188112
This includes special members (copy/default ctor, copy assign, default
ctor) and template specializations for member function templates.
Good for a 5% decrease (1.80 to 1.71 GB) in size on Clang+LLVM's .dwo
files (when using fission).
llvm-svn: 188085
Make sure we can properly generate code when the UUID has curly braces
on it, strip the curly braces at the sema layer.
This fixes PR16813.
llvm-svn: 188061
Summary:
ExprEngine had code which specificaly disabled using CXXTempObjectRegions in
InitListExprs. This was a hack put in r168757 to silence a false positive.
The underlying problem seems to have been fixed in the mean time, as removing
this code doesn't seem to break anything. Therefore I propose to remove it and
solve PR16629 in the process.
Reviewers: jordan_rose
CC: cfe-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D1325
llvm-svn: 188059
Summary: This is a follow-up to r187837.
Reviewers: gribozavr, jordan_rose
Reviewed By: jordan_rose
CC: cfe-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D1306
llvm-svn: 188056
We mangled them like:
L___uuid_12345678-1234-1234-1234-123456789abc
We should've mangled them like:
__GUID_12345678_1234_1234_1234_123456789abc
Furthermore, they are external symbols.
llvm-svn: 188053
of local classes. We were previously handling this by performing qualified
lookup within a function declaration(!!); replace it with the proper scope
lookup.
llvm-svn: 188050
This option prints information about #included files to stderr. Clang could
already do it, this patch just teaches the existing code about the /showIncludes
style and adds the flag.
Differential Revision: http://llvm-reviews.chandlerc.com/D1333
llvm-svn: 188037
We were exposing the extra alignment given to large arrays. The new behavior
matches gcc, which is a good thing since this is a gcc extension.
Thanks to Joerg Sonnenberger for noticing it.
While at it, centralize the method description in the .h file.
llvm-svn: 187999
This reverts commit r187991 and adjusts the comment. /Za is much more
involved, and we don't want to give anyone the impression we actually
support it.
llvm-svn: 187998
Summary:
This patch adds tooling::deduplicate() which removes duplicates from and
looks for conflicts in a vector of Replacements.
Differential Revision: http://llvm-reviews.chandlerc.com/D1314
llvm-svn: 187979
'-fno-unroll-loops'. The option to the backend is even called
'DisableUnrollLoops'. This is precisely the form that Clang *didn't*
support. We didn't recognize the flag, we didn't pass it to the CC1
layer, and even if we did we wouldn't use it. Clang only inspected the
positive form of the flag, and only did so to enable loop unrolling when
the optimization level wasn't high enough. This only occurs for an
optimization level that even has a chance of running the loop unroller
when optimizing for size.
This commit wires up the 'no' variant, and switches the code to actually
follow the standard flag pattern of using the last flag and allowing
a flag in either direction to override the default.
I think this is still wrong. I don't know why we disable the loop
unroller entirely *from Clang* when optimizing for size, as the loop
unrolling pass *already has special logic* for the case where the
function is attributed as optimized for size! We should really be
trusting that. Maybe in a follow-up patch, I don't really want to change
behavior here.
llvm-svn: 187969
Summary:
UBSan was checking for alignment of the derived class on the pointer to
the base class, before converting. With some class hierarchies, this could
generate false positives.
Added test-case.
llvm-svn: 187948
These flags set some preprocessor macros and injects a dependency
on the runtime library into the object file, which later is picked up
by the linker.
This also adds a new CC1 flag for adding a dependent library.
Differential Revision: http://llvm-reviews.chandlerc.com/D1315
llvm-svn: 187945
DataFlowSanitizer is a generalised dynamic data flow analysis.
Unlike other Sanitizer tools, this tool is not designed to detect a
specific class of bugs on its own. Instead, it provides a generic
dynamic data flow analysis framework to be used by clients to help
detect application-specific issues within their own code.
Differential Revision: http://llvm-reviews.chandlerc.com/D966
llvm-svn: 187925
The problem was that an enum without closing semicolon could be associated as a forward enum
in an erroneous declaration, leading to the identifier being associated with the enum decl but
without a declaration actually referencing it.
This resulted in not having it serialized before serializing the identifier that is associated with.
Also prevent the ASTUnit from querying the serialized DeclID for an invalid top-level decl; it may not
have been serialized.
rdar://14539667
llvm-svn: 187914
In particular, left braces after an enum declaration now occur on their
own line. Further, when short ifs/whiles are allowed these no longer
cause the left brace to be on the same line as the if/while when a
brace is included.
Patch by Thomas Gibson-Robinson.
llvm-svn: 187901
Before this patch we would align
long long int big[1024];
to 4 bytes on 32 bit systems. The problem is that we were only looking
at the element type when getLargeArrayMinWidth returned non zero.
llvm-svn: 187897
This field is just IsDefaulted && !IsDeleted; in all places it's used,
a simple check for isDefaulted() is superior anyway, and we were forgetting
to set it in a few cases.
Also eliminate CXXDestructorDecl::IsImplicitlyDefined, for the same reasons.
No intended functionality change.
llvm-svn: 187891
This removes a formatting choice that was added at one point, but is
not generally liked by users. Specifically, in builder-type calls, do
(easily) break if the object before the ./-> is either a field or a
parameter-less function call. I.e., don't break after "aa.aa.aa" or
"aa.aa.aa()". In general, these sequences in builder-type calls are
seen as a single entity and thus breaking them up is a bad idea.
llvm-svn: 187865
This implements support for the /Fo option, which is used
to set the filename or output dir for object files.
Differential Revision: http://llvm-reviews.chandlerc.com/D1302
llvm-svn: 187820
on @property migration. Don't set unsafe_unretained
on non-object properties. Set 'retain' on strong
properties. Makecertain properties with specific
names unsafe_unretained as well.
llvm-svn: 187810
These are used to specify source files, and whether to treat source
files as C or C++.
Differential Revision: http://llvm-reviews.chandlerc.com/D1290
llvm-svn: 187760
There were three things missing from the original implementation:
- We would omit the 'E' qualifier for members int 64-bit mode.
- We would not exmaine the qualifiers in 'IsMember' mode.
- We didn't generate the correct backref to the base class.
llvm-svn: 187753
function: it can't be 'void' and it can't be an initializer list. We give a
hard error for these rather than treating them as undefined behavior (we can
and probably should do the same for non-POD types in C++11, but as of this
change we don't).
Slightly rework the checking of variadic arguments in a function with a format
attribute to ensure that certain kinds of format string problem (non-literal
string, too many/too few arguments, ...) don't suppress this error.
llvm-svn: 187735
Sema::PerformObjectMemberConversion assumed that the Qualifier it was
given holds a type. However, the specifier could hold just a namespace.
In this case, we should ignore the qualifier and not attempt to cast to
it.
llvm-svn: 187715