Skip to content
Snippets Groups Projects
Commit ccae0dc8 authored by Rafael Espindola's avatar Rafael Espindola
Browse files

Don't indent inside namespaces.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@208377 91177308-0d34-0410-b5e6-96231b3b80d8
parent b543badc
No related branches found
No related tags found
No related merge requests found
...@@ -28,15 +28,15 @@ ...@@ -28,15 +28,15 @@
#include "llvm/IR/Module.h" #include "llvm/IR/Module.h"
namespace llvm { namespace llvm {
class Module; class Module;
class Constant; class Constant;
class Function; class Function;
class GlobalValue; class GlobalValue;
class DataLayout; class DataLayout;
class FunctionType; class FunctionType;
class PointerType; class PointerType;
class Value; class Value;
class LLVMContext; class LLVMContext;
} }
namespace clang { namespace clang {
......
...@@ -19,23 +19,23 @@ ...@@ -19,23 +19,23 @@
#include "clang/Basic/LLVM.h" #include "clang/Basic/LLVM.h"
namespace llvm { namespace llvm {
class Constant; class Constant;
class Type; class Type;
class Value; class Value;
} }
namespace clang { namespace clang {
class CastExpr; class CastExpr;
class CXXConstructorDecl; class CXXConstructorDecl;
class CXXDestructorDecl; class CXXDestructorDecl;
class CXXMethodDecl; class CXXMethodDecl;
class CXXRecordDecl; class CXXRecordDecl;
class FieldDecl; class FieldDecl;
class MangleContext; class MangleContext;
namespace CodeGen { namespace CodeGen {
class CodeGenFunction; class CodeGenFunction;
class CodeGenModule; class CodeGenModule;
/// \brief Implements C++ ABI-specific code generation functions. /// \brief Implements C++ ABI-specific code generation functions.
class CGCXXABI { class CGCXXABI {
......
...@@ -21,194 +21,195 @@ ...@@ -21,194 +21,195 @@
#include "llvm/ADT/StringRef.h" #include "llvm/ADT/StringRef.h"
namespace llvm { namespace llvm {
class Constant; class Constant;
class GlobalValue; class GlobalValue;
class Type; class Type;
class Value; class Value;
} }
namespace clang { namespace clang {
class ABIInfo; class ABIInfo;
class Decl; class Decl;
namespace CodeGen { namespace CodeGen {
class CallArgList; class CallArgList;
class CodeGenModule; class CodeGenModule;
class CodeGenFunction; class CodeGenFunction;
class CGFunctionInfo; class CGFunctionInfo;
}
/// TargetCodeGenInfo - This class organizes various target-specific
/// codegeneration issues, like target-specific attributes, builtins and so
/// on.
class TargetCodeGenInfo {
ABIInfo *Info;
public:
// WARNING: Acquires the ownership of ABIInfo.
TargetCodeGenInfo(ABIInfo *info = 0) : Info(info) {}
virtual ~TargetCodeGenInfo();
/// getABIInfo() - Returns ABI info helper for the target.
const ABIInfo &getABIInfo() const { return *Info; }
/// SetTargetAttributes - Provides a convenient hook to handle extra
/// target-specific attributes for the given global.
virtual void SetTargetAttributes(const Decl *D, llvm::GlobalValue *GV,
CodeGen::CodeGenModule &M) const {}
/// EmitTargetMD - Provides a convenient hook to handle extra
/// target-specific metadata for the given global.
virtual void emitTargetMD(const Decl *D, llvm::GlobalValue *GV,
CodeGen::CodeGenModule &M) const {}
/// Determines the size of struct _Unwind_Exception on this platform,
/// in 8-bit units. The Itanium ABI defines this as:
/// struct _Unwind_Exception {
/// uint64 exception_class;
/// _Unwind_Exception_Cleanup_Fn exception_cleanup;
/// uint64 private_1;
/// uint64 private_2;
/// };
virtual unsigned getSizeOfUnwindException() const;
/// Controls whether __builtin_extend_pointer should sign-extend
/// pointers to uint64_t or zero-extend them (the default). Has
/// no effect for targets:
/// - that have 64-bit pointers, or
/// - that cannot address through registers larger than pointers, or
/// - that implicitly ignore/truncate the top bits when addressing
/// through such registers.
virtual bool extendPointerWithSExt() const { return false; }
/// Determines the DWARF register number for the stack pointer, for
/// exception-handling purposes. Implements __builtin_dwarf_sp_column.
///
/// Returns -1 if the operation is unsupported by this target.
virtual int getDwarfEHStackPointer(CodeGen::CodeGenModule &M) const {
return -1;
}
/// Initializes the given DWARF EH register-size table, a char*.
/// Implements __builtin_init_dwarf_reg_size_table.
///
/// Returns true if the operation is unsupported by this target.
virtual bool initDwarfEHRegSizeTable(CodeGen::CodeGenFunction &CGF,
llvm::Value *Address) const {
return true;
}
/// Performs the code-generation required to convert a return
/// address as stored by the system into the actual address of the
/// next instruction that will be executed.
///
/// Used by __builtin_extract_return_addr().
virtual llvm::Value *decodeReturnAddress(CodeGen::CodeGenFunction &CGF,
llvm::Value *Address) const {
return Address;
}
/// Performs the code-generation required to convert the address
/// of an instruction into a return address suitable for storage
/// by the system in a return slot.
///
/// Used by __builtin_frob_return_addr().
virtual llvm::Value *encodeReturnAddress(CodeGen::CodeGenFunction &CGF,
llvm::Value *Address) const {
return Address;
}
/// Corrects the low-level LLVM type for a given constraint and "usual"
/// type.
///
/// \returns A pointer to a new LLVM type, possibly the same as the original
/// on success; 0 on failure.
virtual llvm::Type *adjustInlineAsmType(CodeGen::CodeGenFunction &CGF,
StringRef Constraint,
llvm::Type *Ty) const {
return Ty;
}
/// doesReturnSlotInterfereWithArgs - Return true if the target uses an
/// argument slot for an 'sret' type.
virtual bool doesReturnSlotInterfereWithArgs() const { return true; }
/// Retrieve the address of a function to call immediately before
/// calling objc_retainAutoreleasedReturnValue. The
/// implementation of objc_autoreleaseReturnValue sniffs the
/// instruction stream following its return address to decide
/// whether it's a call to objc_retainAutoreleasedReturnValue.
/// This can be prohibitively expensive, depending on the
/// relocation model, and so on some targets it instead sniffs for
/// a particular instruction sequence. This functions returns
/// that instruction sequence in inline assembly, which will be
/// empty if none is required.
virtual StringRef getARCRetainAutoreleasedReturnValueMarker() const {
return "";
}
/// Return a constant used by UBSan as a signature to identify functions
/// possessing type information, or 0 if the platform is unsupported.
virtual llvm::Constant *
getUBSanFunctionSignature(CodeGen::CodeGenModule &CGM) const {
return 0;
} }
/// TargetCodeGenInfo - This class organizes various target-specific /// Determine whether a call to an unprototyped functions under
/// codegeneration issues, like target-specific attributes, builtins and so /// the given calling convention should use the variadic
/// on. /// convention or the non-variadic convention.
class TargetCodeGenInfo { ///
ABIInfo *Info; /// There's a good reason to make a platform's variadic calling
public: /// convention be different from its non-variadic calling
// WARNING: Acquires the ownership of ABIInfo. /// convention: the non-variadic arguments can be passed in
TargetCodeGenInfo(ABIInfo *info = 0):Info(info) { } /// registers (better for performance), and the variadic arguments
virtual ~TargetCodeGenInfo(); /// can be passed on the stack (also better for performance). If
/// this is done, however, unprototyped functions *must* use the
/// getABIInfo() - Returns ABI info helper for the target. /// non-variadic convention, because C99 states that a call
const ABIInfo& getABIInfo() const { return *Info; } /// through an unprototyped function type must succeed if the
/// function was defined with a non-variadic prototype with
/// SetTargetAttributes - Provides a convenient hook to handle extra /// compatible parameters. Therefore, splitting the conventions
/// target-specific attributes for the given global. /// makes it impossible to call a variadic function through an
virtual void SetTargetAttributes(const Decl *D, llvm::GlobalValue *GV, /// unprototyped type. Since function prototypes came out in the
CodeGen::CodeGenModule &M) const { } /// late 1970s, this is probably an acceptable trade-off.
/// Nonetheless, not all platforms are willing to make it, and in
/// EmitTargetMD - Provides a convenient hook to handle extra /// particularly x86-64 bends over backwards to make the
/// target-specific metadata for the given global. /// conventions compatible.
virtual void emitTargetMD(const Decl *D, llvm::GlobalValue *GV, ///
CodeGen::CodeGenModule &M) const { } /// The default is false. This is correct whenever:
/// - the conventions are exactly the same, because it does not
/// Determines the size of struct _Unwind_Exception on this platform, /// matter and the resulting IR will be somewhat prettier in
/// in 8-bit units. The Itanium ABI defines this as: /// certain cases; or
/// struct _Unwind_Exception { /// - the conventions are substantively different in how they pass
/// uint64 exception_class; /// arguments, because in this case using the variadic convention
/// _Unwind_Exception_Cleanup_Fn exception_cleanup; /// will lead to C99 violations.
/// uint64 private_1; ///
/// uint64 private_2; /// However, some platforms make the conventions identical except
/// }; /// for passing additional out-of-band information to a variadic
virtual unsigned getSizeOfUnwindException() const; /// function: for example, x86-64 passes the number of SSE
/// arguments in %al. On these platforms, it is desirable to
/// Controls whether __builtin_extend_pointer should sign-extend /// call unprototyped functions using the variadic convention so
/// pointers to uint64_t or zero-extend them (the default). Has /// that unprototyped calls to varargs functions still succeed.
/// no effect for targets: ///
/// - that have 64-bit pointers, or /// Relatedly, platforms which pass the fixed arguments to this:
/// - that cannot address through registers larger than pointers, or /// A foo(B, C, D);
/// - that implicitly ignore/truncate the top bits when addressing /// differently than they would pass them to this:
/// through such registers. /// A foo(B, C, D, ...);
virtual bool extendPointerWithSExt() const { return false; } /// may need to adjust the debugger-support code in Sema to do the
/// right thing when calling a function with no know signature.
/// Determines the DWARF register number for the stack pointer, for virtual bool isNoProtoCallVariadic(const CodeGen::CallArgList &args,
/// exception-handling purposes. Implements __builtin_dwarf_sp_column. const FunctionNoProtoType *fnType) const;
///
/// Returns -1 if the operation is unsupported by this target. /// Gets the linker options necessary to link a dependent library on this
virtual int getDwarfEHStackPointer(CodeGen::CodeGenModule &M) const { /// platform.
return -1; virtual void getDependentLibraryOption(llvm::StringRef Lib,
} llvm::SmallString<24> &Opt) const;
/// Initializes the given DWARF EH register-size table, a char*. /// Gets the linker options necessary to detect object file mismatches on
/// Implements __builtin_init_dwarf_reg_size_table. /// this platform.
/// virtual void getDetectMismatchOption(llvm::StringRef Name,
/// Returns true if the operation is unsupported by this target. llvm::StringRef Value,
virtual bool initDwarfEHRegSizeTable(CodeGen::CodeGenFunction &CGF, llvm::SmallString<32> &Opt) const {}
llvm::Value *Address) const { };
return true;
}
/// Performs the code-generation required to convert a return
/// address as stored by the system into the actual address of the
/// next instruction that will be executed.
///
/// Used by __builtin_extract_return_addr().
virtual llvm::Value *decodeReturnAddress(CodeGen::CodeGenFunction &CGF,
llvm::Value *Address) const {
return Address;
}
/// Performs the code-generation required to convert the address
/// of an instruction into a return address suitable for storage
/// by the system in a return slot.
///
/// Used by __builtin_frob_return_addr().
virtual llvm::Value *encodeReturnAddress(CodeGen::CodeGenFunction &CGF,
llvm::Value *Address) const {
return Address;
}
/// Corrects the low-level LLVM type for a given constraint and "usual"
/// type.
///
/// \returns A pointer to a new LLVM type, possibly the same as the original
/// on success; 0 on failure.
virtual llvm::Type* adjustInlineAsmType(CodeGen::CodeGenFunction &CGF,
StringRef Constraint,
llvm::Type* Ty) const {
return Ty;
}
/// doesReturnSlotInterfereWithArgs - Return true if the target uses an
/// argument slot for an 'sret' type.
virtual bool doesReturnSlotInterfereWithArgs() const { return true; }
/// Retrieve the address of a function to call immediately before
/// calling objc_retainAutoreleasedReturnValue. The
/// implementation of objc_autoreleaseReturnValue sniffs the
/// instruction stream following its return address to decide
/// whether it's a call to objc_retainAutoreleasedReturnValue.
/// This can be prohibitively expensive, depending on the
/// relocation model, and so on some targets it instead sniffs for
/// a particular instruction sequence. This functions returns
/// that instruction sequence in inline assembly, which will be
/// empty if none is required.
virtual StringRef getARCRetainAutoreleasedReturnValueMarker() const {
return "";
}
/// Return a constant used by UBSan as a signature to identify functions
/// possessing type information, or 0 if the platform is unsupported.
virtual llvm::Constant *getUBSanFunctionSignature(
CodeGen::CodeGenModule &CGM) const {
return 0;
}
/// Determine whether a call to an unprototyped functions under
/// the given calling convention should use the variadic
/// convention or the non-variadic convention.
///
/// There's a good reason to make a platform's variadic calling
/// convention be different from its non-variadic calling
/// convention: the non-variadic arguments can be passed in
/// registers (better for performance), and the variadic arguments
/// can be passed on the stack (also better for performance). If
/// this is done, however, unprototyped functions *must* use the
/// non-variadic convention, because C99 states that a call
/// through an unprototyped function type must succeed if the
/// function was defined with a non-variadic prototype with
/// compatible parameters. Therefore, splitting the conventions
/// makes it impossible to call a variadic function through an
/// unprototyped type. Since function prototypes came out in the
/// late 1970s, this is probably an acceptable trade-off.
/// Nonetheless, not all platforms are willing to make it, and in
/// particularly x86-64 bends over backwards to make the
/// conventions compatible.
///
/// The default is false. This is correct whenever:
/// - the conventions are exactly the same, because it does not
/// matter and the resulting IR will be somewhat prettier in
/// certain cases; or
/// - the conventions are substantively different in how they pass
/// arguments, because in this case using the variadic convention
/// will lead to C99 violations.
///
/// However, some platforms make the conventions identical except
/// for passing additional out-of-band information to a variadic
/// function: for example, x86-64 passes the number of SSE
/// arguments in %al. On these platforms, it is desirable to
/// call unprototyped functions using the variadic convention so
/// that unprototyped calls to varargs functions still succeed.
///
/// Relatedly, platforms which pass the fixed arguments to this:
/// A foo(B, C, D);
/// differently than they would pass them to this:
/// A foo(B, C, D, ...);
/// may need to adjust the debugger-support code in Sema to do the
/// right thing when calling a function with no know signature.
virtual bool isNoProtoCallVariadic(const CodeGen::CallArgList &args,
const FunctionNoProtoType *fnType) const;
/// Gets the linker options necessary to link a dependent library on this
/// platform.
virtual void getDependentLibraryOption(llvm::StringRef Lib,
llvm::SmallString<24> &Opt) const;
/// Gets the linker options necessary to detect object file mismatches on
/// this platform.
virtual void getDetectMismatchOption(llvm::StringRef Name,
llvm::StringRef Value,
llvm::SmallString<32> &Opt) const {}
};
} }
#endif // CLANG_CODEGEN_TARGETINFO_H #endif // CLANG_CODEGEN_TARGETINFO_H
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment