"One" line fix for -parse-noop failure, "id" and several other things
were being treated as type names for non-Objective-C files.
- Other lines are just because MinimalAction didn't have access to
the LangOptions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58498 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Parse/MinimalAction.cpp b/lib/Parse/MinimalAction.cpp
index cb130c3..c98830c 100644
--- a/lib/Parse/MinimalAction.cpp
+++ b/lib/Parse/MinimalAction.cpp
@@ -28,12 +28,16 @@
}
};
-void MinimalAction:: ActOnTranslationUnitScope(SourceLocation Loc, Scope *S) {
+MinimalAction::MinimalAction(Preprocessor &pp)
+ : Idents(pp.getIdentifierTable()), PP(pp) {}
+
+void MinimalAction::ActOnTranslationUnitScope(SourceLocation Loc, Scope *S) {
TUScope = S;
+ if (!PP.getLangOptions().ObjC1) return;
+
+ // recognize the ObjC built-in type identifiers.
IdentifierInfo *II;
TypeNameInfo *TI;
-
- // recognize the ObjC built-in type identifiers.
II = &Idents.get("id");
TI = new TypeNameInfo(1, II->getFETokenInfo<TypeNameInfo>());
II->setFETokenInfo(TI);