[lldb] Remove default llvm::Triple argument from ClangASTContext constructor

Creating an ASTContext with an unknown triple is rarely a good idea (as usually
all our ASTs have a valid triple that is either from the host or the target) and the
default argument makes it far to easy to implicitly create such an AST. Let's
remove it and force people to pass a triple.

The only place where we don't pass a triple is a DWARFASTParserClangTests
where we now just pass the host triple instead (the test doesn't depend on any
triple so this shouldn't change anything).
This commit is contained in:
Raphael Isemann 2020-01-08 09:40:08 +01:00
parent dfeb8730e2
commit 518597c173
2 changed files with 4 additions and 3 deletions

View File

@ -61,7 +61,7 @@ public:
/// certain characteristics of the ASTContext and its types
/// (e.g., whether certain primitive types exist or what their
/// signedness is).
explicit ClangASTContext(llvm::Triple triple = llvm::Triple());
explicit ClangASTContext(llvm::Triple triple);
/// Constructs a ClangASTContext that uses an existing ASTContext internally.
/// Useful when having an existing ASTContext created by Clang.

View File

@ -9,6 +9,7 @@
#include "Plugins/SymbolFile/DWARF/DWARFASTParserClang.h"
#include "Plugins/SymbolFile/DWARF/DWARFDIE.h"
#include "TestingSupport/SubsystemRAII.h"
#include "lldb/Host/HostInfo.h"
#include "gmock/gmock.h"
#include "gtest/gtest.h"
@ -16,7 +17,7 @@ using namespace lldb;
using namespace lldb_private;
class DWARFASTParserClangTests : public testing::Test {
SubsystemRAII<FileSystem, ClangASTContext> subsystems;
SubsystemRAII<FileSystem, HostInfo, ClangASTContext> subsystems;
};
namespace {
@ -38,7 +39,7 @@ public:
// defining here, causing this test to fail, feel free to delete it.
TEST_F(DWARFASTParserClangTests,
EnsureAllDIEsInDeclContextHaveBeenParsedParsesOnlyMatchingEntries) {
ClangASTContext ast_ctx;
ClangASTContext ast_ctx(HostInfoBase::GetTargetTriple());
DWARFASTParserClangStub ast_parser(ast_ctx);
DWARFUnit *unit = nullptr;