summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2012-06-29 22:03:56 +0000
committerDavid Blaikie <dblaikie@gmail.com>2012-06-29 22:03:56 +0000
commit5d577a225e1186a7a800bdc11818027237ffbc96 (patch)
tree5526430edd34196f6b7051019ca1a3d14419a2a0 /clang/lib
parent5ef31a9c46db8431a76239857d1f76773cbc9730 (diff)
downloadbcm5719-llvm-5d577a225e1186a7a800bdc11818027237ffbc96.tar.gz
bcm5719-llvm-5d577a225e1186a7a800bdc11818027237ffbc96.zip
Use -frewrite-includes for crash reports.
In future changes we should: * use __builtin_trap rather than derefing 'random' volatile pointers. * avoid dumping temporary files into /tmp when running tests, instead preferring a location that is properly cleaned up by lit. Review by Chandler Carruth. llvm-svn: 159469
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Driver/Driver.cpp6
-rw-r--r--clang/lib/Lex/Pragma.cpp4
-rw-r--r--clang/lib/Parse/ParseDecl.cpp2
3 files changed, 11 insertions, 1 deletions
diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
index a6af7af7718..2f2d07c8b97 100644
--- a/clang/lib/Driver/Driver.cpp
+++ b/clang/lib/Driver/Driver.cpp
@@ -392,6 +392,7 @@ void Driver::generateCompilationDiagnostics(Compilation &C,
// Suppress driver output and emit preprocessor output to temp file.
CCCIsCPP = true;
CCGenDiagnostics = true;
+ C.getArgs().AddFlagArg(0, Opts->getOption(options::OPT_frewrite_includes));
// Save the original job command(s).
std::string Cmd;
@@ -1181,7 +1182,10 @@ Action *Driver::ConstructPhaseAction(const ArgList &Args, phases::ID Phase,
if (Args.hasArg(options::OPT_M, options::OPT_MM)) {
OutputTy = types::TY_Dependencies;
} else {
- OutputTy = types::getPreprocessedType(Input->getType());
+ OutputTy = Input->getType();
+ if (!Args.hasFlag(options::OPT_frewrite_includes,
+ options::OPT_fno_rewrite_includes, false))
+ OutputTy = types::getPreprocessedType(OutputTy);
assert(OutputTy != types::TY_INVALID &&
"Cannot preprocess this input type!");
}
diff --git a/clang/lib/Lex/Pragma.cpp b/clang/lib/Lex/Pragma.cpp
index 7b94d268b5b..c9cc4adf401 100644
--- a/clang/lib/Lex/Pragma.cpp
+++ b/clang/lib/Lex/Pragma.cpp
@@ -1010,6 +1010,10 @@ struct PragmaDebugHandler : public PragmaHandler {
llvm_unreachable("This is an assertion!");
} else if (II->isStr("crash")) {
*(volatile int*) 0x11 = 0;
+ } else if (II->isStr("parser_crash")) {
+ Token Crasher;
+ Crasher.setKind(tok::annot_pragma_parser_crash);
+ PP.EnterToken(Crasher);
} else if (II->isStr("llvm_fatal_error")) {
llvm::report_fatal_error("#pragma clang __debug llvm_fatal_error");
} else if (II->isStr("llvm_unreachable")) {
diff --git a/clang/lib/Parse/ParseDecl.cpp b/clang/lib/Parse/ParseDecl.cpp
index 489a46ca39d..409f8e002ab 100644
--- a/clang/lib/Parse/ParseDecl.cpp
+++ b/clang/lib/Parse/ParseDecl.cpp
@@ -4252,6 +4252,8 @@ void Parser::ParseDirectDeclarator(Declarator &D) {
// portion is empty), if an abstract-declarator is allowed.
D.SetIdentifier(0, Tok.getLocation());
} else {
+ if (Tok.getKind() == tok::annot_pragma_parser_crash)
+ *(volatile int*) 0x11 = 0;
if (D.getContext() == Declarator::MemberContext)
Diag(Tok, diag::err_expected_member_name_or_semi)
<< D.getDeclSpec().getSourceRange();
OpenPOWER on IntegriCloud