[llvm-branch-commits] [cfe-branch] r159731 - in /cfe/branches/tooling: ./ bindings/python/clang/ include/clang-c/ include/clang/AST/ include/clang/Basic/ include/clang/Driver/ include/clang/Frontend/ include/clang/Sema/ include/clang/StaticAnalyzer/Core/PathSensitive/ lib/ARCMigrate/ lib/AST/ lib/ASTMatchers/ lib/Analysis/ lib/Basic/ lib/CodeGen/ lib/Driver/ lib/Edit/ lib/Frontend/ lib/Parse/ lib/Sema/ lib/Serialization/ lib/StaticAnalyzer/Checkers/ lib/StaticAnalyzer/Core/ test/ARCMT/ test/Analysis/ test/CodeGen/ test/CodeGe...
Manuel Klimek
klimek at google.com
Thu Jul 5 00:35:05 PDT 2012
Author: klimek
Date: Thu Jul 5 02:35:04 2012
New Revision: 159731
URL: http://llvm.org/viewvc/llvm-project?rev=159731&view=rev
Log:
Merging mainline.
Added:
cfe/branches/tooling/test/CodeGen/mips-vector-arg.c
- copied unchanged from r159729, cfe/trunk/test/CodeGen/mips-vector-arg.c
cfe/branches/tooling/test/SemaObjCXX/delay-parsing-cfunctions.mm
- copied unchanged from r159729, cfe/trunk/test/SemaObjCXX/delay-parsing-cfunctions.mm
Modified:
cfe/branches/tooling/ (props changed)
cfe/branches/tooling/bindings/python/clang/cindex.py
cfe/branches/tooling/include/clang-c/CXCompilationDatabase.h
cfe/branches/tooling/include/clang/AST/ASTVector.h
cfe/branches/tooling/include/clang/AST/CommentLexer.h
cfe/branches/tooling/include/clang/AST/DeclCXX.h
cfe/branches/tooling/include/clang/AST/DeclFriend.h
cfe/branches/tooling/include/clang/AST/Expr.h
cfe/branches/tooling/include/clang/AST/ExprCXX.h
cfe/branches/tooling/include/clang/AST/OperationKinds.h
cfe/branches/tooling/include/clang/AST/RawCommentList.h
cfe/branches/tooling/include/clang/AST/RecordLayout.h
cfe/branches/tooling/include/clang/AST/Stmt.h
cfe/branches/tooling/include/clang/Basic/ObjCRuntime.h
cfe/branches/tooling/include/clang/Driver/ToolChain.h
cfe/branches/tooling/include/clang/Frontend/ASTUnit.h
cfe/branches/tooling/include/clang/Sema/DelayedDiagnostic.h
cfe/branches/tooling/include/clang/Sema/Initialization.h
cfe/branches/tooling/include/clang/Sema/Sema.h
cfe/branches/tooling/include/clang/StaticAnalyzer/Core/PathSensitive/Calls.h
cfe/branches/tooling/include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h
cfe/branches/tooling/include/clang/StaticAnalyzer/Core/PathSensitive/SValBuilder.h
cfe/branches/tooling/lib/ARCMigrate/ObjCMT.cpp
cfe/branches/tooling/lib/ARCMigrate/TransAPIUses.cpp
cfe/branches/tooling/lib/ARCMigrate/TransARCAssign.cpp
cfe/branches/tooling/lib/ARCMigrate/TransAutoreleasePool.cpp
cfe/branches/tooling/lib/ARCMigrate/TransBlockObjCVariable.cpp
cfe/branches/tooling/lib/ARCMigrate/TransEmptyStatementsAndDealloc.cpp
cfe/branches/tooling/lib/ARCMigrate/TransGCAttrs.cpp
cfe/branches/tooling/lib/ARCMigrate/TransGCCalls.cpp
cfe/branches/tooling/lib/ARCMigrate/TransRetainReleaseDealloc.cpp
cfe/branches/tooling/lib/ARCMigrate/TransUnbridgedCasts.cpp
cfe/branches/tooling/lib/ARCMigrate/TransUnusedInitDelegate.cpp
cfe/branches/tooling/lib/ARCMigrate/TransZeroOutPropsInDealloc.cpp
cfe/branches/tooling/lib/ARCMigrate/TransformActions.cpp
cfe/branches/tooling/lib/ARCMigrate/Transforms.cpp
cfe/branches/tooling/lib/AST/ASTContext.cpp
cfe/branches/tooling/lib/AST/CXXInheritance.cpp
cfe/branches/tooling/lib/AST/CommentBriefParser.cpp
cfe/branches/tooling/lib/AST/DeclCXX.cpp
cfe/branches/tooling/lib/AST/DeclFriend.cpp
cfe/branches/tooling/lib/AST/Expr.cpp
cfe/branches/tooling/lib/AST/ExprCXX.cpp
cfe/branches/tooling/lib/AST/LambdaMangleContext.cpp
cfe/branches/tooling/lib/AST/RawCommentList.cpp
cfe/branches/tooling/lib/AST/RecordLayout.cpp
cfe/branches/tooling/lib/AST/RecordLayoutBuilder.cpp
cfe/branches/tooling/lib/AST/Stmt.cpp
cfe/branches/tooling/lib/AST/StmtDumper.cpp
cfe/branches/tooling/lib/AST/StmtPrinter.cpp
cfe/branches/tooling/lib/AST/TypeLoc.cpp
cfe/branches/tooling/lib/AST/TypePrinter.cpp
cfe/branches/tooling/lib/AST/VTTBuilder.cpp
cfe/branches/tooling/lib/AST/VTableBuilder.cpp
cfe/branches/tooling/lib/ASTMatchers/ASTMatchFinder.cpp
cfe/branches/tooling/lib/Analysis/AnalysisDeclContext.cpp
cfe/branches/tooling/lib/Analysis/CFG.cpp
cfe/branches/tooling/lib/Analysis/PseudoConstantAnalysis.cpp
cfe/branches/tooling/lib/Analysis/ThreadSafety.cpp
cfe/branches/tooling/lib/Basic/ObjCRuntime.cpp
cfe/branches/tooling/lib/Basic/Targets.cpp
cfe/branches/tooling/lib/CodeGen/CGCXX.cpp
cfe/branches/tooling/lib/CodeGen/CGDebugInfo.cpp
cfe/branches/tooling/lib/CodeGen/CGDebugInfo.h
cfe/branches/tooling/lib/CodeGen/CGException.cpp
cfe/branches/tooling/lib/CodeGen/CGExprConstant.cpp
cfe/branches/tooling/lib/CodeGen/CGExprScalar.cpp
cfe/branches/tooling/lib/CodeGen/CGObjCGNU.cpp
cfe/branches/tooling/lib/CodeGen/CGObjCMac.cpp
cfe/branches/tooling/lib/CodeGen/CodeGenModule.cpp
cfe/branches/tooling/lib/CodeGen/TargetInfo.cpp
cfe/branches/tooling/lib/Driver/ToolChain.cpp
cfe/branches/tooling/lib/Driver/ToolChains.h
cfe/branches/tooling/lib/Driver/Tools.cpp
cfe/branches/tooling/lib/Edit/RewriteObjCFoundationAPI.cpp
cfe/branches/tooling/lib/Frontend/ASTUnit.cpp
cfe/branches/tooling/lib/Parse/ParseAST.cpp
cfe/branches/tooling/lib/Parse/ParseDecl.cpp
cfe/branches/tooling/lib/Parse/ParseStmt.cpp
cfe/branches/tooling/lib/Sema/AttributeList.cpp
cfe/branches/tooling/lib/Sema/Sema.cpp
cfe/branches/tooling/lib/Sema/SemaAccess.cpp
cfe/branches/tooling/lib/Sema/SemaDeclCXX.cpp
cfe/branches/tooling/lib/Sema/SemaFixItUtils.cpp
cfe/branches/tooling/lib/Sema/SemaLambda.cpp
cfe/branches/tooling/lib/Sema/SemaStmt.cpp
cfe/branches/tooling/lib/Sema/TreeTransform.h
cfe/branches/tooling/lib/Serialization/ASTReaderStmt.cpp
cfe/branches/tooling/lib/Serialization/ASTWriterStmt.cpp
cfe/branches/tooling/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp
cfe/branches/tooling/lib/StaticAnalyzer/Core/BasicValueFactory.cpp
cfe/branches/tooling/lib/StaticAnalyzer/Core/Calls.cpp
cfe/branches/tooling/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp
cfe/branches/tooling/test/ARCMT/checking.m
cfe/branches/tooling/test/Analysis/operator-calls.cpp
cfe/branches/tooling/test/CodeGen/mips-vector-return.c
cfe/branches/tooling/test/CodeGenObjC/bitfield-gnu.m
cfe/branches/tooling/test/CodeGenObjC/bitfield_encoding.m
cfe/branches/tooling/test/CodeGenObjC/constant-strings.m
cfe/branches/tooling/test/CodeGenObjC/gnu-exceptions.m
cfe/branches/tooling/test/CodeGenObjC/messages.m
cfe/branches/tooling/test/CodeGenObjC/undefined-protocol.m
cfe/branches/tooling/test/Coverage/codegen-gnu.m
cfe/branches/tooling/test/Driver/darwin-ld.c
cfe/branches/tooling/test/Driver/gnu-runtime.m
cfe/branches/tooling/test/Preprocessor/init.c
cfe/branches/tooling/test/Preprocessor/non_fragile_feature1.m
cfe/branches/tooling/test/SemaCXX/warn-thread-safety-analysis.cpp
cfe/branches/tooling/test/SemaCXX/warn-unreachable.cpp (props changed)
cfe/branches/tooling/test/SemaObjC/delay-parsing-cfunctions.m
cfe/branches/tooling/tools/c-index-test/c-index-test.c
cfe/branches/tooling/tools/fix-llvm-style/FixLLVMStyle.cpp
cfe/branches/tooling/tools/libclang/CXCompilationDatabase.cpp
cfe/branches/tooling/tools/libclang/libclang.exports
cfe/branches/tooling/tools/rename/ClangRename.cpp
cfe/branches/tooling/unittests/Frontend/FrontendActionTest.cpp
cfe/branches/tooling/unittests/Tooling/RefactoringTest.cpp
cfe/branches/tooling/unittests/Tooling/TestVisitor.h
cfe/branches/tooling/utils/TableGen/ClangAttrEmitter.cpp
Propchange: cfe/branches/tooling/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Jul 5 02:35:04 2012
@@ -1,3 +1,3 @@
/cfe/branches/type-system-rewrite:134693-134817
-/cfe/trunk:146581-159654
+/cfe/trunk:146581-159729
/cfe/trunk/test/SemaTemplate:126920
Modified: cfe/branches/tooling/bindings/python/clang/cindex.py
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/bindings/python/clang/cindex.py?rev=159731&r1=159730&r2=159731&view=diff
==============================================================================
--- cfe/branches/tooling/bindings/python/clang/cindex.py (original)
+++ cfe/branches/tooling/bindings/python/clang/cindex.py Thu Jul 5 02:35:04 2012
@@ -2578,39 +2578,39 @@
_clang_getCompletionPriority.restype = c_int
# Compilation Database
-CompilationDatabase_fromDirectory = lib.clang_tooling_CompilationDatabase_fromDirectory
+CompilationDatabase_fromDirectory = lib.clang_CompilationDatabase_fromDirectory
CompilationDatabase_fromDirectory.argtypes = [c_char_p, POINTER(c_uint)]
CompilationDatabase_fromDirectory.restype = c_object_p
CompilationDatabase_fromDirectory.errcheck = CompilationDatabase.from_result
-CompilationDatabase_dispose = lib.clang_tooling_CompilationDatabase_dispose
+CompilationDatabase_dispose = lib.clang_CompilationDatabase_dispose
CompilationDatabase_dispose.argtypes = [c_object_p]
-CompilationDatabase_getCompileCommands = lib.clang_tooling_CompilationDatabase_getCompileCommands
+CompilationDatabase_getCompileCommands = lib.clang_CompilationDatabase_getCompileCommands
CompilationDatabase_getCompileCommands.argtypes = [c_object_p, c_char_p]
CompilationDatabase_getCompileCommands.restype = c_object_p
CompilationDatabase_getCompileCommands.errcheck = CompileCommands.from_result
-CompileCommands_dispose = lib.clang_tooling_CompileCommands_dispose
+CompileCommands_dispose = lib.clang_CompileCommands_dispose
CompileCommands_dispose.argtypes = [c_object_p]
-CompileCommands_getSize = lib.clang_tooling_CompileCommands_getSize
+CompileCommands_getSize = lib.clang_CompileCommands_getSize
CompileCommands_getSize.argtypes = [c_object_p]
CompileCommands_getSize.restype = c_uint
-CompileCommands_getCommand = lib.clang_tooling_CompileCommands_getCommand
+CompileCommands_getCommand = lib.clang_CompileCommands_getCommand
CompileCommands_getCommand.argtypes = [c_object_p, c_uint]
CompileCommands_getCommand.restype = c_object_p
-CompileCommand_getDirectory = lib.clang_tooling_CompileCommand_getDirectory
+CompileCommand_getDirectory = lib.clang_CompileCommand_getDirectory
CompileCommand_getDirectory.argtypes = [c_object_p]
CompileCommand_getDirectory.restype = _CXString
-CompileCommand_getNumArgs = lib.clang_tooling_CompileCommand_getNumArgs
+CompileCommand_getNumArgs = lib.clang_CompileCommand_getNumArgs
CompileCommand_getNumArgs.argtypes = [c_object_p]
CompileCommand_getNumArgs.restype = c_uint
-CompileCommand_getArg = lib.clang_tooling_CompileCommand_getArg
+CompileCommand_getArg = lib.clang_CompileCommand_getArg
CompileCommand_getArg.argtypes = [c_object_p, c_uint]
CompileCommand_getArg.restype = _CXString
Modified: cfe/branches/tooling/include/clang-c/CXCompilationDatabase.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/include/clang-c/CXCompilationDatabase.h?rev=159731&r1=159730&r2=159731&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang-c/CXCompilationDatabase.h (original)
+++ cfe/branches/tooling/include/clang-c/CXCompilationDatabase.h Thu Jul 5 02:35:04 2012
@@ -29,9 +29,11 @@
*/
/**
- * \brief Represents clang::tooling::CompilationDatabase
+ * A compilation database holds all information used to compile files in a
+ * project. For each file in the database, it can be queried for the working
+ * directory or the command line used for the compiler invocation.
*
- * Must be freed by \c clang_tooling_CompilationDatabase_dispose
+ * Must be freed by \c clang_CompilationDatabase_dispose
*/
typedef void * CXCompilationDatabase;
@@ -42,7 +44,7 @@
* return several commands, as the file may have been compiled with
* different options in different places of the project. This choice of compile
* commands is wrapped in this opaque data structure. It must be freed by
- * \c clang_tooling_CompileCommands_dispose.
+ * \c clang_CompileCommands_dispose.
*/
typedef void * CXCompileCommands;
@@ -69,59 +71,60 @@
/**
* \brief Creates a compilation database from the database found in directory
- * buildDir. It must be freed by \c clang_tooling_CompilationDatabase_dispose.
+ * buildDir. For example, CMake can output a compile_commands.json which can
+ * be used to build the database.
+ *
+ * It must be freed by \c clang_CompilationDatabase_dispose.
*/
CINDEX_LINKAGE CXCompilationDatabase
-clang_tooling_CompilationDatabase_fromDirectory(
- const char *BuildDir,
- CXCompilationDatabase_Error *ErrorCode);
+clang_CompilationDatabase_fromDirectory(const char *BuildDir,
+ CXCompilationDatabase_Error *ErrorCode);
/**
* \brief Free the given compilation database
*/
CINDEX_LINKAGE void
-clang_tooling_CompilationDatabase_dispose(CXCompilationDatabase);
+clang_CompilationDatabase_dispose(CXCompilationDatabase);
/**
* \brief Find the compile commands used for a file. The compile commands
- * must be freed by \c clang_tooling_CompileCommands_dispose.
+ * must be freed by \c clang_CompileCommands_dispose.
*/
CINDEX_LINKAGE CXCompileCommands
-clang_tooling_CompilationDatabase_getCompileCommands(
- CXCompilationDatabase,
- const char *CompleteFileName);
+clang_CompilationDatabase_getCompileCommands(CXCompilationDatabase,
+ const char *CompleteFileName);
/**
* \brief Free the given CompileCommands
*/
-CINDEX_LINKAGE void clang_tooling_CompileCommands_dispose(CXCompileCommands);
+CINDEX_LINKAGE void clang_CompileCommands_dispose(CXCompileCommands);
/**
* \brief Get the number of CompileCommand we have for a file
*/
CINDEX_LINKAGE unsigned
-clang_tooling_CompileCommands_getSize(CXCompileCommands);
+clang_CompileCommands_getSize(CXCompileCommands);
/**
* \brief Get the I'th CompileCommand for a file
*
- * Note : 0 <= i < clang_tooling_CompileCommands_getSize(CXCompileCommands)
+ * Note : 0 <= i < clang_CompileCommands_getSize(CXCompileCommands)
*/
CINDEX_LINKAGE CXCompileCommand
-clang_tooling_CompileCommands_getCommand(CXCompileCommands, unsigned I);
+clang_CompileCommands_getCommand(CXCompileCommands, unsigned I);
/**
* \brief Get the working directory where the CompileCommand was executed from
*/
CINDEX_LINKAGE CXString
-clang_tooling_CompileCommand_getDirectory(CXCompileCommand);
+clang_CompileCommand_getDirectory(CXCompileCommand);
/**
* \brief Get the number of arguments in the compiler invocation.
*
*/
CINDEX_LINKAGE unsigned
-clang_tooling_CompileCommand_getNumArgs(CXCompileCommand);
+clang_CompileCommand_getNumArgs(CXCompileCommand);
/**
* \brief Get the I'th argument value in the compiler invocations
@@ -130,7 +133,7 @@
* - argument 0 is the compiler executable
*/
CINDEX_LINKAGE CXString
-clang_tooling_CompileCommand_getArg(CXCompileCommand, unsigned I);
+clang_CompileCommand_getArg(CXCompileCommand, unsigned I);
/**
* @}
Modified: cfe/branches/tooling/include/clang/AST/ASTVector.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/include/clang/AST/ASTVector.h?rev=159731&r1=159730&r2=159731&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/AST/ASTVector.h (original)
+++ cfe/branches/tooling/include/clang/AST/ASTVector.h Thu Jul 5 02:35:04 2012
@@ -374,7 +374,7 @@
NewCapacity = MinSize;
// Allocate the memory from the ASTContext.
- T *NewElts = new (C) T[NewCapacity];
+ T *NewElts = new (C, llvm::alignOf<T>()) T[NewCapacity];
// Copy the elements over.
if (llvm::is_class<T>::value) {
@@ -387,7 +387,7 @@
memcpy(NewElts, Begin, CurSize * sizeof(T));
}
- C.Deallocate(Begin);
+ // ASTContext never frees any memory.
Begin = NewElts;
End = NewElts+CurSize;
Capacity = Begin+NewCapacity;
Modified: cfe/branches/tooling/include/clang/AST/CommentLexer.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/include/clang/AST/CommentLexer.h?rev=159731&r1=159730&r2=159731&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/AST/CommentLexer.h (original)
+++ cfe/branches/tooling/include/clang/AST/CommentLexer.h Thu Jul 5 02:35:04 2012
@@ -41,15 +41,7 @@
html_equals, // =
html_quoted_string, // "blah\"blah" or 'blah\'blah'
html_greater, // >
- html_tag_close, // </tag>
-
- // Markdown tokens (not supported yet).
- ruler,
- md_code_line, // Line indented at least by 4 spaces.
- md_code_inline, // `code`
- md_emph, // _text_ or *text*
- md_strong, // __text__ or *text*
- md_header // ### level 3 header ###
+ html_tag_close // </tag>
};
} // end namespace tok
Modified: cfe/branches/tooling/include/clang/AST/DeclCXX.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/include/clang/AST/DeclCXX.h?rev=159731&r1=159730&r2=159731&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/AST/DeclCXX.h (original)
+++ cfe/branches/tooling/include/clang/AST/DeclCXX.h Thu Jul 5 02:35:04 2012
@@ -41,6 +41,7 @@
class CXXIndirectPrimaryBaseSet;
class FriendDecl;
class LambdaExpr;
+class UsingDecl;
/// \brief Represents any kind of function declaration, whether it is a
/// concrete function or a function template.
@@ -541,13 +542,21 @@
/// \brief Retrieve the set of direct base classes.
CXXBaseSpecifier *getBases() const {
- return Bases.get(Definition->getASTContext().getExternalSource());
+ if (!Bases.isOffset())
+ return Bases.get(0);
+ return getBasesSlowCase();
}
/// \brief Retrieve the set of virtual base classes.
CXXBaseSpecifier *getVBases() const {
- return VBases.get(Definition->getASTContext().getExternalSource());
+ if (!VBases.isOffset())
+ return VBases.get(0);
+ return getVBasesSlowCase();
}
+
+ private:
+ CXXBaseSpecifier *getBasesSlowCase() const;
+ CXXBaseSpecifier *getVBasesSlowCase() const;
} *DefinitionData;
/// \brief Describes a C++ closure type (generated by a lambda expression).
Modified: cfe/branches/tooling/include/clang/AST/DeclFriend.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/include/clang/AST/DeclFriend.h?rev=159731&r1=159730&r2=159731&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/AST/DeclFriend.h (original)
+++ cfe/branches/tooling/include/clang/AST/DeclFriend.h Thu Jul 5 02:35:04 2012
@@ -71,10 +71,12 @@
: Decl(Decl::Friend, Empty), NextFriend() { }
FriendDecl *getNextFriend() {
- return cast_or_null<FriendDecl>(
- NextFriend.get(getASTContext().getExternalSource()));
+ if (!NextFriend.isOffset())
+ return cast_or_null<FriendDecl>(NextFriend.get(0));
+ return getNextFriendSlowCase();
}
-
+ FriendDecl *getNextFriendSlowCase();
+
public:
static FriendDecl *Create(ASTContext &C, DeclContext *DC,
SourceLocation L, FriendUnion Friend_,
Modified: cfe/branches/tooling/include/clang/AST/Expr.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/include/clang/AST/Expr.h?rev=159731&r1=159730&r2=159731&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/AST/Expr.h (original)
+++ cfe/branches/tooling/include/clang/AST/Expr.h Thu Jul 5 02:35:04 2012
@@ -15,6 +15,7 @@
#define LLVM_CLANG_AST_EXPR_H
#include "clang/AST/APValue.h"
+#include "clang/AST/Decl.h"
#include "clang/AST/Stmt.h"
#include "clang/AST/Type.h"
#include "clang/AST/DeclAccessPair.h"
@@ -1163,16 +1164,8 @@
public:
// type should be IntTy, LongTy, LongLongTy, UnsignedIntTy, UnsignedLongTy,
// or UnsignedLongLongTy
- IntegerLiteral(ASTContext &C, const llvm::APInt &V,
- QualType type, SourceLocation l)
- : Expr(IntegerLiteralClass, type, VK_RValue, OK_Ordinary, false, false,
- false, false),
- Loc(l) {
- assert(type->isIntegerType() && "Illegal type in IntegerLiteral");
- assert(V.getBitWidth() == C.getIntWidth(type) &&
- "Integer type is not the correct size for constant.");
- setValue(C, V);
- }
+ IntegerLiteral(ASTContext &C, const llvm::APInt &V, QualType type,
+ SourceLocation l);
/// \brief Returns a new integer literal with value 'V' and type 'type'.
/// \param type - either IntTy, LongTy, LongLongTy, UnsignedIntTy,
@@ -1250,22 +1243,10 @@
SourceLocation Loc;
FloatingLiteral(ASTContext &C, const llvm::APFloat &V, bool isexact,
- QualType Type, SourceLocation L)
- : Expr(FloatingLiteralClass, Type, VK_RValue, OK_Ordinary, false, false,
- false, false), Loc(L) {
- FloatingLiteralBits.IsIEEE =
- &C.getTargetInfo().getLongDoubleFormat() == &llvm::APFloat::IEEEquad;
- FloatingLiteralBits.IsExact = isexact;
- setValue(C, V);
- }
+ QualType Type, SourceLocation L);
/// \brief Construct an empty floating-point literal.
- explicit FloatingLiteral(ASTContext &C, EmptyShell Empty)
- : Expr(FloatingLiteralClass, Empty) {
- FloatingLiteralBits.IsIEEE =
- &C.getTargetInfo().getLongDoubleFormat() == &llvm::APFloat::IEEEquad;
- FloatingLiteralBits.IsExact = false;
- }
+ explicit FloatingLiteral(ASTContext &C, EmptyShell Empty);
public:
static FloatingLiteral *Create(ASTContext &C, const llvm::APFloat &V,
Modified: cfe/branches/tooling/include/clang/AST/ExprCXX.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/include/clang/AST/ExprCXX.h?rev=159731&r1=159730&r2=159731&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/AST/ExprCXX.h (original)
+++ cfe/branches/tooling/include/clang/AST/ExprCXX.h Thu Jul 5 02:35:04 2012
@@ -14,6 +14,7 @@
#ifndef LLVM_CLANG_AST_EXPRCXX_H
#define LLVM_CLANG_AST_EXPRCXX_H
+#include "clang/AST/Decl.h"
#include "clang/AST/Expr.h"
#include "clang/AST/UnresolvedSet.h"
#include "clang/AST/TemplateBase.h"
Modified: cfe/branches/tooling/include/clang/AST/OperationKinds.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/include/clang/AST/OperationKinds.h?rev=159731&r1=159730&r2=159731&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/AST/OperationKinds.h (original)
+++ cfe/branches/tooling/include/clang/AST/OperationKinds.h Thu Jul 5 02:35:04 2012
@@ -291,7 +291,7 @@
CK_CopyAndAutoreleaseBlockObject
};
-#define CK_Invalid ((CastKind) -1)
+static const CastKind CK_Invalid = static_cast<CastKind>(-1);
enum BinaryOperatorKind {
// Operators listed in order of precedence.
Modified: cfe/branches/tooling/include/clang/AST/RawCommentList.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/include/clang/AST/RawCommentList.h?rev=159731&r1=159730&r2=159731&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/AST/RawCommentList.h (original)
+++ cfe/branches/tooling/include/clang/AST/RawCommentList.h Thu Jul 5 02:35:04 2012
@@ -21,17 +21,17 @@
class RawComment {
public:
enum CommentKind {
- CK_Invalid, ///< Invalid comment
- CK_OrdinaryBCPL, ///< Any normal BCPL comments
- CK_OrdinaryC, ///< Any normal C comment
- CK_BCPLSlash, ///< \code /// stuff \endcode
- CK_BCPLExcl, ///< \code //! stuff \endcode
- CK_JavaDoc, ///< \code /** stuff */ \endcode
- CK_Qt, ///< \code /*! stuff */ \endcode, also used by HeaderDoc
- CK_Merged ///< Two or more documentation comments merged together
+ RCK_Invalid, ///< Invalid comment
+ RCK_OrdinaryBCPL, ///< Any normal BCPL comments
+ RCK_OrdinaryC, ///< Any normal C comment
+ RCK_BCPLSlash, ///< \code /// stuff \endcode
+ RCK_BCPLExcl, ///< \code //! stuff \endcode
+ RCK_JavaDoc, ///< \code /** stuff */ \endcode
+ RCK_Qt, ///< \code /*! stuff */ \endcode, also used by HeaderDoc
+ RCK_Merged ///< Two or more documentation comments merged together
};
- RawComment() : Kind(CK_Invalid), IsAlmostTrailingComment(false) { }
+ RawComment() : Kind(RCK_Invalid), IsAlmostTrailingComment(false) { }
RawComment(const SourceManager &SourceMgr, SourceRange SR,
bool Merged = false);
@@ -41,11 +41,11 @@
}
bool isInvalid() const LLVM_READONLY {
- return Kind == CK_Invalid;
+ return Kind == RCK_Invalid;
}
bool isMerged() const LLVM_READONLY {
- return Kind == CK_Merged;
+ return Kind == RCK_Merged;
}
/// Returns true if it is a comment that should be put after a member:
@@ -67,7 +67,7 @@
/// Returns true if this comment is not a documentation comment.
bool isOrdinary() const LLVM_READONLY {
- return (Kind == CK_OrdinaryBCPL) || (Kind == CK_OrdinaryC);
+ return (Kind == RCK_OrdinaryBCPL) || (Kind == RCK_OrdinaryC);
}
/// Returns true if this comment any kind of a documentation comment.
Modified: cfe/branches/tooling/include/clang/AST/RecordLayout.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/include/clang/AST/RecordLayout.h?rev=159731&r1=159730&r2=159731&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/AST/RecordLayout.h (original)
+++ cfe/branches/tooling/include/clang/AST/RecordLayout.h Thu Jul 5 02:35:04 2012
@@ -14,10 +14,9 @@
#ifndef LLVM_CLANG_AST_LAYOUTINFO_H
#define LLVM_CLANG_AST_LAYOUTINFO_H
-#include "llvm/Support/DataTypes.h"
-#include "llvm/ADT/DenseMap.h"
#include "clang/AST/CharUnits.h"
#include "clang/AST/DeclCXX.h"
+#include "llvm/ADT/DenseMap.h"
namespace clang {
class ASTContext;
@@ -210,26 +209,6 @@
return CXXInfo->VBaseOffsets[VBase].VBaseOffset;
}
- /// getBaseClassOffsetInBits - Get the offset, in bits, for the given
- /// base class.
- uint64_t getBaseClassOffsetInBits(const CXXRecordDecl *Base) const {
- assert(CXXInfo && "Record layout does not have C++ specific info!");
- assert(CXXInfo->BaseOffsets.count(Base) && "Did not find base!");
-
- return getBaseClassOffset(Base).getQuantity() *
- Base->getASTContext().getCharWidth();
- }
-
- /// getVBaseClassOffsetInBits - Get the offset, in bits, for the given
- /// base class.
- uint64_t getVBaseClassOffsetInBits(const CXXRecordDecl *VBase) const {
- assert(CXXInfo && "Record layout does not have C++ specific info!");
- assert(CXXInfo->VBaseOffsets.count(VBase) && "Did not find base!");
-
- return getVBaseClassOffset(VBase).getQuantity() *
- VBase->getASTContext().getCharWidth();
- }
-
CharUnits getSizeOfLargestEmptySubobject() const {
assert(CXXInfo && "Record layout does not have C++ specific info!");
return CXXInfo->SizeOfLargestEmptySubobject;
Modified: cfe/branches/tooling/include/clang/AST/Stmt.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/include/clang/AST/Stmt.h?rev=159731&r1=159730&r2=159731&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/AST/Stmt.h (original)
+++ cfe/branches/tooling/include/clang/AST/Stmt.h Thu Jul 5 02:35:04 2012
@@ -19,7 +19,6 @@
#include "clang/AST/PrettyPrinter.h"
#include "clang/AST/StmtIterator.h"
#include "clang/AST/DeclGroup.h"
-#include "clang/AST/ASTContext.h"
#include "clang/AST/Attr.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/Support/Compiler.h"
@@ -37,9 +36,11 @@
class ParmVarDecl;
class QualType;
class IdentifierInfo;
+ class LabelDecl;
class SourceManager;
class StringLiteral;
class SwitchStmt;
+ class VarDecl;
//===--------------------------------------------------------------------===//
// ExprIterator - Iterators for iterating over Stmt* arrays that contain
@@ -545,20 +546,13 @@
Stmt** Body;
SourceLocation LBracLoc, RBracLoc;
public:
- CompoundStmt(ASTContext& C, Stmt **StmtStart, unsigned NumStmts,
- SourceLocation LB, SourceLocation RB)
- : Stmt(CompoundStmtClass), LBracLoc(LB), RBracLoc(RB) {
- CompoundStmtBits.NumStmts = NumStmts;
- assert(CompoundStmtBits.NumStmts == NumStmts &&
- "NumStmts doesn't fit in bits of CompoundStmtBits.NumStmts!");
-
- if (NumStmts == 0) {
- Body = 0;
- return;
- }
+ CompoundStmt(ASTContext &C, Stmt **StmtStart, unsigned NumStmts,
+ SourceLocation LB, SourceLocation RB);
- Body = new (C) Stmt*[NumStmts];
- memcpy(Body, StmtStart, NumStmts * sizeof(*Body));
+ // \brief Build an empty compound statment with a location.
+ explicit CompoundStmt(SourceLocation Loc)
+ : Stmt(CompoundStmtClass), Body(0), LBracLoc(Loc), RBracLoc(Loc) {
+ CompoundStmtBits.NumStmts = 0;
}
// \brief Build an empty compound statement.
Modified: cfe/branches/tooling/include/clang/Basic/ObjCRuntime.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/include/clang/Basic/ObjCRuntime.h?rev=159731&r1=159730&r2=159731&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/Basic/ObjCRuntime.h (original)
+++ cfe/branches/tooling/include/clang/Basic/ObjCRuntime.h Thu Jul 5 02:35:04 2012
@@ -16,6 +16,7 @@
#define LLVM_CLANG_OBJCRUNTIME_H
#include "clang/Basic/VersionTuple.h"
+#include "llvm/ADT/Triple.h"
#include "llvm/Support/ErrorHandling.h"
namespace clang {
@@ -40,11 +41,12 @@
/// version of iOS.
iOS,
- /// 'gnu' is the non-fragile GNU runtime.
- GNU,
+ /// 'gcc' is the Objective-C runtime shipped with GCC, implementing a
+ /// fragile Objective-C ABI
+ GCC,
- /// 'gnu-fragile' is the fragile GNU runtime.
- FragileGNU
+ /// 'gnustep' is the modern non-fragile GNUstep runtime.
+ GNUstep
};
private:
@@ -71,9 +73,9 @@
bool isNonFragile() const {
switch (getKind()) {
case FragileMacOSX: return false;
- case FragileGNU: return false;
+ case GCC: return false;
case MacOSX: return true;
- case GNU: return true;
+ case GNUstep: return true;
case iOS: return true;
}
llvm_unreachable("bad kind");
@@ -83,15 +85,30 @@
/// implied behaviors for a "fragile" ABI?
bool isFragile() const { return !isNonFragile(); }
- /// \brief Is this runtime basically of the GNU family of runtimes?
+ /// The default dispatch mechanism to use for the specified architecture
+ bool isLegacyDispatchDefaultForArch(llvm::Triple::ArchType Arch) {
+ // The GNUstep runtime uses a newer dispatch method by default from
+ // version 1.6 onwards
+ if (getKind() == GNUstep && getVersion() >= VersionTuple(1, 6)) {
+ if (Arch == llvm::Triple::arm ||
+ Arch == llvm::Triple::x86 ||
+ Arch == llvm::Triple::x86_64)
+ return false;
+ // Mac runtimes use legacy dispatch everywhere except x86-64
+ } else if (isNeXTFamily() && isNonFragile())
+ return Arch != llvm::Triple::x86_64;
+ return true;
+ }
+
+ /// \brief Is this runtime basically of the GNUstep family of runtimes?
bool isGNUFamily() const {
switch (getKind()) {
case FragileMacOSX:
case MacOSX:
case iOS:
return false;
- case FragileGNU:
- case GNU:
+ case GCC:
+ case GNUstep:
return true;
}
llvm_unreachable("bad kind");
@@ -115,11 +132,8 @@
case MacOSX: return getVersion() >= VersionTuple(10, 7);
case iOS: return getVersion() >= VersionTuple(5);
- // This is really a lie, because some implementations and versions
- // of the runtime do not support ARC. Probably -fgnu-runtime
- // should imply a "maximal" runtime or something?
- case FragileGNU: return true;
- case GNU: return true;
+ case GCC: return false;
+ case GNUstep: return getVersion() >= VersionTuple(1, 6);
}
llvm_unreachable("bad kind");
}
@@ -143,8 +157,8 @@
// This is really a lie, because some implementations and versions
// of the runtime do not support ARC. Probably -fgnu-runtime
// should imply a "maximal" runtime or something?
- case FragileGNU: return true;
- case GNU: return true;
+ case GCC: return true;
+ case GNUstep: return true;
}
llvm_unreachable("bad kind");
}
@@ -158,8 +172,8 @@
case FragileMacOSX: return getVersion() >= VersionTuple(10, 8);
case MacOSX: return getVersion() >= VersionTuple(10, 8);
case iOS: return getVersion() >= VersionTuple(5);
- case FragileGNU: return false;
- case GNU: return false;
+ case GCC: return false;
+ case GNUstep: return false;
}
llvm_unreachable("bad kind");
}
@@ -170,8 +184,19 @@
case MacOSX: return true;
case iOS: return true;
case FragileMacOSX: return false;
- case FragileGNU: return false;
- case GNU: return false;
+ case GCC: return true;
+ case GNUstep: return true;
+ }
+ llvm_unreachable("bad kind");
+ }
+ /// \brief Does this runtime use zero-cost exceptions?
+ bool hasUnwindExceptions() const {
+ switch (getKind()) {
+ case MacOSX: return true;
+ case iOS: return true;
+ case FragileMacOSX: return false;
+ case GCC: return true;
+ case GNUstep: return true;
}
llvm_unreachable("bad kind");
}
Modified: cfe/branches/tooling/include/clang/Driver/ToolChain.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/include/clang/Driver/ToolChain.h?rev=159731&r1=159730&r2=159731&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/Driver/ToolChain.h (original)
+++ cfe/branches/tooling/include/clang/Driver/ToolChain.h Thu Jul 5 02:35:04 2012
@@ -149,11 +149,6 @@
/// -fobjc-nonfragile-abi by default.
virtual bool IsObjCNonFragileABIDefault() const { return false; }
- /// IsObjCLegacyDispatchDefault - Does this tool chain set
- /// -fobjc-legacy-dispatch by default (this is only used with the non-fragile
- /// ABI).
- virtual bool IsObjCLegacyDispatchDefault() const { return true; }
-
/// UseObjCMixedDispatchDefault - When using non-legacy dispatch, should the
/// mixed dispatch method be used?
virtual bool UseObjCMixedDispatch() const { return false; }
Modified: cfe/branches/tooling/include/clang/Frontend/ASTUnit.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/include/clang/Frontend/ASTUnit.h?rev=159731&r1=159730&r2=159731&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/Frontend/ASTUnit.h (original)
+++ cfe/branches/tooling/include/clang/Frontend/ASTUnit.h Thu Jul 5 02:35:04 2012
@@ -19,6 +19,7 @@
#include "clang/Sema/CodeCompleteConsumer.h"
#include "clang/Lex/ModuleLoader.h"
#include "clang/Lex/PreprocessingRecord.h"
+#include "clang/AST/ASTContext.h"
#include "clang/Basic/LangOptions.h"
#include "clang/Basic/SourceManager.h"
#include "clang/Basic/FileManager.h"
Modified: cfe/branches/tooling/include/clang/Sema/DelayedDiagnostic.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/include/clang/Sema/DelayedDiagnostic.h?rev=159731&r1=159730&r2=159731&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/Sema/DelayedDiagnostic.h (original)
+++ cfe/branches/tooling/include/clang/Sema/DelayedDiagnostic.h Thu Jul 5 02:35:04 2012
@@ -40,17 +40,17 @@
bool isMemberAccess() const { return IsMember; }
- AccessedEntity(ASTContext &Context,
+ AccessedEntity(PartialDiagnostic::StorageAllocator &Allocator,
MemberNonce _,
CXXRecordDecl *NamingClass,
DeclAccessPair FoundDecl,
QualType BaseObjectType)
: Access(FoundDecl.getAccess()), IsMember(true),
Target(FoundDecl.getDecl()), NamingClass(NamingClass),
- BaseObjectType(BaseObjectType), Diag(0, Context.getDiagAllocator()) {
+ BaseObjectType(BaseObjectType), Diag(0, Allocator) {
}
- AccessedEntity(ASTContext &Context,
+ AccessedEntity(PartialDiagnostic::StorageAllocator &Allocator,
BaseNonce _,
CXXRecordDecl *BaseClass,
CXXRecordDecl *DerivedClass,
@@ -58,7 +58,7 @@
: Access(Access), IsMember(false),
Target(BaseClass),
NamingClass(DerivedClass),
- Diag(0, Context.getDiagAllocator()) {
+ Diag(0, Allocator) {
}
bool isQuiet() const { return Diag.getDiagID() == 0; }
Modified: cfe/branches/tooling/include/clang/Sema/Initialization.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/include/clang/Sema/Initialization.h?rev=159731&r1=159730&r2=159731&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/Sema/Initialization.h (original)
+++ cfe/branches/tooling/include/clang/Sema/Initialization.h Thu Jul 5 02:35:04 2012
@@ -15,6 +15,7 @@
#include "clang/Sema/Ownership.h"
#include "clang/Sema/Overload.h"
+#include "clang/AST/ASTContext.h"
#include "clang/AST/Type.h"
#include "clang/AST/UnresolvedSet.h"
#include "clang/Basic/SourceLocation.h"
Modified: cfe/branches/tooling/include/clang/Sema/Sema.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/include/clang/Sema/Sema.h?rev=159731&r1=159730&r2=159731&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/Sema/Sema.h (original)
+++ cfe/branches/tooling/include/clang/Sema/Sema.h Thu Jul 5 02:35:04 2012
@@ -28,6 +28,7 @@
#include "clang/AST/ExprObjC.h"
#include "clang/AST/DeclarationName.h"
#include "clang/AST/ExternalASTSource.h"
+#include "clang/AST/LambdaMangleContext.h"
#include "clang/AST/TypeLoc.h"
#include "clang/AST/NSAPI.h"
#include "clang/Lex/ModuleLoader.h"
@@ -2493,12 +2494,14 @@
FullExprArg Third,
SourceLocation RParenLoc,
Stmt *Body);
- ExprResult ActOnObjCForCollectionOperand(SourceLocation forLoc,
+ ExprResult CheckObjCForCollectionOperand(SourceLocation forLoc,
Expr *collection);
StmtResult ActOnObjCForCollectionStmt(SourceLocation ForColLoc,
SourceLocation LParenLoc,
- Stmt *First, Expr *Second,
- SourceLocation RParenLoc, Stmt *Body);
+ Stmt *First, Expr *collection,
+ SourceLocation RParenLoc);
+ StmtResult FinishObjCForCollectionStmt(Stmt *ForCollection, Stmt *Body);
+
StmtResult ActOnCXXForRangeStmt(SourceLocation ForLoc,
SourceLocation LParenLoc, Stmt *LoopVar,
SourceLocation ColonLoc, Expr *Collection,
@@ -3300,7 +3303,7 @@
public:
explicit ImplicitExceptionSpecification(Sema &Self)
: Self(&Self), ComputedEST(EST_BasicNoexcept) {
- if (!Self.Context.getLangOpts().CPlusPlus0x)
+ if (!Self.getLangOpts().CPlusPlus0x)
ComputedEST = EST_DynamicNone;
}
Modified: cfe/branches/tooling/include/clang/StaticAnalyzer/Core/PathSensitive/Calls.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/include/clang/StaticAnalyzer/Core/PathSensitive/Calls.h?rev=159731&r1=159730&r2=159731&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/StaticAnalyzer/Core/PathSensitive/Calls.h (original)
+++ cfe/branches/tooling/include/clang/StaticAnalyzer/Core/PathSensitive/Calls.h Thu Jul 5 02:35:04 2012
@@ -29,6 +29,7 @@
enum CallEventKind {
CE_Function,
CE_CXXMember,
+ CE_CXXMemberOperator,
CE_Block,
CE_BEG_SIMPLE_CALLS = CE_Function,
CE_END_SIMPLE_CALLS = CE_Block,
@@ -264,9 +265,36 @@
}
};
+/// \brief Represents a C++ overloaded operator call where the operator is
+/// implemented as a non-static member function.
+///
+/// Example: <tt>iter + 1</tt>
+class CXXMemberOperatorCall : public SimpleCall {
+protected:
+ void addExtraInvalidatedRegions(RegionList &Regions) const;
+
+public:
+ CXXMemberOperatorCall(const CXXOperatorCallExpr *CE, ProgramStateRef St,
+ const LocationContext *LCtx)
+ : SimpleCall(CE, St, LCtx, CE_CXXMemberOperator) {}
+
+ const CXXOperatorCallExpr *getOriginExpr() const {
+ return cast<CXXOperatorCallExpr>(SimpleCall::getOriginExpr());
+ }
+
+ unsigned getNumArgs() const { return getOriginExpr()->getNumArgs() - 1; }
+ const Expr *getArgExpr(unsigned Index) const {
+ return getOriginExpr()->getArg(Index + 1);
+ }
+
+ static bool classof(const CallEvent *CA) {
+ return CA->getKind() == CE_CXXMemberOperator;
+ }
+};
+
/// \brief Represents a call to a block.
///
-/// Example: \c ^{ /* ... */ }()
+/// Example: <tt>^{ /* ... */ }()</tt>
class BlockCall : public SimpleCall {
protected:
void addExtraInvalidatedRegions(RegionList &Regions) const;
Modified: cfe/branches/tooling/include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h?rev=159731&r1=159730&r2=159731&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h (original)
+++ cfe/branches/tooling/include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h Thu Jul 5 02:35:04 2012
@@ -16,6 +16,7 @@
#ifndef LLVM_CLANG_GR_MEMREGION_H
#define LLVM_CLANG_GR_MEMREGION_H
+#include "clang/AST/ASTContext.h"
#include "clang/AST/CharUnits.h"
#include "clang/AST/Decl.h"
#include "clang/AST/ExprObjC.h"
Modified: cfe/branches/tooling/include/clang/StaticAnalyzer/Core/PathSensitive/SValBuilder.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/include/clang/StaticAnalyzer/Core/PathSensitive/SValBuilder.h?rev=159731&r1=159730&r2=159731&view=diff
==============================================================================
--- cfe/branches/tooling/include/clang/StaticAnalyzer/Core/PathSensitive/SValBuilder.h (original)
+++ cfe/branches/tooling/include/clang/StaticAnalyzer/Core/PathSensitive/SValBuilder.h Thu Jul 5 02:35:04 2012
@@ -15,6 +15,7 @@
#ifndef LLVM_CLANG_GR_SVALBUILDER
#define LLVM_CLANG_GR_SVALBUILDER
+#include "clang/AST/ASTContext.h"
#include "clang/AST/Expr.h"
#include "clang/AST/ExprCXX.h"
#include "clang/AST/ExprObjC.h"
Modified: cfe/branches/tooling/lib/ARCMigrate/ObjCMT.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/ARCMigrate/ObjCMT.cpp?rev=159731&r1=159730&r2=159731&view=diff
==============================================================================
--- cfe/branches/tooling/lib/ARCMigrate/ObjCMT.cpp (original)
+++ cfe/branches/tooling/lib/ARCMigrate/ObjCMT.cpp Thu Jul 5 02:35:04 2012
@@ -10,6 +10,7 @@
#include "clang/ARCMigrate/ARCMTActions.h"
#include "clang/Frontend/CompilerInstance.h"
#include "clang/Frontend/MultiplexConsumer.h"
+#include "clang/AST/ASTContext.h"
#include "clang/AST/RecursiveASTVisitor.h"
#include "clang/AST/NSAPI.h"
#include "clang/AST/ASTConsumer.h"
Modified: cfe/branches/tooling/lib/ARCMigrate/TransAPIUses.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/ARCMigrate/TransAPIUses.cpp?rev=159731&r1=159730&r2=159731&view=diff
==============================================================================
--- cfe/branches/tooling/lib/ARCMigrate/TransAPIUses.cpp (original)
+++ cfe/branches/tooling/lib/ARCMigrate/TransAPIUses.cpp Thu Jul 5 02:35:04 2012
@@ -19,6 +19,7 @@
#include "Transforms.h"
#include "Internals.h"
+#include "clang/AST/ASTContext.h"
#include "clang/Sema/SemaDiagnostic.h"
using namespace clang;
Modified: cfe/branches/tooling/lib/ARCMigrate/TransARCAssign.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/ARCMigrate/TransARCAssign.cpp?rev=159731&r1=159730&r2=159731&view=diff
==============================================================================
--- cfe/branches/tooling/lib/ARCMigrate/TransARCAssign.cpp (original)
+++ cfe/branches/tooling/lib/ARCMigrate/TransARCAssign.cpp Thu Jul 5 02:35:04 2012
@@ -23,6 +23,7 @@
#include "Transforms.h"
#include "Internals.h"
+#include "clang/AST/ASTContext.h"
#include "clang/Sema/SemaDiagnostic.h"
using namespace clang;
Modified: cfe/branches/tooling/lib/ARCMigrate/TransAutoreleasePool.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/ARCMigrate/TransAutoreleasePool.cpp?rev=159731&r1=159730&r2=159731&view=diff
==============================================================================
--- cfe/branches/tooling/lib/ARCMigrate/TransAutoreleasePool.cpp (original)
+++ cfe/branches/tooling/lib/ARCMigrate/TransAutoreleasePool.cpp Thu Jul 5 02:35:04 2012
@@ -29,6 +29,7 @@
#include "Transforms.h"
#include "Internals.h"
+#include "clang/AST/ASTContext.h"
#include "clang/Sema/SemaDiagnostic.h"
#include "clang/Basic/SourceManager.h"
#include <map>
Modified: cfe/branches/tooling/lib/ARCMigrate/TransBlockObjCVariable.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/ARCMigrate/TransBlockObjCVariable.cpp?rev=159731&r1=159730&r2=159731&view=diff
==============================================================================
--- cfe/branches/tooling/lib/ARCMigrate/TransBlockObjCVariable.cpp (original)
+++ cfe/branches/tooling/lib/ARCMigrate/TransBlockObjCVariable.cpp Thu Jul 5 02:35:04 2012
@@ -27,6 +27,7 @@
#include "Transforms.h"
#include "Internals.h"
+#include "clang/AST/ASTContext.h"
#include "clang/Basic/SourceManager.h"
using namespace clang;
Modified: cfe/branches/tooling/lib/ARCMigrate/TransEmptyStatementsAndDealloc.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/ARCMigrate/TransEmptyStatementsAndDealloc.cpp?rev=159731&r1=159730&r2=159731&view=diff
==============================================================================
--- cfe/branches/tooling/lib/ARCMigrate/TransEmptyStatementsAndDealloc.cpp (original)
+++ cfe/branches/tooling/lib/ARCMigrate/TransEmptyStatementsAndDealloc.cpp Thu Jul 5 02:35:04 2012
@@ -21,6 +21,7 @@
#include "Transforms.h"
#include "Internals.h"
+#include "clang/AST/ASTContext.h"
#include "clang/AST/StmtVisitor.h"
#include "clang/Basic/SourceManager.h"
Modified: cfe/branches/tooling/lib/ARCMigrate/TransGCAttrs.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/ARCMigrate/TransGCAttrs.cpp?rev=159731&r1=159730&r2=159731&view=diff
==============================================================================
--- cfe/branches/tooling/lib/ARCMigrate/TransGCAttrs.cpp (original)
+++ cfe/branches/tooling/lib/ARCMigrate/TransGCAttrs.cpp Thu Jul 5 02:35:04 2012
@@ -9,12 +9,13 @@
#include "Transforms.h"
#include "Internals.h"
-#include "clang/Lex/Lexer.h"
+#include "clang/AST/ASTContext.h"
#include "clang/Basic/SourceManager.h"
-#include "llvm/Support/SaveAndRestore.h"
+#include "clang/Lex/Lexer.h"
#include "clang/Sema/SemaDiagnostic.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/TinyPtrVector.h"
+#include "llvm/Support/SaveAndRestore.h"
using namespace clang;
using namespace arcmt;
Modified: cfe/branches/tooling/lib/ARCMigrate/TransGCCalls.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/ARCMigrate/TransGCCalls.cpp?rev=159731&r1=159730&r2=159731&view=diff
==============================================================================
--- cfe/branches/tooling/lib/ARCMigrate/TransGCCalls.cpp (original)
+++ cfe/branches/tooling/lib/ARCMigrate/TransGCCalls.cpp Thu Jul 5 02:35:04 2012
@@ -9,6 +9,7 @@
#include "Transforms.h"
#include "Internals.h"
+#include "clang/AST/ASTContext.h"
#include "clang/Sema/SemaDiagnostic.h"
using namespace clang;
Modified: cfe/branches/tooling/lib/ARCMigrate/TransRetainReleaseDealloc.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/ARCMigrate/TransRetainReleaseDealloc.cpp?rev=159731&r1=159730&r2=159731&view=diff
==============================================================================
--- cfe/branches/tooling/lib/ARCMigrate/TransRetainReleaseDealloc.cpp (original)
+++ cfe/branches/tooling/lib/ARCMigrate/TransRetainReleaseDealloc.cpp Thu Jul 5 02:35:04 2012
@@ -19,10 +19,11 @@
#include "Transforms.h"
#include "Internals.h"
-#include "clang/Sema/SemaDiagnostic.h"
+#include "clang/AST/ASTContext.h"
#include "clang/AST/ParentMap.h"
-#include "clang/Lex/Lexer.h"
#include "clang/Basic/SourceManager.h"
+#include "clang/Lex/Lexer.h"
+#include "clang/Sema/SemaDiagnostic.h"
using namespace clang;
using namespace arcmt;
Modified: cfe/branches/tooling/lib/ARCMigrate/TransUnbridgedCasts.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/ARCMigrate/TransUnbridgedCasts.cpp?rev=159731&r1=159730&r2=159731&view=diff
==============================================================================
--- cfe/branches/tooling/lib/ARCMigrate/TransUnbridgedCasts.cpp (original)
+++ cfe/branches/tooling/lib/ARCMigrate/TransUnbridgedCasts.cpp Thu Jul 5 02:35:04 2012
@@ -35,10 +35,11 @@
#include "Transforms.h"
#include "Internals.h"
#include "clang/Analysis/DomainSpecific/CocoaConventions.h"
-#include "clang/Sema/SemaDiagnostic.h"
+#include "clang/AST/ASTContext.h"
#include "clang/AST/ParentMap.h"
-#include "clang/Lex/Lexer.h"
#include "clang/Basic/SourceManager.h"
+#include "clang/Lex/Lexer.h"
+#include "clang/Sema/SemaDiagnostic.h"
#include "llvm/ADT/SmallString.h"
using namespace clang;
Modified: cfe/branches/tooling/lib/ARCMigrate/TransUnusedInitDelegate.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/ARCMigrate/TransUnusedInitDelegate.cpp?rev=159731&r1=159730&r2=159731&view=diff
==============================================================================
--- cfe/branches/tooling/lib/ARCMigrate/TransUnusedInitDelegate.cpp (original)
+++ cfe/branches/tooling/lib/ARCMigrate/TransUnusedInitDelegate.cpp Thu Jul 5 02:35:04 2012
@@ -22,6 +22,7 @@
#include "Transforms.h"
#include "Internals.h"
+#include "clang/AST/ASTContext.h"
#include "clang/Sema/SemaDiagnostic.h"
using namespace clang;
Modified: cfe/branches/tooling/lib/ARCMigrate/TransZeroOutPropsInDealloc.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/ARCMigrate/TransZeroOutPropsInDealloc.cpp?rev=159731&r1=159730&r2=159731&view=diff
==============================================================================
--- cfe/branches/tooling/lib/ARCMigrate/TransZeroOutPropsInDealloc.cpp (original)
+++ cfe/branches/tooling/lib/ARCMigrate/TransZeroOutPropsInDealloc.cpp Thu Jul 5 02:35:04 2012
@@ -15,6 +15,7 @@
#include "Transforms.h"
#include "Internals.h"
+#include "clang/AST/ASTContext.h"
using namespace clang;
using namespace arcmt;
Modified: cfe/branches/tooling/lib/ARCMigrate/TransformActions.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/ARCMigrate/TransformActions.cpp?rev=159731&r1=159730&r2=159731&view=diff
==============================================================================
--- cfe/branches/tooling/lib/ARCMigrate/TransformActions.cpp (original)
+++ cfe/branches/tooling/lib/ARCMigrate/TransformActions.cpp Thu Jul 5 02:35:04 2012
@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
#include "Internals.h"
+#include "clang/AST/ASTContext.h"
#include "clang/AST/Expr.h"
#include "clang/Lex/Preprocessor.h"
#include "clang/Basic/SourceManager.h"
Modified: cfe/branches/tooling/lib/ARCMigrate/Transforms.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/ARCMigrate/Transforms.cpp?rev=159731&r1=159730&r2=159731&view=diff
==============================================================================
--- cfe/branches/tooling/lib/ARCMigrate/Transforms.cpp (original)
+++ cfe/branches/tooling/lib/ARCMigrate/Transforms.cpp Thu Jul 5 02:35:04 2012
@@ -9,13 +9,14 @@
#include "Transforms.h"
#include "Internals.h"
-#include "clang/Sema/SemaDiagnostic.h"
-#include "clang/Sema/Sema.h"
+#include "clang/Analysis/DomainSpecific/CocoaConventions.h"
+#include "clang/AST/ASTContext.h"
#include "clang/AST/RecursiveASTVisitor.h"
#include "clang/AST/StmtVisitor.h"
-#include "clang/Lex/Lexer.h"
#include "clang/Basic/SourceManager.h"
-#include "clang/Analysis/DomainSpecific/CocoaConventions.h"
+#include "clang/Lex/Lexer.h"
+#include "clang/Sema/Sema.h"
+#include "clang/Sema/SemaDiagnostic.h"
#include "llvm/ADT/StringSwitch.h"
#include "llvm/ADT/DenseSet.h"
#include <map>
Modified: cfe/branches/tooling/lib/AST/ASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/AST/ASTContext.cpp?rev=159731&r1=159730&r2=159731&view=diff
==============================================================================
--- cfe/branches/tooling/lib/AST/ASTContext.cpp (original)
+++ cfe/branches/tooling/lib/AST/ASTContext.cpp Thu Jul 5 02:35:04 2012
@@ -4855,7 +4855,7 @@
CXXRecordDecl *base = BI->getType()->getAsCXXRecordDecl();
if (base->isEmpty())
continue;
- uint64_t offs = layout.getBaseClassOffsetInBits(base);
+ uint64_t offs = toBits(layout.getBaseClassOffset(base));
FieldOrBaseOffsets.insert(FieldOrBaseOffsets.upper_bound(offs),
std::make_pair(offs, base));
}
@@ -4878,7 +4878,7 @@
CXXRecordDecl *base = BI->getType()->getAsCXXRecordDecl();
if (base->isEmpty())
continue;
- uint64_t offs = layout.getVBaseClassOffsetInBits(base);
+ uint64_t offs = toBits(layout.getVBaseClassOffset(base));
if (FieldOrBaseOffsets.find(offs) == FieldOrBaseOffsets.end())
FieldOrBaseOffsets.insert(FieldOrBaseOffsets.end(),
std::make_pair(offs, base));
Modified: cfe/branches/tooling/lib/AST/CXXInheritance.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/AST/CXXInheritance.cpp?rev=159731&r1=159730&r2=159731&view=diff
==============================================================================
--- cfe/branches/tooling/lib/AST/CXXInheritance.cpp (original)
+++ cfe/branches/tooling/lib/AST/CXXInheritance.cpp Thu Jul 5 02:35:04 2012
@@ -11,6 +11,7 @@
//
//===----------------------------------------------------------------------===//
#include "clang/AST/CXXInheritance.h"
+#include "clang/AST/ASTContext.h"
#include "clang/AST/RecordLayout.h"
#include "clang/AST/DeclCXX.h"
#include <algorithm>
Modified: cfe/branches/tooling/lib/AST/CommentBriefParser.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/AST/CommentBriefParser.cpp?rev=159731&r1=159730&r2=159731&view=diff
==============================================================================
--- cfe/branches/tooling/lib/AST/CommentBriefParser.cpp (original)
+++ cfe/branches/tooling/lib/AST/CommentBriefParser.cpp Thu Jul 5 02:35:04 2012
@@ -81,10 +81,8 @@
if (isBlockCommand(Name)) {
// We found an implicit paragraph end.
InFirstParagraph = false;
- if (InBrief) {
- InBrief = false;
+ if (InBrief)
break;
- }
}
}
@@ -97,10 +95,8 @@
ConsumeToken();
// We found a paragraph end.
InFirstParagraph = false;
- if (InBrief) {
- InBrief = false;
+ if (InBrief)
break;
- }
}
continue;
}
Modified: cfe/branches/tooling/lib/AST/DeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/AST/DeclCXX.cpp?rev=159731&r1=159730&r2=159731&view=diff
==============================================================================
--- cfe/branches/tooling/lib/AST/DeclCXX.cpp (original)
+++ cfe/branches/tooling/lib/AST/DeclCXX.cpp Thu Jul 5 02:35:04 2012
@@ -60,6 +60,14 @@
NumVBases(0), Bases(), VBases(), Definition(D), FirstFriend(0) {
}
+CXXBaseSpecifier *CXXRecordDecl::DefinitionData::getBasesSlowCase() const {
+ return Bases.get(Definition->getASTContext().getExternalSource());
+}
+
+CXXBaseSpecifier *CXXRecordDecl::DefinitionData::getVBasesSlowCase() const {
+ return VBases.get(Definition->getASTContext().getExternalSource());
+}
+
CXXRecordDecl::CXXRecordDecl(Kind K, TagKind TK, DeclContext *DC,
SourceLocation StartLoc, SourceLocation IdLoc,
IdentifierInfo *Id, CXXRecordDecl *PrevDecl)
Modified: cfe/branches/tooling/lib/AST/DeclFriend.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/AST/DeclFriend.cpp?rev=159731&r1=159730&r2=159731&view=diff
==============================================================================
--- cfe/branches/tooling/lib/AST/DeclFriend.cpp (original)
+++ cfe/branches/tooling/lib/AST/DeclFriend.cpp Thu Jul 5 02:35:04 2012
@@ -12,12 +12,18 @@
//
//===----------------------------------------------------------------------===//
+#include "clang/AST/ASTContext.h"
#include "clang/AST/DeclFriend.h"
#include "clang/AST/DeclTemplate.h"
using namespace clang;
void FriendDecl::anchor() { }
+FriendDecl *FriendDecl::getNextFriendSlowCase() {
+ return cast_or_null<FriendDecl>(
+ NextFriend.get(getASTContext().getExternalSource()));
+}
+
FriendDecl *FriendDecl::Create(ASTContext &C, DeclContext *DC,
SourceLocation L,
FriendUnion Friend,
Modified: cfe/branches/tooling/lib/AST/Expr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/AST/Expr.cpp?rev=159731&r1=159730&r2=159731&view=diff
==============================================================================
--- cfe/branches/tooling/lib/AST/Expr.cpp (original)
+++ cfe/branches/tooling/lib/AST/Expr.cpp Thu Jul 5 02:35:04 2012
@@ -555,6 +555,17 @@
VAL = 0;
}
+IntegerLiteral::IntegerLiteral(ASTContext &C, const llvm::APInt &V,
+ QualType type, SourceLocation l)
+ : Expr(IntegerLiteralClass, type, VK_RValue, OK_Ordinary, false, false,
+ false, false),
+ Loc(l) {
+ assert(type->isIntegerType() && "Illegal type in IntegerLiteral");
+ assert(V.getBitWidth() == C.getIntWidth(type) &&
+ "Integer type is not the correct size for constant.");
+ setValue(C, V);
+}
+
IntegerLiteral *
IntegerLiteral::Create(ASTContext &C, const llvm::APInt &V,
QualType type, SourceLocation l) {
@@ -566,6 +577,23 @@
return new (C) IntegerLiteral(Empty);
}
+FloatingLiteral::FloatingLiteral(ASTContext &C, const llvm::APFloat &V,
+ bool isexact, QualType Type, SourceLocation L)
+ : Expr(FloatingLiteralClass, Type, VK_RValue, OK_Ordinary, false, false,
+ false, false), Loc(L) {
+ FloatingLiteralBits.IsIEEE =
+ &C.getTargetInfo().getLongDoubleFormat() == &llvm::APFloat::IEEEquad;
+ FloatingLiteralBits.IsExact = isexact;
+ setValue(C, V);
+}
+
+FloatingLiteral::FloatingLiteral(ASTContext &C, EmptyShell Empty)
+ : Expr(FloatingLiteralClass, Empty) {
+ FloatingLiteralBits.IsIEEE =
+ &C.getTargetInfo().getLongDoubleFormat() == &llvm::APFloat::IEEEquad;
+ FloatingLiteralBits.IsExact = false;
+}
+
FloatingLiteral *
FloatingLiteral::Create(ASTContext &C, const llvm::APFloat &V,
bool isexact, QualType Type, SourceLocation L) {
Modified: cfe/branches/tooling/lib/AST/ExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/AST/ExprCXX.cpp?rev=159731&r1=159730&r2=159731&view=diff
==============================================================================
--- cfe/branches/tooling/lib/AST/ExprCXX.cpp (original)
+++ cfe/branches/tooling/lib/AST/ExprCXX.cpp Thu Jul 5 02:35:04 2012
@@ -12,6 +12,7 @@
//===----------------------------------------------------------------------===//
#include "clang/Basic/IdentifierTable.h"
+#include "clang/AST/ASTContext.h"
#include "clang/AST/DeclCXX.h"
#include "clang/AST/DeclTemplate.h"
#include "clang/AST/ExprCXX.h"
Modified: cfe/branches/tooling/lib/AST/LambdaMangleContext.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/AST/LambdaMangleContext.cpp?rev=159731&r1=159730&r2=159731&view=diff
==============================================================================
--- cfe/branches/tooling/lib/AST/LambdaMangleContext.cpp (original)
+++ cfe/branches/tooling/lib/AST/LambdaMangleContext.cpp Thu Jul 5 02:35:04 2012
@@ -11,7 +11,9 @@
// the Itanium C++ ABI mangling numbers for lambda expressions.
//
//===----------------------------------------------------------------------===//
+
#include "clang/AST/LambdaMangleContext.h"
+#include "clang/AST/ASTContext.h"
#include "clang/AST/DeclCXX.h"
using namespace clang;
Modified: cfe/branches/tooling/lib/AST/RawCommentList.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/AST/RawCommentList.cpp?rev=159731&r1=159730&r2=159731&view=diff
==============================================================================
--- cfe/branches/tooling/lib/AST/RawCommentList.cpp (original)
+++ cfe/branches/tooling/lib/AST/RawCommentList.cpp Thu Jul 5 02:35:04 2012
@@ -19,19 +19,19 @@
/// Get comment kind and bool describing if it is a trailing comment.
std::pair<RawComment::CommentKind, bool> getCommentKind(StringRef Comment) {
if (Comment.size() < 3 || Comment[0] != '/')
- return std::make_pair(RawComment::CK_Invalid, false);
+ return std::make_pair(RawComment::RCK_Invalid, false);
RawComment::CommentKind K;
if (Comment[1] == '/') {
if (Comment.size() < 3)
- return std::make_pair(RawComment::CK_OrdinaryBCPL, false);
+ return std::make_pair(RawComment::RCK_OrdinaryBCPL, false);
if (Comment[2] == '/')
- K = RawComment::CK_BCPLSlash;
+ K = RawComment::RCK_BCPLSlash;
else if (Comment[2] == '!')
- K = RawComment::CK_BCPLExcl;
+ K = RawComment::RCK_BCPLExcl;
else
- return std::make_pair(RawComment::CK_OrdinaryBCPL, false);
+ return std::make_pair(RawComment::RCK_OrdinaryBCPL, false);
} else {
assert(Comment.size() >= 4);
@@ -40,14 +40,14 @@
if (Comment[1] != '*' ||
Comment[Comment.size() - 2] != '*' ||
Comment[Comment.size() - 1] != '/')
- return std::make_pair(RawComment::CK_Invalid, false);
+ return std::make_pair(RawComment::RCK_Invalid, false);
if (Comment[2] == '*')
- K = RawComment::CK_JavaDoc;
+ K = RawComment::RCK_JavaDoc;
else if (Comment[2] == '!')
- K = RawComment::CK_Qt;
+ K = RawComment::RCK_Qt;
else
- return std::make_pair(RawComment::CK_OrdinaryC, false);
+ return std::make_pair(RawComment::RCK_OrdinaryC, false);
}
const bool TrailingComment = (Comment.size() > 3) && (Comment[3] == '<');
return std::make_pair(K, TrailingComment);
@@ -65,7 +65,7 @@
BeginLineValid(false), EndLineValid(false) {
// Extract raw comment text, if possible.
if (SR.getBegin() == SR.getEnd() || getRawText(SourceMgr).empty()) {
- Kind = CK_Invalid;
+ Kind = RCK_Invalid;
return;
}
@@ -78,7 +78,7 @@
IsAlmostTrailingComment = RawText.startswith("//<") ||
RawText.startswith("/*<");
} else {
- Kind = CK_Merged;
+ Kind = RCK_Merged;
IsTrailingComment = mergedCommentIsTrailingComment(RawText);
}
}
Modified: cfe/branches/tooling/lib/AST/RecordLayout.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/AST/RecordLayout.cpp?rev=159731&r1=159730&r2=159731&view=diff
==============================================================================
--- cfe/branches/tooling/lib/AST/RecordLayout.cpp (original)
+++ cfe/branches/tooling/lib/AST/RecordLayout.cpp Thu Jul 5 02:35:04 2012
@@ -81,7 +81,7 @@
"Primary virtual base must be at offset 0!");
}
} else {
- assert(getBaseClassOffsetInBits(PrimaryBase) == 0 &&
+ assert(getBaseClassOffset(PrimaryBase).isZero() &&
"Primary base must be at offset 0!");
}
}
Modified: cfe/branches/tooling/lib/AST/RecordLayoutBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/AST/RecordLayoutBuilder.cpp?rev=159731&r1=159730&r2=159731&view=diff
==============================================================================
--- cfe/branches/tooling/lib/AST/RecordLayoutBuilder.cpp (original)
+++ cfe/branches/tooling/lib/AST/RecordLayoutBuilder.cpp Thu Jul 5 02:35:04 2012
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+#include "clang/AST/ASTContext.h"
#include "clang/AST/Attr.h"
#include "clang/AST/CXXInheritance.h"
#include "clang/AST/Decl.h"
Modified: cfe/branches/tooling/lib/AST/Stmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/AST/Stmt.cpp?rev=159731&r1=159730&r2=159731&view=diff
==============================================================================
--- cfe/branches/tooling/lib/AST/Stmt.cpp (original)
+++ cfe/branches/tooling/lib/AST/Stmt.cpp Thu Jul 5 02:35:04 2012
@@ -244,6 +244,22 @@
llvm_unreachable("unknown statement kind");
}
+CompoundStmt::CompoundStmt(ASTContext &C, Stmt **StmtStart, unsigned NumStmts,
+ SourceLocation LB, SourceLocation RB)
+ : Stmt(CompoundStmtClass), LBracLoc(LB), RBracLoc(RB) {
+ CompoundStmtBits.NumStmts = NumStmts;
+ assert(CompoundStmtBits.NumStmts == NumStmts &&
+ "NumStmts doesn't fit in bits of CompoundStmtBits.NumStmts!");
+
+ if (NumStmts == 0) {
+ Body = 0;
+ return;
+ }
+
+ Body = new (C) Stmt*[NumStmts];
+ memcpy(Body, StmtStart, NumStmts * sizeof(*Body));
+}
+
void CompoundStmt::setStmts(ASTContext &C, Stmt **Stmts, unsigned NumStmts) {
if (this->Body)
C.Deallocate(Body);
Modified: cfe/branches/tooling/lib/AST/StmtDumper.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/AST/StmtDumper.cpp?rev=159731&r1=159730&r2=159731&view=diff
==============================================================================
--- cfe/branches/tooling/lib/AST/StmtDumper.cpp (original)
+++ cfe/branches/tooling/lib/AST/StmtDumper.cpp Thu Jul 5 02:35:04 2012
@@ -13,6 +13,7 @@
//===----------------------------------------------------------------------===//
#include "clang/AST/StmtVisitor.h"
+#include "clang/AST/ASTContext.h"
#include "clang/AST/DeclObjC.h"
#include "clang/AST/DeclCXX.h"
#include "clang/AST/PrettyPrinter.h"
Modified: cfe/branches/tooling/lib/AST/StmtPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/AST/StmtPrinter.cpp?rev=159731&r1=159730&r2=159731&view=diff
==============================================================================
--- cfe/branches/tooling/lib/AST/StmtPrinter.cpp (original)
+++ cfe/branches/tooling/lib/AST/StmtPrinter.cpp Thu Jul 5 02:35:04 2012
@@ -12,6 +12,7 @@
//
//===----------------------------------------------------------------------===//
+#include "clang/AST/ASTContext.h"
#include "clang/AST/StmtVisitor.h"
#include "clang/AST/DeclCXX.h"
#include "clang/AST/DeclObjC.h"
Modified: cfe/branches/tooling/lib/AST/TypeLoc.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/AST/TypeLoc.cpp?rev=159731&r1=159730&r2=159731&view=diff
==============================================================================
--- cfe/branches/tooling/lib/AST/TypeLoc.cpp (original)
+++ cfe/branches/tooling/lib/AST/TypeLoc.cpp Thu Jul 5 02:35:04 2012
@@ -13,6 +13,7 @@
#include "llvm/Support/raw_ostream.h"
#include "clang/AST/TypeLocVisitor.h"
+#include "clang/AST/ASTContext.h"
#include "clang/AST/Expr.h"
#include "llvm/Support/ErrorHandling.h"
using namespace clang;
Modified: cfe/branches/tooling/lib/AST/TypePrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/AST/TypePrinter.cpp?rev=159731&r1=159730&r2=159731&view=diff
==============================================================================
--- cfe/branches/tooling/lib/AST/TypePrinter.cpp (original)
+++ cfe/branches/tooling/lib/AST/TypePrinter.cpp Thu Jul 5 02:35:04 2012
@@ -11,6 +11,7 @@
//
//===----------------------------------------------------------------------===//
+#include "clang/AST/ASTContext.h"
#include "clang/AST/Decl.h"
#include "clang/AST/DeclObjC.h"
#include "clang/AST/DeclTemplate.h"
Modified: cfe/branches/tooling/lib/AST/VTTBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/AST/VTTBuilder.cpp?rev=159731&r1=159730&r2=159731&view=diff
==============================================================================
--- cfe/branches/tooling/lib/AST/VTTBuilder.cpp (original)
+++ cfe/branches/tooling/lib/AST/VTTBuilder.cpp Thu Jul 5 02:35:04 2012
@@ -13,6 +13,7 @@
//===----------------------------------------------------------------------===//
#include "clang/AST/VTTBuilder.h"
+#include "clang/AST/ASTContext.h"
#include "clang/AST/CXXInheritance.h"
#include "clang/AST/RecordLayout.h"
#include "clang/Basic/TargetInfo.h"
Modified: cfe/branches/tooling/lib/AST/VTableBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/AST/VTableBuilder.cpp?rev=159731&r1=159730&r2=159731&view=diff
==============================================================================
--- cfe/branches/tooling/lib/AST/VTableBuilder.cpp (original)
+++ cfe/branches/tooling/lib/AST/VTableBuilder.cpp Thu Jul 5 02:35:04 2012
@@ -12,6 +12,7 @@
//===----------------------------------------------------------------------===//
#include "clang/AST/VTableBuilder.h"
+#include "clang/AST/ASTContext.h"
#include "clang/AST/CXXInheritance.h"
#include "clang/AST/RecordLayout.h"
#include "clang/Basic/TargetInfo.h"
@@ -630,7 +631,7 @@
// Get the base offset of the primary base.
if (PrimaryBaseIsVirtual) {
- assert(Layout.getVBaseClassOffsetInBits(PrimaryBase) == 0 &&
+ assert(Layout.getVBaseClassOffset(PrimaryBase).isZero() &&
"Primary vbase should have a zero offset!");
const ASTRecordLayout &MostDerivedClassLayout =
@@ -639,7 +640,7 @@
PrimaryBaseOffset =
MostDerivedClassLayout.getVBaseClassOffset(PrimaryBase);
} else {
- assert(Layout.getBaseClassOffsetInBits(PrimaryBase) == 0 &&
+ assert(Layout.getBaseClassOffset(PrimaryBase).isZero() &&
"Primary base should have a zero offset!");
PrimaryBaseOffset = Base.getBaseOffset();
@@ -682,7 +683,7 @@
// primary base will have its vcall and vbase offsets emitted already.
if (PrimaryBase && !Layout.isPrimaryBaseVirtual()) {
// Get the base offset of the primary base.
- assert(Layout.getBaseClassOffsetInBits(PrimaryBase) == 0 &&
+ assert(Layout.getBaseClassOffset(PrimaryBase).isZero() &&
"Primary base should have a zero offset!");
AddVCallOffsets(BaseSubobject(PrimaryBase, Base.getBaseOffset()),
@@ -1370,7 +1371,7 @@
break;
if (Layout.isPrimaryBaseVirtual()) {
- assert(Layout.getVBaseClassOffsetInBits(PrimaryBase) == 0 &&
+ assert(Layout.getVBaseClassOffset(PrimaryBase).isZero() &&
"Primary base should always be at offset 0!");
const ASTRecordLayout &LayoutClassLayout =
@@ -1384,7 +1385,7 @@
break;
}
} else {
- assert(Layout.getBaseClassOffsetInBits(PrimaryBase) == 0 &&
+ assert(Layout.getBaseClassOffset(PrimaryBase).isZero() &&
"Primary base should always be at offset 0!");
}
@@ -1436,7 +1437,7 @@
CharUnits PrimaryBaseOffset;
CharUnits PrimaryBaseOffsetInLayoutClass;
if (Layout.isPrimaryBaseVirtual()) {
- assert(Layout.getVBaseClassOffsetInBits(PrimaryBase) == 0 &&
+ assert(Layout.getVBaseClassOffset(PrimaryBase).isZero() &&
"Primary vbase should have a zero offset!");
const ASTRecordLayout &MostDerivedClassLayout =
@@ -1451,7 +1452,7 @@
PrimaryBaseOffsetInLayoutClass =
LayoutClassLayout.getVBaseClassOffset(PrimaryBase);
} else {
- assert(Layout.getBaseClassOffsetInBits(PrimaryBase) == 0 &&
+ assert(Layout.getBaseClassOffset(PrimaryBase).isZero() &&
"Primary base should have a zero offset!");
PrimaryBaseOffset = Base.getBaseOffset();
Modified: cfe/branches/tooling/lib/ASTMatchers/ASTMatchFinder.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/ASTMatchers/ASTMatchFinder.cpp?rev=159731&r1=159730&r2=159731&view=diff
==============================================================================
--- cfe/branches/tooling/lib/ASTMatchers/ASTMatchFinder.cpp (original)
+++ cfe/branches/tooling/lib/ASTMatchers/ASTMatchFinder.cpp Thu Jul 5 02:35:04 2012
@@ -18,6 +18,7 @@
#include "clang/ASTMatchers/ASTMatchFinder.h"
#include "clang/AST/ASTConsumer.h"
+#include "clang/AST/ASTContext.h"
#include "clang/AST/RecursiveASTVisitor.h"
#include <set>
Modified: cfe/branches/tooling/lib/Analysis/AnalysisDeclContext.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Analysis/AnalysisDeclContext.cpp?rev=159731&r1=159730&r2=159731&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Analysis/AnalysisDeclContext.cpp (original)
+++ cfe/branches/tooling/lib/Analysis/AnalysisDeclContext.cpp Thu Jul 5 02:35:04 2012
@@ -12,6 +12,7 @@
//
//===----------------------------------------------------------------------===//
+#include "clang/AST/ASTContext.h"
#include "clang/AST/Decl.h"
#include "clang/AST/DeclObjC.h"
#include "clang/AST/DeclTemplate.h"
Modified: cfe/branches/tooling/lib/Analysis/CFG.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Analysis/CFG.cpp?rev=159731&r1=159730&r2=159731&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Analysis/CFG.cpp (original)
+++ cfe/branches/tooling/lib/Analysis/CFG.cpp Thu Jul 5 02:35:04 2012
@@ -14,6 +14,7 @@
#include "llvm/Support/SaveAndRestore.h"
#include "clang/Analysis/CFG.h"
+#include "clang/AST/ASTContext.h"
#include "clang/AST/DeclCXX.h"
#include "clang/AST/StmtVisitor.h"
#include "clang/AST/PrettyPrinter.h"
Modified: cfe/branches/tooling/lib/Analysis/PseudoConstantAnalysis.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Analysis/PseudoConstantAnalysis.cpp?rev=159731&r1=159730&r2=159731&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Analysis/PseudoConstantAnalysis.cpp (original)
+++ cfe/branches/tooling/lib/Analysis/PseudoConstantAnalysis.cpp Thu Jul 5 02:35:04 2012
@@ -17,6 +17,7 @@
#include "clang/AST/Decl.h"
#include "clang/AST/Expr.h"
#include "clang/AST/Stmt.h"
+#include "llvm/ADT/SmallPtrSet.h"
#include <deque>
using namespace clang;
Modified: cfe/branches/tooling/lib/Analysis/ThreadSafety.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Analysis/ThreadSafety.cpp?rev=159731&r1=159730&r2=159731&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Analysis/ThreadSafety.cpp (original)
+++ cfe/branches/tooling/lib/Analysis/ThreadSafety.cpp Thu Jul 5 02:35:04 2012
@@ -26,6 +26,7 @@
#include "clang/AST/StmtVisitor.h"
#include "clang/Basic/SourceManager.h"
#include "clang/Basic/SourceLocation.h"
+#include "clang/Basic/OperatorKinds.h"
#include "llvm/ADT/BitVector.h"
#include "llvm/ADT/FoldingSet.h"
#include "llvm/ADT/ImmutableMap.h"
@@ -162,6 +163,13 @@
buildMutexID(At->getArg(), &LRCallCtx);
return;
}
+ // Hack to treat smart pointers and iterators as pointers;
+ // ignore any method named get().
+ if (CMCE->getMethodDecl()->getNameAsString() == "get" &&
+ CMCE->getNumArgs() == 0) {
+ buildMutexID(CMCE->getImplicitObjectArgument(), CallCtx);
+ return;
+ }
DeclSeq.push_back(CMCE->getMethodDecl()->getCanonicalDecl());
buildMutexID(CMCE->getImplicitObjectArgument(), CallCtx);
unsigned NumCallArgs = CMCE->getNumArgs();
@@ -179,6 +187,15 @@
buildMutexID(At->getArg(), &LRCallCtx);
return;
}
+ // Treat smart pointers and iterators as pointers;
+ // ignore the * and -> operators.
+ if (CXXOperatorCallExpr *OE = dyn_cast<CXXOperatorCallExpr>(CE)) {
+ OverloadedOperatorKind k = OE->getOperator();
+ if (k == OO_Arrow || k == OO_Star) {
+ buildMutexID(OE->getArg(0), CallCtx);
+ return;
+ }
+ }
buildMutexID(CE->getCallee(), CallCtx);
unsigned NumCallArgs = CE->getNumArgs();
Expr** CallArgs = CE->getArgs();
@@ -206,15 +223,19 @@
buildMutexID(CE->getSubExpr(), CallCtx);
} else if (ParenExpr *PE = dyn_cast<ParenExpr>(Exp)) {
buildMutexID(PE->getSubExpr(), CallCtx);
+ } else if (ExprWithCleanups *EWC = dyn_cast<ExprWithCleanups>(Exp)) {
+ buildMutexID(EWC->getSubExpr(), CallCtx);
+ } else if (CXXBindTemporaryExpr *E = dyn_cast<CXXBindTemporaryExpr>(Exp)) {
+ buildMutexID(E->getSubExpr(), CallCtx);
} else if (isa<CharacterLiteral>(Exp) ||
- isa<CXXNullPtrLiteralExpr>(Exp) ||
- isa<GNUNullExpr>(Exp) ||
- isa<CXXBoolLiteralExpr>(Exp) ||
- isa<FloatingLiteral>(Exp) ||
- isa<ImaginaryLiteral>(Exp) ||
- isa<IntegerLiteral>(Exp) ||
- isa<StringLiteral>(Exp) ||
- isa<ObjCStringLiteral>(Exp)) {
+ isa<CXXNullPtrLiteralExpr>(Exp) ||
+ isa<GNUNullExpr>(Exp) ||
+ isa<CXXBoolLiteralExpr>(Exp) ||
+ isa<FloatingLiteral>(Exp) ||
+ isa<ImaginaryLiteral>(Exp) ||
+ isa<IntegerLiteral>(Exp) ||
+ isa<StringLiteral>(Exp) ||
+ isa<ObjCStringLiteral>(Exp)) {
return; // FIXME: Ignore literals for now
} else {
// Ignore. FIXME: mark as invalid expression?
@@ -1523,6 +1544,10 @@
Decl *D = *I;
if (VarDecl *VD = dyn_cast_or_null<VarDecl>(D)) {
Expr *E = VD->getInit();
+ // handle constructors that involve temporaries
+ if (ExprWithCleanups *EWC = dyn_cast_or_null<ExprWithCleanups>(E))
+ E = EWC->getSubExpr();
+
if (CXXConstructExpr *CE = dyn_cast_or_null<CXXConstructExpr>(E)) {
NamedDecl *CtorD = dyn_cast_or_null<NamedDecl>(CE->getConstructor());
if (!CtorD || !CtorD->hasAttrs())
Modified: cfe/branches/tooling/lib/Basic/ObjCRuntime.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Basic/ObjCRuntime.cpp?rev=159731&r1=159730&r2=159731&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Basic/ObjCRuntime.cpp (original)
+++ cfe/branches/tooling/lib/Basic/ObjCRuntime.cpp Thu Jul 5 02:35:04 2012
@@ -30,8 +30,8 @@
case ObjCRuntime::MacOSX: out << "macosx"; break;
case ObjCRuntime::FragileMacOSX: out << "macosx-fragile"; break;
case ObjCRuntime::iOS: out << "ios"; break;
- case ObjCRuntime::GNU: out << "gnu"; break;
- case ObjCRuntime::FragileGNU: out << "gnu-fragile"; break;
+ case ObjCRuntime::GNUstep: out << "gnustep"; break;
+ case ObjCRuntime::GCC: out << "gcc"; break;
}
if (value.getVersion() > VersionTuple(0)) {
out << '-' << value.getVersion();
@@ -54,22 +54,25 @@
// Everything prior to that must be a valid string name.
Kind kind;
StringRef runtimeName = input.substr(0, dash);
+ Version = VersionTuple(0);
if (runtimeName == "macosx") {
kind = ObjCRuntime::MacOSX;
} else if (runtimeName == "macosx-fragile") {
kind = ObjCRuntime::FragileMacOSX;
} else if (runtimeName == "ios") {
kind = ObjCRuntime::iOS;
- } else if (runtimeName == "gnu") {
- kind = ObjCRuntime::GNU;
- } else if (runtimeName == "gnu-fragile") {
- kind = ObjCRuntime::FragileGNU;
+ } else if (runtimeName == "gnustep") {
+ // If no version is specified then default to the most recent one that we
+ // know about.
+ Version = VersionTuple(1, 6);
+ kind = ObjCRuntime::GNUstep;
+ } else if (runtimeName == "gcc") {
+ kind = ObjCRuntime::GCC;
} else {
return true;
}
TheKind = kind;
- Version = VersionTuple(0);
if (dash != StringRef::npos) {
StringRef verString = input.substr(dash + 1);
if (Version.tryParse(verString))
Modified: cfe/branches/tooling/lib/Basic/Targets.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Basic/Targets.cpp?rev=159731&r1=159730&r2=159731&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Basic/Targets.cpp (original)
+++ cfe/branches/tooling/lib/Basic/Targets.cpp Thu Jul 5 02:35:04 2012
@@ -582,6 +582,19 @@
LongDoubleFormat = &llvm::APFloat::PPCDoubleDouble;
}
+ /// \brief Flags for architecture specific defines.
+ typedef enum {
+ ArchDefineNone = 0,
+ ArchDefineName = 1 << 0, // <name> is substituted for arch name.
+ ArchDefinePpcgr = 1 << 1,
+ ArchDefinePpcsq = 1 << 2,
+ ArchDefine440 = 1 << 3,
+ ArchDefine603 = 1 << 4,
+ ArchDefine604 = 1 << 5,
+ ArchDefinePwr4 = 1 << 6,
+ ArchDefinePwr6 = 1 << 7
+ } ArchDefineTypes;
+
virtual bool setCPU(const std::string &Name) {
bool CPUKnown = llvm::StringSwitch<bool>(Name)
.Case("generic", true)
@@ -781,17 +794,44 @@
}
// CPU identification.
- if (CPU == "440") {
- Builder.defineMacro("_ARCH_440");
- } else if (CPU == "450") {
+ ArchDefineTypes defs = (ArchDefineTypes)llvm::StringSwitch<int>(CPU)
+ .Case("440", ArchDefineName)
+ .Case("450", ArchDefineName | ArchDefine440)
+ .Case("601", ArchDefineName)
+ .Case("602", ArchDefineName | ArchDefinePpcgr)
+ .Case("603", ArchDefineName | ArchDefinePpcgr)
+ .Case("603e", ArchDefineName | ArchDefine603 | ArchDefinePpcgr)
+ .Case("603ev", ArchDefineName | ArchDefine603 | ArchDefinePpcgr)
+ .Case("604", ArchDefineName | ArchDefinePpcgr)
+ .Case("604e", ArchDefineName | ArchDefine604 | ArchDefinePpcgr)
+ .Case("620", ArchDefineName | ArchDefinePpcgr)
+ .Case("7400", ArchDefineName | ArchDefinePpcgr)
+ .Case("7450", ArchDefineName | ArchDefinePpcgr)
+ .Case("750", ArchDefineName | ArchDefinePpcgr)
+ .Case("970", ArchDefineName | ArchDefinePwr4 | ArchDefinePpcgr
+ | ArchDefinePpcsq)
+ .Case("pwr6", ArchDefinePwr6 | ArchDefinePpcgr | ArchDefinePpcsq)
+ .Case("pwr7", ArchDefineName | ArchDefinePwr6 | ArchDefinePpcgr
+ | ArchDefinePpcsq)
+ .Default(ArchDefineNone);
+
+ if (defs & ArchDefineName)
+ Builder.defineMacro(Twine("_ARCH_", StringRef(CPU).upper()));
+ if (defs & ArchDefinePpcgr)
+ Builder.defineMacro("_ARCH_PPCGR");
+ if (defs & ArchDefinePpcsq)
+ Builder.defineMacro("_ARCH_PPCSQ");
+ if (defs & ArchDefine440)
Builder.defineMacro("_ARCH_440");
- Builder.defineMacro("_ARCH_450");
- } else if (CPU == "970") {
- Builder.defineMacro("_ARCH_970");
- } else if (CPU == "pwr6") {
+ if (defs & ArchDefine603)
+ Builder.defineMacro("_ARCH_603");
+ if (defs & ArchDefine604)
+ Builder.defineMacro("_ARCH_604");
+ if (defs & (ArchDefinePwr4 | ArchDefinePwr6))
+ Builder.defineMacro("_ARCH_PWR4");
+ if (defs & ArchDefinePwr6) {
+ Builder.defineMacro("_ARCH_PWR5");
Builder.defineMacro("_ARCH_PWR6");
- } else if (CPU == "pwr7") {
- Builder.defineMacro("_ARCH_PWR7");
}
}
Modified: cfe/branches/tooling/lib/CodeGen/CGCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/CodeGen/CGCXX.cpp?rev=159731&r1=159730&r2=159731&view=diff
==============================================================================
--- cfe/branches/tooling/lib/CodeGen/CGCXX.cpp (original)
+++ cfe/branches/tooling/lib/CodeGen/CGCXX.cpp Thu Jul 5 02:35:04 2012
@@ -91,7 +91,7 @@
// If the base is at a non-zero offset, give up.
const ASTRecordLayout &ClassLayout = Context.getASTRecordLayout(Class);
- if (ClassLayout.getBaseClassOffsetInBits(UniqueBase) != 0)
+ if (!ClassLayout.getBaseClassOffset(UniqueBase).isZero())
return true;
return TryEmitDefinitionAsAlias(GlobalDecl(D, Dtor_Base),
Modified: cfe/branches/tooling/lib/CodeGen/CGDebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/CodeGen/CGDebugInfo.cpp?rev=159731&r1=159730&r2=159731&view=diff
==============================================================================
--- cfe/branches/tooling/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/branches/tooling/lib/CodeGen/CGDebugInfo.cpp Thu Jul 5 02:35:04 2012
@@ -1050,7 +1050,7 @@
.getVirtualBaseOffsetOffset(RD, Base).getQuantity();
BFlags = llvm::DIDescriptor::FlagVirtual;
} else
- BaseOffset = RL.getBaseClassOffsetInBits(Base);
+ BaseOffset = CGM.getContext().toBits(RL.getBaseClassOffset(Base));
// FIXME: Inconsistent units for BaseOffset. It is in bytes when
// BI->isVirtual() and bits when not.
Modified: cfe/branches/tooling/lib/CodeGen/CGDebugInfo.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/CodeGen/CGDebugInfo.h?rev=159731&r1=159730&r2=159731&view=diff
==============================================================================
--- cfe/branches/tooling/lib/CodeGen/CGDebugInfo.h (original)
+++ cfe/branches/tooling/lib/CodeGen/CGDebugInfo.h Thu Jul 5 02:35:04 2012
@@ -30,6 +30,7 @@
}
namespace clang {
+ class CXXMethodDecl;
class VarDecl;
class ObjCInterfaceDecl;
class ClassTemplateSpecializationDecl;
Modified: cfe/branches/tooling/lib/CodeGen/CGException.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/CodeGen/CGException.cpp?rev=159731&r1=159730&r2=159731&view=diff
==============================================================================
--- cfe/branches/tooling/lib/CodeGen/CGException.cpp (original)
+++ cfe/branches/tooling/lib/CodeGen/CGException.cpp Thu Jul 5 02:35:04 2012
@@ -186,8 +186,8 @@
case ObjCRuntime::MacOSX:
case ObjCRuntime::iOS:
return EHPersonality::NeXT_ObjC;
- case ObjCRuntime::GNU:
- case ObjCRuntime::FragileGNU:
+ case ObjCRuntime::GNUstep:
+ case ObjCRuntime::GCC:
return EHPersonality::GNU_ObjC;
}
llvm_unreachable("bad runtime kind");
@@ -216,10 +216,11 @@
case ObjCRuntime::FragileMacOSX:
return getCXXPersonality(L);
- // The GNU runtime's personality function inherently doesn't support
+ // The GCC runtime's personality function inherently doesn't support
// mixed EH. Use the C++ personality just to avoid returning null.
- case ObjCRuntime::GNU:
- case ObjCRuntime::FragileGNU:
+ case ObjCRuntime::GCC:
+ return EHPersonality::GNU_ObjC;
+ case ObjCRuntime::GNUstep:
return EHPersonality::GNU_ObjCXX;
}
llvm_unreachable("bad runtime kind");
Modified: cfe/branches/tooling/lib/CodeGen/CGExprConstant.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/CodeGen/CGExprConstant.cpp?rev=159731&r1=159730&r2=159731&view=diff
==============================================================================
--- cfe/branches/tooling/lib/CodeGen/CGExprConstant.cpp (original)
+++ cfe/branches/tooling/lib/CodeGen/CGExprConstant.cpp Thu Jul 5 02:35:04 2012
@@ -1301,7 +1301,8 @@
if (CGM.getTypes().isZeroInitializable(BaseDecl))
continue;
- uint64_t BaseOffset = Layout.getBaseClassOffsetInBits(BaseDecl);
+ uint64_t BaseOffset =
+ CGM.getContext().toBits(Layout.getBaseClassOffset(BaseDecl));
FillInNullDataMemberPointers(CGM, I->getType(),
Elements, StartOffset + BaseOffset);
}
Modified: cfe/branches/tooling/lib/CodeGen/CGExprScalar.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/CodeGen/CGExprScalar.cpp?rev=159731&r1=159730&r2=159731&view=diff
==============================================================================
--- cfe/branches/tooling/lib/CodeGen/CGExprScalar.cpp (original)
+++ cfe/branches/tooling/lib/CodeGen/CGExprScalar.cpp Thu Jul 5 02:35:04 2012
@@ -1555,9 +1555,8 @@
// Compute the offset to the base.
const RecordType *BaseRT = CurrentType->getAs<RecordType>();
CXXRecordDecl *BaseRD = cast<CXXRecordDecl>(BaseRT->getDecl());
- int64_t OffsetInt = RL.getBaseClassOffsetInBits(BaseRD) /
- CGF.getContext().getCharWidth();
- Offset = llvm::ConstantInt::get(ResultType, OffsetInt);
+ CharUnits OffsetInt = RL.getBaseClassOffset(BaseRD);
+ Offset = llvm::ConstantInt::get(ResultType, OffsetInt.getQuantity());
break;
}
}
Modified: cfe/branches/tooling/lib/CodeGen/CGObjCGNU.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/CodeGen/CGObjCGNU.cpp?rev=159731&r1=159730&r2=159731&view=diff
==============================================================================
--- cfe/branches/tooling/lib/CodeGen/CGObjCGNU.cpp (original)
+++ cfe/branches/tooling/lib/CodeGen/CGObjCGNU.cpp Thu Jul 5 02:35:04 2012
@@ -2666,10 +2666,10 @@
CGObjCRuntime *
clang::CodeGen::CreateGNUObjCRuntime(CodeGenModule &CGM) {
switch (CGM.getLangOpts().ObjCRuntime.getKind()) {
- case ObjCRuntime::GNU:
+ case ObjCRuntime::GNUstep:
return new CGObjCGNUstep(CGM);
- case ObjCRuntime::FragileGNU:
+ case ObjCRuntime::GCC:
return new CGObjCGCC(CGM);
case ObjCRuntime::FragileMacOSX:
Modified: cfe/branches/tooling/lib/CodeGen/CGObjCMac.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/CodeGen/CGObjCMac.cpp?rev=159731&r1=159730&r2=159731&view=diff
==============================================================================
--- cfe/branches/tooling/lib/CodeGen/CGObjCMac.cpp (original)
+++ cfe/branches/tooling/lib/CodeGen/CGObjCMac.cpp Thu Jul 5 02:35:04 2012
@@ -6389,8 +6389,8 @@
case ObjCRuntime::iOS:
return new CGObjCNonFragileABIMac(CGM);
- case ObjCRuntime::GNU:
- case ObjCRuntime::FragileGNU:
+ case ObjCRuntime::GNUstep:
+ case ObjCRuntime::GCC:
llvm_unreachable("these runtimes are not Mac runtimes");
}
llvm_unreachable("bad runtime");
Modified: cfe/branches/tooling/lib/CodeGen/CodeGenModule.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/CodeGen/CodeGenModule.cpp?rev=159731&r1=159730&r2=159731&view=diff
==============================================================================
--- cfe/branches/tooling/lib/CodeGen/CodeGenModule.cpp (original)
+++ cfe/branches/tooling/lib/CodeGen/CodeGenModule.cpp Thu Jul 5 02:35:04 2012
@@ -138,8 +138,8 @@
// This is just isGNUFamily(), but we want to force implementors of
// new ABIs to decide how best to do this.
switch (LangOpts.ObjCRuntime.getKind()) {
- case ObjCRuntime::GNU:
- case ObjCRuntime::FragileGNU:
+ case ObjCRuntime::GNUstep:
+ case ObjCRuntime::GCC:
ObjCRuntime = CreateGNUObjCRuntime(*this);
return;
@@ -546,7 +546,7 @@
// If ObjC exceptions are enabled, this depends on the ABI.
if (LangOpts.ObjCExceptions) {
- if (LangOpts.ObjCRuntime.isFragile()) return false;
+ return LangOpts.ObjCRuntime.hasUnwindExceptions();
}
return true;
Modified: cfe/branches/tooling/lib/CodeGen/TargetInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/CodeGen/TargetInfo.cpp?rev=159731&r1=159730&r2=159731&view=diff
==============================================================================
--- cfe/branches/tooling/lib/CodeGen/TargetInfo.cpp (original)
+++ cfe/branches/tooling/lib/CodeGen/TargetInfo.cpp Thu Jul 5 02:35:04 2012
@@ -1350,7 +1350,8 @@
// single eightbyte, each is classified separately. Each eightbyte gets
// initialized to class NO_CLASS.
Class FieldLo, FieldHi;
- uint64_t Offset = OffsetBase + Layout.getBaseClassOffsetInBits(Base);
+ uint64_t Offset =
+ OffsetBase + getContext().toBits(Layout.getBaseClassOffset(Base));
classify(i->getType(), Offset, FieldLo, FieldHi);
Lo = merge(Lo, FieldLo);
Hi = merge(Hi, FieldHi);
@@ -1589,7 +1590,7 @@
cast<CXXRecordDecl>(i->getType()->getAs<RecordType>()->getDecl());
// If the base is after the span we care about, ignore it.
- unsigned BaseOffset = (unsigned)Layout.getBaseClassOffsetInBits(Base);
+ unsigned BaseOffset = Context.toBits(Layout.getBaseClassOffset(Base));
if (BaseOffset >= EndBit) continue;
unsigned BaseStart = BaseOffset < StartBit ? StartBit-BaseOffset :0;
@@ -3166,14 +3167,16 @@
namespace {
class MipsABIInfo : public ABIInfo {
bool IsO32;
- unsigned MinABIStackAlignInBytes;
- llvm::Type* CoerceToIntArgs(uint64_t TySize) const;
+ unsigned MinABIStackAlignInBytes, StackAlignInBytes;
+ void CoerceToIntArgs(uint64_t TySize,
+ SmallVector<llvm::Type*, 8> &ArgList) const;
llvm::Type* HandleAggregates(QualType Ty, uint64_t TySize) const;
llvm::Type* returnAggregateInRegs(QualType RetTy, uint64_t Size) const;
llvm::Type* getPaddingType(uint64_t Align, uint64_t Offset) const;
public:
MipsABIInfo(CodeGenTypes &CGT, bool _IsO32) :
- ABIInfo(CGT), IsO32(_IsO32), MinABIStackAlignInBytes(IsO32 ? 4 : 8) {}
+ ABIInfo(CGT), IsO32(_IsO32), MinABIStackAlignInBytes(IsO32 ? 4 : 8),
+ StackAlignInBytes(IsO32 ? 8 : 16) {}
ABIArgInfo classifyReturnType(QualType RetTy) const;
ABIArgInfo classifyArgumentType(QualType RetTy, uint64_t &Offset) const;
@@ -3202,10 +3205,10 @@
};
}
-llvm::Type* MipsABIInfo::CoerceToIntArgs(uint64_t TySize) const {
- SmallVector<llvm::Type*, 8> ArgList;
- llvm::IntegerType *IntTy = llvm::IntegerType::get(getVMContext(),
- MinABIStackAlignInBytes * 8);
+void MipsABIInfo::CoerceToIntArgs(uint64_t TySize,
+ SmallVector<llvm::Type*, 8> &ArgList) const {
+ llvm::IntegerType *IntTy =
+ llvm::IntegerType::get(getVMContext(), MinABIStackAlignInBytes * 8);
// Add (TySize / MinABIStackAlignInBytes) args of IntTy.
for (unsigned N = TySize / (MinABIStackAlignInBytes * 8); N; --N)
@@ -3216,24 +3219,28 @@
if (R)
ArgList.push_back(llvm::IntegerType::get(getVMContext(), R));
-
- return llvm::StructType::get(getVMContext(), ArgList);
}
// In N32/64, an aligned double precision floating point field is passed in
// a register.
llvm::Type* MipsABIInfo::HandleAggregates(QualType Ty, uint64_t TySize) const {
- if (IsO32)
- return CoerceToIntArgs(TySize);
+ SmallVector<llvm::Type*, 8> ArgList, IntArgList;
+
+ if (IsO32) {
+ CoerceToIntArgs(TySize, ArgList);
+ return llvm::StructType::get(getVMContext(), ArgList);
+ }
if (Ty->isComplexType())
return CGT.ConvertType(Ty);
const RecordType *RT = Ty->getAs<RecordType>();
- // Unions are passed in integer registers.
- if (!RT || !RT->isStructureOrClassType())
- return CoerceToIntArgs(TySize);
+ // Unions/vectors are passed in integer registers.
+ if (!RT || !RT->isStructureOrClassType()) {
+ CoerceToIntArgs(TySize, ArgList);
+ return llvm::StructType::get(getVMContext(), ArgList);
+ }
const RecordDecl *RD = RT->getDecl();
const ASTRecordLayout &Layout = getContext().getASTRecordLayout(RD);
@@ -3242,7 +3249,6 @@
uint64_t LastOffset = 0;
unsigned idx = 0;
llvm::IntegerType *I64 = llvm::IntegerType::get(getVMContext(), 64);
- SmallVector<llvm::Type*, 8> ArgList;
// Iterate over fields in the struct/class and check if there are any aligned
// double fields.
@@ -3267,15 +3273,8 @@
LastOffset = Offset + 64;
}
- // Add ((TySize - LastOffset) / 64) args of type i64.
- for (unsigned N = (TySize - LastOffset) / 64; N; --N)
- ArgList.push_back(I64);
-
- // If the size of the remainder is not zero, add one more integer type to
- // ArgList.
- unsigned R = (TySize - LastOffset) % 64;
- if (R)
- ArgList.push_back(llvm::IntegerType::get(getVMContext(), R));
+ CoerceToIntArgs(TySize - LastOffset, IntArgList);
+ ArgList.append(IntArgList.begin(), IntArgList.end());
return llvm::StructType::get(getVMContext(), ArgList);
}
@@ -3295,11 +3294,12 @@
uint64_t TySize = getContext().getTypeSize(Ty);
uint64_t Align = getContext().getTypeAlign(Ty) / 8;
- Align = std::max(Align, (uint64_t)MinABIStackAlignInBytes);
+ Align = std::min(std::max(Align, (uint64_t)MinABIStackAlignInBytes),
+ (uint64_t)StackAlignInBytes);
Offset = llvm::RoundUpToAlignment(Offset, Align);
Offset += llvm::RoundUpToAlignment(TySize, Align * 8) / 8;
- if (isAggregateTypeForABI(Ty)) {
+ if (isAggregateTypeForABI(Ty) || Ty->isVectorType()) {
// Ignore empty aggregates.
if (TySize == 0)
return ABIArgInfo::getIgnore();
@@ -3331,7 +3331,7 @@
llvm::Type*
MipsABIInfo::returnAggregateInRegs(QualType RetTy, uint64_t Size) const {
const RecordType *RT = RetTy->getAs<RecordType>();
- SmallVector<llvm::Type*, 2> RTList;
+ SmallVector<llvm::Type*, 8> RTList;
if (RT && RT->isStructureOrClassType()) {
const RecordDecl *RD = RT->getDecl();
@@ -3366,11 +3366,7 @@
}
}
- RTList.push_back(llvm::IntegerType::get(getVMContext(),
- std::min(Size, (uint64_t)64)));
- if (Size > 64)
- RTList.push_back(llvm::IntegerType::get(getVMContext(), Size - 64));
-
+ CoerceToIntArgs(Size, RTList);
return llvm::StructType::get(getVMContext(), RTList);
}
@@ -3385,6 +3381,10 @@
if (RetTy->isAnyComplexType())
return ABIArgInfo::getDirect();
+ // O32 returns integer vectors in registers.
+ if (IsO32 && RetTy->isVectorType() && !RetTy->hasFloatingRepresentation())
+ return ABIArgInfo::getDirect(returnAggregateInRegs(RetTy, Size));
+
if (!IsO32 && !isRecordWithNonTrivialDestructorOrCopyConstructor(RetTy))
return ABIArgInfo::getDirect(returnAggregateInRegs(RetTy, Size));
}
Modified: cfe/branches/tooling/lib/Driver/ToolChain.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Driver/ToolChain.cpp?rev=159731&r1=159730&r2=159731&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Driver/ToolChain.cpp (original)
+++ cfe/branches/tooling/lib/Driver/ToolChain.cpp Thu Jul 5 02:35:04 2012
@@ -50,7 +50,7 @@
}
ObjCRuntime ToolChain::getDefaultObjCRuntime(bool isNonFragile) const {
- return ObjCRuntime(isNonFragile ? ObjCRuntime::GNU : ObjCRuntime::FragileGNU,
+ return ObjCRuntime(isNonFragile ? ObjCRuntime::GNUstep : ObjCRuntime::GCC,
VersionTuple());
}
Modified: cfe/branches/tooling/lib/Driver/ToolChains.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Driver/ToolChains.h?rev=159731&r1=159730&r2=159731&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Driver/ToolChains.h (original)
+++ cfe/branches/tooling/lib/Driver/ToolChains.h Thu Jul 5 02:35:04 2012
@@ -329,12 +329,7 @@
// Non-fragile ABI is default for everything but i386.
return getTriple().getArch() != llvm::Triple::x86;
}
- virtual bool IsObjCLegacyDispatchDefault() const {
- // This is only used with the non-fragile ABI.
- // Legacy dispatch is used everywhere except on x86_64.
- return getTriple().getArch() != llvm::Triple::x86_64;
- }
virtual bool UseObjCMixedDispatch() const {
// This is only used with the non-fragile ABI and non-legacy dispatch.
@@ -445,14 +440,6 @@
virtual bool IsMathErrnoDefault() const { return false; }
virtual bool IsObjCNonFragileABIDefault() const { return true; }
- virtual bool IsObjCLegacyDispatchDefault() const {
- llvm::Triple::ArchType Arch = getTriple().getArch();
- if (Arch == llvm::Triple::arm ||
- Arch == llvm::Triple::x86 ||
- Arch == llvm::Triple::x86_64)
- return false;
- return true;
- }
virtual Tool &SelectTool(const Compilation &C, const JobAction &JA,
const ActionList &Inputs) const;
@@ -464,14 +451,6 @@
virtual bool IsMathErrnoDefault() const { return false; }
virtual bool IsObjCNonFragileABIDefault() const { return true; }
- virtual bool IsObjCLegacyDispatchDefault() const {
- llvm::Triple::ArchType Arch = getTriple().getArch();
- if (Arch == llvm::Triple::arm ||
- Arch == llvm::Triple::x86 ||
- Arch == llvm::Triple::x86_64)
- return false;
- return true;
- }
virtual Tool &SelectTool(const Compilation &C, const JobAction &JA,
const ActionList &Inputs) const;
@@ -483,14 +462,6 @@
virtual bool IsMathErrnoDefault() const { return false; }
virtual bool IsObjCNonFragileABIDefault() const { return true; }
- virtual bool IsObjCLegacyDispatchDefault() const {
- llvm::Triple::ArchType Arch = getTriple().getArch();
- if (Arch == llvm::Triple::arm ||
- Arch == llvm::Triple::x86 ||
- Arch == llvm::Triple::x86_64)
- return false;
- return true;
- }
virtual Tool &SelectTool(const Compilation &C, const JobAction &JA,
const ActionList &Inputs) const;
Modified: cfe/branches/tooling/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Driver/Tools.cpp?rev=159731&r1=159730&r2=159731&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Driver/Tools.cpp (original)
+++ cfe/branches/tooling/lib/Driver/Tools.cpp Thu Jul 5 02:35:04 2012
@@ -2467,7 +2467,8 @@
if (objcRuntime.isNonFragile()) {
if (!Args.hasFlag(options::OPT_fobjc_legacy_dispatch,
options::OPT_fno_objc_legacy_dispatch,
- getToolChain().IsObjCLegacyDispatchDefault())) {
+ objcRuntime.isLegacyDispatchDefaultForArch(
+ getToolChain().getTriple().getArch()))) {
if (getToolChain().UseObjCMixedDispatch())
CmdArgs.push_back("-fobjc-dispatch-method=mixed");
else
@@ -2934,7 +2935,12 @@
// -fgnu-runtime
} else {
assert(runtimeArg->getOption().matches(options::OPT_fgnu_runtime));
- runtime = ObjCRuntime(ObjCRuntime::GNU, VersionTuple());
+ // Legacy behaviour is to target the gnustep runtime if we are i
+ // non-fragile mode or the GCC runtime in fragile mode.
+ if (isNonFragile)
+ runtime = ObjCRuntime(ObjCRuntime::GNUstep, VersionTuple());
+ else
+ runtime = ObjCRuntime(ObjCRuntime::GCC, VersionTuple());
}
cmdArgs.push_back(args.MakeArgString(
@@ -4341,6 +4347,14 @@
// darwin_crt2 spec is empty.
}
+ // By default on OS X 10.8 and later, we don't link with a crt1.o
+ // file and the linker knows to use _main as the entry point. But,
+ // when compiling with -pg, we need to link with the gcrt1.o file,
+ // so pass the -no_new_main option to tell the linker to use the
+ // "start" symbol as the entry point.
+ if (getDarwinToolChain().isTargetMacOS() &&
+ !getDarwinToolChain().isMacosxVersionLT(10, 8))
+ CmdArgs.push_back("-no_new_main");
} else {
if (Args.hasArg(options::OPT_static) ||
Args.hasArg(options::OPT_object) ||
Modified: cfe/branches/tooling/lib/Edit/RewriteObjCFoundationAPI.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Edit/RewriteObjCFoundationAPI.cpp?rev=159731&r1=159730&r2=159731&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Edit/RewriteObjCFoundationAPI.cpp (original)
+++ cfe/branches/tooling/lib/Edit/RewriteObjCFoundationAPI.cpp Thu Jul 5 02:35:04 2012
@@ -14,6 +14,7 @@
#include "clang/Edit/Rewriters.h"
#include "clang/Edit/Commit.h"
#include "clang/Lex/Lexer.h"
+#include "clang/AST/ASTContext.h"
#include "clang/AST/ExprObjC.h"
#include "clang/AST/ExprCXX.h"
#include "clang/AST/NSAPI.h"
Modified: cfe/branches/tooling/lib/Frontend/ASTUnit.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Frontend/ASTUnit.cpp?rev=159731&r1=159730&r2=159731&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Frontend/ASTUnit.cpp (original)
+++ cfe/branches/tooling/lib/Frontend/ASTUnit.cpp Thu Jul 5 02:35:04 2012
@@ -116,7 +116,8 @@
}
static void cleanupOnDiskMapAtExit(void) {
- // No mutex required here since we are leaving the program.
+ // Use the mutex because there can be an alive thread destroying an ASTUnit.
+ llvm::MutexGuard Guard(getOnDiskMutex());
OnDiskDataMap &M = getOnDiskDataMap();
for (OnDiskDataMap::iterator I = M.begin(), E = M.end(); I != E; ++I) {
// We don't worry about freeing the memory associated with OnDiskDataMap.
Modified: cfe/branches/tooling/lib/Parse/ParseAST.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Parse/ParseAST.cpp?rev=159731&r1=159730&r2=159731&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Parse/ParseAST.cpp (original)
+++ cfe/branches/tooling/lib/Parse/ParseAST.cpp Thu Jul 5 02:35:04 2012
@@ -18,6 +18,7 @@
#include "clang/Sema/SemaConsumer.h"
#include "clang/Sema/ExternalSemaSource.h"
#include "clang/AST/ASTConsumer.h"
+#include "clang/AST/ASTContext.h"
#include "clang/AST/DeclCXX.h"
#include "clang/AST/ExternalASTSource.h"
#include "clang/AST/Stmt.h"
Modified: cfe/branches/tooling/lib/Parse/ParseDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Parse/ParseDecl.cpp?rev=159731&r1=159730&r2=159731&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Parse/ParseDecl.cpp (original)
+++ cfe/branches/tooling/lib/Parse/ParseDecl.cpp Thu Jul 5 02:35:04 2012
@@ -1613,7 +1613,8 @@
Actions.AddInitializerToDecl(ThisDecl, Initializer.take(),
/*DirectInit=*/true, TypeContainsAuto);
}
- } else if (getLangOpts().CPlusPlus0x && Tok.is(tok::l_brace)) {
+ } else if (getLangOpts().CPlusPlus0x && Tok.is(tok::l_brace) &&
+ (!CurParsedObjCImpl || !D.isFunctionDeclarator())) {
// Parse C++0x braced-init-list.
Diag(Tok, diag::warn_cxx98_compat_generalized_initializer_lists);
Modified: cfe/branches/tooling/lib/Parse/ParseStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Parse/ParseStmt.cpp?rev=159731&r1=159730&r2=159731&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Parse/ParseStmt.cpp (original)
+++ cfe/branches/tooling/lib/Parse/ParseStmt.cpp Thu Jul 5 02:35:04 2012
@@ -1491,6 +1491,8 @@
// statememt before parsing the body, in order to be able to deduce the type
// of an auto-typed loop variable.
StmtResult ForRangeStmt;
+ StmtResult ForEachStmt;
+
if (ForRange) {
ForRangeStmt = Actions.ActOnCXXForRangeStmt(ForLoc, T.getOpenLocation(),
FirstPart.take(),
@@ -1502,9 +1504,10 @@
// Similarly, we need to do the semantic analysis for a for-range
// statement immediately in order to close over temporaries correctly.
} else if (ForEach) {
- if (!Collection.isInvalid())
- Collection =
- Actions.ActOnObjCForCollectionOperand(ForLoc, Collection.take());
+ ForEachStmt = Actions.ActOnObjCForCollectionStmt(ForLoc, T.getOpenLocation(),
+ FirstPart.take(),
+ Collection.take(),
+ T.getCloseLocation());
}
// C99 6.8.5p5 - In C99, the body of the if statement is a scope, even if
@@ -1534,11 +1537,8 @@
return StmtError();
if (ForEach)
- return Actions.ActOnObjCForCollectionStmt(ForLoc, T.getOpenLocation(),
- FirstPart.take(),
- Collection.take(),
- T.getCloseLocation(),
- Body.take());
+ return Actions.FinishObjCForCollectionStmt(ForEachStmt.take(),
+ Body.take());
if (ForRange)
return Actions.FinishCXXForRangeStmt(ForRangeStmt.take(), Body.take());
Modified: cfe/branches/tooling/lib/Sema/AttributeList.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Sema/AttributeList.cpp?rev=159731&r1=159730&r2=159731&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Sema/AttributeList.cpp (original)
+++ cfe/branches/tooling/lib/Sema/AttributeList.cpp Thu Jul 5 02:35:04 2012
@@ -12,6 +12,7 @@
//===----------------------------------------------------------------------===//
#include "clang/Sema/AttributeList.h"
+#include "clang/AST/ASTContext.h"
#include "clang/AST/Expr.h"
#include "clang/Basic/IdentifierTable.h"
#include "llvm/ADT/StringSwitch.h"
Modified: cfe/branches/tooling/lib/Sema/Sema.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Sema/Sema.cpp?rev=159731&r1=159730&r2=159731&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Sema/Sema.cpp (original)
+++ cfe/branches/tooling/lib/Sema/Sema.cpp Thu Jul 5 02:35:04 2012
@@ -1029,10 +1029,10 @@
Comment.getBegin().getLocWithOffset(3));
StringRef MagicMarkerText;
switch (RC.getKind()) {
- case RawComment::CK_OrdinaryBCPL:
+ case RawComment::RCK_OrdinaryBCPL:
MagicMarkerText = "///<";
break;
- case RawComment::CK_OrdinaryC:
+ case RawComment::RCK_OrdinaryC:
MagicMarkerText = "/**<";
break;
default:
Modified: cfe/branches/tooling/lib/Sema/SemaAccess.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Sema/SemaAccess.cpp?rev=159731&r1=159730&r2=159731&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Sema/SemaAccess.cpp (original)
+++ cfe/branches/tooling/lib/Sema/SemaAccess.cpp Thu Jul 5 02:35:04 2012
@@ -152,7 +152,8 @@
CXXRecordDecl *NamingClass,
DeclAccessPair FoundDecl,
QualType BaseObjectType)
- : AccessedEntity(Context, Member, NamingClass, FoundDecl, BaseObjectType) {
+ : AccessedEntity(Context.getDiagAllocator(), Member, NamingClass,
+ FoundDecl, BaseObjectType) {
initialize();
}
@@ -161,7 +162,8 @@
CXXRecordDecl *BaseClass,
CXXRecordDecl *DerivedClass,
AccessSpecifier Access)
- : AccessedEntity(Context, Base, BaseClass, DerivedClass, Access) {
+ : AccessedEntity(Context.getDiagAllocator(), Base, BaseClass, DerivedClass,
+ Access) {
initialize();
}
Modified: cfe/branches/tooling/lib/Sema/SemaDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Sema/SemaDeclCXX.cpp?rev=159731&r1=159730&r2=159731&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Sema/SemaDeclCXX.cpp (original)
+++ cfe/branches/tooling/lib/Sema/SemaDeclCXX.cpp Thu Jul 5 02:35:04 2012
@@ -6801,7 +6801,7 @@
}
SourceLocation Loc = Constructor->getLocation();
- Constructor->setBody(new (Context) CompoundStmt(Context, 0, 0, Loc, Loc));
+ Constructor->setBody(new (Context) CompoundStmt(Loc));
Constructor->setUsed();
MarkVTableUsed(CurrentLocation, ClassDecl);
@@ -7162,7 +7162,7 @@
}
SourceLocation Loc = Destructor->getLocation();
- Destructor->setBody(new (Context) CompoundStmt(Context, 0, 0, Loc, Loc));
+ Destructor->setBody(new (Context) CompoundStmt(Loc));
Destructor->setImplicitlyDefined(true);
Destructor->setUsed();
MarkVTableUsed(CurrentLocation, ClassDecl);
@@ -8905,8 +8905,7 @@
// will fill in the actual details.
Invoke->setUsed();
Invoke->setReferenced();
- Invoke->setBody(new (Context) CompoundStmt(Context, 0, 0, Conv->getLocation(),
- Conv->getLocation()));
+ Invoke->setBody(new (Context) CompoundStmt(Conv->getLocation()));
if (ASTMutationListener *L = getASTMutationListener()) {
L->CompletedImplicitDefinition(Conv);
Modified: cfe/branches/tooling/lib/Sema/SemaFixItUtils.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Sema/SemaFixItUtils.cpp?rev=159731&r1=159730&r2=159731&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Sema/SemaFixItUtils.cpp (original)
+++ cfe/branches/tooling/lib/Sema/SemaFixItUtils.cpp Thu Jul 5 02:35:04 2012
@@ -11,6 +11,7 @@
//
//===----------------------------------------------------------------------===//
+#include "clang/AST/ASTContext.h"
#include "clang/AST/ExprCXX.h"
#include "clang/AST/ExprObjC.h"
#include "clang/Lex/Preprocessor.h"
Modified: cfe/branches/tooling/lib/Sema/SemaLambda.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Sema/SemaLambda.cpp?rev=159731&r1=159730&r2=159731&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Sema/SemaLambda.cpp (original)
+++ cfe/branches/tooling/lib/Sema/SemaLambda.cpp Thu Jul 5 02:35:04 2012
@@ -947,9 +947,7 @@
// Add a fake function body to the block. IR generation is responsible
// for filling in the actual body, which cannot be expressed as an AST.
- Block->setBody(new (Context) CompoundStmt(Context, 0, 0,
- ConvLocation,
- ConvLocation));
+ Block->setBody(new (Context) CompoundStmt(ConvLocation));
// Create the block literal expression.
Expr *BuildBlock = new (Context) BlockExpr(Block, Conv->getConversionType());
Modified: cfe/branches/tooling/lib/Sema/SemaStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Sema/SemaStmt.cpp?rev=159731&r1=159730&r2=159731&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Sema/SemaStmt.cpp (original)
+++ cfe/branches/tooling/lib/Sema/SemaStmt.cpp Thu Jul 5 02:35:04 2012
@@ -1385,9 +1385,10 @@
}
ExprResult
-Sema::ActOnObjCForCollectionOperand(SourceLocation forLoc, Expr *collection) {
- assert(collection);
-
+Sema::CheckObjCForCollectionOperand(SourceLocation forLoc, Expr *collection) {
+ if (!collection)
+ return ExprError();
+
// Bail out early if we've got a type-dependent expression.
if (collection->isTypeDependent()) return Owned(collection);
@@ -1457,8 +1458,12 @@
StmtResult
Sema::ActOnObjCForCollectionStmt(SourceLocation ForLoc,
SourceLocation LParenLoc,
- Stmt *First, Expr *Second,
- SourceLocation RParenLoc, Stmt *Body) {
+ Stmt *First, Expr *collection,
+ SourceLocation RParenLoc) {
+
+ ExprResult CollectionExprResult =
+ CheckObjCForCollectionOperand(ForLoc, collection);
+
if (First) {
QualType FirstType;
if (DeclStmt *DS = dyn_cast<DeclStmt>(First)) {
@@ -1486,11 +1491,15 @@
if (!FirstType->isDependentType() &&
!FirstType->isObjCObjectPointerType() &&
!FirstType->isBlockPointerType())
- Diag(ForLoc, diag::err_selector_element_type)
- << FirstType << First->getSourceRange();
+ return StmtError(Diag(ForLoc, diag::err_selector_element_type)
+ << FirstType << First->getSourceRange());
}
-
- return Owned(new (Context) ObjCForCollectionStmt(First, Second, Body,
+
+ if (CollectionExprResult.isInvalid())
+ return StmtError();
+
+ return Owned(new (Context) ObjCForCollectionStmt(First,
+ CollectionExprResult.take(), 0,
ForLoc, RParenLoc));
}
@@ -1900,6 +1909,17 @@
ColonLoc, RParenLoc));
}
+/// FinishObjCForCollectionStmt - Attach the body to a objective-C foreach
+/// statement.
+StmtResult Sema::FinishObjCForCollectionStmt(Stmt *S, Stmt *B) {
+ if (!S || !B)
+ return StmtError();
+ ObjCForCollectionStmt * ForStmt = cast<ObjCForCollectionStmt>(S);
+
+ ForStmt->setBody(B);
+ return S;
+}
+
/// FinishCXXForRangeStmt - Attach the body to a C++0x for-range statement.
/// This is a separate step from ActOnCXXForRangeStmt because analysis of the
/// body cannot be performed until after the type of the range variable is
Modified: cfe/branches/tooling/lib/Sema/TreeTransform.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Sema/TreeTransform.h?rev=159731&r1=159730&r2=159731&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Sema/TreeTransform.h (original)
+++ cfe/branches/tooling/lib/Sema/TreeTransform.h Thu Jul 5 02:35:04 2012
@@ -1267,16 +1267,6 @@
return getSema().ActOnObjCAutoreleasePoolStmt(AtLoc, Body);
}
- /// \brief Build the collection operand to a new Objective-C fast
- /// enumeration statement.
- ///
- /// By default, performs semantic analysis to build the new statement.
- /// Subclasses may override this routine to provide different behavior.
- ExprResult RebuildObjCForCollectionOperand(SourceLocation forLoc,
- Expr *collection) {
- return getSema().ActOnObjCForCollectionOperand(forLoc, collection);
- }
-
/// \brief Build a new Objective-C fast enumeration statement.
///
/// By default, performs semantic analysis to build the new statement.
@@ -1287,11 +1277,14 @@
Expr *Collection,
SourceLocation RParenLoc,
Stmt *Body) {
- return getSema().ActOnObjCForCollectionStmt(ForLoc, LParenLoc,
- Element,
+ StmtResult ForEachStmt = getSema().ActOnObjCForCollectionStmt(ForLoc, LParenLoc,
+ Element,
Collection,
- RParenLoc,
- Body);
+ RParenLoc);
+ if (ForEachStmt.isInvalid())
+ return StmtError();
+
+ return getSema().FinishObjCForCollectionStmt(ForEachStmt.take(), Body);
}
/// \brief Build a new C++ exception declaration.
@@ -5791,10 +5784,6 @@
ExprResult Collection = getDerived().TransformExpr(S->getCollection());
if (Collection.isInvalid())
return StmtError();
- Collection = getDerived().RebuildObjCForCollectionOperand(S->getForLoc(),
- Collection.take());
- if (Collection.isInvalid())
- return StmtError();
// Transform the body.
StmtResult Body = getDerived().TransformStmt(S->getBody());
Modified: cfe/branches/tooling/lib/Serialization/ASTReaderStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Serialization/ASTReaderStmt.cpp?rev=159731&r1=159730&r2=159731&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Serialization/ASTReaderStmt.cpp (original)
+++ cfe/branches/tooling/lib/Serialization/ASTReaderStmt.cpp Thu Jul 5 02:35:04 2012
@@ -13,6 +13,7 @@
//===----------------------------------------------------------------------===//
#include "clang/Serialization/ASTReader.h"
+#include "clang/AST/ASTContext.h"
#include "clang/AST/DeclCXX.h"
#include "clang/AST/DeclTemplate.h"
#include "clang/AST/StmtVisitor.h"
Modified: cfe/branches/tooling/lib/Serialization/ASTWriterStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/Serialization/ASTWriterStmt.cpp?rev=159731&r1=159730&r2=159731&view=diff
==============================================================================
--- cfe/branches/tooling/lib/Serialization/ASTWriterStmt.cpp (original)
+++ cfe/branches/tooling/lib/Serialization/ASTWriterStmt.cpp Thu Jul 5 02:35:04 2012
@@ -12,6 +12,7 @@
//===----------------------------------------------------------------------===//
#include "clang/Serialization/ASTWriter.h"
+#include "clang/AST/ASTContext.h"
#include "clang/AST/DeclCXX.h"
#include "clang/AST/DeclObjC.h"
#include "clang/AST/DeclTemplate.h"
Modified: cfe/branches/tooling/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp?rev=159731&r1=159730&r2=159731&view=diff
==============================================================================
--- cfe/branches/tooling/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp (original)
+++ cfe/branches/tooling/lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp Thu Jul 5 02:35:04 2012
@@ -945,6 +945,7 @@
Summ = getFunctionSummary(cast<FunctionCall>(Call).getDecl());
break;
case CE_CXXMember:
+ case CE_CXXMemberOperator:
case CE_Block:
case CE_CXXConstructor:
case CE_CXXAllocator:
Modified: cfe/branches/tooling/lib/StaticAnalyzer/Core/BasicValueFactory.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/StaticAnalyzer/Core/BasicValueFactory.cpp?rev=159731&r1=159730&r2=159731&view=diff
==============================================================================
--- cfe/branches/tooling/lib/StaticAnalyzer/Core/BasicValueFactory.cpp (original)
+++ cfe/branches/tooling/lib/StaticAnalyzer/Core/BasicValueFactory.cpp Thu Jul 5 02:35:04 2012
@@ -13,6 +13,7 @@
//
//===----------------------------------------------------------------------===//
+#include "clang/AST/ASTContext.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/BasicValueFactory.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/Store.h"
Modified: cfe/branches/tooling/lib/StaticAnalyzer/Core/Calls.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/StaticAnalyzer/Core/Calls.cpp?rev=159731&r1=159730&r2=159731&view=diff
==============================================================================
--- cfe/branches/tooling/lib/StaticAnalyzer/Core/Calls.cpp (original)
+++ cfe/branches/tooling/lib/StaticAnalyzer/Core/Calls.cpp Thu Jul 5 02:35:04 2012
@@ -303,6 +303,14 @@
}
+void
+CXXMemberOperatorCall::addExtraInvalidatedRegions(RegionList &Regions) const {
+ const Expr *Base = getOriginExpr()->getArg(0);
+ if (const MemRegion *R = getSVal(Base).getAsRegion())
+ Regions.push_back(R);
+}
+
+
const BlockDataRegion *BlockCall::getBlockRegion() const {
const Expr *Callee = getOriginExpr()->getCallee();
const MemRegion *DataReg = getSVal(Callee).getAsRegion();
Modified: cfe/branches/tooling/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp?rev=159731&r1=159730&r2=159731&view=diff
==============================================================================
--- cfe/branches/tooling/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp (original)
+++ cfe/branches/tooling/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp Thu Jul 5 02:35:04 2012
@@ -22,6 +22,23 @@
using namespace clang;
using namespace ento;
+static CallEventKind classifyCallExpr(const CallExpr *CE) {
+ if (isa<CXXMemberCallExpr>(CE))
+ return CE_CXXMember;
+
+ const CXXOperatorCallExpr *OpCE = dyn_cast<CXXOperatorCallExpr>(CE);
+ if (OpCE) {
+ const FunctionDecl *DirectCallee = CE->getDirectCallee();
+ if (const CXXMethodDecl *MD = dyn_cast<CXXMethodDecl>(DirectCallee))
+ if (MD->isInstance())
+ return CE_CXXMemberOperator;
+ } else if (CE->getCallee()->getType()->isBlockPointerType()) {
+ return CE_Block;
+ }
+
+ return CE_Function;
+}
+
void ExprEngine::processCallEnter(CallEnter CE, ExplodedNode *Pred) {
// Get the entry block in the CFG of the callee.
const StackFrameContext *calleeCtx = CE.getCalleeContext();
@@ -265,6 +282,12 @@
case CE_CXXMember:
// These are always at least possible to inline.
break;
+ case CE_CXXMemberOperator:
+ // FIXME: This should be possible to inline, but
+ // RegionStore::enterStackFrame isn't smart enough to handle the first
+ // argument being 'this'. The correct solution is to use CallEvent in
+ // enterStackFrame as well.
+ return false;
case CE_CXXConstructor:
// Do not inline constructors until we can model destructors.
// This is unfortunate, but basically necessary for smart pointers and such.
@@ -336,9 +359,7 @@
getCheckerManager().runCheckersForPreStmt(dstPreVisit, Pred, CE, *this);
// Get the callee kind.
- const CXXMemberCallExpr *MemberCE = dyn_cast<CXXMemberCallExpr>(CE);
- bool IsBlock = (MemberCE ? false
- : CE->getCallee()->getType()->isBlockPointerType());
+ CallEventKind K = classifyCallExpr(CE);
// Evaluate the function call. We try each of the checkers
// to see if the can evaluate the function call.
@@ -349,12 +370,25 @@
const LocationContext *LCtx = (*I)->getLocationContext();
// Evaluate the call.
- if (MemberCE)
- evalCall(dstCallEvaluated, *I, CXXMemberCall(MemberCE, State, LCtx));
- else if (IsBlock)
- evalCall(dstCallEvaluated, *I, BlockCall(CE, State, LCtx));
- else
+ switch (K) {
+ case CE_Function:
evalCall(dstCallEvaluated, *I, FunctionCall(CE, State, LCtx));
+ break;
+ case CE_CXXMember:
+ evalCall(dstCallEvaluated, *I, CXXMemberCall(cast<CXXMemberCallExpr>(CE),
+ State, LCtx));
+ break;
+ case CE_CXXMemberOperator:
+ evalCall(dstCallEvaluated, *I,
+ CXXMemberOperatorCall(cast<CXXOperatorCallExpr>(CE),
+ State, LCtx));
+ break;
+ case CE_Block:
+ evalCall(dstCallEvaluated, *I, BlockCall(CE, State, LCtx));
+ break;
+ default:
+ llvm_unreachable("Non-CallExpr CallEventKind");
+ }
}
// Finally, perform the post-condition check of the CallExpr and store
Modified: cfe/branches/tooling/test/ARCMT/checking.m
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/ARCMT/checking.m?rev=159731&r1=159730&r2=159731&view=diff
==============================================================================
--- cfe/branches/tooling/test/ARCMT/checking.m (original)
+++ cfe/branches/tooling/test/ARCMT/checking.m Thu Jul 5 02:35:04 2012
@@ -142,7 +142,7 @@
- (void) noninit {
self = 0; // expected-error {{cannot assign to 'self' outside of a method in the init family}}
- for (id x in collection) { // expected-error {{use of undeclared identifier 'collection'}}
+ for (__strong id x in collection) { // expected-error {{use of undeclared identifier 'collection'}}
x = 0;
}
}
Modified: cfe/branches/tooling/test/Analysis/operator-calls.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Analysis/operator-calls.cpp?rev=159731&r1=159730&r2=159731&view=diff
==============================================================================
--- cfe/branches/tooling/test/Analysis/operator-calls.cpp (original)
+++ cfe/branches/tooling/test/Analysis/operator-calls.cpp Thu Jul 5 02:35:04 2012
@@ -1,4 +1,6 @@
-// RUN: %clang_cc1 -analyze -analyzer-checker=core,experimental.core -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,experimental.core,debug.ExprInspection -verify %s
+void clang_analyzer_eval(bool);
+
struct X0 { };
bool operator==(const X0&, const X0&);
@@ -14,3 +16,18 @@
bool PR7287(X0 a, X0 b) {
return operator==(a, b);
}
+
+
+// Inlining non-static member operators mistakenly treated 'this' as the first
+// argument for a while.
+
+struct IntComparable {
+ bool operator==(int x) const {
+ return x == 0;
+ }
+};
+
+void testMemberOperator(IntComparable B) {
+ // FIXME: Change this to TRUE when we re-enable inlining.
+ clang_analyzer_eval(B == 0); // expected-warning{{UNKNOWN}}
+}
Modified: cfe/branches/tooling/test/CodeGen/mips-vector-return.c
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/CodeGen/mips-vector-return.c?rev=159731&r1=159730&r2=159731&view=diff
==============================================================================
--- cfe/branches/tooling/test/CodeGen/mips-vector-return.c (original)
+++ cfe/branches/tooling/test/CodeGen/mips-vector-return.c Thu Jul 5 02:35:04 2012
@@ -6,6 +6,7 @@
// integer registers.
typedef float v4sf __attribute__ ((__vector_size__ (16)));
typedef double v4df __attribute__ ((__vector_size__ (32)));
+typedef int v4i32 __attribute__ ((__vector_size__ (16)));
// O32: define void @test_v4sf(<4 x float>* noalias nocapture sret
// N64: define { i64, i64 } @test_v4sf
@@ -19,3 +20,12 @@
return (v4df){0.0, a, 0.0, 0.0};
}
+// O32 returns integer vectors whose size is equal to or smaller than 16-bytes
+// in integer registers.
+//
+// O32: define { i32, i32, i32, i32 } @test_v4i32
+// N64: define { i64, i64 } @test_v4i32
+v4i32 test_v4i32(int a) {
+ return (v4i32){0, a, 0, 0};
+}
+
Modified: cfe/branches/tooling/test/CodeGenObjC/bitfield-gnu.m
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/CodeGenObjC/bitfield-gnu.m?rev=159731&r1=159730&r2=159731&view=diff
==============================================================================
--- cfe/branches/tooling/test/CodeGenObjC/bitfield-gnu.m (original)
+++ cfe/branches/tooling/test/CodeGenObjC/bitfield-gnu.m Thu Jul 5 02:35:04 2012
@@ -1,4 +1,4 @@
-// RUN: %clang -S -emit-llvm -fobjc-runtime=gnu -o %t %s
+// RUN: %clang -S -emit-llvm -fobjc-runtime=gcc -o %t %s
typedef enum { A1, A2 } A;
typedef struct { A a : 1; } B;
@interface Obj { B *b; } @end
Modified: cfe/branches/tooling/test/CodeGenObjC/bitfield_encoding.m
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/CodeGenObjC/bitfield_encoding.m?rev=159731&r1=159730&r2=159731&view=diff
==============================================================================
--- cfe/branches/tooling/test/CodeGenObjC/bitfield_encoding.m (original)
+++ cfe/branches/tooling/test/CodeGenObjC/bitfield_encoding.m Thu Jul 5 02:35:04 2012
@@ -1,6 +1,6 @@
// RUN: %clang_cc1 -triple i386-unknown-unknown -fobjc-runtime=macosx-fragile-10.5 -emit-llvm -o %t %s
// RUN: grep "ib1b14" %t | count 1
-// RUN: %clang_cc1 -triple i386-unknown-unknown -fobjc-runtime=macosx-fragile-10.5 -fobjc-runtime=gnu -emit-llvm -o %t %s
+// RUN: %clang_cc1 -triple i386-unknown-unknown -fobjc-runtime=macosx-fragile-10.5 -fobjc-runtime=gcc -emit-llvm -o %t %s
// RUN: grep "ib32i1b33i14" %t | count 1
struct foo{
Modified: cfe/branches/tooling/test/CodeGenObjC/constant-strings.m
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/CodeGenObjC/constant-strings.m?rev=159731&r1=159730&r2=159731&view=diff
==============================================================================
--- cfe/branches/tooling/test/CodeGenObjC/constant-strings.m (original)
+++ cfe/branches/tooling/test/CodeGenObjC/constant-strings.m Thu Jul 5 02:35:04 2012
@@ -5,11 +5,11 @@
//
// CHECK-NEXT: @.str = {{.*}}constant [13 x i8] c"Hello World!\00", align 1
-// RUN: %clang_cc1 -fobjc-runtime=gnu -emit-llvm -o %t %s
+// RUN: %clang_cc1 -fobjc-runtime=gcc -emit-llvm -o %t %s
// RUN: FileCheck --check-prefix=CHECK-GNU < %t %s
// CHECK-GNU: NXConstantString
-// RUN: %clang_cc1 -fobjc-runtime=gnu -fconstant-string-class NSConstantString -emit-llvm -o %t %s
+// RUN: %clang_cc1 -fobjc-runtime=gcc -fconstant-string-class NSConstantString -emit-llvm -o %t %s
// RUN: FileCheck --check-prefix=CHECK-GNU-WITH-CLASS < %t %s
// CHECK-GNU-WITH-CLASS: NSConstantString
id a = @"Hello World!";
Modified: cfe/branches/tooling/test/CodeGenObjC/gnu-exceptions.m
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/CodeGenObjC/gnu-exceptions.m?rev=159731&r1=159730&r2=159731&view=diff
==============================================================================
--- cfe/branches/tooling/test/CodeGenObjC/gnu-exceptions.m (original)
+++ cfe/branches/tooling/test/CodeGenObjC/gnu-exceptions.m Thu Jul 5 02:35:04 2012
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -emit-llvm -fexceptions -fobjc-exceptions -fobjc-runtime=gnu -o - %s | FileCheck %s
+// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -emit-llvm -fexceptions -fobjc-exceptions -fobjc-runtime=gcc -o - %s | FileCheck %s
void opaque(void);
void log(int i);
Modified: cfe/branches/tooling/test/CodeGenObjC/messages.m
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/CodeGenObjC/messages.m?rev=159731&r1=159730&r2=159731&view=diff
==============================================================================
--- cfe/branches/tooling/test/CodeGenObjC/messages.m (original)
+++ cfe/branches/tooling/test/CodeGenObjC/messages.m Thu Jul 5 02:35:04 2012
@@ -1,7 +1,7 @@
// RUN: %clang_cc1 -fobjc-runtime=macosx-fragile-10.5 -emit-llvm -o - %s | FileCheck %s -check-prefix=CHECK-MAC
// RUN: %clang_cc1 -emit-llvm -o - %s | FileCheck %s -check-prefix=CHECK-MAC-NF
-// RUN: %clang_cc1 -fobjc-runtime=gnu-fragile -emit-llvm -o - %s | FileCheck %s -check-prefix=CHECK-GNU
-// RUN: %clang_cc1 -fobjc-runtime=gnu -emit-llvm -o - %s | FileCheck %s -check-prefix CHECK-GNU-NF
+// RUN: %clang_cc1 -fobjc-runtime=gcc -emit-llvm -o - %s | FileCheck %s -check-prefix=CHECK-GNU
+// RUN: %clang_cc1 -fobjc-runtime=gnustep -emit-llvm -o - %s | FileCheck %s -check-prefix CHECK-GNU-NF
typedef struct {
int x;
Modified: cfe/branches/tooling/test/CodeGenObjC/undefined-protocol.m
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/CodeGenObjC/undefined-protocol.m?rev=159731&r1=159730&r2=159731&view=diff
==============================================================================
--- cfe/branches/tooling/test/CodeGenObjC/undefined-protocol.m (original)
+++ cfe/branches/tooling/test/CodeGenObjC/undefined-protocol.m Thu Jul 5 02:35:04 2012
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -emit-llvm-only -fobjc-runtime=gnu %s
+// RUN: %clang_cc1 -emit-llvm-only -fobjc-runtime=gcc %s
@protocol MadeUpProtocol;
Modified: cfe/branches/tooling/test/Coverage/codegen-gnu.m
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Coverage/codegen-gnu.m?rev=159731&r1=159730&r2=159731&view=diff
==============================================================================
--- cfe/branches/tooling/test/Coverage/codegen-gnu.m (original)
+++ cfe/branches/tooling/test/Coverage/codegen-gnu.m Thu Jul 5 02:35:04 2012
@@ -1,3 +1,3 @@
-// RUN: %clang_cc1 -triple i386-unknown-unknown -fobjc-exceptions -fobjc-runtime=gnu -emit-llvm -o %t %s
+// RUN: %clang_cc1 -triple i386-unknown-unknown -fobjc-exceptions -fobjc-runtime=gcc -emit-llvm -o %t %s
#include "objc-language-features.inc"
Modified: cfe/branches/tooling/test/Driver/darwin-ld.c
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Driver/darwin-ld.c?rev=159731&r1=159730&r2=159731&view=diff
==============================================================================
--- cfe/branches/tooling/test/Driver/darwin-ld.c (original)
+++ cfe/branches/tooling/test/Driver/darwin-ld.c Thu Jul 5 02:35:04 2012
@@ -121,3 +121,8 @@
// RUN: %clang -target x86_64-apple-darwin12 -### %t.o 2> %t.log
// RUN: FileCheck -check-prefix=LINK_NO_CRT1 %s < %t.log
// LINK_NO_CRT1-NOT: crt
+
+// RUN: %clang -target i386-apple-darwin12 -pg -### %t.o 2> %t.log
+// RUN: FileCheck -check-prefix=LINK_PG %s < %t.log
+// LINK_PG: -lgcrt1.o
+// LINK_PG: -no_new_main
Modified: cfe/branches/tooling/test/Driver/gnu-runtime.m
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Driver/gnu-runtime.m?rev=159731&r1=159730&r2=159731&view=diff
==============================================================================
--- cfe/branches/tooling/test/Driver/gnu-runtime.m (original)
+++ cfe/branches/tooling/test/Driver/gnu-runtime.m Thu Jul 5 02:35:04 2012
@@ -1,4 +1,4 @@
// RUN: %clang -target i386-apple-darwin10 -### -fsyntax-only -fgnu-runtime %s 2>&1 | FileCheck %s
// RUN: %clang -target i386-apple-darwin10 -### -x objective-c++ -fsyntax-only -fgnu-runtime %s 2>&1 | FileCheck %s
-// CHECK: -fobjc-runtime=gnu
+// CHECK: -fobjc-runtime=gcc
// CHECK-NOT: fragile
Modified: cfe/branches/tooling/test/Preprocessor/init.c
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Preprocessor/init.c?rev=159731&r1=159730&r2=159731&view=diff
==============================================================================
--- cfe/branches/tooling/test/Preprocessor/init.c (original)
+++ cfe/branches/tooling/test/Preprocessor/init.c Thu Jul 5 02:35:04 2012
@@ -85,7 +85,7 @@
// C94:#define __STDC_VERSION__ 199409L
//
//
-// RUN: %clang_cc1 -fms-extensions -triple i686-pc-win32 -fobjc-runtime=gnu-fragile -E -dM < /dev/null | FileCheck -check-prefix MSEXT %s
+// RUN: %clang_cc1 -fms-extensions -triple i686-pc-win32 -fobjc-runtime=gcc -E -dM < /dev/null | FileCheck -check-prefix MSEXT %s
//
// MSEXT-NOT:#define __STDC__
// MSEXT:#define _INTEGRAL_MAX_BITS 64
@@ -967,10 +967,116 @@
// MSP430:#define __WINT_WIDTH__ 16
// MSP430:#define __clang__ 1
//
+// RUN: %clang_cc1 -E -dM -ffreestanding -triple=powerpc-none-none -target-cpu 603e < /dev/null | FileCheck -check-prefix PPC603E %s
+//
+// PPC603E:#define _ARCH_603 1
+// PPC603E:#define _ARCH_603E 1
+// PPC603E:#define _ARCH_PPC 1
+// PPC603E:#define _ARCH_PPCGR 1
+// PPC603E:#define _BIG_ENDIAN 1
+// PPC603E:#define __BIG_ENDIAN__ 1
+// PPC603E:#define __CHAR16_TYPE__ unsigned short
+// PPC603E:#define __CHAR32_TYPE__ unsigned int
+// PPC603E:#define __CHAR_BIT__ 8
+// PPC603E:#define __DBL_DENORM_MIN__ 4.9406564584124654e-324
+// PPC603E:#define __DBL_DIG__ 15
+// PPC603E:#define __DBL_EPSILON__ 2.2204460492503131e-16
+// PPC603E:#define __DBL_HAS_DENORM__ 1
+// PPC603E:#define __DBL_HAS_INFINITY__ 1
+// PPC603E:#define __DBL_HAS_QUIET_NAN__ 1
+// PPC603E:#define __DBL_MANT_DIG__ 53
+// PPC603E:#define __DBL_MAX_10_EXP__ 308
+// PPC603E:#define __DBL_MAX_EXP__ 1024
+// PPC603E:#define __DBL_MAX__ 1.7976931348623157e+308
+// PPC603E:#define __DBL_MIN_10_EXP__ (-307)
+// PPC603E:#define __DBL_MIN_EXP__ (-1021)
+// PPC603E:#define __DBL_MIN__ 2.2250738585072014e-308
+// PPC603E:#define __DECIMAL_DIG__ 33
+// PPC603E:#define __FLT_DENORM_MIN__ 1.40129846e-45F
+// PPC603E:#define __FLT_DIG__ 6
+// PPC603E:#define __FLT_EPSILON__ 1.19209290e-7F
+// PPC603E:#define __FLT_EVAL_METHOD__ 0
+// PPC603E:#define __FLT_HAS_DENORM__ 1
+// PPC603E:#define __FLT_HAS_INFINITY__ 1
+// PPC603E:#define __FLT_HAS_QUIET_NAN__ 1
+// PPC603E:#define __FLT_MANT_DIG__ 24
+// PPC603E:#define __FLT_MAX_10_EXP__ 38
+// PPC603E:#define __FLT_MAX_EXP__ 128
+// PPC603E:#define __FLT_MAX__ 3.40282347e+38F
+// PPC603E:#define __FLT_MIN_10_EXP__ (-37)
+// PPC603E:#define __FLT_MIN_EXP__ (-125)
+// PPC603E:#define __FLT_MIN__ 1.17549435e-38F
+// PPC603E:#define __FLT_RADIX__ 2
+// PPC603E:#define __INT16_TYPE__ short
+// PPC603E:#define __INT32_TYPE__ int
+// PPC603E:#define __INT64_C_SUFFIX__ LL
+// PPC603E:#define __INT64_TYPE__ long long int
+// PPC603E:#define __INT8_TYPE__ char
+// PPC603E:#define __INTMAX_MAX__ 9223372036854775807LL
+// PPC603E:#define __INTMAX_TYPE__ long long int
+// PPC603E:#define __INTMAX_WIDTH__ 64
+// PPC603E:#define __INTPTR_TYPE__ long int
+// PPC603E:#define __INTPTR_WIDTH__ 32
+// PPC603E:#define __INT_MAX__ 2147483647
+// PPC603E:#define __LDBL_DENORM_MIN__ 4.94065645841246544176568792868221e-324L
+// PPC603E:#define __LDBL_DIG__ 31
+// PPC603E:#define __LDBL_EPSILON__ 4.94065645841246544176568792868221e-324L
+// PPC603E:#define __LDBL_HAS_DENORM__ 1
+// PPC603E:#define __LDBL_HAS_INFINITY__ 1
+// PPC603E:#define __LDBL_HAS_QUIET_NAN__ 1
+// PPC603E:#define __LDBL_MANT_DIG__ 106
+// PPC603E:#define __LDBL_MAX_10_EXP__ 308
+// PPC603E:#define __LDBL_MAX_EXP__ 1024
+// PPC603E:#define __LDBL_MAX__ 1.79769313486231580793728971405301e+308L
+// PPC603E:#define __LDBL_MIN_10_EXP__ (-291)
+// PPC603E:#define __LDBL_MIN_EXP__ (-968)
+// PPC603E:#define __LDBL_MIN__ 2.00416836000897277799610805135016e-292L
+// PPC603E:#define __LONG_DOUBLE_128__ 1
+// PPC603E:#define __LONG_LONG_MAX__ 9223372036854775807LL
+// PPC603E:#define __LONG_MAX__ 2147483647L
+// PPC603E:#define __NATURAL_ALIGNMENT__ 1
+// PPC603E:#define __NO_INLINE__ 1
+// PPC603E:#define __POINTER_WIDTH__ 32
+// PPC603E:#define __POWERPC__ 1
+// PPC603E:#define __PTRDIFF_TYPE__ long int
+// PPC603E:#define __PTRDIFF_WIDTH__ 32
+// PPC603E:#define __REGISTER_PREFIX__
+// PPC603E:#define __SCHAR_MAX__ 127
+// PPC603E:#define __SHRT_MAX__ 32767
+// PPC603E:#define __SIG_ATOMIC_WIDTH__ 32
+// PPC603E:#define __SIZEOF_DOUBLE__ 8
+// PPC603E:#define __SIZEOF_FLOAT__ 4
+// PPC603E:#define __SIZEOF_INT__ 4
+// PPC603E:#define __SIZEOF_LONG_DOUBLE__ 16
+// PPC603E:#define __SIZEOF_LONG_LONG__ 8
+// PPC603E:#define __SIZEOF_LONG__ 4
+// PPC603E:#define __SIZEOF_POINTER__ 4
+// PPC603E:#define __SIZEOF_PTRDIFF_T__ 4
+// PPC603E:#define __SIZEOF_SHORT__ 2
+// PPC603E:#define __SIZEOF_SIZE_T__ 4
+// PPC603E:#define __SIZEOF_WCHAR_T__ 4
+// PPC603E:#define __SIZEOF_WINT_T__ 4
+// PPC603E:#define __SIZE_TYPE__ long unsigned int
+// PPC603E:#define __SIZE_WIDTH__ 32
+// PPC603E:#define __UINTMAX_TYPE__ long long unsigned int
+// PPC603E:#define __USER_LABEL_PREFIX__ _
+// PPC603E:#define __WCHAR_MAX__ 2147483647
+// PPC603E:#define __WCHAR_TYPE__ int
+// PPC603E:#define __WCHAR_WIDTH__ 32
+// PPC603E:#define __WINT_TYPE__ int
+// PPC603E:#define __WINT_WIDTH__ 32
+// PPC603E:#define __powerpc__ 1
+// PPC603E:#define __ppc__ 1
+//
// RUN: %clang_cc1 -E -dM -ffreestanding -triple=powerpc64-none-none -target-cpu pwr7 -fno-signed-char < /dev/null | FileCheck -check-prefix PPC64 %s
//
// PPC64:#define _ARCH_PPC 1
// PPC64:#define _ARCH_PPC64 1
+// PPC64:#define _ARCH_PPCGR 1
+// PPC64:#define _ARCH_PPCSQ 1
+// PPC64:#define _ARCH_PWR4 1
+// PPC64:#define _ARCH_PWR5 1
+// PPC64:#define _ARCH_PWR6 1
// PPC64:#define _ARCH_PWR7 1
// PPC64:#define _BIG_ENDIAN 1
// PPC64:#define _LP64 1
@@ -1766,7 +1872,7 @@
// X86_64-LINUX:#define __x86_64 1
// X86_64-LINUX:#define __x86_64__ 1
//
-// RUN: %clang_cc1 -x c++ -triple i686-pc-linux-gnu -fobjc-runtime=gnu-fragile -E -dM < /dev/null | FileCheck -check-prefix GNUSOURCE %s
+// RUN: %clang_cc1 -x c++ -triple i686-pc-linux-gnu -fobjc-runtime=gcc -E -dM < /dev/null | FileCheck -check-prefix GNUSOURCE %s
// GNUSOURCE:#define _GNU_SOURCE 1
//
// RUN: %clang_cc1 -x c++ -std=c++98 -fno-rtti -E -dM < /dev/null | FileCheck -check-prefix NORTTI %s
Modified: cfe/branches/tooling/test/Preprocessor/non_fragile_feature1.m
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/Preprocessor/non_fragile_feature1.m?rev=159731&r1=159730&r2=159731&view=diff
==============================================================================
--- cfe/branches/tooling/test/Preprocessor/non_fragile_feature1.m (original)
+++ cfe/branches/tooling/test/Preprocessor/non_fragile_feature1.m Thu Jul 5 02:35:04 2012
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -triple i386-unknown-unknown -fobjc-runtime=gnu-fragile %s
+// RUN: %clang_cc1 -triple i386-unknown-unknown -fobjc-runtime=gcc %s
#ifndef __has_feature
#error Should have __has_feature
#endif
Modified: cfe/branches/tooling/test/SemaCXX/warn-thread-safety-analysis.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/SemaCXX/warn-thread-safety-analysis.cpp?rev=159731&r1=159730&r2=159731&view=diff
==============================================================================
--- cfe/branches/tooling/test/SemaCXX/warn-thread-safety-analysis.cpp (original)
+++ cfe/branches/tooling/test/SemaCXX/warn-thread-safety-analysis.cpp Thu Jul 5 02:35:04 2012
@@ -57,6 +57,23 @@
void Release() UNLOCK_FUNCTION();
};
+
+template<class T>
+class SmartPtr {
+public:
+ SmartPtr(T* p) : ptr_(p) { }
+ SmartPtr(const SmartPtr<T>& p) : ptr_(p.ptr_) { }
+ ~SmartPtr();
+
+ T* get() const { return ptr_; }
+ T* operator->() const { return ptr_; }
+ T& operator*() const { return *ptr_; }
+
+private:
+ T* ptr_;
+};
+
+
Mutex sls_mu;
Mutex sls_mu2 __attribute__((acquired_after(sls_mu)));
@@ -2535,3 +2552,191 @@
} // end namespace FoolishScopedLockableBug
+
+namespace TemporaryCleanupExpr {
+
+class Foo {
+ int a GUARDED_BY(getMutexPtr().get());
+
+ SmartPtr<Mutex> getMutexPtr();
+
+ void test();
+};
+
+
+void Foo::test() {
+ {
+ ReaderMutexLock lock(getMutexPtr().get());
+ int b = a;
+ }
+ int b = a; // expected-warning {{reading variable 'a' requires locking 'getMutexPtr'}}
+}
+
+} // end namespace TemporaryCleanupExpr
+
+
+
+namespace SmartPointerTests {
+
+class Foo {
+public:
+ SmartPtr<Mutex> mu_;
+ int a GUARDED_BY(mu_);
+ int b GUARDED_BY(mu_.get());
+ int c GUARDED_BY(*mu_);
+
+ void Lock() EXCLUSIVE_LOCK_FUNCTION(mu_);
+ void Unlock() UNLOCK_FUNCTION(mu_);
+
+ void test0();
+ void test1();
+ void test2();
+ void test3();
+ void test4();
+ void test5();
+ void test6();
+ void test7();
+ void test8();
+};
+
+void Foo::test0() {
+ a = 0; // expected-warning {{writing variable 'a' requires locking 'mu_' exclusively}}
+ b = 0; // expected-warning {{writing variable 'b' requires locking 'mu_' exclusively}}
+ c = 0; // expected-warning {{writing variable 'c' requires locking 'mu_' exclusively}}
+}
+
+void Foo::test1() {
+ mu_->Lock();
+ a = 0;
+ b = 0;
+ c = 0;
+ mu_->Unlock();
+}
+
+void Foo::test2() {
+ (*mu_).Lock();
+ a = 0;
+ b = 0;
+ c = 0;
+ (*mu_).Unlock();
+}
+
+
+void Foo::test3() {
+ mu_.get()->Lock();
+ a = 0;
+ b = 0;
+ c = 0;
+ mu_.get()->Unlock();
+}
+
+
+void Foo::test4() {
+ MutexLock lock(mu_.get());
+ a = 0;
+ b = 0;
+ c = 0;
+}
+
+
+void Foo::test5() {
+ MutexLock lock(&(*mu_));
+ a = 0;
+ b = 0;
+ c = 0;
+}
+
+
+void Foo::test6() {
+ Lock();
+ a = 0;
+ b = 0;
+ c = 0;
+ Unlock();
+}
+
+
+void Foo::test7() {
+ {
+ Lock();
+ mu_->Unlock();
+ }
+ {
+ mu_->Lock();
+ Unlock();
+ }
+ {
+ mu_.get()->Lock();
+ mu_->Unlock();
+ }
+ {
+ mu_->Lock();
+ mu_.get()->Unlock();
+ }
+ {
+ mu_.get()->Lock();
+ (*mu_).Unlock();
+ }
+ {
+ (*mu_).Lock();
+ mu_->Unlock();
+ }
+}
+
+
+void Foo::test8() {
+ mu_->Lock();
+ mu_.get()->Lock(); // expected-warning {{locking 'mu_' that is already locked}}
+ (*mu_).Lock(); // expected-warning {{locking 'mu_' that is already locked}}
+ mu_.get()->Unlock();
+ Unlock(); // expected-warning {{unlocking 'mu_' that was not locked}}
+}
+
+
+class Bar {
+ SmartPtr<Foo> foo;
+
+ void test0();
+ void test1();
+ void test2();
+ void test3();
+};
+
+
+void Bar::test0() {
+ foo->a = 0; // expected-warning {{writing variable 'a' requires locking 'mu_' exclusively}}
+ (*foo).b = 0; // expected-warning {{writing variable 'b' requires locking 'mu_' exclusively}}
+ foo.get()->c = 0; // expected-warning {{writing variable 'c' requires locking 'mu_' exclusively}}
+}
+
+
+void Bar::test1() {
+ foo->mu_->Lock();
+ foo->a = 0;
+ (*foo).b = 0;
+ foo.get()->c = 0;
+ foo->mu_->Unlock();
+}
+
+
+void Bar::test2() {
+ (*foo).mu_->Lock();
+ foo->a = 0;
+ (*foo).b = 0;
+ foo.get()->c = 0;
+ foo.get()->mu_->Unlock();
+}
+
+
+void Bar::test3() {
+ MutexLock lock(foo->mu_.get());
+ foo->a = 0;
+ (*foo).b = 0;
+ foo.get()->c = 0;
+}
+
+} // end namespace SmartPointerTests
+
+
+
+
Propchange: cfe/branches/tooling/test/SemaCXX/warn-unreachable.cpp
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Jul 5 02:35:04 2012
@@ -1,2 +1,2 @@
/cfe/branches/type-system-rewrite/test/SemaCXX/warn-unreachable.cpp:134693-134817
-/cfe/trunk/test/SemaCXX/warn-unreachable.cpp:121961,146581-159654
+/cfe/trunk/test/SemaCXX/warn-unreachable.cpp:121961,146581-159729
Modified: cfe/branches/tooling/test/SemaObjC/delay-parsing-cfunctions.m
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/test/SemaObjC/delay-parsing-cfunctions.m?rev=159731&r1=159730&r2=159731&view=diff
==============================================================================
--- cfe/branches/tooling/test/SemaObjC/delay-parsing-cfunctions.m (original)
+++ cfe/branches/tooling/test/SemaObjC/delay-parsing-cfunctions.m Thu Jul 5 02:35:04 2012
@@ -29,4 +29,8 @@
static int getMe;
+static int test() {
+ return 0;
+}
+
@end
Modified: cfe/branches/tooling/tools/c-index-test/c-index-test.c
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/tools/c-index-test/c-index-test.c?rev=159731&r1=159730&r2=159731&view=diff
==============================================================================
--- cfe/branches/tooling/tools/c-index-test/c-index-test.c (original)
+++ cfe/branches/tooling/tools/c-index-test/c-index-test.c Thu Jul 5 02:35:04 2012
@@ -2415,7 +2415,7 @@
memcpy(tmp, database, len+1);
buildDir = dirname(tmp);
- db = clang_tooling_CompilationDatabase_fromDirectory(buildDir, &ec);
+ db = clang_CompilationDatabase_fromDirectory(buildDir, &ec);
if (db) {
@@ -2427,7 +2427,7 @@
for (i=0; i<argc && errorCode==0; ) {
if (strcmp(argv[i],"lookup")==0){
- CCmds = clang_tooling_CompilationDatabase_getCompileCommands(db, argv[i+1]);
+ CCmds = clang_CompilationDatabase_getCompileCommands(db, argv[i+1]);
if (!CCmds) {
printf("file %s not found in compilation db\n", argv[i+1]);
@@ -2435,7 +2435,7 @@
break;
}
- numCmds = clang_tooling_CompileCommands_getSize(CCmds);
+ numCmds = clang_CompileCommands_getSize(CCmds);
if (numCmds==0) {
fprintf(stderr, "should not get an empty compileCommand set for file"
@@ -2445,29 +2445,29 @@
}
for (j=0; j<numCmds; ++j) {
- CCmd = clang_tooling_CompileCommands_getCommand(CCmds, j);
+ CCmd = clang_CompileCommands_getCommand(CCmds, j);
- wd = clang_tooling_CompileCommand_getDirectory(CCmd);
+ wd = clang_CompileCommand_getDirectory(CCmd);
printf("workdir:'%s'", clang_getCString(wd));
clang_disposeString(wd);
printf(" cmdline:'");
- numArgs = clang_tooling_CompileCommand_getNumArgs(CCmd);
+ numArgs = clang_CompileCommand_getNumArgs(CCmd);
for (a=0; a<numArgs; ++a) {
if (a) printf(" ");
- arg = clang_tooling_CompileCommand_getArg(CCmd, a);
+ arg = clang_CompileCommand_getArg(CCmd, a);
printf("%s", clang_getCString(arg));
clang_disposeString(arg);
}
printf("'\n");
}
- clang_tooling_CompileCommands_dispose(CCmds);
+ clang_CompileCommands_dispose(CCmds);
i += 2;
}
}
- clang_tooling_CompilationDatabase_dispose(db);
+ clang_CompilationDatabase_dispose(db);
} else {
printf("database loading failed with error code %d.\n", ec);
errorCode = -1;
Modified: cfe/branches/tooling/tools/fix-llvm-style/FixLLVMStyle.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/tools/fix-llvm-style/FixLLVMStyle.cpp?rev=159731&r1=159730&r2=159731&view=diff
==============================================================================
--- cfe/branches/tooling/tools/fix-llvm-style/FixLLVMStyle.cpp (original)
+++ cfe/branches/tooling/tools/fix-llvm-style/FixLLVMStyle.cpp Thu Jul 5 02:35:04 2012
@@ -11,6 +11,7 @@
//
//===----------------------------------------------------------------------===//
+#include "clang/AST/ASTContext.h"
#include "clang/ASTMatchers/ASTMatchers.h"
#include "clang/ASTMatchers/ASTMatchFinder.h"
#include "clang/Basic/SourceManager.h"
Modified: cfe/branches/tooling/tools/libclang/CXCompilationDatabase.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/tools/libclang/CXCompilationDatabase.cpp?rev=159731&r1=159730&r2=159731&view=diff
==============================================================================
--- cfe/branches/tooling/tools/libclang/CXCompilationDatabase.cpp (original)
+++ cfe/branches/tooling/tools/libclang/CXCompilationDatabase.cpp Thu Jul 5 02:35:04 2012
@@ -10,9 +10,8 @@
// FIXME: do something more usefull with the error message
CXCompilationDatabase
-clang_tooling_CompilationDatabase_fromDirectory(
- const char *BuildDir,
- CXCompilationDatabase_Error *ErrorCode)
+clang_CompilationDatabase_fromDirectory(const char *BuildDir,
+ CXCompilationDatabase_Error *ErrorCode)
{
std::string ErrorMsg;
CXCompilationDatabase_Error Err = CXCompilationDatabase_NoError;
@@ -32,7 +31,7 @@
}
void
-clang_tooling_CompilationDatabase_dispose(CXCompilationDatabase CDb)
+clang_CompilationDatabase_dispose(CXCompilationDatabase CDb)
{
delete static_cast<CompilationDatabase *>(CDb);
}
@@ -47,8 +46,8 @@
};
CXCompileCommands
-clang_tooling_CompilationDatabase_getCompileCommands(CXCompilationDatabase CDb,
- const char *CompleteFileName)
+clang_CompilationDatabase_getCompileCommands(CXCompilationDatabase CDb,
+ const char *CompleteFileName)
{
if (CompilationDatabase *db = static_cast<CompilationDatabase *>(CDb)) {
const std::vector<CompileCommand>
@@ -61,13 +60,13 @@
}
void
-clang_tooling_CompileCommands_dispose(CXCompileCommands Cmds)
+clang_CompileCommands_dispose(CXCompileCommands Cmds)
{
delete static_cast<AllocatedCXCompileCommands *>(Cmds);
}
unsigned
-clang_tooling_CompileCommands_getSize(CXCompileCommands Cmds)
+clang_CompileCommands_getSize(CXCompileCommands Cmds)
{
if (!Cmds)
return 0;
@@ -79,7 +78,7 @@
}
CXCompileCommand
-clang_tooling_CompileCommands_getCommand(CXCompileCommands Cmds, unsigned I)
+clang_CompileCommands_getCommand(CXCompileCommands Cmds, unsigned I)
{
if (!Cmds)
return 0;
@@ -94,7 +93,7 @@
}
CXString
-clang_tooling_CompileCommand_getDirectory(CXCompileCommand CCmd)
+clang_CompileCommand_getDirectory(CXCompileCommand CCmd)
{
if (!CCmd)
return createCXString((const char*)NULL);
@@ -104,7 +103,7 @@
}
unsigned
-clang_tooling_CompileCommand_getNumArgs(CXCompileCommand CCmd)
+clang_CompileCommand_getNumArgs(CXCompileCommand CCmd)
{
if (!CCmd)
return 0;
@@ -113,7 +112,7 @@
}
CXString
-clang_tooling_CompileCommand_getArg(CXCompileCommand CCmd, unsigned Arg)
+clang_CompileCommand_getArg(CXCompileCommand CCmd, unsigned Arg)
{
if (!CCmd)
return createCXString((const char*)NULL);
Modified: cfe/branches/tooling/tools/libclang/libclang.exports
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/tools/libclang/libclang.exports?rev=159731&r1=159730&r2=159731&view=diff
==============================================================================
--- cfe/branches/tooling/tools/libclang/libclang.exports (original)
+++ cfe/branches/tooling/tools/libclang/libclang.exports Thu Jul 5 02:35:04 2012
@@ -206,14 +206,14 @@
clang_sortCodeCompletionResults
clang_toggleCrashRecovery
clang_tokenize
-clang_tooling_CompilationDatabase_fromDirectory
-clang_tooling_CompilationDatabase_dispose
-clang_tooling_CompilationDatabase_getCompileCommands
-clang_tooling_CompileCommands_dispose
-clang_tooling_CompileCommands_getSize
-clang_tooling_CompileCommands_getCommand
-clang_tooling_CompileCommand_getDirectory
-clang_tooling_CompileCommand_getNumArgs
-clang_tooling_CompileCommand_getArg
+clang_CompilationDatabase_fromDirectory
+clang_CompilationDatabase_dispose
+clang_CompilationDatabase_getCompileCommands
+clang_CompileCommands_dispose
+clang_CompileCommands_getSize
+clang_CompileCommands_getCommand
+clang_CompileCommand_getDirectory
+clang_CompileCommand_getNumArgs
+clang_CompileCommand_getArg
clang_visitChildren
clang_visitChildrenWithBlock
Modified: cfe/branches/tooling/tools/rename/ClangRename.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/tools/rename/ClangRename.cpp?rev=159731&r1=159730&r2=159731&view=diff
==============================================================================
--- cfe/branches/tooling/tools/rename/ClangRename.cpp (original)
+++ cfe/branches/tooling/tools/rename/ClangRename.cpp Thu Jul 5 02:35:04 2012
@@ -21,6 +21,7 @@
#include "clang/Basic/SourceManager.h"
#include "clang/AST/RecursiveASTVisitor.h"
#include "clang/AST/ASTConsumer.h"
+#include "clang/AST/ASTContext.h"
#include "clang/Frontend/FrontendActions.h"
#include "clang/Frontend/CompilerInstance.h"
#include "clang/Lex/Lexer.h"
Modified: cfe/branches/tooling/unittests/Frontend/FrontendActionTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/unittests/Frontend/FrontendActionTest.cpp?rev=159731&r1=159730&r2=159731&view=diff
==============================================================================
--- cfe/branches/tooling/unittests/Frontend/FrontendActionTest.cpp (original)
+++ cfe/branches/tooling/unittests/Frontend/FrontendActionTest.cpp Thu Jul 5 02:35:04 2012
@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
#include "clang/AST/RecursiveASTVisitor.h"
+#include "clang/AST/ASTContext.h"
#include "clang/AST/ASTConsumer.h"
#include "clang/Frontend/CompilerInstance.h"
#include "clang/Frontend/CompilerInvocation.h"
Modified: cfe/branches/tooling/unittests/Tooling/RefactoringTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/unittests/Tooling/RefactoringTest.cpp?rev=159731&r1=159730&r2=159731&view=diff
==============================================================================
--- cfe/branches/tooling/unittests/Tooling/RefactoringTest.cpp (original)
+++ cfe/branches/tooling/unittests/Tooling/RefactoringTest.cpp Thu Jul 5 02:35:04 2012
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+#include "clang/AST/ASTContext.h"
#include "clang/AST/ASTConsumer.h"
#include "clang/AST/DeclCXX.h"
#include "clang/AST/DeclGroup.h"
Modified: cfe/branches/tooling/unittests/Tooling/TestVisitor.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/unittests/Tooling/TestVisitor.h?rev=159731&r1=159730&r2=159731&view=diff
==============================================================================
--- cfe/branches/tooling/unittests/Tooling/TestVisitor.h (original)
+++ cfe/branches/tooling/unittests/Tooling/TestVisitor.h Thu Jul 5 02:35:04 2012
@@ -14,6 +14,7 @@
#ifndef LLVM_CLANG_TEST_VISITOR_H
#define LLVM_CLANG_TEST_VISITOR_H
+#include "clang/AST/ASTContext.h"
#include "clang/AST/ASTConsumer.h"
#include "clang/AST/RecursiveASTVisitor.h"
#include "clang/Frontend/FrontendAction.h"
Modified: cfe/branches/tooling/utils/TableGen/ClangAttrEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/tooling/utils/TableGen/ClangAttrEmitter.cpp?rev=159731&r1=159730&r2=159731&view=diff
==============================================================================
--- cfe/branches/tooling/utils/TableGen/ClangAttrEmitter.cpp (original)
+++ cfe/branches/tooling/utils/TableGen/ClangAttrEmitter.cpp Thu Jul 5 02:35:04 2012
@@ -789,7 +789,7 @@
OS << "void " << R.getName() << "Attr::printPretty("
<< "llvm::raw_ostream &OS, ASTContext &Ctx) const {\n";
if (Spellings.begin() != Spellings.end()) {
- StringRef Spelling = (*Spellings.begin())->getValueAsString("Name");
+ std::string Spelling = (*Spellings.begin())->getValueAsString("Name");
OS << " OS << \" __attribute__((" << Spelling;
if (Args.size()) OS << "(";
if (Spelling == "availability") {
More information about the llvm-branch-commits
mailing list