Skip to content

Commit

Permalink
[NFC] Update comments
Browse files Browse the repository at this point in the history
Don't prepend function or data name before each comment. Split into its own NFC patch as requested in D46858.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332323 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
jfbastien committed May 15, 2018
1 parent b6cd9b4 commit 54e2a7e
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 34 deletions.
6 changes: 3 additions & 3 deletions include/llvm/Support/Signals.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ namespace sys {
// Run all registered signal handlers.
void RunSignalHandlers();

/// AddSignalHandler - Add a function to be called when an abort/kill signal
/// is delivered to the process. The handler can have a cookie passed to it
/// to identify what instance of the handler it is.
/// Add a function to be called when an abort/kill signal is delivered to the
/// process. The handler can have a cookie passed to it to identify what
/// instance of the handler it is.
void AddSignalHandler(void (*FnPtr)(void *), void *Cookie);

/// This function registers a function to be called when the user "interrupts"
Expand Down
39 changes: 19 additions & 20 deletions lib/Support/Unix/Signals.inc
Original file line number Diff line number Diff line change
Expand Up @@ -62,22 +62,22 @@ static RETSIGTYPE SignalHandler(int Sig); // defined below.

static ManagedStatic<sys::SmartMutex<true> > SignalsMutex;

/// InterruptFunction - The function to call if ctrl-c is pressed.
/// The function to call if ctrl-c is pressed.
static void (*InterruptFunction)() = nullptr;

static ManagedStatic<std::vector<std::string>> FilesToRemove;

static StringRef Argv0;

// IntSigs - Signals that represent requested termination. There's no bug
// or failure, or if there is, it's not our direct responsibility. For whatever
// reason, our continued execution is no longer desirable.
// Signals that represent requested termination. There's no bug or failure, or
// if there is, it's not our direct responsibility. For whatever reason, our
// continued execution is no longer desirable.
static const int IntSigs[] = {
SIGHUP, SIGINT, SIGPIPE, SIGTERM, SIGUSR1, SIGUSR2
};

// KillSigs - Signals that represent that we have a bug, and our prompt
// termination has been ordered.
// Signals that represent that we have a bug, and our prompt termination has
// been ordered.
static const int KillSigs[] = {
SIGILL, SIGTRAP, SIGABRT, SIGFPE, SIGBUS, SIGSEGV, SIGQUIT
#ifdef SIGSYS
Expand Down Expand Up @@ -172,10 +172,9 @@ static void UnregisterHandlers() {
}


/// RemoveFilesToRemove - Process the FilesToRemove list. This function
/// should be called with the SignalsMutex lock held.
/// NB: This must be an async signal safe function. It cannot allocate or free
/// memory, even in debug builds.
/// Process the FilesToRemove list. This function should be called with the
/// SignalsMutex lock held. NB: This must be an async signal safe function. It
/// cannot allocate or free memory, even in debug builds.
static void RemoveFilesToRemove() {
// Avoid constructing ManagedStatic in the signal handler.
// If FilesToRemove is not constructed, there are no files to remove.
Expand Down Expand Up @@ -206,7 +205,7 @@ static void RemoveFilesToRemove() {
}
}

// SignalHandler - The signal handler that runs.
// The signal handler that runs.
static RETSIGTYPE SignalHandler(int Sig) {
// Restore the signal behavior to default, so that the program actually
// crashes when we return and the signal reissues. This also ensures that if
Expand Down Expand Up @@ -265,7 +264,7 @@ void llvm::sys::SetInterruptFunction(void (*IF)()) {
RegisterHandlers();
}

// RemoveFileOnSignal - The public API
// The public API
bool llvm::sys::RemoveFileOnSignal(StringRef Filename,
std::string* ErrMsg) {
{
Expand All @@ -277,7 +276,7 @@ bool llvm::sys::RemoveFileOnSignal(StringRef Filename,
return false;
}

// DontRemoveFileOnSignal - The public API
// The public API
void llvm::sys::DontRemoveFileOnSignal(StringRef Filename) {
sys::SmartScopedLock<true> Guard(*SignalsMutex);
std::vector<std::string>::reverse_iterator RI =
Expand All @@ -287,9 +286,9 @@ void llvm::sys::DontRemoveFileOnSignal(StringRef Filename) {
I = FilesToRemove->erase(RI.base()-1);
}

/// AddSignalHandler - Add a function to be called when a signal is delivered
/// to the process. The handler can have a cookie passed to it to identify
/// what instance of the handler it is.
/// Add a function to be called when a signal is delivered to the process. The
/// handler can have a cookie passed to it to identify what instance of the
/// handler it is.
void llvm::sys::AddSignalHandler(void (*FnPtr)(void *), void *Cookie) {
CallBacksToRun->push_back(std::make_pair(FnPtr, Cookie));
RegisterHandlers();
Expand Down Expand Up @@ -384,8 +383,8 @@ static int unwindBacktrace(void **StackTrace, int MaxEntries) {
}
#endif

// PrintStackTrace - In the case of a program crash or fault, print out a stack
// trace so that the user has an indication of why and where we died.
// In the case of a program crash or fault, print out a stack trace so that the
// user has an indication of why and where we died.
//
// On glibc systems we have the 'backtrace' function, which works nicely, but
// doesn't demangle symbols.
Expand Down Expand Up @@ -464,8 +463,8 @@ static void PrintStackTraceSignalHandler(void *) {

void llvm::sys::DisableSystemDialogsOnCrash() {}

/// PrintStackTraceOnErrorSignal - When an error signal (such as SIGABRT or
/// SIGSEGV) is delivered to the process, print a stack trace and then exit.
/// When an error signal (such as SIGABRT or SIGSEGV) is delivered to the
/// process, print a stack trace and then exit.
void llvm::sys::PrintStackTraceOnErrorSignal(StringRef Argv0,
bool DisableCrashReporting) {
::Argv0 = Argv0;
Expand Down
22 changes: 11 additions & 11 deletions lib/Support/Windows/Signals.inc
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ using namespace llvm;
static LONG WINAPI LLVMUnhandledExceptionFilter(LPEXCEPTION_POINTERS ep);
static BOOL WINAPI LLVMConsoleCtrlHandler(DWORD dwCtrlType);

// InterruptFunction - The function to call if ctrl-c is pressed.
// The function to call if ctrl-c is pressed.
static void (*InterruptFunction)() = 0;

static std::vector<std::string> *FilesToRemove = NULL;
Expand Down Expand Up @@ -387,9 +387,9 @@ namespace llvm {
//===----------------------------------------------------------------------===//

#ifdef _MSC_VER
/// AvoidMessageBoxHook - Emulates hitting "retry" from an "abort, retry,
/// ignore" CRT debug report dialog. "retry" raises an exception which
/// ultimately triggers our stack dumper.
/// Emulates hitting "retry" from an "abort, retry, ignore" CRT debug report
/// dialog. "retry" raises an exception which ultimately triggers our stack
/// dumper.
static LLVM_ATTRIBUTE_UNUSED int
AvoidMessageBoxHook(int ReportType, char *Message, int *Return) {
// Set *Return to the retry code for the return value of _CrtDbgReport:
Expand Down Expand Up @@ -447,7 +447,7 @@ static void RegisterHandler() {
// else multi-threading problems will ensue.
}

// RemoveFileOnSignal - The public API
// The public API
bool sys::RemoveFileOnSignal(StringRef Filename, std::string* ErrMsg) {
RegisterHandler();

Expand All @@ -466,7 +466,7 @@ bool sys::RemoveFileOnSignal(StringRef Filename, std::string* ErrMsg) {
return false;
}

// DontRemoveFileOnSignal - The public API
// The public API
void sys::DontRemoveFileOnSignal(StringRef Filename) {
if (FilesToRemove == NULL)
return;
Expand Down Expand Up @@ -500,8 +500,8 @@ void sys::DisableSystemDialogsOnCrash() {
_set_error_mode(_OUT_TO_STDERR);
}

/// PrintStackTraceOnErrorSignal - When an error signal (such as SIGABRT or
/// SIGSEGV) is delivered to the process, print a stack trace and then exit.
/// When an error signal (such as SIGABRT or SIGSEGV) is delivered to the
/// process, print a stack trace and then exit.
void sys::PrintStackTraceOnErrorSignal(StringRef Argv0,
bool DisableCrashReporting) {
::Argv0 = Argv0;
Expand Down Expand Up @@ -557,9 +557,9 @@ void llvm::sys::SetInterruptFunction(void (*IF)()) {
}


/// AddSignalHandler - Add a function to be called when a signal is delivered
/// to the process. The handler can have a cookie passed to it to identify
/// what instance of the handler it is.
/// Add a function to be called when a signal is delivered to the process. The
/// handler can have a cookie passed to it to identify what instance of the
/// handler it is.
void llvm::sys::AddSignalHandler(void (*FnPtr)(void *), void *Cookie) {
CallBacksToRun->push_back(std::make_pair(FnPtr, Cookie));
RegisterHandler();
Expand Down

0 comments on commit 54e2a7e

Please sign in to comment.