Daniel Dunbar
6b03ecef0d
ASTUnit: Ensure the CompilerInvocation object used in LoadFromCommandLine is
...
live as long as the ASTUnit. This is useful for clients which want to maintain
pointers to the LangOptions object which ultimately lives in the
CompilerInvocation, although it would be nice to make all of this ownership
stuff more explicit and obvious.
llvm-svn: 94924
2010-01-30 21:47:16 +00:00
Daniel Dunbar
6824225465
CompilerInstance: Change to not contain the CompilerInvocation object.
...
This allows clients to install their own CompilerInvocation object, which is
important for clients that may wish to create references to things like
LangOptions whose lifetime will extend past that of the CompilerInstance.
llvm-svn: 94923
2010-01-30 21:47:07 +00:00
Anders Carlsson
0c5d7448d8
Fix thinko.
...
llvm-svn: 94922
2010-01-30 20:48:08 +00:00
Anders Carlsson
66de081f39
Even more AsmStmt cleanup.
...
llvm-svn: 94921
2010-01-30 20:38:10 +00:00
Anders Carlsson
087bc13d96
More asm cleanup.
...
llvm-svn: 94920
2010-01-30 20:05:21 +00:00
Benjamin Kramer
31a68e70a5
Simplify FreeBSD version parsing.
...
llvm-svn: 94919
2010-01-30 19:55:01 +00:00
Anders Carlsson
96fe0b5b96
Combine AsmStmt::setOutputsAndInputs and AsmStmt::setClobbers.
...
llvm-svn: 94918
2010-01-30 19:34:25 +00:00
Anders Carlsson
c7c5baa482
Yay for more StringRefs.
...
llvm-svn: 94917
2010-01-30 19:12:25 +00:00
Anders Carlsson
0b0a122fde
StringRef-ize the TargetInfo::ConstraintInfo constructor.
...
llvm-svn: 94916
2010-01-30 18:33:31 +00:00
Anders Carlsson
bd32c434ae
Add an assert to make sure that we don't try to mess with overridden methods for class templates.
...
llvm-svn: 94907
2010-01-30 17:42:34 +00:00
Benjamin Kramer
2ecf8eb2dc
PCHReader doesn't implement classof so dyn_casting it will do really weird stuff. Use a static_cast instead.
...
I don't know if this hack is the right fix. Doug, please take a look.
llvm-svn: 94895
2010-01-30 16:23:25 +00:00
Daniel Dunbar
19b70bd46c
Recognize 'q' as a format length modifier (from BSD).
...
llvm-svn: 94894
2010-01-30 15:49:20 +00:00
Benjamin Kramer
842bf17366
Use StringRef instead of returning a temporary std::string.
...
This fixes a really nasty bug in Darwin::getDarwinArchName where we were going
StringRef -> temporary std::string -> StringRef (and return the dead StringRef).
The StringRefs from Triple live as long as the Triple itself, that should be
long enough.
Hopefully 2 of 4 MSVC buildbot failures are gone now.
llvm-svn: 94892
2010-01-30 15:01:47 +00:00
Benjamin Kramer
a87bdb793e
We don't need to place 0 in the URL string now that we return a StringRef.
...
- URL can go into read only memory now.
- Compilers will fold away all the strstr calls.
llvm-svn: 94887
2010-01-30 14:01:39 +00:00
Anton Korobeynikov
cbc4e98381
Fix alignment for msp430 integer types.
...
llvm-svn: 94879
2010-01-30 12:55:11 +00:00
Anders Carlsson
a18f0fbca2
Eliminate yet another old-school PerformCopyInitialization.
...
llvm-svn: 94874
2010-01-30 01:56:32 +00:00
Ted Kremenek
9ff02052dd
Add format string checking of 'double' arguments. Fixes <rdar://problem/6931734>.
...
llvm-svn: 94867
2010-01-30 01:02:18 +00:00
Ted Kremenek
c3bdff7c8c
Add basic type checking of format string conversion specifiers and their arguments. Thanks to Cristian Draghici for his help with this patch!
...
llvm-svn: 94864
2010-01-30 00:49:51 +00:00
Ted Kremenek
605b0113f3
Be a little more permissive than C99: allow 'unsigned' to be used for
...
the field width and precision of a format specifier instead of just
'int'. This matches GCC, and fixes <rdar://problem/6079850>.
llvm-svn: 94856
2010-01-29 23:32:22 +00:00
Ted Kremenek
ba775fe5c7
Fix spacing.
...
llvm-svn: 94852
2010-01-29 23:00:35 +00:00
Ted Kremenek
79db7b7b17
Per a suggestion from Cristian Draghici, add a method to FormatSpecifier that returns the expected type of the matching data argument. It isn't complete, but should handle several of the important cases.
...
llvm-svn: 94851
2010-01-29 22:59:32 +00:00
Devang Patel
bb4820dc8e
Use appropriate context for typedefs.
...
llvm-svn: 94849
2010-01-29 22:29:31 +00:00
Daniel Dunbar
1299819f71
Driver: Don't honor -std-default for C++, this makes it hard to run the gdb test
...
suite with clang++ enabled.
The right fix here is PR6175, although we would still have to find a different
work around for the gdb test suite.
llvm-svn: 94838
2010-01-29 21:03:02 +00:00
Ted Kremenek
8d9842d43f
Switch Sema over to using the new implementation of format string
...
checking. It passes all existing tests, and the diagnostics have been
refined to provide better range information (we now highlight
individual format specifiers) and more precise wording in the
diagnostics.
llvm-svn: 94837
2010-01-29 20:55:36 +00:00
Ted Kremenek
23a71a1cdf
Enhancements to the alternate (WIP) format string checking:
...
- Add ConversionSpecifier::consumesDataArgument() as a helper method
to determine if a conversion specifier requires a matching argument.
- Add support for glibc-specific '%m' conversion
- Add an extra callback to HandleNull() for locations within the
format specifier that have a null character
llvm-svn: 94834
2010-01-29 20:29:53 +00:00
Douglas Gregor
d1e08648c6
Fix reference-binding when we have a reference to const volatile type;
...
previously, we were allowing this to bind to a temporary. Now, we
don't; add test-cases and improve diagnostics.
llvm-svn: 94831
2010-01-29 19:39:15 +00:00
Ted Kremenek
db4b7710f7
Fix subtle bug in Preprocessor::AdvanceToTokenCharacter(): use '+=' instead of '='.
...
llvm-svn: 94830
2010-01-29 19:38:24 +00:00
Douglas Gregor
65eb86e912
Fix reference binding of const lvalue references to bit-fields, which
...
requires a temporary. Previously, we were building an initialization
sequence that bound to the bit-field as if it were a real lvalue. Note
that we previously (and still) diagnose binding of non-const
references to bit-fields, as we should.
There's no real way to test that this code is correct, since reference
binding does not *currently* have any representation in the AST. This
fix should make it easier for that to happen, so I've verified this
fix with...
Added InitializationSequence::dump(), to print an initialization
sequence for debugging purposes.
llvm-svn: 94826
2010-01-29 19:14:02 +00:00
Anders Carlsson
7c5fe48060
And yet another call.
...
llvm-svn: 94824
2010-01-29 18:43:53 +00:00
Anders Carlsson
a68e51e3a1
Another PerformCopyInitialization call bites the dust.
...
llvm-svn: 94823
2010-01-29 18:37:50 +00:00
Anders Carlsson
6f923f89c3
Get rid of another old PerformCopyInitialization call.
...
llvm-svn: 94819
2010-01-29 18:30:20 +00:00
Devang Patel
92e2541599
Maintain a map of regions (lexical scopes) and use it to find context for a global variable.
...
llvm-svn: 94817
2010-01-29 18:11:03 +00:00
Douglas Gregor
4b4844f88d
When naming a function template via a qualified-id (or any other way
...
that ADL is suppressed), we need to build an
UnresolvedLookupExpr. Fixes PR6063, which was hitting Boost headers
pretty hard.
llvm-svn: 94814
2010-01-29 17:15:43 +00:00
Daniel Dunbar
6596984f3c
Driver/Darwin: Fix a crash when diagnosing conflicting deployment targets.
...
llvm-svn: 94812
2010-01-29 17:02:25 +00:00
Douglas Gregor
16810ca647
Name mangling for cast expressions, from Matthias Schiffer! Fixes PR5876.
...
llvm-svn: 94811
2010-01-29 16:37:09 +00:00
Anders Carlsson
42c876dff2
Use EmitLValueForFieldInitialization when synthesizing the copy ctor as well.
...
llvm-svn: 94800
2010-01-29 05:41:25 +00:00
Anders Carlsson
db78f0ad04
Add a new EmitLValueForFieldInitialization that will be used for initializing fields (and reference type fields in particular).
...
llvm-svn: 94799
2010-01-29 05:24:29 +00:00
Anders Carlsson
5d8645b150
Simplify EmitLValueForField - we can get whether the field is part of a union or not from the FieldDecl (through its DeclContext).
...
llvm-svn: 94798
2010-01-29 05:05:36 +00:00
Daniel Dunbar
45c7ff1d79
ARM/APCS ABI: Fix some problems with bit-fields in structures. After rereading
...
the ABI spec, this turns out to simplify the code. We still have some annoying
code which mismatches the spec with regard to empty structures.
llvm-svn: 94796
2010-01-29 03:22:29 +00:00
Ted Kremenek
c22f78ddfd
Alternate format string checking: issue warnings for incomplete format specifiers.
...
In addition, move ParseFormatString() and FormatStringHandler() from
the clang::analyze_printf to the clang namespace. Hopefully this will
resolve some link errors on Linux.
llvm-svn: 94794
2010-01-29 03:16:21 +00:00
Anders Carlsson
a91be641a7
Simplify InitListChecker::CheckReferenceType
...
llvm-svn: 94793
2010-01-29 02:47:33 +00:00
Ted Kremenek
94af575e9c
Alternate format string checking: issue a warning for invalid conversion specifiers.
...
llvm-svn: 94792
2010-01-29 02:40:24 +00:00
Anders Carlsson
ba6c437d52
Add an CXXBindReferenceExpr (not used just yet).
...
llvm-svn: 94791
2010-01-29 02:39:32 +00:00
Ted Kremenek
176f7d6ef0
Yet another attempt to make the Linux buildbots happy. Apparently there are differences on how nested namespaces are handled...
...
llvm-svn: 94790
2010-01-29 02:13:53 +00:00
Fariborz Jahanian
b5f99c3f4f
Fixes rewriter bug rewriting byref related API where a struct
...
definition comes after where it is needed. Fixes radar 7589385.
llvm-svn: 94788
2010-01-29 01:55:49 +00:00
Ted Kremenek
019d224d91
Alternate format string checking: check for excess data arguments.
...
llvm-svn: 94787
2010-01-29 01:50:07 +00:00
Ted Kremenek
9fcd8305c0
Alternate format string checking: check if the number of format specifiers exceeds the number of arguments.
...
llvm-svn: 94785
2010-01-29 01:43:31 +00:00
Ted Kremenek
559d89a02a
Move definition of FormatStringHandler::~FormatStringHandler() within namespace directives. Hopefully this will make the Linux buildbots happy.
...
llvm-svn: 94784
2010-01-29 01:37:52 +00:00
Ted Kremenek
d5fd0fac38
Alternate format string checking: warn of '%n' as being potentially insecure.
...
llvm-svn: 94782
2010-01-29 01:35:25 +00:00
Ted Kremenek
5739de77fa
Add precision/field width checking to AlternateCheckPrintfString().
...
llvm-svn: 94774
2010-01-29 01:06:55 +00:00